From e64da065e8016643d21c2fe95897c57d2a951e71 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 29 Dec 2024 22:24:09 +0100 Subject: [PATCH] Fixes Eject Pack / Intimidate issue (#5902) --- src/battle_util.c | 12 ++++++++++++ test/battle/hold_effect/eject_pack.c | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/battle_util.c b/src/battle_util.c index 1e0341f337..a9956615a1 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8322,6 +8322,18 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn) gBattlescriptCurrInstr = BattleScript_WhiteHerbRet; } break; + case HOLD_EFFECT_EJECT_PACK: + if (gProtectStructs[battler].statFell + && gProtectStructs[battler].disableEjectPack == 0 + && CountUsablePartyMons(battler) > 0) + { + gBattleScripting.battler = battler; + gPotentialItemEffectBattler = battler; + effect = ITEM_STATS_CHANGE; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_EjectPackActivates; + } + break; } break; } diff --git a/test/battle/hold_effect/eject_pack.c b/test/battle/hold_effect/eject_pack.c index 9272a23a7c..b3a2d34b63 100644 --- a/test/battle/hold_effect/eject_pack.c +++ b/test/battle/hold_effect/eject_pack.c @@ -85,3 +85,19 @@ SINGLE_BATTLE_TEST("Eject Pack will miss timing to switch out user if Emergency EXPECT(opponent->species == SPECIES_WYNAUT); } } + +SINGLE_BATTLE_TEST("Eject Pack activates once intimidate mon switches in") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_PACK); } + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); } + } WHEN { + TURN { SWITCH(opponent, 1); SEND_OUT(player, 1); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); + MESSAGE("Wobbuffet is switched out with the Eject Pack!"); + } +}