Fixes Sweet Veil not protecting sleep from Yawn status (#7704)

This commit is contained in:
Alex 2025-09-08 11:51:22 +02:00 committed by GitHub
parent 441d39cc57
commit 92ba0d813d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 45 additions and 9 deletions

View File

@ -2756,6 +2756,13 @@ BattleScript_TerrainPreventsEnd2::
waitmessage B_WAIT_TIME_LONG
end2
BattleScript_ImmunityProtectedEnd2::
call BattleScript_AbilityPopUp
pause B_WAIT_TIME_SHORT
printfromtable gStatusPreventionStringIds
waitmessage B_WAIT_TIME_LONG
end2
BattleScript_ElectricTerrainPrevents::
pause B_WAIT_TIME_SHORT
printstring STRINGID_ELECTRICTERRAINPREVENTS
@ -6947,7 +6954,7 @@ BattleScript_UpdateEffectStatusIconRet::
flushtextbox
return
BattleScript_YawnMakesAsleep::
BattleScript_YawnMakesAsleepEnd2::
statusanimation BS_EFFECT_BATTLER
printstring STRINGID_PKMNFELLASLEEP
waitmessage B_WAIT_TIME_LONG
@ -9682,7 +9689,7 @@ BattleScript_SleepClauseBlocked::
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_SleepClausePreventsEnd::
BattleScript_SleepClausePreventsEnd2::
pause B_WAIT_TIME_SHORT
printstring STRINGID_BLOCKEDBYSLEEPCLAUSE
waitmessage B_WAIT_TIME_LONG

View File

@ -150,7 +150,7 @@ extern const u8 BattleScript_TargetWokeUp[];
extern const u8 BattleScript_TargetBurnHeal[];
extern const u8 BattleScript_TargetPoisonHealed[];
extern const u8 BattleScript_MoveEffectSleep[];
extern const u8 BattleScript_YawnMakesAsleep[];
extern const u8 BattleScript_YawnMakesAsleepEnd2[];
extern const u8 BattleScript_MoveEffectPoison[];
extern const u8 BattleScript_MoveEffectBurn[];
extern const u8 BattleScript_MoveEffectFrostbite[];
@ -424,6 +424,7 @@ extern const u8 BattleScript_EjectPackActivates[];
extern const u8 BattleScript_MentalHerbCureRet[];
extern const u8 BattleScript_MentalHerbCureEnd2[];
extern const u8 BattleScript_TerrainPreventsEnd2[];
extern const u8 BattleScript_ImmunityProtectedEnd2[];
extern const u8 BattleScript_MistyTerrainPrevents[];
extern const u8 BattleScript_ElectricTerrainPrevents[];
extern const u8 BattleScript_DoesntAffectTargetAtkString[];
@ -518,7 +519,7 @@ extern const u8 BattleScript_BoosterEnergyEnd2[];
extern const u8 BattleScript_BoosterEnergyRet[];
extern const u8 BattleScript_TeraShellDistortingTypeMatchups[];
extern const u8 BattleScript_TeraFormChange[];
extern const u8 BattleScript_SleepClausePreventsEnd[];
extern const u8 BattleScript_SleepClausePreventsEnd2[];
extern const u8 BattleScript_PowerConstruct[];
extern const u8 BattleScript_AbilityProtectsDoesntAffect[];
extern const u8 BattleScript_ImmunityProtected[];

View File

@ -1024,7 +1024,6 @@ static bool32 HandleEndTurnYawn(u32 battler)
&& !UproarWakeUpCheck(battler)
&& !IsLeafGuardProtected(battler, ability))
{
CancelMultiTurnMoves(battler, SKY_DROP_STATUS_YAWN);
gEffectBattler = gBattlerTarget = battler;
if (IsBattlerTerrainAffected(battler, STATUS_FIELD_ELECTRIC_TERRAIN))
{
@ -1038,7 +1037,15 @@ static bool32 HandleEndTurnYawn(u32 battler)
}
else if (IsSleepClauseActiveForSide(GetBattlerSide(battler)))
{
BattleScriptExecute(BattleScript_SleepClausePreventsEnd);
BattleScriptExecute(BattleScript_SleepClausePreventsEnd2);
}
else if ((gBattleScripting.battler = IsAbilityOnSide(battler, ABILITY_SWEET_VEIL)))
{
gBattleScripting.battler--;
gLastUsedAbility = ABILITY_SWEET_VEIL;
gBattlerAbility = gBattleScripting.battler;
RecordAbilityBattle(gBattleScripting.battler, ABILITY_SWEET_VEIL);
BattleScriptExecute(BattleScript_ImmunityProtectedEnd2);
}
else
{
@ -1047,10 +1054,11 @@ static bool32 HandleEndTurnYawn(u32 battler)
else
gBattleMons[battler].status1 |= ((Random() % 4) + 3);
CancelMultiTurnMoves(battler, SKY_DROP_STATUS_YAWN);
TryActivateSleepClause(battler, gBattlerPartyIndexes[battler]);
BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1);
MarkBattlerForControllerExec(battler);
BattleScriptExecute(BattleScript_YawnMakesAsleep);
BattleScriptExecute(BattleScript_YawnMakesAsleepEnd2);
}
effect = TRUE;
}

View File

@ -17,7 +17,7 @@ DOUBLE_BATTLE_TEST("Sweet Veil prevents Sleep on partner - right target")
} WHEN {
TURN { MOVE(playerLeft, MOVE_HYPNOSIS, target: opponentRight); }
} SCENE {
MESSAGE("Wobbuffet used Hypnosis!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_HYPNOSIS, playerLeft);
ABILITY_POPUP(opponentLeft, ABILITY_SWEET_VEIL);
NOT STATUS_ICON(opponentRight, sleep: TRUE);
}
@ -33,7 +33,27 @@ DOUBLE_BATTLE_TEST("Sweet Veil prevents Sleep on partner - left target")
} WHEN {
TURN { MOVE(playerLeft, MOVE_HYPNOSIS, target: opponentLeft); }
} SCENE {
MESSAGE("Wobbuffet used Hypnosis!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_HYPNOSIS, playerLeft);
ABILITY_POPUP(opponentRight, ABILITY_SWEET_VEIL);
NOT STATUS_ICON(opponentLeft, sleep: TRUE);
}
}
DOUBLE_BATTLE_TEST("Sweet Veil prevents Yawn activation")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
OPPONENT(SPECIES_BOUNSWEET) { Ability(ABILITY_SWEET_VEIL); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_YAWN, target: opponentLeft); }
TURN { SWITCH(opponentRight, 2); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, playerLeft);
// Turn 2
ABILITY_POPUP(opponentRight, ABILITY_SWEET_VEIL);
NOT STATUS_ICON(opponentLeft, sleep: TRUE);
}