Merge pull request #2304 from LOuroboros/shashaForms

Merged FORM_ITEM_USE_TIME into FORM_ITEM_USE
This commit is contained in:
Eduardo Quezada D'Ottone 2022-09-09 15:35:09 -04:00 committed by GitHub
commit 6e7f139716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 24 deletions

View File

@ -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

View File

@ -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] =

View File

@ -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},
};

View File

@ -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)