diff --git a/include/constants/form_change_types.h b/include/constants/form_change_types.h index 30bb54d0279a..94f97639f807 100644 --- a/include/constants/form_change_types.h +++ b/include/constants/form_change_types.h @@ -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. diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index 0b8eb485a9d4..84b7a86088db 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -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}, diff --git a/src/pokemon.c b/src/pokemon.c index daa02077ce14..763c044c7655 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -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: