Fixes Eject Pack softlocking the game (#4387)

This commit is contained in:
Alex 2024-04-14 02:43:16 +02:00 committed by GitHub
parent a8a8344ba2
commit 5bf6a252b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View file

@ -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;

View file

@ -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!");
}
}
}