Adds universal move array (#4052)

* Add universal move list

* Exclude TM illiterates from learning universal moves

* Add config for literacy checks

* Fix config check

* Update src/pokemon.c

Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>

* Other review remarks

---------

Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>
This commit is contained in:
Bassoonian 2024-01-24 15:45:22 +01:00 committed by GitHub
parent 6d1d6a5d5f
commit 78708cad55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 70 additions and 4588 deletions

View File

@ -35,6 +35,7 @@
#define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs.
#define P_EV_CAP GEN_LATEST // Since Gen 6, the max EVs per stat is 252 instead of 255.
#define P_SHOW_TERA_TYPE GEN_LATEST // Since Gen 9, the Tera Type is shown on the summary screen.
#define P_TM_LITERACY GEN_LATEST // Since Gen 6, TM illiterate Pokémon can learn TMs that teach moves that are in their level-up learnsets.
// Flag settings
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.

View File

@ -433,7 +433,8 @@ struct SpeciesInfo /*0x8C*/
u32 cannotBeTraded:1;
u32 allPerfectIVs:1;
u32 dexForceRequired:1; // This species will be taken into account for Pokédex ratings even if they have the "isMythical" flag set.
u32 padding4:17;
u32 tmIlliterate:1; // This species will be unable to learn the universal moves.
u32 padding4:16;
// Move Data
/* 0x80 */ const struct LevelUpMove *levelUpLearnset;
/* 0x84 */ const u16 *teachableLearnset;

View File

@ -785,6 +785,7 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
ICON(Caterpie, 1),
FOOTPRINT(Caterpie)
LEARNSETS(Caterpie),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 7, SPECIES_METAPOD}),
},
@ -833,6 +834,7 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
ICON(Metapod, 1),
FOOTPRINT(Metapod)
LEARNSETS(Metapod),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 10, SPECIES_BUTTERFREE}),
},
@ -980,6 +982,7 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
ICON(Weedle, 2),
FOOTPRINT(Weedle)
LEARNSETS(Weedle),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 7, SPECIES_KAKUNA}),
},
@ -1029,6 +1032,7 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
ICON(Kakuna, 2),
FOOTPRINT(Kakuna)
LEARNSETS(Kakuna),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 10, SPECIES_BEEDRILL}),
},
@ -10603,6 +10607,7 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
ICON(Magikarp, 0),
FOOTPRINT(Magikarp)
LEARNSETS(Magikarp),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 20, SPECIES_GYARADOS}),
},
@ -10827,6 +10832,7 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
ICON(Ditto, 2),
FOOTPRINT(Ditto)
LEARNSETS(Ditto),
.tmIlliterate = TRUE,
},
#endif //P_FAMILY_DITTO

View File

@ -2624,6 +2624,7 @@ const struct SpeciesInfo gSpeciesInfoGen2[] =
ICON(Unown ##letter, 0), \
FOOTPRINT(Unown) \
LEARNSETS(Unown), \
.tmIlliterate = TRUE, \
.formSpeciesIdTable = sUnownFormSpeciesIdTable
[SPECIES_UNOWN] =
@ -2917,6 +2918,7 @@ const struct SpeciesInfo gSpeciesInfoGen2[] =
ICON(Wynaut, 0),
FOOTPRINT(Wynaut)
LEARNSETS(Wynaut),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 15, SPECIES_WOBBUFFET}),
},
#endif //P_GEN_3_CROSS_EVOS
@ -2971,6 +2973,7 @@ const struct SpeciesInfo gSpeciesInfoGen2[] =
#endif
FOOTPRINT(Wobbuffet)
LEARNSETS(Wobbuffet),
.tmIlliterate = TRUE,
},
#endif //P_FAMILY_WOBBUFFET
@ -5267,6 +5270,7 @@ const struct SpeciesInfo gSpeciesInfoGen2[] =
ICON(Smeargle, 1),
FOOTPRINT(Smeargle)
LEARNSETS(Smeargle),
.tmIlliterate = TRUE,
},
#endif //P_FAMILY_SMEARGLE

View File

@ -953,6 +953,7 @@ const struct SpeciesInfo gSpeciesInfoGen3[] =
ICON(Wurmple, 0),
FOOTPRINT(Wurmple)
LEARNSETS(Wurmple),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL_SILCOON, 7, SPECIES_SILCOON},
{EVO_LEVEL_CASCOON, 7, SPECIES_CASCOON}),
},
@ -1002,6 +1003,7 @@ const struct SpeciesInfo gSpeciesInfoGen3[] =
ICON(Silcoon, 2),
FOOTPRINT(Silcoon)
LEARNSETS(Silcoon),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 10, SPECIES_BEAUTIFLY}),
},
@ -1115,6 +1117,7 @@ const struct SpeciesInfo gSpeciesInfoGen3[] =
ICON(Cascoon, 2),
FOOTPRINT(Cascoon)
LEARNSETS(Cascoon),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 10, SPECIES_DUSTOX}),
},
@ -7529,6 +7532,7 @@ const struct SpeciesInfo gSpeciesInfoGen3[] =
ICON(Beldum, 0),
FOOTPRINT(Beldum)
LEARNSETS(Beldum),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 20, SPECIES_METANG}),
},

View File

@ -783,6 +783,7 @@ const struct SpeciesInfo gSpeciesInfoGen4[] =
ICON(Kricketot, 2),
FOOTPRINT(Kricketot)
LEARNSETS(Kricketot),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 10, SPECIES_KRICKETUNE}),
},
@ -1222,6 +1223,7 @@ const struct SpeciesInfo gSpeciesInfoGen4[] =
.backAnimId = BACK_ANIM_H_SHAKE, \
FOOTPRINT(Burmy) \
LEARNSETS(Burmy), \
.tmIlliterate = TRUE, \
.formSpeciesIdTable = sBurmyFormSpeciesIdTable, \
.formChangeTable = sBurmyFormChangeTable
@ -1484,6 +1486,7 @@ const struct SpeciesInfo gSpeciesInfoGen4[] =
ICON(Combee, 0),
FOOTPRINT(Combee)
LEARNSETS(Combee),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL_FEMALE, 21, SPECIES_VESPIQUEN}),
},

View File

@ -6108,6 +6108,7 @@ const struct SpeciesInfo gSpeciesInfoGen5[] =
ICON(Tynamo, 0),
FOOTPRINT(Tynamo)
LEARNSETS(Tynamo),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 39, SPECIES_EELEKTRIK}),
},

View File

@ -774,6 +774,7 @@ const struct SpeciesInfo gSpeciesInfoGen6[] =
ICON(Scatterbug, 1),
FOOTPRINT(Scatterbug)
LEARNSETS(Scatterbug),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 9, SPECIES_SPEWPA}),
},
@ -822,6 +823,7 @@ const struct SpeciesInfo gSpeciesInfoGen6[] =
ICON(Spewpa, 1),
FOOTPRINT(Spewpa)
LEARNSETS(Spewpa),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 12, SPECIES_VIVILLON_ICY_SNOW}),
},

View File

@ -3666,6 +3666,7 @@ const struct SpeciesInfo gSpeciesInfoGen7[] =
ICON(Cosmog, 2),
FOOTPRINT(Cosmog)
LEARNSETS(Cosmog),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 43, SPECIES_COSMOEM}),
},
@ -3717,6 +3718,7 @@ const struct SpeciesInfo gSpeciesInfoGen7[] =
ICON(Cosmoem, 0),
FOOTPRINT(Cosmoem)
LEARNSETS(Cosmoem),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL_DAY, 53, SPECIES_SOLGALEO},
{EVO_LEVEL_NIGHT, 53, SPECIES_LUNALA}),
},

View File

@ -855,6 +855,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] =
ICON(Blipbug, 0),
FOOTPRINT(Blipbug)
LEARNSETS(Blipbug),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_LEVEL, 10, SPECIES_DOTTLER}),
},
@ -1729,6 +1730,7 @@ const struct SpeciesInfo gSpeciesInfoGen8[] =
ICON(Applin, 1),
FOOTPRINT(Applin)
LEARNSETS(Applin),
.tmIlliterate = TRUE,
.evolutions = EVOLUTION({EVO_ITEM, ITEM_TART_APPLE, SPECIES_FLAPPLE},
{EVO_ITEM, ITEM_SWEET_APPLE, SPECIES_APPLETUN},
{EVO_ITEM, ITEM_SYRUPY_APPLE, SPECIES_DIPPLIN}),

File diff suppressed because it is too large Load Diff

View File

@ -5067,6 +5067,20 @@ bool8 TryIncrementMonLevel(struct Pokemon *mon)
}
}
static const u16 sUniversalMoves[] =
{
MOVE_BIDE,
MOVE_FRUSTRATION,
MOVE_HIDDEN_POWER,
MOVE_MIMIC,
MOVE_NATURAL_GIFT,
MOVE_RAGE,
MOVE_RETURN,
MOVE_SECRET_POWER,
MOVE_SUBSTITUTE,
MOVE_TERA_BLAST,
};
u8 CanLearnTeachableMove(u16 species, u16 move)
{
if (species == SPECIES_EGG)
@ -5107,8 +5121,36 @@ u8 CanLearnTeachableMove(u16 species, u16 move)
}
else
{
u8 i;
u32 i, j;
const u16 *teachableLearnset = GetSpeciesTeachableLearnset(species);
for (i = 0; i < ARRAY_COUNT(sUniversalMoves); i++)
{
if (sUniversalMoves[i] == move)
{
if (!gSpeciesInfo[species].tmIlliterate)
{
if (move == MOVE_TERA_BLAST && GET_BASE_SPECIES_ID(species) == SPECIES_TERAPAGOS)
return FALSE;
if (GET_BASE_SPECIES_ID(species) == SPECIES_PYUKUMUKU && (move == MOVE_HIDDEN_POWER || move == MOVE_RETURN || move == MOVE_FRUSTRATION))
return FALSE;
return TRUE;
}
else
{
const struct LevelUpMove *learnset = GetSpeciesLevelUpLearnset(species);
if (P_TM_LITERACY < GEN_6)
return FALSE;
for (j = 0; j < MAX_LEVEL_UP_MOVES && learnset[j].move != LEVEL_UP_MOVE_END; j++)
{
if (learnset[j].move == move)
return TRUE;
}
return FALSE;
}
}
}
for (i = 0; teachableLearnset[i] != MOVE_UNAVAILABLE; i++)
{
if (teachableLearnset[i] == move)