Fix Lightning Rod activation on fainted mon (#9434)

This commit is contained in:
Alex 2026-03-07 16:29:31 +01:00 committed by GitHub
parent 4e0fc26fc5
commit 8c42eafd0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

@ -824,6 +824,9 @@ static bool32 HandleMoveTargetRedirection(enum MoveTarget moveTarget)
enum BattlerId battler;
for (battler = 0; battler < gBattlersCount; battler++)
{
if (!IsBattlerAlive(battler) || gBattlerAttacker == battler)
continue;
ability = GetBattlerAbility(battler);
if ((B_REDIRECT_ABILITY_ALLIES >= GEN_4 || !IsBattlerAlly(gBattlerAttacker, battler))
&& battler != gBattlerAttacker

View File

@ -130,3 +130,21 @@ DOUBLE_BATTLE_TEST("Lightning Rod absorbs moves that targets all battlers but do
HP_BAR(playerRight);
}
}
DOUBLE_BATTLE_TEST("Lightning Rod doesn't activate if user has fainted")
{
GIVEN {
ASSUME(GetMoveType(MOVE_SPARK) == TYPE_ELECTRIC);
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_RAICHU) { HP(1); Ability(ABILITY_LIGHTNING_ROD); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_POUND, target: opponentRight); MOVE(playerRight, MOVE_SPARK, target: opponentLeft); }
} SCENE {
NONE_OF {
MESSAGE("The opposing Raichu's Lightning Rod took the attack");
ABILITY_POPUP(opponentRight, ABILITY_LIGHTNING_ROD);
}
}
}