From a74a8fa134cd7d2946536f98ca9a1146c52f11e0 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 29 Oct 2022 16:13:40 -0300 Subject: [PATCH] Updated CanTeleport --- src/battle_script_commands.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index eaa7bbde1..188d9a73b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8023,14 +8023,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); @@ -8041,11 +8037,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; }