mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
fix electric/misty yawn/rest interactions
This commit is contained in:
parent
5e250853c6
commit
0bbbd1e7a9
@ -2154,6 +2154,12 @@ BattleScript_EffectSleep::
|
||||
seteffectprimary
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_TerrainPreventsEnd2::
|
||||
pause 0x20
|
||||
printfromtable gTerrainPreventsStringIds
|
||||
waitmessage 0x40
|
||||
end2
|
||||
|
||||
BattleScript_ElectricTerrainPrevents:
|
||||
pause 0x20
|
||||
printstring STRINGID_ELECTRICTERRAINPREVENTS
|
||||
@ -2733,11 +2739,11 @@ BattleScript_EffectRest::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifterrainaffected BS_ATTACKER, (STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_MISTY_TERRAIN), BattleScript_ButItFailed
|
||||
jumpifstatus BS_ATTACKER, STATUS1_SLEEP, BattleScript_RestIsAlreadyAsleep
|
||||
jumpifability BS_ATTACKER, ABILITY_COMATOSE, BattleScript_RestIsAlreadyAsleep
|
||||
jumpifcantmakeasleep BattleScript_RestCantSleep
|
||||
trysetrest BattleScript_AlreadyAtFullHp
|
||||
jumpifterrainaffected BS_ATTACKER, (STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_MISTY_TERRAIN), BattleScript_ButItFailed
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printfromtable gRestUsedStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
@ -4630,6 +4636,8 @@ BattleScript_EffectYawn::
|
||||
jumpifability BS_TARGET, ABILITY_VITAL_SPIRIT, BattleScript_PrintBankAbilityMadeIneffective
|
||||
jumpifability BS_TARGET, ABILITY_INSOMNIA, BattleScript_PrintBankAbilityMadeIneffective
|
||||
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_PrintBankAbilityMadeIneffective
|
||||
jumpifterrainaffected BS_TARGET, STATUS_FIELD_ELECTRIC_TERRAIN, BattleScript_ElectricTerrainPrevents
|
||||
jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents
|
||||
jumpifflowerveil BattleScript_FlowerVeilProtects
|
||||
jumpifleafguard BattleScript_LeafGuardProtects
|
||||
jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects
|
||||
|
@ -369,5 +369,6 @@ extern const u8 BattleScript_JabocaRowapBerryActivates[];
|
||||
extern const u8 BattleScript_NotAffectedAbilityPopUp[];
|
||||
extern const u8 BattleScript_BattlerShookOffTaunt[];
|
||||
extern const u8 BattleScript_BattlerGotOverItsInfatuation[];
|
||||
extern const u8 BattleScript_TerrainPreventsEnd2[];
|
||||
|
||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||
|
@ -2724,15 +2724,27 @@ u8 DoBattlerEndTurnEffects(void)
|
||||
if (!(gStatuses3[gActiveBattler] & STATUS3_YAWN) && !(gBattleMons[gActiveBattler].status1 & STATUS1_ANY)
|
||||
&& gBattleMons[gActiveBattler].ability != ABILITY_VITAL_SPIRIT
|
||||
&& gBattleMons[gActiveBattler].ability != ABILITY_INSOMNIA && !UproarWakeUpCheck(gActiveBattler)
|
||||
&& !IsLeafGuardProtected(gActiveBattler)
|
||||
&& !(gFieldStatuses & (STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_MISTY_TERRAIN)))
|
||||
&& !IsLeafGuardProtected(gActiveBattler))
|
||||
{
|
||||
CancelMultiTurnMoves(gActiveBattler);
|
||||
gBattleMons[gActiveBattler].status1 |= (Random() & 3) + 2;
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gEffectBattler = gActiveBattler;
|
||||
BattleScriptExecute(BattleScript_YawnMakesAsleep);
|
||||
if (IsBattlerTerrainAffected(gActiveBattler, STATUS_FIELD_ELECTRIC_TERRAIN))
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
BattleScriptExecute(BattleScript_TerrainPreventsEnd2);
|
||||
}
|
||||
else if (IsBattlerTerrainAffected(gActiveBattler, STATUS_FIELD_MISTY_TERRAIN))
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
BattleScriptExecute(BattleScript_TerrainPreventsEnd2);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMons[gActiveBattler].status1 |= (Random() & 3) + 2;
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
BattleScriptExecute(BattleScript_YawnMakesAsleep);
|
||||
}
|
||||
effect++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user