mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-28 04:34:28 +01:00
DoBurmyFormChange handled by FORM_CHANGE_END_BATTLE_TERRAIN
This commit is contained in:
parent
99536089cf
commit
57bdb683ec
@ -177,7 +177,6 @@ void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast);
|
|||||||
bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind);
|
bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind);
|
||||||
bool32 TryRoomService(u8 battlerId);
|
bool32 TryRoomService(u8 battlerId);
|
||||||
void BufferStatChange(u8 battlerId, u8 statId, u8 stringId);
|
void BufferStatChange(u8 battlerId, u8 statId, u8 stringId);
|
||||||
void DoBurmyFormChange(u32 monId);
|
|
||||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget);
|
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget);
|
||||||
u16 GetUsedHeldItem(u8 battler);
|
u16 GetUsedHeldItem(u8 battler);
|
||||||
bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags);
|
bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags);
|
||||||
|
@ -53,9 +53,13 @@
|
|||||||
// param3: a new move to replace it with, optional
|
// param3: a new move to replace it with, optional
|
||||||
#define FORM_CHANGE_END_BATTLE 7
|
#define FORM_CHANGE_END_BATTLE 7
|
||||||
|
|
||||||
|
// Form change that activates at the end of a battle based on the terrain if it participated in the battle and hasn't fainted. Takes priority over FORM_CHANGE_END_BATTLE.
|
||||||
|
// param1: battle terrain to check.
|
||||||
|
#define FORM_CHANGE_END_BATTLE_TERRAIN 8
|
||||||
|
|
||||||
// Form change that activates when the Pokémon is switched out in battle.
|
// Form change that activates when the Pokémon is switched out in battle.
|
||||||
// - No parameters.
|
// - No parameters.
|
||||||
#define FORM_CHANGE_BATTLE_SWITCH 8
|
#define FORM_CHANGE_BATTLE_SWITCH 9
|
||||||
|
|
||||||
// Form change that activates when the Pokémon's HP % passes a certain threshold.
|
// Form change that activates when the Pokémon's HP % passes a certain threshold.
|
||||||
// param1: Ability to check.
|
// param1: Ability to check.
|
||||||
@ -63,19 +67,19 @@
|
|||||||
// - HP_HIGHER_THAN if the form triggers when the current HP is higher than the specified threshold.
|
// - HP_HIGHER_THAN if the form triggers when the current HP is higher than the specified threshold.
|
||||||
// - HP_LOWER_EQ_THAN if the form triggers when the current HP is lower or equal than the specified threshold.
|
// - HP_LOWER_EQ_THAN if the form triggers when the current HP is lower or equal than the specified threshold.
|
||||||
// param3: HP percentage threshold.
|
// param3: HP percentage threshold.
|
||||||
#define FORM_CHANGE_BATTLE_HP_PERCENT 9
|
#define FORM_CHANGE_BATTLE_HP_PERCENT 10
|
||||||
|
|
||||||
// Form change that activates when the mon has the defined item.
|
// Form change that activates when the mon has the defined item.
|
||||||
// If it's on the player's side, it also requires ITEM_MEGA_RING in the user's bag and for the player to trigger it by pressing START before selecting a move.
|
// If it's on the player's side, it also requires ITEM_MEGA_RING in the user's bag and for the player to trigger it by pressing START before selecting a move.
|
||||||
// param1: item to hold.
|
// param1: item to hold.
|
||||||
#define FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM 10
|
#define FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM 11
|
||||||
|
|
||||||
// Form change that activates when the mon has the defined move.
|
// Form change that activates when the mon has the defined move.
|
||||||
// If it's on the player's side, it also requires ITEM_MEGA_RING in the user's bag and for the player to trigger it by pressing START before selecting a move.
|
// If it's on the player's side, it also requires ITEM_MEGA_RING in the user's bag and for the player to trigger it by pressing START before selecting a move.
|
||||||
// param1: move to have.
|
// param1: move to have.
|
||||||
#define FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE 11
|
#define FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE 12
|
||||||
|
|
||||||
// Form change that activates automatically when entering battle with the specified item.
|
// Form change that activates automatically when entering battle with the specified item.
|
||||||
// If the item is a Red Orb, it uses the Omega Symbol for the animation and icon. Otherwise, it defaults to the Alpha symbol.
|
// If the item is a Red Orb, it uses the Omega Symbol for the animation and icon. Otherwise, it defaults to the Alpha symbol.
|
||||||
// param1: item to hold.
|
// param1: item to hold.
|
||||||
#define FORM_CHANGE_BATTLE_PRIMAL_REVERSION 12
|
#define FORM_CHANGE_BATTLE_PRIMAL_REVERSION 13
|
||||||
|
@ -5202,8 +5202,15 @@ static void HandleEndTurn_FinishBattle(void)
|
|||||||
#endif
|
#endif
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
bool32 changedForm = TryFormChange(i, B_SIDE_PLAYER, FORM_CHANGE_END_BATTLE);
|
bool32 changedForm = FALSE;
|
||||||
DoBurmyFormChange(i);
|
|
||||||
|
// Appeared in battle and didn't faint
|
||||||
|
if ((gBattleStruct->appearedInBattle & gBitTable[i]) && GetMonData(&gPlayerParty[i], MON_DATA_HP, NULL) != 0)
|
||||||
|
changedForm = TryFormChange(i, B_SIDE_PLAYER, FORM_CHANGE_END_BATTLE_TERRAIN);
|
||||||
|
|
||||||
|
if (!changedForm)
|
||||||
|
changedForm = TryFormChange(i, B_SIDE_PLAYER, FORM_CHANGE_END_BATTLE);
|
||||||
|
|
||||||
// Clear original species field
|
// Clear original species field
|
||||||
gBattleStruct->changedSpecies[i] = SPECIES_NONE;
|
gBattleStruct->changedSpecies[i] = SPECIES_NONE;
|
||||||
|
|
||||||
@ -5215,7 +5222,7 @@ static void HandleEndTurn_FinishBattle(void)
|
|||||||
}
|
}
|
||||||
// Clear battle mon species to avoid a bug on the next battle that causes
|
// Clear battle mon species to avoid a bug on the next battle that causes
|
||||||
// healthboxes loading incorrectly due to it trying to create a Mega Indicator
|
// healthboxes loading incorrectly due to it trying to create a Mega Indicator
|
||||||
// if the previous battler would've had.
|
// if the previous battler would've had it.
|
||||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||||
{
|
{
|
||||||
gBattleMons[i].species = SPECIES_NONE;
|
gBattleMons[i].species = SPECIES_NONE;
|
||||||
|
@ -10414,46 +10414,6 @@ bool32 TryRoomService(u8 battlerId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoBurmyFormChange(u32 monId)
|
|
||||||
{
|
|
||||||
u16 newSpecies, currSpecies;
|
|
||||||
struct Pokemon *party = gPlayerParty;
|
|
||||||
|
|
||||||
currSpecies = GetMonData(&party[monId], MON_DATA_SPECIES, NULL);
|
|
||||||
|
|
||||||
if ((GET_BASE_SPECIES_ID(currSpecies) == SPECIES_BURMY)
|
|
||||||
&& (gBattleStruct->appearedInBattle & gBitTable[monId]) // Burmy appeared in battle
|
|
||||||
&& GetMonData(&party[monId], MON_DATA_HP, NULL) != 0) // Burmy isn't fainted
|
|
||||||
{
|
|
||||||
switch (gBattleTerrain)
|
|
||||||
{
|
|
||||||
case BATTLE_TERRAIN_GRASS:
|
|
||||||
case BATTLE_TERRAIN_LONG_GRASS:
|
|
||||||
case BATTLE_TERRAIN_POND:
|
|
||||||
case BATTLE_TERRAIN_MOUNTAIN:
|
|
||||||
case BATTLE_TERRAIN_PLAIN:
|
|
||||||
newSpecies = SPECIES_BURMY;
|
|
||||||
break;
|
|
||||||
case BATTLE_TERRAIN_CAVE:
|
|
||||||
case BATTLE_TERRAIN_SAND:
|
|
||||||
newSpecies = SPECIES_BURMY_SANDY_CLOAK;
|
|
||||||
break;
|
|
||||||
case BATTLE_TERRAIN_BUILDING:
|
|
||||||
newSpecies = SPECIES_BURMY_TRASH_CLOAK;
|
|
||||||
break;
|
|
||||||
default: // Don't change form if last battle was water-related
|
|
||||||
newSpecies = SPECIES_NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newSpecies != SPECIES_NONE)
|
|
||||||
{
|
|
||||||
SetMonData(&party[monId], MON_DATA_SPECIES, &newSpecies);
|
|
||||||
CalculateMonStats(&party[monId]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget)
|
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget)
|
||||||
{
|
{
|
||||||
#if B_PRANKSTER_DARK_TYPES >= GEN_7
|
#if B_PRANKSTER_DARK_TYPES >= GEN_7
|
||||||
|
@ -85,6 +85,9 @@ const struct FormChange *const gFormChangeTablePointers[NUM_SPECIES] =
|
|||||||
[SPECIES_RAYQUAZA] = sRayquazaFormChangeTable,
|
[SPECIES_RAYQUAZA] = sRayquazaFormChangeTable,
|
||||||
[SPECIES_RAYQUAZA_MEGA] = sRayquazaFormChangeTable,
|
[SPECIES_RAYQUAZA_MEGA] = sRayquazaFormChangeTable,
|
||||||
#if P_GEN_4_POKEMON == TRUE
|
#if P_GEN_4_POKEMON == TRUE
|
||||||
|
[SPECIES_BURMY] = sBurmyFormChangeTable,
|
||||||
|
[SPECIES_BURMY_SANDY_CLOAK] = sBurmyFormChangeTable,
|
||||||
|
[SPECIES_BURMY_TRASH_CLOAK] = sBurmyFormChangeTable,
|
||||||
[SPECIES_LOPUNNY] = sLopunnyFormChangeTable,
|
[SPECIES_LOPUNNY] = sLopunnyFormChangeTable,
|
||||||
[SPECIES_LOPUNNY_MEGA] = sLopunnyFormChangeTable,
|
[SPECIES_LOPUNNY_MEGA] = sLopunnyFormChangeTable,
|
||||||
[SPECIES_GARCHOMP] = sGarchompFormChangeTable,
|
[SPECIES_GARCHOMP] = sGarchompFormChangeTable,
|
||||||
|
@ -279,13 +279,25 @@ static const struct FormChange sGroudonFormChangeTable[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct FormChange sRayquazaFormChangeTable[] = {
|
static const struct FormChange sRayquazaFormChangeTable[] = {
|
||||||
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE, SPECIES_RAYQUAZA_MEGA, MOVE_DRAGON_ASCENT},
|
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE, SPECIES_RAYQUAZA_MEGA, MOVE_DRAGON_ASCENT},
|
||||||
{FORM_CHANGE_FAINT, SPECIES_RAYQUAZA},
|
{FORM_CHANGE_FAINT, SPECIES_RAYQUAZA},
|
||||||
{FORM_CHANGE_END_BATTLE, SPECIES_RAYQUAZA},
|
{FORM_CHANGE_END_BATTLE, SPECIES_RAYQUAZA},
|
||||||
{FORM_CHANGE_TERMINATOR},
|
{FORM_CHANGE_TERMINATOR},
|
||||||
};
|
};
|
||||||
|
|
||||||
#if P_GEN_4_POKEMON == TRUE
|
#if P_GEN_4_POKEMON == TRUE
|
||||||
|
static const struct FormChange sBurmyFormChangeTable[] = {
|
||||||
|
{FORM_CHANGE_END_BATTLE_TERRAIN, SPECIES_BURMY, BATTLE_TERRAIN_GRASS},
|
||||||
|
{FORM_CHANGE_END_BATTLE_TERRAIN, SPECIES_BURMY, BATTLE_TERRAIN_LONG_GRASS},
|
||||||
|
{FORM_CHANGE_END_BATTLE_TERRAIN, SPECIES_BURMY, BATTLE_TERRAIN_POND},
|
||||||
|
{FORM_CHANGE_END_BATTLE_TERRAIN, SPECIES_BURMY, BATTLE_TERRAIN_MOUNTAIN},
|
||||||
|
{FORM_CHANGE_END_BATTLE_TERRAIN, SPECIES_BURMY, BATTLE_TERRAIN_PLAIN},
|
||||||
|
{FORM_CHANGE_END_BATTLE_TERRAIN, SPECIES_BURMY_SANDY_CLOAK, BATTLE_TERRAIN_CAVE},
|
||||||
|
{FORM_CHANGE_END_BATTLE_TERRAIN, SPECIES_BURMY_SANDY_CLOAK, BATTLE_TERRAIN_SAND},
|
||||||
|
{FORM_CHANGE_END_BATTLE_TERRAIN, SPECIES_BURMY_TRASH_CLOAK, BATTLE_TERRAIN_BUILDING},
|
||||||
|
{FORM_CHANGE_TERMINATOR},
|
||||||
|
};
|
||||||
|
|
||||||
static const struct FormChange sLopunnyFormChangeTable[] = {
|
static const struct FormChange sLopunnyFormChangeTable[] = {
|
||||||
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM, SPECIES_LOPUNNY_MEGA, ITEM_LOPUNNITE},
|
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM, SPECIES_LOPUNNY_MEGA, ITEM_LOPUNNITE},
|
||||||
{FORM_CHANGE_FAINT, SPECIES_LOPUNNY},
|
{FORM_CHANGE_FAINT, SPECIES_LOPUNNY},
|
||||||
|
@ -8538,7 +8538,11 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32
|
|||||||
case FORM_CHANGE_END_BATTLE:
|
case FORM_CHANGE_END_BATTLE:
|
||||||
if (heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE)
|
if (heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE)
|
||||||
targetSpecies = formChanges[i].targetSpecies;
|
targetSpecies = formChanges[i].targetSpecies;
|
||||||
break;
|
break;
|
||||||
|
case FORM_CHANGE_END_BATTLE_TERRAIN:
|
||||||
|
if (gBattleTerrain == formChanges[i].param1)
|
||||||
|
targetSpecies = formChanges[i].targetSpecies;
|
||||||
|
break;
|
||||||
case FORM_CHANGE_WITHDRAW:
|
case FORM_CHANGE_WITHDRAW:
|
||||||
case FORM_CHANGE_FAINT:
|
case FORM_CHANGE_FAINT:
|
||||||
targetSpecies = formChanges[i].targetSpecies;
|
targetSpecies = formChanges[i].targetSpecies;
|
||||||
|
Loading…
Reference in New Issue
Block a user