Added regional form evolution condition (#6990)

This commit is contained in:
Eduardo Quezada 2025-09-25 14:16:33 -03:00 committed by GitHub
parent 5e07d4a509
commit f9a8a0251a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 69 additions and 30 deletions

View File

@ -300,6 +300,8 @@ enum EvolutionConditions {
IF_PID_MODULO_100_LT, // The Pokémon's personality value's modulo by 100 is lower than the defined value. IF_PID_MODULO_100_LT, // The Pokémon's personality value's modulo by 100 is lower than the defined value.
IF_MIN_OVERWORLD_STEPS, // The Player has taken a specific amount of steps in the overworld with the Pokémon following them or in the first slot of the party. IF_MIN_OVERWORLD_STEPS, // The Player has taken a specific amount of steps in the overworld with the Pokémon following them or in the first slot of the party.
IF_BAG_ITEM_COUNT, // The Player has the specific amount of an item in the bag. It then removes those items. IF_BAG_ITEM_COUNT, // The Player has the specific amount of an item in the bag. It then removes those items.
IF_REGION, // The Player is in the specific region.
IF_NOT_REGION, // The Player is NOT in the specific region.
CONDITIONS_END CONDITIONS_END
}; };

View File

@ -2949,8 +2949,8 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
.teachableLearnset = sPikachuTeachableLearnset, .teachableLearnset = sPikachuTeachableLearnset,
.formSpeciesIdTable = sPikachuFormSpeciesIdTable, .formSpeciesIdTable = sPikachuFormSpeciesIdTable,
.formChangeTable = sPikachuFormChangeTable, .formChangeTable = sPikachuFormChangeTable,
.evolutions = EVOLUTION({EVO_ITEM, ITEM_THUNDER_STONE, SPECIES_RAICHU}, .evolutions = EVOLUTION({EVO_ITEM, ITEM_THUNDER_STONE, SPECIES_RAICHU, CONDITIONS({IF_NOT_REGION, REGION_ALOLA})},
{EVO_NONE, 0, SPECIES_RAICHU_ALOLA}), {EVO_ITEM, ITEM_THUNDER_STONE, SPECIES_RAICHU_ALOLA, CONDITIONS({IF_REGION, REGION_ALOLA})}),
}, },
#if P_COSPLAY_PIKACHU_FORMS #if P_COSPLAY_PIKACHU_FORMS
@ -13022,8 +13022,8 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
.levelUpLearnset = sExeggcuteLevelUpLearnset, .levelUpLearnset = sExeggcuteLevelUpLearnset,
.teachableLearnset = sExeggcuteTeachableLearnset, .teachableLearnset = sExeggcuteTeachableLearnset,
.eggMoveLearnset = sExeggcuteEggMoveLearnset, .eggMoveLearnset = sExeggcuteEggMoveLearnset,
.evolutions = EVOLUTION({EVO_ITEM, ITEM_LEAF_STONE, SPECIES_EXEGGUTOR}, .evolutions = EVOLUTION({EVO_ITEM, ITEM_LEAF_STONE, SPECIES_EXEGGUTOR, CONDITIONS({IF_NOT_REGION, REGION_ALOLA})},
{EVO_NONE, 0, SPECIES_EXEGGUTOR_ALOLA}), {EVO_ITEM, ITEM_LEAF_STONE, SPECIES_EXEGGUTOR_ALOLA, CONDITIONS({IF_REGION, REGION_ALOLA})}),
}, },
#if P_UPDATED_EXP_YIELDS >= GEN_7 #if P_UPDATED_EXP_YIELDS >= GEN_7
@ -13249,8 +13249,8 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
.levelUpLearnset = sCuboneLevelUpLearnset, .levelUpLearnset = sCuboneLevelUpLearnset,
.teachableLearnset = sCuboneTeachableLearnset, .teachableLearnset = sCuboneTeachableLearnset,
.eggMoveLearnset = sCuboneEggMoveLearnset, .eggMoveLearnset = sCuboneEggMoveLearnset,
.evolutions = EVOLUTION({EVO_LEVEL, 28, SPECIES_MAROWAK}, .evolutions = EVOLUTION({EVO_LEVEL, 28, SPECIES_MAROWAK, CONDITIONS({IF_NOT_REGION, REGION_ALOLA})},
{EVO_NONE, 0, SPECIES_MAROWAK_ALOLA}, {EVO_LEVEL, 28, SPECIES_MAROWAK_ALOLA, CONDITIONS({IF_REGION, REGION_ALOLA}, {IF_TIME, TIME_NIGHT})},
{EVO_NONE, 0, SPECIES_MAROWAK_ALOLA_TOTEM}), {EVO_NONE, 0, SPECIES_MAROWAK_ALOLA_TOTEM}),
}, },
@ -13982,8 +13982,8 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
.levelUpLearnset = sKoffingLevelUpLearnset, .levelUpLearnset = sKoffingLevelUpLearnset,
.teachableLearnset = sKoffingTeachableLearnset, .teachableLearnset = sKoffingTeachableLearnset,
.eggMoveLearnset = sKoffingEggMoveLearnset, .eggMoveLearnset = sKoffingEggMoveLearnset,
.evolutions = EVOLUTION({EVO_LEVEL, 35, SPECIES_WEEZING}, .evolutions = EVOLUTION({EVO_LEVEL, 35, SPECIES_WEEZING, CONDITIONS({IF_NOT_REGION, REGION_GALAR})},
{EVO_NONE, 0, SPECIES_WEEZING_GALAR}), {EVO_LEVEL, 35, SPECIES_WEEZING_GALAR, CONDITIONS({IF_REGION, REGION_GALAR})}),
}, },
[SPECIES_WEEZING] = [SPECIES_WEEZING] =
@ -15555,8 +15555,8 @@ const struct SpeciesInfo gSpeciesInfoGen1[] =
.levelUpLearnset = sMimeJrLevelUpLearnset, .levelUpLearnset = sMimeJrLevelUpLearnset,
.teachableLearnset = sMimeJrTeachableLearnset, .teachableLearnset = sMimeJrTeachableLearnset,
.eggMoveLearnset = sMimeJrEggMoveLearnset, .eggMoveLearnset = sMimeJrEggMoveLearnset,
.evolutions = EVOLUTION({EVO_LEVEL, 0, SPECIES_MR_MIME, CONDITIONS({IF_KNOWS_MOVE, MOVE_MIMIC})}, .evolutions = EVOLUTION({EVO_LEVEL, 0, SPECIES_MR_MIME, CONDITIONS({IF_KNOWS_MOVE, MOVE_MIMIC}, {IF_NOT_REGION, REGION_GALAR})},
{EVO_NONE, 0, SPECIES_MR_MIME_GALAR}), {EVO_LEVEL, 0, SPECIES_MR_MIME_GALAR, CONDITIONS({IF_KNOWS_MOVE, MOVE_MIMIC}, {IF_REGION, REGION_GALAR})}),
}, },
#endif //P_GEN_4_CROSS_EVOS #endif //P_GEN_4_CROSS_EVOS

View File

@ -364,8 +364,8 @@ const struct SpeciesInfo gSpeciesInfoGen2[] =
) )
.levelUpLearnset = sQuilavaLevelUpLearnset, .levelUpLearnset = sQuilavaLevelUpLearnset,
.teachableLearnset = sQuilavaTeachableLearnset, .teachableLearnset = sQuilavaTeachableLearnset,
.evolutions = EVOLUTION({EVO_LEVEL, 36, SPECIES_TYPHLOSION}, .evolutions = EVOLUTION({EVO_LEVEL, 36, SPECIES_TYPHLOSION, CONDITIONS({IF_NOT_REGION, REGION_HISUI})},
{EVO_NONE, 0, SPECIES_TYPHLOSION_HISUI}), {EVO_LEVEL, 36, SPECIES_TYPHLOSION_HISUI, CONDITIONS({IF_REGION, REGION_HISUI})}),
}, },
#if P_UPDATED_EXP_YIELDS >= GEN_8 #if P_UPDATED_EXP_YIELDS >= GEN_8
@ -5916,7 +5916,7 @@ const struct SpeciesInfo gSpeciesInfoGen2[] =
.levelUpLearnset = sUrsaringLevelUpLearnset, .levelUpLearnset = sUrsaringLevelUpLearnset,
.teachableLearnset = sUrsaringTeachableLearnset, .teachableLearnset = sUrsaringTeachableLearnset,
#if P_GEN_8_CROSS_EVOS #if P_GEN_8_CROSS_EVOS
.evolutions = EVOLUTION({EVO_ITEM, ITEM_PEAT_BLOCK, SPECIES_URSALUNA, CONDITIONS({IF_TIME, TIME_NIGHT})}, .evolutions = EVOLUTION({EVO_ITEM, ITEM_PEAT_BLOCK, SPECIES_URSALUNA, CONDITIONS({IF_REGION, REGION_HISUI}, {IF_TIME, TIME_NIGHT})},
{EVO_NONE, 0, SPECIES_URSALUNA_BLOODMOON}), {EVO_NONE, 0, SPECIES_URSALUNA_BLOODMOON}),
#endif #endif
}, },

View File

@ -656,8 +656,8 @@ const struct SpeciesInfo gSpeciesInfoGen5[] =
) )
.levelUpLearnset = sDewottLevelUpLearnset, .levelUpLearnset = sDewottLevelUpLearnset,
.teachableLearnset = sDewottTeachableLearnset, .teachableLearnset = sDewottTeachableLearnset,
.evolutions = EVOLUTION({EVO_LEVEL, 36, SPECIES_SAMUROTT}, .evolutions = EVOLUTION({EVO_LEVEL, 36, SPECIES_SAMUROTT, CONDITIONS({IF_NOT_REGION, REGION_HISUI})},
{EVO_NONE, 0, SPECIES_SAMUROTT_HISUI}), {EVO_LEVEL, 36, SPECIES_SAMUROTT_HISUI, CONDITIONS({IF_REGION, REGION_HISUI})}),
}, },
[SPECIES_SAMUROTT] = [SPECIES_SAMUROTT] =
@ -4158,8 +4158,8 @@ const struct SpeciesInfo gSpeciesInfoGen5[] =
.levelUpLearnset = sPetililLevelUpLearnset, .levelUpLearnset = sPetililLevelUpLearnset,
.teachableLearnset = sPetililTeachableLearnset, .teachableLearnset = sPetililTeachableLearnset,
.eggMoveLearnset = sPetililEggMoveLearnset, .eggMoveLearnset = sPetililEggMoveLearnset,
.evolutions = EVOLUTION({EVO_ITEM, ITEM_SUN_STONE, SPECIES_LILLIGANT}, .evolutions = EVOLUTION({EVO_ITEM, ITEM_SUN_STONE, SPECIES_LILLIGANT, CONDITIONS({IF_NOT_REGION, REGION_HISUI})},
{EVO_NONE, 0, SPECIES_LILLIGANT_HISUI}), {EVO_ITEM, ITEM_SUN_STONE, SPECIES_LILLIGANT_HISUI, CONDITIONS({IF_REGION, REGION_HISUI})}),
}, },
[SPECIES_LILLIGANT] = [SPECIES_LILLIGANT] =
@ -11316,8 +11316,8 @@ const struct SpeciesInfo gSpeciesInfoGen5[] =
) )
.levelUpLearnset = sRuffletLevelUpLearnset, .levelUpLearnset = sRuffletLevelUpLearnset,
.teachableLearnset = sRuffletTeachableLearnset, .teachableLearnset = sRuffletTeachableLearnset,
.evolutions = EVOLUTION({EVO_LEVEL, 54, SPECIES_BRAVIARY}, .evolutions = EVOLUTION({EVO_LEVEL, 54, SPECIES_BRAVIARY, CONDITIONS({IF_NOT_REGION, REGION_HISUI})},
{EVO_NONE, 0, SPECIES_BRAVIARY_HISUI}), {EVO_LEVEL, 54, SPECIES_BRAVIARY_HISUI, CONDITIONS({IF_REGION, REGION_HISUI})}),
}, },
[SPECIES_BRAVIARY] = [SPECIES_BRAVIARY] =

View File

@ -4441,8 +4441,8 @@ const struct SpeciesInfo gSpeciesInfoGen6[] =
.levelUpLearnset = sGoomyLevelUpLearnset, .levelUpLearnset = sGoomyLevelUpLearnset,
.teachableLearnset = sGoomyTeachableLearnset, .teachableLearnset = sGoomyTeachableLearnset,
.eggMoveLearnset = sGoomyEggMoveLearnset, .eggMoveLearnset = sGoomyEggMoveLearnset,
.evolutions = EVOLUTION({EVO_LEVEL, 40, SPECIES_SLIGGOO}, .evolutions = EVOLUTION({EVO_LEVEL, 40, SPECIES_SLIGGOO, CONDITIONS({IF_NOT_REGION, REGION_HISUI})},
{EVO_NONE, 0, SPECIES_SLIGGOO_HISUI}), {EVO_LEVEL, 40, SPECIES_SLIGGOO_HISUI, CONDITIONS({IF_REGION, REGION_HISUI})}),
}, },
[SPECIES_SLIGGOO] = [SPECIES_SLIGGOO] =
@ -5546,8 +5546,8 @@ const struct SpeciesInfo gSpeciesInfoGen6[] =
.levelUpLearnset = sBergmiteLevelUpLearnset, .levelUpLearnset = sBergmiteLevelUpLearnset,
.teachableLearnset = sBergmiteTeachableLearnset, .teachableLearnset = sBergmiteTeachableLearnset,
.eggMoveLearnset = sBergmiteEggMoveLearnset, .eggMoveLearnset = sBergmiteEggMoveLearnset,
.evolutions = EVOLUTION({EVO_LEVEL, 37, SPECIES_AVALUGG}, .evolutions = EVOLUTION({EVO_LEVEL, 37, SPECIES_AVALUGG, CONDITIONS({IF_NOT_REGION, REGION_HISUI})},
{EVO_NONE, 0, SPECIES_AVALUGG_HISUI}), {EVO_LEVEL, 37, SPECIES_AVALUGG_HISUI, CONDITIONS({IF_REGION, REGION_HISUI})}),
}, },
[SPECIES_AVALUGG] = [SPECIES_AVALUGG] =

View File

@ -137,8 +137,8 @@ const struct SpeciesInfo gSpeciesInfoGen7[] =
) )
.levelUpLearnset = sDartrixLevelUpLearnset, .levelUpLearnset = sDartrixLevelUpLearnset,
.teachableLearnset = sDartrixTeachableLearnset, .teachableLearnset = sDartrixTeachableLearnset,
.evolutions = EVOLUTION({EVO_LEVEL, 34, SPECIES_DECIDUEYE}, .evolutions = EVOLUTION({EVO_LEVEL, 34, SPECIES_DECIDUEYE, CONDITIONS({IF_NOT_REGION, REGION_HISUI})},
{EVO_NONE, 0, SPECIES_DECIDUEYE_HISUI}), {EVO_LEVEL, 36, SPECIES_DECIDUEYE_HISUI, CONDITIONS({IF_REGION, REGION_HISUI})}),
}, },
[SPECIES_DECIDUEYE] = [SPECIES_DECIDUEYE] =

View File

@ -6585,7 +6585,8 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 dept
StringAppend(gStringVar4, COMPOUND_STRING(", ")); StringAppend(gStringVar4, COMPOUND_STRING(", "));
} }
switch((enum EvolutionConditions)evolutions[i].params[j].condition) enum EvolutionConditions condition = evolutions[i].params[j].condition;
switch(condition)
{ {
// Gen 2 // Gen 2
case IF_GENDER: case IF_GENDER:
@ -6642,10 +6643,10 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 dept
case IF_PID_UPPER_MODULO_10_EQ: case IF_PID_UPPER_MODULO_10_EQ:
case IF_PID_UPPER_MODULO_10_LT: case IF_PID_UPPER_MODULO_10_LT:
arg = evolutions[i].params[j].arg1; arg = evolutions[i].params[j].arg1;
if ((enum EvolutionConditions)evolutions[i].params[j].condition == IF_PID_UPPER_MODULO_10_GT if (condition == IF_PID_UPPER_MODULO_10_GT
&& arg < 10 && arg >= 0) && arg < 10 && arg >= 0)
arg = 9 - arg; arg = 9 - arg;
else if ((enum EvolutionConditions)evolutions[i].params[j].condition == IF_PID_UPPER_MODULO_10_EQ else if (condition == IF_PID_UPPER_MODULO_10_EQ
&& arg < 10 && arg >= 0) && arg < 10 && arg >= 0)
arg = 1; arg = 1;
ConvertIntToDecimalStringN(gStringVar2, arg * 10, STR_CONV_MODE_LEFT_ALIGN, 3); ConvertIntToDecimalStringN(gStringVar2, arg * 10, STR_CONV_MODE_LEFT_ALIGN, 3);
@ -6704,6 +6705,33 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 dept
StringAppend(gStringVar4, gTypesInfo[evolutions[i].params[j].arg1].name); StringAppend(gStringVar4, gTypesInfo[evolutions[i].params[j].arg1].name);
StringAppend(gStringVar4, COMPOUND_STRING(" move")); StringAppend(gStringVar4, COMPOUND_STRING(" move"));
break; break;
case IF_REGION:
case IF_NOT_REGION:
{
if (condition == IF_REGION)
StringAppend(gStringVar4, COMPOUND_STRING("in "));
else if (condition == IF_NOT_REGION)
StringAppend(gStringVar4, COMPOUND_STRING("out of "));
switch ((enum Region)evolutions[i].params[j].arg1)
{
case REGION_NONE:
case REGIONS_COUNT:
StringAppend(gStringVar4, COMPOUND_STRING("???"));
break;
case REGION_KANTO: StringAppend(gStringVar4, COMPOUND_STRING("Kanto")); break;
case REGION_JOHTO: StringAppend(gStringVar4, COMPOUND_STRING("Johto")); break;
case REGION_HOENN: StringAppend(gStringVar4, COMPOUND_STRING("Hoenn")); break;
case REGION_SINNOH: StringAppend(gStringVar4, COMPOUND_STRING("Sinnoh")); break;
case REGION_UNOVA: StringAppend(gStringVar4, COMPOUND_STRING("Unova")); break;
case REGION_KALOS: StringAppend(gStringVar4, COMPOUND_STRING("Kalos")); break;
case REGION_ALOLA: StringAppend(gStringVar4, COMPOUND_STRING("Alola")); break;
case REGION_GALAR: StringAppend(gStringVar4, COMPOUND_STRING("Galar")); break;
case REGION_HISUI: StringAppend(gStringVar4, COMPOUND_STRING("Hisui")); break;
case REGION_PALDEA: StringAppend(gStringVar4, COMPOUND_STRING("Paldea")); break;
}
break;
}
// Gen 8 // Gen 8
case IF_NATURE: case IF_NATURE:
StringCopy(gStringVar2, gNaturesInfo[evolutions[i].params[j].arg1].name); StringCopy(gStringVar2, gNaturesInfo[evolutions[i].params[j].arg1].name);
@ -6755,10 +6783,10 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 dept
case IF_PID_MODULO_100_EQ: case IF_PID_MODULO_100_EQ:
case IF_PID_MODULO_100_LT: case IF_PID_MODULO_100_LT:
arg = evolutions[i].params[j].arg1; arg = evolutions[i].params[j].arg1;
if ((enum EvolutionConditions)evolutions[i].params[j].condition == IF_PID_MODULO_100_GT if (condition == IF_PID_MODULO_100_GT
&& arg < 100 && arg >= 0) && arg < 100 && arg >= 0)
arg = 99 - arg; arg = 99 - arg;
else if ((enum EvolutionConditions)evolutions[i].params[j].condition == IF_PID_MODULO_100_EQ else if (condition == IF_PID_MODULO_100_EQ
&& arg < 100 && arg >= 0) && arg < 100 && arg >= 0)
arg = 1; arg = 1;
ConvertIntToDecimalStringN(gStringVar2, arg, STR_CONV_MODE_LEFT_ALIGN, 3); ConvertIntToDecimalStringN(gStringVar2, arg, STR_CONV_MODE_LEFT_ALIGN, 3);

View File

@ -37,6 +37,7 @@
#include "pokemon_storage_system.h" #include "pokemon_storage_system.h"
#include "random.h" #include "random.h"
#include "recorded_battle.h" #include "recorded_battle.h"
#include "regions.h"
#include "rtc.h" #include "rtc.h"
#include "sound.h" #include "sound.h"
#include "string_util.h" #include "string_util.h"
@ -4723,6 +4724,14 @@ bool32 DoesMonMeetAdditionalConditions(struct Pokemon *mon, const struct Evoluti
*canStopEvo = FALSE; *canStopEvo = FALSE;
} }
break; break;
case IF_REGION:
if (GetCurrentRegion() == params[i].arg1)
currentCondition = TRUE;
break;
case IF_NOT_REGION:
if (GetCurrentRegion() != params[i].arg1)
currentCondition = TRUE;
break;
case CONDITIONS_END: case CONDITIONS_END:
break; break;
} }