Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eject Pack fix #4463

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -6040,8 +6040,6 @@ static void Cmd_moveend(void)
for (i = 0; i < gBattlersCount; i++)
{
u32 holdEffect;
if (i == gBattlerAttacker)
continue;
holdEffect = GetBattlerHoldEffect(i, TRUE);
if (holdEffect == HOLD_EFFECT_EJECT_BUTTON)
ejectButtonBattlers |= gBitTable[i];
Expand All @@ -6057,7 +6055,7 @@ static void Cmd_moveend(void)
{
u32 battler = battlers[i];

if (ejectButtonBattlers & gBitTable[battler])
if (battler != gBattlerAttacker && ejectButtonBattlers & gBitTable[battler])
{
if (TestIfSheerForceAffected(gBattlerAttacker, gCurrentMove)) // Apparently Sheer Force blocks Eject Button, but not Eject Pack
continue;
Expand Down
22 changes: 22 additions & 0 deletions test/battle/hold_effect/eject_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SINGLE_BATTLE_TEST("Eject Pack does not cause the new pokemon to lose hp due to
MESSAGE("Wobbuffet is switched out with the Eject Pack!");
MESSAGE("Go! Wynaut!");
NOT MESSAGE("Wynaut was hurt by its Life Orb!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
}
}

Expand All @@ -41,3 +42,24 @@ SINGLE_BATTLE_TEST("Eject Pack does not activate if there are no pokemon left to
}
}
}

SINGLE_BATTLE_TEST("Eject Pack triggers on the correct pokemon")
{
GIVEN {
ASSUME(gItemsInfo[ITEM_LIFE_ORB].holdEffect == HOLD_EFFECT_LIFE_ORB);
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_PACK); }
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_PACK); }
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(player, MOVE_OVERHEAT); SEND_OUT(player, 1); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_OVERHEAT, player);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
MESSAGE("Wobbuffet is switched out with the Eject Pack!");
MESSAGE("Go! Wynaut!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
}
}
Loading