Avoid illegal move retargeting in singles (#8217)
Some checks are pending
CI / build (push) Waiting to run
CI / allcontributors (push) Waiting to run

This commit is contained in:
Martin Griffin 2025-11-13 12:51:35 +00:00 committed by GitHub
parent 586571391f
commit 555c603b67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -545,6 +545,7 @@ void HandleAction_UseMove(void)
gBattlerTarget = gBattleStruct->moveTarget[gBattlerAttacker];
if (!IsBattlerAlive(gBattlerTarget)
&& moveTarget != MOVE_TARGET_OPPONENTS_FIELD
&& IsDoubleBattle()
&& (!IsBattlerAlly(gBattlerAttacker, gBattlerTarget)))
{
gBattlerTarget = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gBattlerTarget)));
@ -6216,7 +6217,7 @@ u32 GetBattleMoveTarget(u16 move, u8 setTarget)
case MOVE_TARGET_BOTH:
case MOVE_TARGET_FOES_AND_ALLY:
targetBattler = GetOpposingSideBattler(gBattlerAttacker);
if (!IsBattlerAlive(targetBattler))
if (IsDoubleBattle() && !IsBattlerAlive(targetBattler))
targetBattler ^= BIT_FLANK;
break;
case MOVE_TARGET_OPPONENTS_FIELD: