From d78d63e53777351a843b9bce9f416e6af7c5ed7b Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 31 Aug 2023 04:07:06 -0300 Subject: [PATCH] Fixed redundant calls in Teleport's battle script (#3212) The battle script was originally making an extra call to attackcanceler and attackstring pointlessly whenever there was a jump to BattleScript_EffectBatonPass. This commit addresses that by relocating BattleScript_EffectTeleport's own calls to attackcanceler and attackstring. --- data/battle_scripts_1.s | 8 +++++--- include/battle_scripts.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 55e4cc351..6017e5349 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -5401,15 +5401,15 @@ BattleScript_EffectHurricane: goto BattleScript_EffectHit BattleScript_EffectTeleport: - attackcanceler - attackstring .if B_TELEPORT_BEHAVIOR >= GEN_7 jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_EffectBatonPass jumpifside BS_ATTACKER, B_SIDE_PLAYER, BattleScript_EffectBatonPass .else - jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailed + jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailedAtkCanceler .endif BattleScript_EffectTeleportTryToRunAway: + attackcanceler + attackstring ppreduce getifcantrunfrombattle BS_ATTACKER jumpifbyte CMP_EQUAL, gBattleCommunication, BATTLE_RUN_FORBIDDEN, BattleScript_ButItFailed @@ -5546,6 +5546,8 @@ BattleScript_EffectFakeOut:: setmoveeffect MOVE_EFFECT_FLINCH goto BattleScript_EffectHit +BattleScript_ButItFailedAtkCanceler:: + attackcanceler BattleScript_ButItFailedAtkStringPpReduce:: attackstring BattleScript_ButItFailedPpReduce:: diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 95f068cf5..a6b897077 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -471,6 +471,7 @@ extern const u8 BattleScript_StealthRockActivates[]; extern const u8 BattleScript_SpikesActivates[]; extern const u8 BattleScript_BerserkGeneRet[]; extern const u8 BattleScript_TargetFormChangeWithStringNoPopup[]; +extern const u8 BattleScript_ButItFailedAtkCanceler[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[];