diff options
Diffstat (limited to 'src/battle_util2.c')
-rw-r--r-- | src/battle_util2.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/battle_util2.c b/src/battle_util2.c index def7302d3..3838f22bb 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -121,7 +121,9 @@ void SwitchPartyOrderInGameMulti(u8 battlerId, u8 arg1) } } -u32 sub_805725C(u8 battlerId) +// Called when a Pokémon is unable to attack during a Battle Palace battle. +// Check if it was because they are frozen/asleep, and if so try to cure the status. +u32 BattlePalace_TryEscapeStatus(u8 battlerId) { u32 effect = 0; @@ -134,6 +136,7 @@ u32 sub_805725C(u8 battlerId) { if (UproarWakeUpCheck(battlerId)) { + // Wake up from Uproar gBattleMons[battlerId].status1 &= ~(STATUS1_SLEEP); gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE); BattleScriptPushCursor(); @@ -150,6 +153,7 @@ u32 sub_805725C(u8 battlerId) else toSub = 1; + // Reduce number of sleep turns if ((gBattleMons[battlerId].status1 & STATUS1_SLEEP) < toSub) gBattleMons[battlerId].status1 &= ~(STATUS1_SLEEP); else @@ -157,11 +161,13 @@ u32 sub_805725C(u8 battlerId) if (gBattleMons[battlerId].status1 & STATUS1_SLEEP) { + // Still asleep gBattlescriptCurrInstr = BattleScript_MoveUsedIsAsleep; effect = 2; } else { + // Wake up gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE); BattleScriptPushCursor(); gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP; @@ -177,10 +183,12 @@ u32 sub_805725C(u8 battlerId) { if (Random() % 5 != 0) { + // Still frozen gBattlescriptCurrInstr = BattleScript_MoveUsedIsFrozen; } else { + // Unfreeze gBattleMons[battlerId].status1 &= ~(STATUS1_FREEZE); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; @@ -193,7 +201,7 @@ u32 sub_805725C(u8 battlerId) case 2: break; } - + // Loop until reaching the final state, or stop early if Pokémon was Asleep/Frozen } while (gBattleCommunication[MULTIUSE_STATE] != 2 && effect == 0); if (effect == 2) |