diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 3f41072ce3..d5a410168a 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -313,10 +313,8 @@ // Form change types #define FORM_ITEM_HOLD 1 #define FORM_ITEM_USE 2 -#define FORM_ITEM_USE_ONE_WAY 3 -#define FORM_MOVE 4 -#define FORM_STATUS 5 -#define FORM_ELAPSED_DAYS 6 +#define FORM_MOVE 3 +#define FORM_WITHDRAW 4 #define NUM_MALE_LINK_FACILITY_CLASSES 8 #define NUM_FEMALE_LINK_FACILITY_CLASSES 8 diff --git a/src/data/pokemon/form_change_table_pointers.h b/src/data/pokemon/form_change_table_pointers.h new file mode 100644 index 0000000000..3ec9952cf0 --- /dev/null +++ b/src/data/pokemon/form_change_table_pointers.h @@ -0,0 +1,61 @@ +const struct FormChange *gFormChangeTablePointers[POKEMON_SLOTS_NUMBER] = +{ + [SPECIES_GIRATINA] = sGiratinaFormChangeTable, + [SPECIES_SHAYMIN] = sShayminFormChangeTable, + [SPECIES_SHAYMIN_SKY] = sShayminSkyFormChangeTable, + [SPECIES_ARCEUS] = sArceusFormChangeTable, + [SPECIES_ARCEUS_FIGHTING] = sArceusFormChangeTable, + [SPECIES_ARCEUS_FLYING] = sArceusFormChangeTable, + [SPECIES_ARCEUS_POISON] = sArceusFormChangeTable, + [SPECIES_ARCEUS_ROCK] = sArceusFormChangeTable, + [SPECIES_ARCEUS_GROUND] = sArceusFormChangeTable, + [SPECIES_ARCEUS_BUG] = sArceusFormChangeTable, + [SPECIES_ARCEUS_GHOST] = sArceusFormChangeTable, + [SPECIES_ARCEUS_STEEL] = sArceusFormChangeTable, + [SPECIES_ARCEUS_FIRE] = sArceusFormChangeTable, + [SPECIES_ARCEUS_WATER] = sArceusFormChangeTable, + [SPECIES_ARCEUS_GRASS] = sArceusFormChangeTable, + [SPECIES_ARCEUS_ELECTRIC] = sArceusFormChangeTable, + [SPECIES_ARCEUS_PSYCHIC] = sArceusFormChangeTable, + [SPECIES_ARCEUS_ICE] = sArceusFormChangeTable, + [SPECIES_ARCEUS_DRAGON] = sArceusFormChangeTable, + [SPECIES_ARCEUS_DARK] = sArceusFormChangeTable, + [SPECIES_ARCEUS_FAIRY] = sArceusFormChangeTable, + [SPECIES_TORNADUS] = sTornadusFormChangeTable, + [SPECIES_TORNADUS_THERIAN] = sTornadusTherianFormChangeTable, + [SPECIES_THUNDURUS] = sThundurusFormChangeTable, + [SPECIES_THUNDURUS_THERIAN] = sThundurusTherianFormChangeTable, + [SPECIES_LANDORUS] = sLandorusFormChangeTable, + [SPECIES_LANDORUS_THERIAN] = sLandorusTherianFormChangeTable, + [SPECIES_KELDEO] = sKeldeoFormChangeTable, + [SPECIES_KELDEO_RESOLUTE] = sKeldeoResoluteFormChangeTable, + [SPECIES_GENESECT] = sGenesectFormChangeTable, + [SPECIES_GENESECT_DOUSE_DRIVE] = sGenesectFormChangeTable, + [SPECIES_GENESECT_SHOCK_DRIVE] = sGenesectFormChangeTable, + [SPECIES_GENESECT_BURN_DRIVE] = sGenesectFormChangeTable, + [SPECIES_GENESECT_CHILL_DRIVE] = sGenesectFormChangeTable, + [SPECIES_HOOPA] = sHoopaFormChangeTable, + [SPECIES_HOOPA_UNBOUND] = sHoopaUnboundFormChangeTable, + [SPECIES_ORICORIO] = sOricorioFormChangeTable, + [SPECIES_ORICORIO_POM_POM] = sOricorioFormChangeTable, + [SPECIES_ORICORIO_PAU] = sOricorioFormChangeTable, + [SPECIES_ORICORIO_SENSU] = sOricorioFormChangeTable, + [SPECIES_SILVALLY] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_BUG] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_DARK] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_DRAGON] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_ELECTRIC] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_FAIRY] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_FIGHTING] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_FIRE] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_FLYING] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_GHOST] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_GRASS] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_GROUND] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_ICE] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_POISON] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_PSYCHIC] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_ROCK] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_STEEL] = sSilvallyFormChangeTable, + [SPECIES_SILVALLY_WATER] = sSilvallyFormChangeTable, +}; diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h new file mode 100644 index 0000000000..ce27e201ad --- /dev/null +++ b/src/data/pokemon/form_change_tables.h @@ -0,0 +1,172 @@ +/* +All form changes are checked for the base species! +Putting a form change on a form has no effect + +FORM_ITEM_USE: + Changes any pokemon with a matching base species (even if + it is a form) to the target species. + param1 = item to use + param1 = ability to check for (none means any) + +FORM_ITEM_HOLD: + param1 = item to hold + param2 = ability to check for (none means any) + +FORM_MOVE: + param1 = move to check for + param2 = true if form change activates when move is forgotten, + false if form change activates when move is learned + +FORM_WITHDRAW: + Form change activates when the Pokemon is withdrawn from the PC or Daycare. + no parameters +*/ + +#define FORM_CHANGE_END 0 +#define WHEN_LEARNED FALSE +#define WHEN_FORGOTTEN TRUE + +const struct FormChange sGiratinaFormChangeTable[] = { + {FORM_ITEM_HOLD, SPECIES_GIRATINA_ORIGIN, ITEM_GRISEOUS_ORB}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sShayminFormChangeTable[] = { + {FORM_ITEM_USE, SPECIES_SHAYMIN_SKY, ITEM_GRACIDEA}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sShayminSkyFormChangeTable[] = { + {FORM_WITHDRAW, SPECIES_SHAYMIN}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sArceusFormChangeTable[] = { + {FORM_ITEM_HOLD, SPECIES_ARCEUS, ITEM_NONE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FIGHTING, ITEM_FIST_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FIGHTING, ITEM_FIGHTINIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FLYING, ITEM_SKY_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FLYING, ITEM_FLYINIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_POISON, ITEM_TOXIC_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_POISON, ITEM_POISONIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ROCK, ITEM_STONE_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ROCK, ITEM_ROCKIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GROUND, ITEM_EARTH_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GROUND, ITEM_GROUNDIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_BUG, ITEM_INSECT_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_BUG, ITEM_BUGINIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GHOST, ITEM_SPOOKY_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GHOST, ITEM_GHOSTIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_STEEL, ITEM_IRON_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_STEEL, ITEM_STEELIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FIRE, ITEM_FLAME_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FIRE, ITEM_FIRIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_WATER, ITEM_SPLASH_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_WATER, ITEM_WATERIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GRASS, ITEM_MEADOW_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_GRASS, ITEM_GRASSIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ELECTRIC, ITEM_ZAP_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ELECTRIC, ITEM_ELECTRIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_PSYCHIC, ITEM_MIND_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_PSYCHIC, ITEM_PSYCHIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ICE, ITEM_ICICLE_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_ICE, ITEM_ICIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_DRAGON, ITEM_DRACO_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_DRAGON, ITEM_DRAGONIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_DARK, ITEM_DREAD_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_DARK, ITEM_DARKINIUM_Z, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FAIRY, ITEM_PIXIE_PLATE, ABILITY_MULTITYPE}, + {FORM_ITEM_HOLD, SPECIES_ARCEUS_FAIRY, ITEM_FAIRIUM_Z, ABILITY_MULTITYPE}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sTornadusFormChangeTable[] = { + {FORM_ITEM_USE, SPECIES_TORNADUS_THERIAN, ITEM_REVEAL_GLASS}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sTornadusTherianFormChangeTable[] = { + {FORM_ITEM_USE, SPECIES_TORNADUS, ITEM_REVEAL_GLASS}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sThundurusFormChangeTable[] = { + {FORM_ITEM_USE, SPECIES_THUNDURUS_THERIAN, ITEM_REVEAL_GLASS}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sThundurusTherianFormChangeTable[] = { + {FORM_ITEM_USE, SPECIES_THUNDURUS, ITEM_REVEAL_GLASS}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sLandorusFormChangeTable[] = { + {FORM_ITEM_USE, SPECIES_LANDORUS_THERIAN, ITEM_REVEAL_GLASS}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sLandorusTherianFormChangeTable[] = { + {FORM_ITEM_USE, SPECIES_LANDORUS, ITEM_REVEAL_GLASS}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sKeldeoFormChangeTable[] = { + {FORM_MOVE, SPECIES_KELDEO_RESOLUTE, MOVE_SECRET_SWORD, WHEN_LEARNED}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sKeldeoResoluteFormChangeTable[] = { + {FORM_MOVE, SPECIES_KELDEO, MOVE_SECRET_SWORD, WHEN_FORGOTTEN}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sGenesectFormChangeTable[] = { + {FORM_ITEM_HOLD, SPECIES_GENESECT, ITEM_NONE}, + {FORM_ITEM_HOLD, SPECIES_GENESECT_DOUSE_DRIVE, ITEM_DOUSE_DRIVE}, + {FORM_ITEM_HOLD, SPECIES_GENESECT_SHOCK_DRIVE, ITEM_SHOCK_DRIVE}, + {FORM_ITEM_HOLD, SPECIES_GENESECT_BURN_DRIVE, ITEM_BURN_DRIVE}, + {FORM_ITEM_HOLD, SPECIES_GENESECT_CHILL_DRIVE, ITEM_CHILL_DRIVE}, +}; + +const struct FormChange sHoopaFormChangeTable[] = { + {FORM_ITEM_USE, SPECIES_HOOPA_UNBOUND, ITEM_PRISON_BOTTLE, SPECIES_HOOPA}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sHoopaUnboundFormChangeTable[] = { + {FORM_WITHDRAW, SPECIES_HOOPA}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sOricorioFormChangeTable[] = { + {FORM_ITEM_USE, SPECIES_ORICORIO, ITEM_RED_NECTAR}, + {FORM_ITEM_USE, SPECIES_ORICORIO_POM_POM, ITEM_YELLOW_NECTAR}, + {FORM_ITEM_USE, SPECIES_ORICORIO_PAU, ITEM_PINK_NECTAR}, + {FORM_ITEM_USE, SPECIES_ORICORIO_SENSU, ITEM_PURPLE_NECTAR}, + {FORM_CHANGE_END}, +}; + +const struct FormChange sSilvallyFormChangeTable[] = { + {FORM_ITEM_HOLD, SPECIES_SILVALLY, ITEM_NONE, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_BUG, ITEM_BUG_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_DARK, ITEM_DARK_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_DRAGON, ITEM_DRAGON_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_ELECTRIC, ITEM_ELECTRIC_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_FAIRY, ITEM_FAIRY_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_FIGHTING, ITEM_FIGHTING_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_FIRE, ITEM_FIRE_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_FLYING, ITEM_FLYING_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_GHOST, ITEM_GHOST_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_GRASS, ITEM_GRASS_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_GROUND, ITEM_GROUND_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_ICE, ITEM_ICE_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_POISON, ITEM_POISON_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_PSYCHIC, ITEM_PSYCHIC_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_ROCK, ITEM_ROCK_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_STEEL, ITEM_STEEL_MEMORY, ABILITY_RKS_SYSTEM}, + {FORM_ITEM_HOLD, SPECIES_SILVALLY_WATER, ITEM_WATER_MEMORY, ABILITY_RKS_SYSTEM}, +}; + +#undef FORM_CHANGE_END +#undef WHEN_LEARNED +#undef WHEN_FORGOTTEN \ No newline at end of file diff --git a/src/pokemon.c b/src/pokemon.c index 4d6df55246..ec84c05c2e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1847,8 +1847,8 @@ const s8 gNatureStatTable[NUM_NATURES][NUM_NATURE_STATS] = #include "data/pokemon/evolution.h" #include "data/pokemon/level_up_learnset_pointers.h" #include "data/pokemon/form_species_tables.h" +#include "data/pokemon/form_change_tables.h" #include "data/pokemon/form_species_table_pointers.h" -#include "data/pokemon/form_change_table.h" // SPECIES_NONE are ignored in the following two tables, so decrement before accessing these arrays to get the right result