fix for multi 2vs1 opponent sends out too many mons bug (#6324)

This commit is contained in:
Bivurnum 2025-02-25 15:15:09 -06:00 committed by GitHub
parent 766b9b00ca
commit 2a6fd24954
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3816,6 +3816,21 @@ bool32 HasNoMonsToSwitch(u32 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2
playerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
party = gEnemyParty;
// Edge case: If both opposing Pokemon were knocked out on the same turn,
// make sure opponent only sents out the final Pokemon once.
if (battler == playerId
&& (gHitMarker & HITMARKER_FAINTED(flankId))
&& (gHitMarker & HITMARKER_FAINTED(playerId)))
{
u8 count = 0;
for (i = 0; i < PARTY_SIZE; i++)
if (IsValidForBattle(&party[i]))
count++;
if (count < 2)
return TRUE;
}
if (partyIdBattlerOn1 == PARTY_SIZE)
partyIdBattlerOn1 = gBattlerPartyIndexes[flankId];
if (partyIdBattlerOn2 == PARTY_SIZE)