Skip to content

Commit

Permalink
Fixes Eject Pack softlocking the game (rh-hideout#4387)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexOn1ine authored and Pawkkie committed May 16, 2024
1 parent 8e7909c commit 14f6388
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -7462,6 +7462,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;
Expand Down
17 changes: 17 additions & 0 deletions test/battle/hold_effect/eject_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
}
}

0 comments on commit 14f6388

Please sign in to comment.