diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index b8a4a20922ee..a2810db20590 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7726,6 +7726,12 @@ BattleScript_IntimidateLoop: jumpiftargetally BattleScript_IntimidateLoopIncrement jumpifabsent BS_TARGET, BattleScript_IntimidateLoopIncrement jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_IntimidateLoopIncrement +.if B_UPDATED_INTIMIDATE >= GEN_8 @These abilties specifically prevent just intimidate, without blocking stat decreases + jumpifability BS_TARGET, ABILITY_INNER_FOCUS, BattleScript_IntimidatePrevented + jumpifability BS_TARGET, ABILITY_SCRAPPY, BattleScript_IntimidatePrevented + jumpifability BS_TARGET, ABILITY_OWN_TEMPO, BattleScript_IntimidatePrevented + jumpifability BS_TARGET, ABILITY_OBLIVIOUS, BattleScript_IntimidatePrevented +.endif jumpifability BS_TARGET, ABILITY_GUARD_DOG, BattleScript_IntimidateInReverse BattleScript_IntimidateEffect: copybyte sBATTLER, gBattlerAttacker @@ -7750,6 +7756,12 @@ BattleScript_IntimidateEnd: pause B_WAIT_TIME_MED end3 +BattleScript_IntimidatePrevented: + copybyte sBATTLER, gBattlerTarget + call BattleScript_AbilityPopUp + printstring STRINGID_PKMNPREVENTSSTATLOSSWITH + goto BattleScript_IntimidateEffect_WaitString + BattleScript_IntimidateWontDecrease: printstring STRINGID_STATSWONTDECREASE goto BattleScript_IntimidateEffect_WaitString diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 84db1e01c5d8..0b0b2eda96bd 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -362,7 +362,7 @@ static void TryUpdateRoundTurnOrder(void); static bool32 ChangeOrderTargetAfterAttacker(void); void ApplyExperienceMultipliers(s32 *expAmount, u8 expGetterMonId, u8 faintedBattler); static void RemoveAllTerrains(void); -static bool8 CanAbilityPreventStatLoss(u16 abilityDef, bool8 isIntimidate); +static bool8 CanAbilityPreventStatLoss(u16 abilityDef); static bool8 CanBurnHitThaw(u16 move); static u32 GetNextTarget(u32 moveTarget, bool32 excludeCurrent); static void TryUpdateEvolutionTracker(u32 evolutionMethod, u32 upAmount, u16 usedMove); @@ -11568,8 +11568,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr gBattlescriptCurrInstr = BattleScript_ButItFailed; return STAT_CHANGE_DIDNT_WORK; } - else if ((battlerHoldEffect == HOLD_EFFECT_CLEAR_AMULET - || CanAbilityPreventStatLoss(battlerAbility, GetBattlerAbility(gBattlerAttacker) == ABILITY_INTIMIDATE)) + else if ((battlerHoldEffect == HOLD_EFFECT_CLEAR_AMULET || CanAbilityPreventStatLoss(battlerAbility)) && (!affectsUser || mirrorArmored) && !certain && gCurrentMove != MOVE_CURSE) { if (flags == STAT_CHANGE_ALLOW_PTR) @@ -15817,7 +15816,7 @@ static bool8 IsFinalStrikeEffect(u16 move) return FALSE; } -static bool8 CanAbilityPreventStatLoss(u16 abilityDef, bool8 byIntimidate) +static bool8 CanAbilityPreventStatLoss(u16 abilityDef) { switch (abilityDef) { @@ -15825,13 +15824,6 @@ static bool8 CanAbilityPreventStatLoss(u16 abilityDef, bool8 byIntimidate) case ABILITY_FULL_METAL_BODY: case ABILITY_WHITE_SMOKE: return TRUE; - case ABILITY_INNER_FOCUS: - case ABILITY_SCRAPPY: - case ABILITY_OWN_TEMPO: - case ABILITY_OBLIVIOUS: - if (byIntimidate && (B_UPDATED_INTIMIDATE >= GEN_8)) - return TRUE; - break; } return FALSE; } diff --git a/test/battle/ability/own_tempo.c b/test/battle/ability/own_tempo.c index 04697aad32c4..d5a6f58a723c 100644 --- a/test/battle/ability/own_tempo.c +++ b/test/battle/ability/own_tempo.c @@ -1,29 +1,24 @@ #include "global.h" #include "test/battle.h" -SINGLE_BATTLE_TEST("Own Tempo prevents intimidate") +SINGLE_BATTLE_TEST("Own Tempo prevents Intimidate but no other stat down changes") { - s16 turnOneHit; - s16 turnTwoHit; - GIVEN { ASSUME(B_UPDATED_INTIMIDATE >= GEN_8); - PLAYER(SPECIES_EKANS) { Ability(ABILITY_SHED_SKIN); }; + ASSUME(gMovesInfo[MOVE_CONFUSE_RAY].effect == EFFECT_CONFUSE); PLAYER(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); }; OPPONENT(SPECIES_SLOWPOKE) { Ability(ABILITY_OWN_TEMPO); }; } WHEN { - TURN { MOVE(opponent, MOVE_TACKLE); } - TURN { SWITCH(player, 1); MOVE(opponent, MOVE_TACKLE); } - + TURN { MOVE(player, MOVE_SCARY_FACE); } } SCENE { - HP_BAR(player, captureDamage: &turnOneHit); ABILITY_POPUP(player, ABILITY_INTIMIDATE); - NONE_OF { ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); } ABILITY_POPUP(opponent, ABILITY_OWN_TEMPO); MESSAGE("Foe Slowpoke's Own Tempo prevents stat loss!"); - HP_BAR(player, captureDamage: &turnTwoHit); - } THEN { - EXPECT_EQ(turnOneHit, turnTwoHit); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SCARY_FACE, player); + NONE_OF { + ABILITY_POPUP(opponent, ABILITY_OWN_TEMPO); + MESSAGE("Foe Slowpoke's Own Tempo prevents stat loss!"); + } } }