Fixes Red Card / Eject Pack interaction with Emergency Exit (#5657)
Co-authored-by: Pawkkie <61265402+Pawkkie@users.noreply.github.com>
This commit is contained in:
parent
afc7795afc
commit
a8351e305c
6 changed files with 67 additions and 22 deletions
|
@ -9628,6 +9628,13 @@ BattleScript_EjectPackActivates::
|
||||||
jumpifcantswitch BS_SCRIPTING, BattleScript_EjectButtonEnd
|
jumpifcantswitch BS_SCRIPTING, BattleScript_EjectButtonEnd
|
||||||
goto BattleScript_EjectPackActivate_Ret
|
goto BattleScript_EjectPackActivate_Ret
|
||||||
|
|
||||||
|
BattleScript_EjectPackMissesTiming::
|
||||||
|
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT
|
||||||
|
printstring STRINGID_EJECTBUTTONACTIVATE
|
||||||
|
waitmessage B_WAIT_TIME_LONG
|
||||||
|
removeitem BS_SCRIPTING
|
||||||
|
return
|
||||||
|
|
||||||
BattleScript_DarkTypePreventsPrankster::
|
BattleScript_DarkTypePreventsPrankster::
|
||||||
attackstring
|
attackstring
|
||||||
ppreduce
|
ppreduce
|
||||||
|
|
|
@ -803,6 +803,7 @@ struct BattleStruct
|
||||||
u32 stellarBoostFlags[NUM_BATTLE_SIDES]; // stored as a bitfield of flags for all types for each side
|
u32 stellarBoostFlags[NUM_BATTLE_SIDES]; // stored as a bitfield of flags for all types for each side
|
||||||
u8 fickleBeamBoosted:1;
|
u8 fickleBeamBoosted:1;
|
||||||
u8 obedienceResult:3;
|
u8 obedienceResult:3;
|
||||||
|
u8 redCardActivates:1;
|
||||||
u8 usedMicleBerry;
|
u8 usedMicleBerry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -418,6 +418,7 @@ extern const u8 BattleScript_EjectButtonActivates[];
|
||||||
extern const u8 BattleScript_EjectPackActivate_Ret[];
|
extern const u8 BattleScript_EjectPackActivate_Ret[];
|
||||||
extern const u8 BattleScript_EjectPackActivate_End2[];
|
extern const u8 BattleScript_EjectPackActivate_End2[];
|
||||||
extern const u8 BattleScript_EjectPackActivates[];
|
extern const u8 BattleScript_EjectPackActivates[];
|
||||||
|
extern const u8 BattleScript_EjectPackMissesTiming[];
|
||||||
extern const u8 BattleScript_MentalHerbCureRet[];
|
extern const u8 BattleScript_MentalHerbCureRet[];
|
||||||
extern const u8 BattleScript_MentalHerbCureEnd2[];
|
extern const u8 BattleScript_MentalHerbCureEnd2[];
|
||||||
extern const u8 BattleScript_TerrainPreventsEnd2[];
|
extern const u8 BattleScript_TerrainPreventsEnd2[];
|
||||||
|
|
|
@ -6178,10 +6178,18 @@ static void Cmd_moveend(void)
|
||||||
}
|
}
|
||||||
else // Eject Pack
|
else // Eject Pack
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr = BattleScript_EjectPackActivates;
|
if (gBattleResources->flags->flags[gBattlerTarget] & RESOURCE_FLAG_EMERGENCY_EXIT)
|
||||||
// Are these 2 lines below needed?
|
{
|
||||||
gProtectStructs[battler].statFell = FALSE;
|
gBattlescriptCurrInstr = BattleScript_EjectPackMissesTiming;
|
||||||
gSpecialStatuses[gBattlerAttacker].preventLifeOrbDamage = TRUE;
|
gProtectStructs[battler].statFell = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gBattlescriptCurrInstr = BattleScript_EjectPackActivates;
|
||||||
|
// Are these 2 lines below needed?
|
||||||
|
gProtectStructs[battler].statFell = FALSE;
|
||||||
|
gSpecialStatuses[gBattlerAttacker].preventLifeOrbDamage = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break; // Only the fastest Eject item activates
|
break; // Only the fastest Eject item activates
|
||||||
}
|
}
|
||||||
|
@ -6238,6 +6246,7 @@ static void Cmd_moveend(void)
|
||||||
SaveBattlerTarget(battler); // save battler with red card
|
SaveBattlerTarget(battler); // save battler with red card
|
||||||
gBattleScripting.battler = battler;
|
gBattleScripting.battler = battler;
|
||||||
gEffectBattler = gBattlerAttacker;
|
gEffectBattler = gBattlerAttacker;
|
||||||
|
gBattleStruct->redCardActivates = TRUE;
|
||||||
if (gMovesInfo[gCurrentMove].effect == EFFECT_HIT_ESCAPE)
|
if (gMovesInfo[gCurrentMove].effect == EFFECT_HIT_ESCAPE)
|
||||||
gBattlescriptCurrInstr = BattleScript_MoveEnd; // Prevent user switch-in selection
|
gBattlescriptCurrInstr = BattleScript_MoveEnd; // Prevent user switch-in selection
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
|
@ -6337,6 +6346,11 @@ static void Cmd_moveend(void)
|
||||||
case MOVEEND_EMERGENCY_EXIT: // Special case, because moves hitting multiple opponents stop after switching out
|
case MOVEEND_EMERGENCY_EXIT: // Special case, because moves hitting multiple opponents stop after switching out
|
||||||
for (i = 0; i < gBattlersCount; i++)
|
for (i = 0; i < gBattlersCount; i++)
|
||||||
{
|
{
|
||||||
|
if (gBattleStruct->redCardActivates)
|
||||||
|
{
|
||||||
|
gBattleResources->flags->flags[i] &= ~RESOURCE_FLAG_EMERGENCY_EXIT;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (gBattleResources->flags->flags[i] & RESOURCE_FLAG_EMERGENCY_EXIT)
|
if (gBattleResources->flags->flags[i] & RESOURCE_FLAG_EMERGENCY_EXIT)
|
||||||
{
|
{
|
||||||
gBattleResources->flags->flags[i] &= ~RESOURCE_FLAG_EMERGENCY_EXIT;
|
gBattleResources->flags->flags[i] &= ~RESOURCE_FLAG_EMERGENCY_EXIT;
|
||||||
|
@ -6444,6 +6458,7 @@ static void Cmd_moveend(void)
|
||||||
gBattleStruct->poisonPuppeteerConfusion = FALSE;
|
gBattleStruct->poisonPuppeteerConfusion = FALSE;
|
||||||
gBattleStruct->fickleBeamBoosted = FALSE;
|
gBattleStruct->fickleBeamBoosted = FALSE;
|
||||||
gBattleStruct->distortedTypeMatchups = 0;
|
gBattleStruct->distortedTypeMatchups = 0;
|
||||||
|
gBattleStruct->redCardActivates = FALSE;
|
||||||
gBattleStruct->usedMicleBerry &= ~(1u << gBattlerAttacker);
|
gBattleStruct->usedMicleBerry &= ~(1u << gBattlerAttacker);
|
||||||
if (gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
|
if (gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
|
||||||
gBattleStruct->pledgeMove = FALSE;
|
gBattleStruct->pledgeMove = FALSE;
|
||||||
|
|
|
@ -63,3 +63,25 @@ SINGLE_BATTLE_TEST("Eject Pack is triggered by self-inflicting stat decreases")
|
||||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Eject Pack will miss timing to switch out user if Emergency Exit was activated on target")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_PACK); }
|
||||||
|
PLAYER(SPECIES_WYNAUT);
|
||||||
|
OPPONENT(SPECIES_GOLISOPOD) { Ability(ABILITY_EMERGENCY_EXIT); MaxHP(263); HP(133); };
|
||||||
|
OPPONENT(SPECIES_WYNAUT);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_OVERHEAT); SEND_OUT(opponent, 1); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_OVERHEAT, player);
|
||||||
|
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!");
|
||||||
|
ABILITY_POPUP(opponent, ABILITY_EMERGENCY_EXIT);
|
||||||
|
} THEN {
|
||||||
|
EXPECT(player->species == SPECIES_WOBBUFFET);
|
||||||
|
EXPECT(player->item == ITEM_NONE);
|
||||||
|
EXPECT(opponent->species == SPECIES_WYNAUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -380,24 +380,6 @@ SINGLE_BATTLE_TEST("Red Card does not activate if attacker's Sheer Force applied
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SINGLE_BATTLE_TEST("Red Card activates before Emergency Exit")
|
|
||||||
{
|
|
||||||
GIVEN {
|
|
||||||
PLAYER(SPECIES_GOLISOPOD) { MaxHP(100); HP(51); Item(ITEM_RED_CARD); }
|
|
||||||
PLAYER(SPECIES_WIMPOD);
|
|
||||||
OPPONENT(SPECIES_WOBBUFFET);
|
|
||||||
OPPONENT(SPECIES_WYNAUT);
|
|
||||||
} WHEN {
|
|
||||||
TURN { MOVE(opponent, MOVE_TACKLE); SEND_OUT(player, 1); }
|
|
||||||
} SCENE {
|
|
||||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
|
|
||||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
|
|
||||||
MESSAGE("Golisopod held up its Red Card against Foe Wobbuffet!");
|
|
||||||
ABILITY_POPUP(player, ABILITY_EMERGENCY_EXIT);
|
|
||||||
SEND_IN_MESSAGE("Wimpod");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SINGLE_BATTLE_TEST("Red Card is consumed after dragged out replacement has its Speed lowered by Sticky Web")
|
SINGLE_BATTLE_TEST("Red Card is consumed after dragged out replacement has its Speed lowered by Sticky Web")
|
||||||
{
|
{
|
||||||
GIVEN {
|
GIVEN {
|
||||||
|
@ -468,4 +450,21 @@ SINGLE_BATTLE_TEST("Red Card does not activate if holder is switched in mid-turn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Red Card prevents Emergency Exit activation when triggered")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET);
|
||||||
|
PLAYER(SPECIES_WYNAUT);
|
||||||
|
OPPONENT(SPECIES_GOLISOPOD) { Item(ITEM_RED_CARD); Ability(ABILITY_EMERGENCY_EXIT); MaxHP(263); HP(262); };
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_SUPER_FANG); MOVE(opponent, MOVE_CELEBRATE); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_SUPER_FANG, player);
|
||||||
|
HP_BAR(opponent);
|
||||||
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
|
||||||
|
NOT ABILITY_POPUP(opponent, ABILITY_EMERGENCY_EXIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SINGLE_BATTLE_TEST("Red Card activates but fails if the attacker has Dynamaxed")
|
// SINGLE_BATTLE_TEST("Red Card activates but fails if the attacker has Dynamaxed")
|
||||||
|
|
Loading…
Reference in a new issue