From a3fe53dd28e944ed77ea7fb5f1c97e2630bd6d4d Mon Sep 17 00:00:00 2001 From: AlexOn1ine Date: Mon, 11 Nov 2024 20:31:21 +0100 Subject: [PATCH] Cleans up Primal Reversion code --- data/battle_scripts_1.s | 21 ++++++--------------- include/battle_scripts.h | 1 - src/battle_message.c | 2 +- src/battle_util.c | 13 ++----------- 4 files changed, 9 insertions(+), 28 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 19328b7189..4708ffb99f 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6988,26 +6988,17 @@ BattleScript_WishMegaEvolution:: goto BattleScript_MegaEvolutionAfterString BattleScript_PrimalReversion:: - call BattleScript_PrimalReversionRet - end3 - -BattleScript_PrimalReversionRestoreAttacker:: - call BattleScript_PrimalReversionRet - copybyte gBattlerAttacker, sSAVED_BATTLER - end3 - -BattleScript_PrimalReversionRet:: flushtextbox setbyte gIsCriticalHit, 0 - handleprimalreversion BS_ATTACKER, 0 - handleprimalreversion BS_ATTACKER, 1 - playanimation BS_ATTACKER, B_ANIM_PRIMAL_REVERSION + handleprimalreversion BS_SCRIPTING, 0 + handleprimalreversion BS_SCRIPTING, 1 + playanimation BS_SCRIPTING, B_ANIM_PRIMAL_REVERSION waitanimation - handleprimalreversion BS_ATTACKER, 2 + handleprimalreversion BS_SCRIPTING, 2 printstring STRINGID_PKMNREVERTEDTOPRIMAL waitmessage B_WAIT_TIME_LONG - switchinabilities BS_ATTACKER - return + switchinabilities BS_SCRIPTING + end3 BattleScript_UltraBurst:: flushtextbox diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 879c2f12c3..19ffcfa656 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -438,7 +438,6 @@ extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; extern const u8 BattleScript_BlockedByPrimalWeatherEnd3[]; extern const u8 BattleScript_BlockedByPrimalWeatherRet[]; extern const u8 BattleScript_PrimalReversion[]; -extern const u8 BattleScript_PrimalReversionRestoreAttacker[]; extern const u8 BattleScript_HyperspaceFuryRemoveProtect[]; extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[]; extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTacticsInPalace[]; diff --git a/src/battle_message.c b/src/battle_message.c index e1eebf74e5..6b045bae80 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -750,7 +750,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_MYSTERIOUSAIRCURRENTBLOWSON] = COMPOUND_STRING("The mysterious strong winds blow on regardless!"), [STRINGID_ATTACKWEAKENEDBSTRONGWINDS] = COMPOUND_STRING("The mysterious strong winds weakened the attack!"), [STRINGID_STUFFCHEEKSCANTSELECT] = COMPOUND_STRING("It can't use the move because it doesn't have a Berry!\p"), - [STRINGID_PKMNREVERTEDTOPRIMAL] = COMPOUND_STRING("{B_ATK_NAME_WITH_PREFIX}'s Primal Reversion! It reverted to its primal state!"), + [STRINGID_PKMNREVERTEDTOPRIMAL] = COMPOUND_STRING("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s Primal Reversion! It reverted to its primal state!"), [STRINGID_BUTPOKEMONCANTUSETHEMOVE] = COMPOUND_STRING("But {B_ATK_NAME_WITH_PREFIX2} can't use the move!"), [STRINGID_BUTHOOPACANTUSEIT] = COMPOUND_STRING("But {B_ATK_NAME_WITH_PREFIX2} can't use it the way it is now!"), [STRINGID_BROKETHROUGHPROTECTION] = COMPOUND_STRING("It broke through {B_DEF_NAME_WITH_PREFIX2}'s protection!"), diff --git a/src/battle_util.c b/src/battle_util.c index 1e5f809c52..054b983c25 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6425,17 +6425,8 @@ bool32 TryPrimalReversion(u32 battler) if (GetBattlerHoldEffect(battler, FALSE) == HOLD_EFFECT_PRIMAL_ORB && GetBattleFormChangeTargetSpecies(battler, FORM_CHANGE_BATTLE_PRIMAL_REVERSION) != SPECIES_NONE) { - if (gBattlerAttacker == battler) - { - BattleScriptPushCursorAndCallback(BattleScript_PrimalReversion); - } - else - { - // edge case for scenarios like a switch-in after activated eject button - gBattleScripting.savedBattler = gBattlerAttacker; - gBattlerAttacker = battler; - BattleScriptPushCursorAndCallback(BattleScript_PrimalReversionRestoreAttacker); - } + gBattleScripting.battler = battler; + BattleScriptPushCursorAndCallback(BattleScript_PrimalReversion); return TRUE; } return FALSE;