Merge pull request #2107 from AsparagusEduardo/pret/pr/simpleMultiBattleFix
Simplified Multi Battle bugfix, removing duplicate code
This commit is contained in:
@@ -7337,38 +7337,6 @@ static void Cmd_forcerandomswitch(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef BUGFIX
|
||||
if (TryDoForceSwitchOut())
|
||||
{
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
i = Random() % monsCount;
|
||||
i += firstMonId;
|
||||
}
|
||||
while (i == battler2PartyId || i == battler1PartyId);
|
||||
} while (GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE
|
||||
|| GetMonData(&party[i], MON_DATA_IS_EGG) == TRUE
|
||||
|| GetMonData(&party[i], MON_DATA_HP) == 0); //should be one while loop, but that doesn't match.
|
||||
*(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = i;
|
||||
|
||||
if (!IsMultiBattle())
|
||||
SwitchPartyOrder(gBattlerTarget);
|
||||
|
||||
if ((gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER)
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER)
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI))
|
||||
{
|
||||
SwitchPartyOrderLinkMulti(gBattlerTarget, i, 0);
|
||||
SwitchPartyOrderLinkMulti(BATTLE_PARTNER(gBattlerTarget), i, 1);
|
||||
}
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
SwitchPartyOrderInGameMulti(gBattlerTarget, i);
|
||||
}
|
||||
#else
|
||||
if (TryDoForceSwitchOut())
|
||||
{
|
||||
do
|
||||
@@ -7382,7 +7350,14 @@ static void Cmd_forcerandomswitch(void)
|
||||
} while (GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE
|
||||
|| GetMonData(&party[i], MON_DATA_IS_EGG) == TRUE
|
||||
|| GetMonData(&party[i], MON_DATA_HP) == 0); //should be one while loop, but that doesn't match.
|
||||
// Bug: If the opponent uses forced switchout moves in a Multi Battle, the player side party
|
||||
// might get the order messed up where the mons appear in the wrong slots of the party screen.
|
||||
// This causes a hardlock when all mons on the player side are knocked out and the player
|
||||
// can't select their mon that's on the partner side of the party screen.
|
||||
// To fix this, the below code is moved inside the 'if (TryDoForceSwitchOut())' block by moving the brace further down.
|
||||
#ifndef BUGFIX
|
||||
}
|
||||
#endif
|
||||
*(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = i;
|
||||
|
||||
if (!IsMultiBattle())
|
||||
@@ -7399,7 +7374,9 @@ static void Cmd_forcerandomswitch(void)
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
SwitchPartyOrderInGameMulti(gBattlerTarget, i);
|
||||
#endif
|
||||
#ifdef BUGFIX
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user