Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds forbidden status parameter to FORM_CHANGE_ITEM_USE #4738

Merged
merged 1 commit into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/constants/form_change_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/data/pokemon/form_change_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
18 changes: 11 additions & 7 deletions src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
break;
case NIGHT:
if (GetTimeOfDay() == TIME_NIGHT)
targetSpecies = formChanges[i].targetSpecies;
pass = FALSE;
break;
default:
targetSpecies = formChanges[i].targetSpecies;
case NIGHT:
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:
Expand Down
Loading