mirror of
https://github.com/rh-hideout/pokeemerald-expansion.git
synced 2026-03-21 18:04:50 -05:00
Fix Commander cleanup to only clear STATE_COMMANDER semi-invulnerability for partners (#9598)
This commit is contained in:
parent
7248ff7193
commit
04245161e0
|
|
@ -3388,11 +3388,14 @@ const u8* FaintClearSetData(enum BattlerId battler)
|
|||
enum BattlerId partner = BATTLE_PARTNER(battler);
|
||||
// Clear commander state immediately so a replacement doesn't inherit it.
|
||||
gBattleStruct->battlerState[battler].commanderSpecies = SPECIES_NONE;
|
||||
gBattleMons[partner].volatiles.semiInvulnerable = STATE_NONE;
|
||||
if (IsBattlerAlive(partner))
|
||||
if (gBattleMons[partner].volatiles.semiInvulnerable == STATE_COMMANDER)
|
||||
{
|
||||
BtlController_EmitSpriteInvisibility(partner, B_COMM_TO_CONTROLLER, FALSE);
|
||||
MarkBattlerForControllerExec(partner);
|
||||
gBattleMons[partner].volatiles.semiInvulnerable = STATE_NONE;
|
||||
if (IsBattlerAlive(partner))
|
||||
{
|
||||
BtlController_EmitSpriteInvisibility(partner, B_COMM_TO_CONTROLLER, FALSE);
|
||||
MarkBattlerForControllerExec(partner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3751,7 +3751,7 @@ static enum MoveEndResult MoveEndClearBits(void)
|
|||
{
|
||||
enum BattlerId partner = BATTLE_PARTNER(i);
|
||||
gBattleStruct->battlerState[i].commanderSpecies = SPECIES_NONE;
|
||||
if (IsBattlerAlive(partner))
|
||||
if (gBattleMons[partner].volatiles.semiInvulnerable == STATE_COMMANDER)
|
||||
gBattleMons[partner].volatiles.semiInvulnerable = STATE_NONE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -506,3 +506,33 @@ DOUBLE_BATTLE_TEST("Commander clears when Dondozo is replaced and Tatsugiri can
|
|||
HP_BAR(playerRight);
|
||||
}
|
||||
}
|
||||
|
||||
DOUBLE_BATTLE_TEST("Commander does not clear semi-invulnerability of non-Tatsugiri partner")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(GetMoveEffect(MOVE_FLY) == EFFECT_SEMI_INVULNERABLE);
|
||||
PLAYER(SPECIES_DONDOZO) { HP(1); Speed(1); }
|
||||
PLAYER(SPECIES_TATSUGIRI) { Ability(ABILITY_COMMANDER); HP(1); Status1(STATUS1_POISON); Speed(2); }
|
||||
PLAYER(SPECIES_PIDGEOT) { Speed(100); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Speed(90); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Speed(80); }
|
||||
} WHEN {
|
||||
TURN { SKIP_TURN(playerRight); SEND_OUT(playerRight, 2); }
|
||||
TURN {
|
||||
MOVE(playerRight, MOVE_FLY, target: opponentLeft);
|
||||
MOVE(opponentLeft, MOVE_SCRATCH, target: playerLeft);
|
||||
MOVE(opponentRight, MOVE_SCRATCH, target: playerRight);
|
||||
}
|
||||
} SCENE {
|
||||
ABILITY_POPUP(playerRight, ABILITY_COMMANDER);
|
||||
MESSAGE("Tatsugiri was swallowed by Dondozo and became Dondozo's commander!");
|
||||
MESSAGE("Tatsugiri fainted!");
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_FLY, playerRight);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, opponentLeft);
|
||||
HP_BAR(playerLeft);
|
||||
MESSAGE("Dondozo fainted!");
|
||||
NOT HP_BAR(playerRight);
|
||||
} THEN {
|
||||
EXPECT_EQ(playerRight->hp, playerRight->maxHP);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user