mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-02-22 04:04:15 +01:00
Merge pull request #1565 from BuffelSaft/disguise-fix
Fix Disguise reverting on switch out
This commit is contained in:
commit
304f3b9203
@ -123,7 +123,7 @@ u16 GetMegaEvolutionSpecies(u16 preEvoSpecies, u16 heldItemId);
|
||||
u16 GetWishMegaEvolutionSpecies(u16 preEvoSpecies, u16 moveId1, u16 moveId2, u16 moveId3, u16 moveId4);
|
||||
bool32 CanMegaEvolve(u8 battlerId);
|
||||
void UndoMegaEvolution(u32 monId);
|
||||
void UndoFormChange(u32 monId, u32 side);
|
||||
void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut);
|
||||
bool32 DoBattlersShareType(u32 battler1, u32 battler2);
|
||||
bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId);
|
||||
struct Pokemon *GetIllusionMonPtr(u32 battlerId);
|
||||
|
@ -3122,7 +3122,7 @@ void FaintClearSetData(void)
|
||||
ClearBattlerMoveHistory(gActiveBattler);
|
||||
ClearBattlerAbilityHistory(gActiveBattler);
|
||||
ClearBattlerItemEffectHistory(gActiveBattler);
|
||||
UndoFormChange(gBattlerPartyIndexes[gActiveBattler], GET_BATTLER_SIDE(gActiveBattler));
|
||||
UndoFormChange(gBattlerPartyIndexes[gActiveBattler], GET_BATTLER_SIDE(gActiveBattler), FALSE);
|
||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
|
||||
UndoMegaEvolution(gBattlerPartyIndexes[gActiveBattler]);
|
||||
}
|
||||
@ -4878,7 +4878,7 @@ static void HandleEndTurn_FinishBattle(void)
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
UndoMegaEvolution(i);
|
||||
UndoFormChange(i, B_SIDE_PLAYER);
|
||||
UndoFormChange(i, B_SIDE_PLAYER, FALSE);
|
||||
}
|
||||
gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions;
|
||||
gCB2_AfterEvolution = BattleMainCB2;
|
||||
|
@ -492,7 +492,7 @@ void HandleAction_Switch(void)
|
||||
if (gBattleResults.playerSwitchesCounter < 255)
|
||||
gBattleResults.playerSwitchesCounter++;
|
||||
|
||||
UndoFormChange(gBattlerPartyIndexes[gBattlerAttacker], GetBattlerSide(gBattlerAttacker));
|
||||
UndoFormChange(gBattlerPartyIndexes[gBattlerAttacker], GetBattlerSide(gBattlerAttacker), TRUE);
|
||||
}
|
||||
|
||||
void HandleAction_UseItem(void)
|
||||
@ -8322,14 +8322,14 @@ void UndoMegaEvolution(u32 monId)
|
||||
}
|
||||
}
|
||||
|
||||
void UndoFormChange(u32 monId, u32 side)
|
||||
void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
|
||||
{
|
||||
u32 i, currSpecies;
|
||||
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
||||
static const u16 species[][2] = // changed form id, default form id
|
||||
{
|
||||
{SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH},
|
||||
{SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU},
|
||||
{SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH},
|
||||
{SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN},
|
||||
{SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED},
|
||||
{SPECIES_MINIOR_METEOR_BLUE, SPECIES_MINIOR_CORE_BLUE},
|
||||
@ -8341,8 +8341,13 @@ void UndoFormChange(u32 monId, u32 side)
|
||||
{SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI},
|
||||
};
|
||||
|
||||
if (isSwitchingOut) // Don't revert Mimikyu Busted when switching out
|
||||
i = 1;
|
||||
else
|
||||
i = 0;
|
||||
|
||||
currSpecies = GetMonData(&party[monId], MON_DATA_SPECIES, NULL);
|
||||
for (i = 0; i < ARRAY_COUNT(species); i++)
|
||||
for (; i < ARRAY_COUNT(species); i++)
|
||||
{
|
||||
if (currSpecies == species[i][0])
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user