Cleans up Primal Reversion code

This commit is contained in:
AlexOn1ine 2024-11-11 20:31:21 +01:00
parent 7409b87d17
commit a3fe53dd28
4 changed files with 9 additions and 28 deletions

View file

@ -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

View file

@ -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[];

View file

@ -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!"),

View file

@ -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;