Fixes freeze during a 1v2 double battle (#7075)

This commit is contained in:
Alex 2025-06-07 11:49:15 +02:00 committed by GitHub
parent 1692d641c4
commit 9f1eb78737
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2868,7 +2868,7 @@ static void Cmd_resultmessage(void)
gDisableStructs[gBattlerTarget].iceFaceActivationPrevention = FALSE;
u32 side = GetBattlerSide(gBattlerTarget);
if (gBattleStruct->changedSpecies[side][gBattlerPartyIndexes[gBattlerTarget]] == SPECIES_NONE)
gBattleStruct->changedSpecies[side][gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species;
gBattleStruct->changedSpecies[side][gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species;
gBattleMons[gBattlerTarget].species = SPECIES_EISCUE_NOICE;
gBattleScripting.battler = gBattlerTarget; // For STRINGID_PKMNTRANSFORMED
BattleScriptPushCursor();
@ -7934,7 +7934,16 @@ static void Cmd_openpartyscreen(void)
{
if (((1u << i) & hitmarkerFaintBits))
{
if (i > 1 && ((1u << BATTLE_PARTNER(i)) & hitmarkerFaintBits))
u32 skipPartnerCheck = FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS
&& GetBattlerSide(i) == B_SIDE_OPPONENT
&& TRAINER_BATTLE_PARAM.opponentB != TRAINER_NONE)
skipPartnerCheck = TRUE;
// In a 1v2 Double Battle if trainer A didn't have any more mons left
// the battler for trainer B wasn't being registered to be send out.
// Likely reason is because hitmarkerFaintBits was not set for battler 1 due to it being missing for a turn or cleared somewhere
if (!skipPartnerCheck && i > 1 && ((1u << BATTLE_PARTNER(i)) & hitmarkerFaintBits))
continue;
battler = i;