diff --git a/src/battle_util.c b/src/battle_util.c index 88ae8af274..c217e37c9b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7260,6 +7260,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn) case HOLD_EFFECT_EJECT_PACK: if (gProtectStructs[battler].statFell && gProtectStructs[battler].disableEjectPack == 0 + && CountUsablePartyMons(battler) > 0 && !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker))) // Does not activate if attacker used Parting Shot and can switch out { gProtectStructs[battler].statFell = FALSE; diff --git a/test/battle/hold_effect/eject_pack.c b/test/battle/hold_effect/eject_pack.c index 940824da5d..1a54d5a2e9 100644 --- a/test/battle/hold_effect/eject_pack.c +++ b/test/battle/hold_effect/eject_pack.c @@ -24,3 +24,20 @@ SINGLE_BATTLE_TEST("Eject Pack does not cause the new pokemon to lose hp due to NOT MESSAGE("Wynaut was hurt by its Life Orb!"); } } + +SINGLE_BATTLE_TEST("Eject Pack does not activate if there are no pokemon left to battle") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_PACK); } + PLAYER(SPECIES_WOBBUFFET) { HP(0); } + OPPONENT(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); } + } WHEN { + TURN { } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + NONE_OF { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); + MESSAGE("Wobbuffet is switched out with the Eject Pack!"); + } + } +}