Merge pull request #2420 from LOuroboros/teleport

Updated CanTeleport
This commit is contained in:
Eduardo Quezada D'Ottone 2022-11-04 12:40:25 -03:00 committed by GitHub
commit fa8bf80905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8189,14 +8189,10 @@ static bool32 CourtChangeSwapSideStatuses(void)
static bool32 CanTeleport(u8 battlerId)
{
struct Pokemon* party = NULL;
u8 side = GetBattlerSide(battlerId);
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
u32 species, count, i;
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
for (i = 0; i < PARTY_SIZE; i++)
{
species = GetMonData(&party[i], MON_DATA_SPECIES2);
@ -8207,11 +8203,11 @@ static bool32 CanTeleport(u8 battlerId)
switch (GetBattlerSide(battlerId))
{
case B_SIDE_OPPONENT:
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
if (count == 1 || gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
return FALSE;
break;
case B_SIDE_PLAYER:
if (count == 1 || (count <= 2 && gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
if (count == 1 || (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && count <= 2))
return FALSE;
break;
}