Fixes Quash-affected battlers having the wrong order for End Turn effects (#5838)

This commit is contained in:
PhallenTree 2024-12-20 10:11:18 +00:00 committed by GitHub
parent a797e901b2
commit 4ac9dea30e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View file

@ -6757,6 +6757,7 @@ static void AnimTask_AllySwitchDataSwap(u8 taskId)
break; break;
} }
SWAP(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], temp); SWAP(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], temp);
SWAP(gActionsByTurnOrder[i], gActionsByTurnOrder[j], temp);
break; break;
} }
} }

View file

@ -1679,17 +1679,12 @@ u8 DoFieldEndTurnEffects(void)
switch (gBattleStruct->turnCountersTracker) switch (gBattleStruct->turnCountersTracker)
{ {
case ENDTURN_ORDER: case ENDTURN_ORDER:
for (i = 0; i < gBattlersCount; i++)
{
gBattlerByTurnOrder[i] = i;
}
for (i = 0; i < gBattlersCount - 1; i++) for (i = 0; i < gBattlersCount - 1; i++)
{ {
s32 j; s32 j;
for (j = i + 1; j < gBattlersCount; j++) for (j = i + 1; j < gBattlersCount; j++)
{ {
if (!gProtectStructs[i].quash if (!(gProtectStructs[i].quash && gProtectStructs[j].quash)
&& !gProtectStructs[j].quash
&& GetWhichBattlerFaster(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE) == -1) && GetWhichBattlerFaster(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE) == -1)
SwapTurnOrder(i, j); SwapTurnOrder(i, j);
} }