Updated CanTeleport

This commit is contained in:
LOuroboros 2022-10-29 16:13:40 -03:00
parent 93dd8786ee
commit a74a8fa134

View File

@ -8023,14 +8023,10 @@ static bool32 CourtChangeSwapSideStatuses(void)
static bool32 CanTeleport(u8 battlerId) 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; u32 species, count, i;
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
for (i = 0; i < PARTY_SIZE; i++) for (i = 0; i < PARTY_SIZE; i++)
{ {
species = GetMonData(&party[i], MON_DATA_SPECIES2); species = GetMonData(&party[i], MON_DATA_SPECIES2);
@ -8041,11 +8037,11 @@ static bool32 CanTeleport(u8 battlerId)
switch (GetBattlerSide(battlerId)) switch (GetBattlerSide(battlerId))
{ {
case B_SIDE_OPPONENT: case B_SIDE_OPPONENT:
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (count == 1 || gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
return FALSE; return FALSE;
break; break;
case B_SIDE_PLAYER: case B_SIDE_PLAYER:
if (count == 1 || (count <= 2 && gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) if (count == 1 || (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && count <= 2))
return FALSE; return FALSE;
break; break;
} }