mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-17 03:57:38 +01:00
Refactored UndoFormChange to make it more user friendly
This commit is contained in:
parent
86ad65df76
commit
05850f0f65
@ -8954,33 +8954,29 @@ 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
|
||||
static const u16 species[][3] =
|
||||
{
|
||||
{SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU},
|
||||
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND},
|
||||
{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},
|
||||
{SPECIES_MINIOR_METEOR_GREEN, SPECIES_MINIOR_CORE_GREEN},
|
||||
{SPECIES_MINIOR_METEOR_INDIGO, SPECIES_MINIOR_CORE_INDIGO},
|
||||
{SPECIES_MINIOR_METEOR_ORANGE, SPECIES_MINIOR_CORE_ORANGE},
|
||||
{SPECIES_MINIOR_METEOR_VIOLET, SPECIES_MINIOR_CORE_VIOLET},
|
||||
{SPECIES_MINIOR_METEOR_YELLOW, SPECIES_MINIOR_CORE_YELLOW},
|
||||
{SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI},
|
||||
{SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT},
|
||||
{SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT},
|
||||
// Changed Form ID Default Form ID Should change on switch
|
||||
{SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU, FALSE},
|
||||
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND, FALSE},
|
||||
{SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH, TRUE},
|
||||
{SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN, TRUE},
|
||||
{SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_BLUE, SPECIES_MINIOR_CORE_BLUE, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_GREEN, SPECIES_MINIOR_CORE_GREEN, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_INDIGO, SPECIES_MINIOR_CORE_INDIGO, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_ORANGE, SPECIES_MINIOR_CORE_ORANGE, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_VIOLET, SPECIES_MINIOR_CORE_VIOLET, TRUE},
|
||||
{SPECIES_MINIOR_METEOR_YELLOW, SPECIES_MINIOR_CORE_YELLOW, TRUE},
|
||||
{SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI, TRUE},
|
||||
{SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT, TRUE},
|
||||
{SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT, TRUE},
|
||||
};
|
||||
|
||||
if (isSwitchingOut) // Don't revert Mimikyu Busted or Ash-Greninja when switching out
|
||||
i = 2;
|
||||
else
|
||||
i = 0;
|
||||
|
||||
currSpecies = GetMonData(&party[monId], MON_DATA_SPECIES, NULL);
|
||||
for (; i < ARRAY_COUNT(species); i++)
|
||||
for (i = 0; i < ARRAY_COUNT(species); i++)
|
||||
{
|
||||
if (currSpecies == species[i][0])
|
||||
if (currSpecies == species[i][0] && (!isSwitchingOut || species[i][2] == TRUE))
|
||||
{
|
||||
SetMonData(&party[monId], MON_DATA_SPECIES, &species[i][1]);
|
||||
CalculateMonStats(&party[monId]);
|
||||
|
Loading…
Reference in New Issue
Block a user