mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-08 08:27:52 +01:00
Introduced FORM_BATTLE form changes
For species such as Xerneas and Zacian.
This commit is contained in:
parent
e5288449b4
commit
df88317a98
@ -324,6 +324,8 @@
|
|||||||
#define FORM_WITHDRAW 4
|
#define FORM_WITHDRAW 4
|
||||||
#define FORM_ITEM_HOLD_ABILITY 5
|
#define FORM_ITEM_HOLD_ABILITY 5
|
||||||
#define FORM_ITEM_USE_TIME 6
|
#define FORM_ITEM_USE_TIME 6
|
||||||
|
#define FORM_BATTLE_BEGIN 7
|
||||||
|
#define FORM_BATTLE_END 8
|
||||||
|
|
||||||
#define NUM_MALE_LINK_FACILITY_CLASSES 8
|
#define NUM_MALE_LINK_FACILITY_CLASSES 8
|
||||||
#define NUM_FEMALE_LINK_FACILITY_CLASSES 8
|
#define NUM_FEMALE_LINK_FACILITY_CLASSES 8
|
||||||
|
@ -481,6 +481,7 @@ void CB2_InitBattle(void)
|
|||||||
static void CB2_InitBattleInternal(void)
|
static void CB2_InitBattleInternal(void)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
|
u16 targetSpecies;
|
||||||
|
|
||||||
SetHBlankCallback(NULL);
|
SetHBlankCallback(NULL);
|
||||||
SetVBlankCallback(NULL);
|
SetVBlankCallback(NULL);
|
||||||
@ -571,6 +572,19 @@ static void CB2_InitBattleInternal(void)
|
|||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
AdjustFriendship(&gPlayerParty[i], FRIENDSHIP_EVENT_LEAGUE_BATTLE);
|
AdjustFriendship(&gPlayerParty[i], FRIENDSHIP_EVENT_LEAGUE_BATTLE);
|
||||||
|
|
||||||
|
// Apply party-wide start-of-battle form changes
|
||||||
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
|
{
|
||||||
|
// Player's side
|
||||||
|
targetSpecies = GetFormChangeTargetSpecies(&gPlayerParty[i], FORM_BATTLE_BEGIN, 0);
|
||||||
|
if (targetSpecies != SPECIES_NONE)
|
||||||
|
SetMonData(&gPlayerParty[i], MON_DATA_SPECIES, &targetSpecies);
|
||||||
|
// Opponent's side
|
||||||
|
targetSpecies = GetFormChangeTargetSpecies(&gEnemyParty[i], FORM_BATTLE_BEGIN, 0);
|
||||||
|
if (targetSpecies != SPECIES_NONE)
|
||||||
|
SetMonData(&gEnemyParty[i], MON_DATA_SPECIES, &targetSpecies);
|
||||||
|
}
|
||||||
|
|
||||||
gBattleCommunication[MULTIUSE_STATE] = 0;
|
gBattleCommunication[MULTIUSE_STATE] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9588,7 +9588,7 @@ void UndoMegaEvolution(u32 monId)
|
|||||||
|
|
||||||
void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
|
void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
|
||||||
{
|
{
|
||||||
u32 i, currSpecies;
|
u32 i, currSpecies, targetSpecies;
|
||||||
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
|
||||||
static const u16 species[][3] =
|
static const u16 species[][3] =
|
||||||
{
|
{
|
||||||
@ -9622,6 +9622,21 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!isSwitchingOut)
|
||||||
|
{
|
||||||
|
// Apply party-wide end-of-battle form changes
|
||||||
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
|
{
|
||||||
|
// Player's side
|
||||||
|
targetSpecies = GetFormChangeTargetSpecies(&gPlayerParty[i], FORM_BATTLE_END, 0);
|
||||||
|
if (targetSpecies != SPECIES_NONE)
|
||||||
|
SetMonData(&gPlayerParty[i], MON_DATA_SPECIES, &targetSpecies);
|
||||||
|
// Opponent's side
|
||||||
|
targetSpecies = GetFormChangeTargetSpecies(&gEnemyParty[i], FORM_BATTLE_END, 0);
|
||||||
|
if (targetSpecies != SPECIES_NONE)
|
||||||
|
SetMonData(&gEnemyParty[i], MON_DATA_SPECIES, &targetSpecies);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 DoBattlersShareType(u32 battler1, u32 battler2)
|
bool32 DoBattlersShareType(u32 battler1, u32 battler2)
|
||||||
|
@ -31,11 +31,13 @@ const struct FormChange *const gFormChangeTablePointers[NUM_SPECIES] =
|
|||||||
[SPECIES_LANDORUS_THERIAN] = sLandorusTherianFormChangeTable,
|
[SPECIES_LANDORUS_THERIAN] = sLandorusTherianFormChangeTable,
|
||||||
[SPECIES_KELDEO] = sKeldeoFormChangeTable,
|
[SPECIES_KELDEO] = sKeldeoFormChangeTable,
|
||||||
[SPECIES_KELDEO_RESOLUTE] = sKeldeoResoluteFormChangeTable,
|
[SPECIES_KELDEO_RESOLUTE] = sKeldeoResoluteFormChangeTable,
|
||||||
[SPECIES_GENESECT] = sGenesectFormChangeTable,
|
[SPECIES_GENESECT] = sGenesectFormChangeTable,
|
||||||
[SPECIES_GENESECT_DOUSE_DRIVE] = sGenesectFormChangeTable,
|
[SPECIES_GENESECT_DOUSE_DRIVE] = sGenesectFormChangeTable,
|
||||||
[SPECIES_GENESECT_SHOCK_DRIVE] = sGenesectFormChangeTable,
|
[SPECIES_GENESECT_SHOCK_DRIVE] = sGenesectFormChangeTable,
|
||||||
[SPECIES_GENESECT_BURN_DRIVE] = sGenesectFormChangeTable,
|
[SPECIES_GENESECT_BURN_DRIVE] = sGenesectFormChangeTable,
|
||||||
[SPECIES_GENESECT_CHILL_DRIVE] = sGenesectFormChangeTable,
|
[SPECIES_GENESECT_CHILL_DRIVE] = sGenesectFormChangeTable,
|
||||||
|
[SPECIES_XERNEAS] = sXerneasFormChangeTable,
|
||||||
|
[SPECIES_XERNEAS_ACTIVE] = sXerneasFormChangeTable,
|
||||||
[SPECIES_HOOPA] = sHoopaFormChangeTable,
|
[SPECIES_HOOPA] = sHoopaFormChangeTable,
|
||||||
[SPECIES_HOOPA_UNBOUND] = sHoopaUnboundFormChangeTable,
|
[SPECIES_HOOPA_UNBOUND] = sHoopaUnboundFormChangeTable,
|
||||||
[SPECIES_ORICORIO] = sOricorioFormChangeTable,
|
[SPECIES_ORICORIO] = sOricorioFormChangeTable,
|
||||||
@ -60,5 +62,9 @@ const struct FormChange *const gFormChangeTablePointers[NUM_SPECIES] =
|
|||||||
[SPECIES_SILVALLY_ROCK] = sSilvallyFormChangeTable,
|
[SPECIES_SILVALLY_ROCK] = sSilvallyFormChangeTable,
|
||||||
[SPECIES_SILVALLY_STEEL] = sSilvallyFormChangeTable,
|
[SPECIES_SILVALLY_STEEL] = sSilvallyFormChangeTable,
|
||||||
[SPECIES_SILVALLY_WATER] = sSilvallyFormChangeTable,
|
[SPECIES_SILVALLY_WATER] = sSilvallyFormChangeTable,
|
||||||
|
[SPECIES_ZACIAN] = sZacianFormChangeTable,
|
||||||
|
[SPECIES_ZACIAN_CROWNED_SWORD] = sZacianFormChangeTable,
|
||||||
|
[SPECIES_ZAMAZENTA] = sZamazentaFormChangeTable,
|
||||||
|
[SPECIES_ZAMAZENTA_CROWNED_SHIELD] = sZamazentaFormChangeTable,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -33,6 +33,14 @@ FORM_ITEM_USE_TIME:
|
|||||||
param1 = item to use
|
param1 = item to use
|
||||||
param2 = DAY if form change activates in the daytime
|
param2 = DAY if form change activates in the daytime
|
||||||
NIGHT if form change activates at nighttime
|
NIGHT if form change activates at nighttime
|
||||||
|
|
||||||
|
FORM_BATTLE_BEGIN:
|
||||||
|
Form change activates when the Pokémon is sent out at the beginning of a battle
|
||||||
|
param1 = item to hold, optional
|
||||||
|
|
||||||
|
FORM_BATTLE_END:
|
||||||
|
Form change activates at the end of a battle
|
||||||
|
param1 = item to hold, optional
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// FORM_MOVE param2 Arguments
|
// FORM_MOVE param2 Arguments
|
||||||
@ -185,5 +193,23 @@ static const struct FormChange sSilvallyFormChangeTable[] = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const struct FormChange sXerneasFormChangeTable[] = {
|
||||||
|
{FORM_BATTLE_BEGIN, SPECIES_XERNEAS_ACTIVE, ITEM_NONE},
|
||||||
|
{FORM_BATTLE_END, SPECIES_XERNEAS, ITEM_NONE},
|
||||||
|
{FORM_CHANGE_END},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct FormChange sZacianFormChangeTable[] = {
|
||||||
|
{FORM_BATTLE_BEGIN, SPECIES_ZACIAN_CROWNED_SWORD, ITEM_RUSTED_SWORD},
|
||||||
|
{FORM_BATTLE_END, SPECIES_ZACIAN, ITEM_RUSTED_SWORD},
|
||||||
|
{FORM_CHANGE_END},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct FormChange sZamazentaFormChangeTable[] = {
|
||||||
|
{FORM_BATTLE_BEGIN, SPECIES_ZAMAZENTA_CROWNED_SHIELD, ITEM_RUSTED_SHIELD},
|
||||||
|
{FORM_BATTLE_END, SPECIES_ZAMAZENTA, ITEM_RUSTED_SHIELD},
|
||||||
|
{FORM_CHANGE_END},
|
||||||
|
};
|
||||||
|
|
||||||
#undef WHEN_LEARNED
|
#undef WHEN_LEARNED
|
||||||
#undef WHEN_FORGOTTEN
|
#undef WHEN_FORGOTTEN
|
||||||
|
@ -8237,13 +8237,13 @@ u8 GetFormIdFromFormSpeciesId(u16 formSpeciesId)
|
|||||||
return targetFormId;
|
return targetFormId;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg)
|
u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg)
|
||||||
{
|
{
|
||||||
return GetFormChangeTargetSpeciesBoxMon(&mon->box, method, arg);
|
return GetFormChangeTargetSpeciesBoxMon(&mon->box, method, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns SPECIES_NONE if no form change is possible
|
// Returns SPECIES_NONE if no form change is possible
|
||||||
u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg)
|
u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
u16 targetSpecies = SPECIES_NONE;
|
u16 targetSpecies = SPECIES_NONE;
|
||||||
@ -8264,6 +8264,8 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg
|
|||||||
switch (method)
|
switch (method)
|
||||||
{
|
{
|
||||||
case FORM_ITEM_HOLD:
|
case FORM_ITEM_HOLD:
|
||||||
|
case FORM_BATTLE_BEGIN:
|
||||||
|
case FORM_BATTLE_END:
|
||||||
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user