diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 6912cfe6b..98b32ffd5 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -322,9 +322,8 @@ #define FORM_ITEM_USE 2 #define FORM_MOVE 3 #define FORM_WITHDRAW 4 -#define FORM_ITEM_USE_TIME 5 -#define FORM_BATTLE_BEGIN 6 -#define FORM_BATTLE_END 7 +#define FORM_BATTLE_BEGIN 5 +#define FORM_BATTLE_END 6 #define NUM_MALE_LINK_FACILITY_CLASSES 8 #define NUM_FEMALE_LINK_FACILITY_CLASSES 8 diff --git a/src/data/items.h b/src/data/items.h index 08060db77..6649fb24b 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -9071,7 +9071,7 @@ const struct Item gItems[] = .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_FormChange, - .secondaryId = FORM_ITEM_USE_TIME, + .secondaryId = FORM_ITEM_USE, }, [ITEM_REVEAL_GLASS] = diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index ddcb4d9cb..2531a10c9 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -9,6 +9,8 @@ FORM_ITEM_HOLD: FORM_ITEM_USE: Form change activates when the item is used on the selected Pokémon. param1 = item to use + param2 = DAY if form change activates in the daytime, optional + NIGHT if form change activates at nighttime, optional FORM_MOVE: Form change activates when the Pokémon learns or forgets the move. @@ -20,13 +22,6 @@ FORM_WITHDRAW: Form change activates when the Pokémon is withdrawn from the PC or Daycare. no parameters -FORM_ITEM_USE_TIME: - Form change activates when the item is used on the selected Pokémon at the - appropriate time of day. - param1 = item to use - param2 = DAY if form change activates in the daytime - 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 @@ -44,9 +39,9 @@ FORM_BATTLE_END: #define WHEN_LEARNED 0 #define WHEN_FORGOTTEN 1 -// FORM_ITEM_USE_TIME param2 Arguments -#define DAY 0 -#define NIGHT 1 +// FORM_ITEM_USE param2 Arguments +#define DAY 1 +#define NIGHT 2 #if P_NEW_POKEMON == TRUE static const struct FormChange sGiratinaFormChangeTable[] = { @@ -56,7 +51,7 @@ static const struct FormChange sGiratinaFormChangeTable[] = { }; static const struct FormChange sShayminFormChangeTable[] = { - {FORM_ITEM_USE_TIME, SPECIES_SHAYMIN_SKY, ITEM_GRACIDEA, DAY}, + {FORM_ITEM_USE, SPECIES_SHAYMIN_SKY, ITEM_GRACIDEA, DAY}, // {FORM_WITHDRAW, SPECIES_SHAYMIN}, {FORM_CHANGE_END}, }; diff --git a/src/pokemon.c b/src/pokemon.c index 722eaafe8..b421e5ace 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -8273,30 +8273,30 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 targetSpecies = formChanges[i].targetSpecies; break; case FORM_ITEM_USE: - if (arg == formChanges[i].param1) - targetSpecies = formChanges[i].targetSpecies; - break; - case FORM_MOVE: - if (BoxMonKnowsMove(boxMon, formChanges[i].param1) != formChanges[i].param2) - targetSpecies = formChanges[i].targetSpecies; - break; - case FORM_ITEM_USE_TIME: - RtcCalcLocalTime(); if (arg == formChanges[i].param1) { switch (formChanges[i].param2) { case DAY: + RtcCalcLocalTime(); if (gLocalTime.hours >= 12 && gLocalTime.hours < 24) targetSpecies = formChanges[i].targetSpecies; break; case NIGHT: + RtcCalcLocalTime(); if (gLocalTime.hours >= 0 && gLocalTime.hours < 12) targetSpecies = formChanges[i].targetSpecies; break; + default: + targetSpecies = formChanges[i].targetSpecies; + break; } } break; + case FORM_MOVE: + if (BoxMonKnowsMove(boxMon, formChanges[i].param1) != formChanges[i].param2) + targetSpecies = formChanges[i].targetSpecies; + break; case FORM_BATTLE_BEGIN: case FORM_BATTLE_END: if (heldItem == formChanges[i].param1 || formChanges[i].param1 == ITEM_NONE)