Fixes Unnerve activation not limited to 1 per switch-in (#6960)

This commit is contained in:
Alex 2025-05-22 19:15:01 +02:00 committed by GitHub
parent 8ec998abff
commit 48100e9593
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 2 deletions

View File

@ -132,6 +132,7 @@ struct DisableStruct
u8 unburdenActive:1;
u8 neutralizingGas:1;
u8 iceFaceActivationPrevention:1; // fixes hit escape move edge case
u8 unnerveActivated:1; // Unnerve and As One (Unnerve part) activate only once per switch in
u8 padding:3;
};

View File

@ -4847,10 +4847,11 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
}
break;
case ABILITY_UNNERVE:
if (!gSpecialStatuses[battler].switchInAbilityDone)
if (!gSpecialStatuses[battler].switchInAbilityDone && !gDisableStructs[battler].unnerveActivated)
{
gBattlerTarget = GetOppositeBattler(battler);
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_UNNERVE;
gDisableStructs[battler].unnerveActivated = TRUE;
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg);
effect++;
@ -4858,10 +4859,11 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
break;
case ABILITY_AS_ONE_ICE_RIDER:
case ABILITY_AS_ONE_SHADOW_RIDER:
if (!gSpecialStatuses[battler].switchInAbilityDone)
if (!gSpecialStatuses[battler].switchInAbilityDone && !gDisableStructs[battler].unnerveActivated)
{
gBattlerTarget = GetOppositeBattler(battler);
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_ASONE;
gDisableStructs[battler].unnerveActivated = TRUE;
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
BattleScriptPushCursorAndCallback(BattleScript_ActivateAsOne);
effect++;

View File

@ -72,3 +72,30 @@ SINGLE_BATTLE_TEST("Unnerve prints the correct string (opponent)")
MESSAGE("Your team is too nervous to eat Berries!");
}
}
SINGLE_BATTLE_TEST("Unnerve activates only once per switch-in")
{
u16 mon;
u16 ability;
PARAMETRIZE { mon = SPECIES_JOLTIK, ability = ABILITY_UNNERVE; }
PARAMETRIZE { mon = SPECIES_CALYREX_ICE, ability = ABILITY_AS_ONE_ICE_RIDER; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WEEZING) { Ability(ABILITY_NEUTRALIZING_GAS); }
OPPONENT(mon) { Ability(ability); }
OPPONENT(mon) { Ability(ability); }
} WHEN {
TURN { SWITCH(player, 1); }
TURN { SWITCH(player, 0); }
TURN { SWITCH(player, 1); }
TURN { SWITCH(player, 0); }
TURN { SWITCH(opponent, 1); }
} SCENE {
ABILITY_POPUP(opponent, ability);
ABILITY_POPUP(player, ABILITY_NEUTRALIZING_GAS);
NOT ABILITY_POPUP(opponent, ability);
ABILITY_POPUP(player, ABILITY_NEUTRALIZING_GAS);
ABILITY_POPUP(opponent, ability);
}
}