Adds forbidden status parameter to FORM_CHANGE_ITEM_USE (#4738)

This commit is contained in:
Bassoonian 2024-06-08 07:36:39 +02:00 committed by GitHub
parent f1911dae59
commit 568ce39c5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 8 deletions

View file

@ -24,6 +24,8 @@
// param2: time of day to check, optional.
// - DAY if Form change that activates in the daytime.
// - NIGHT if Form change that activates at nighttime.
// - 0 if irrelevant, but param3 is necessary.
// param3: illegal statuses to have, optional.
#define FORM_CHANGE_ITEM_USE 2
// TODO: Form change that activates when the Pokémon learns or forgets the move.

View file

@ -624,7 +624,7 @@ static const struct FormChange sGiratinaFormChangeTable[] = {
#if P_FAMILY_SHAYMIN
static const struct FormChange sShayminFormChangeTable[] = {
{FORM_CHANGE_ITEM_USE, SPECIES_SHAYMIN_SKY, ITEM_GRACIDEA, DAY},
{FORM_CHANGE_ITEM_USE, SPECIES_SHAYMIN_SKY, ITEM_GRACIDEA, DAY, STATUS1_FREEZE | STATUS1_FROSTBITE},
{FORM_CHANGE_WITHDRAW, SPECIES_SHAYMIN_LAND},
{FORM_CHANGE_TIME_OF_DAY, SPECIES_SHAYMIN_LAND, NIGHT},
{FORM_CHANGE_STATUS, SPECIES_SHAYMIN_LAND, STATUS1_FREEZE | STATUS1_FROSTBITE},

View file

@ -6196,20 +6196,24 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32
case FORM_CHANGE_ITEM_USE:
if (arg == formChanges[i].param1)
{
bool32 pass = TRUE;
switch (formChanges[i].param2)
{
case DAY:
if (GetTimeOfDay() != TIME_NIGHT)
targetSpecies = formChanges[i].targetSpecies;
if (GetTimeOfDay() == TIME_NIGHT)
pass = FALSE;
break;
case NIGHT:
if (GetTimeOfDay() == TIME_NIGHT)
targetSpecies = formChanges[i].targetSpecies;
break;
default:
targetSpecies = formChanges[i].targetSpecies;
if (GetTimeOfDay() != TIME_NIGHT)
pass = FALSE;
break;
}
if (formChanges[i].param3 != STATUS1_NONE && GetBoxMonData(boxMon, MON_DATA_STATUS, NULL) & formChanges[i].param3)
pass = FALSE;
if (pass)
targetSpecies = formChanges[i].targetSpecies;
}
break;
case FORM_CHANGE_ITEM_USE_MULTICHOICE: