summaryrefslogtreecommitdiff
path: root/src/battle_util2.c
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-10-07 16:10:35 -0400
committerGitHub <noreply@github.com>2021-10-07 16:10:35 -0400
commita2655ba9ab82646a54f60abc6078df372179f8d4 (patch)
tree95b074a1a4d77d6cd77e413e1d6e72eb55b595b0 /src/battle_util2.c
parente86d3410a1719fcbf62754bfda93a295aa7e0d57 (diff)
parent001a25e49cd6acdac89a62f4230aef80422e78f2 (diff)
Merge branch 'master' into doc-union
Diffstat (limited to 'src/battle_util2.c')
-rw-r--r--src/battle_util2.c12
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)