Fixed mix of logic of regular vs regional forms. Added Alola/Galar tests
This commit is contained in:
parent
4950a34a94
commit
a37c9596ba
2 changed files with 50 additions and 4 deletions
|
@ -6979,6 +6979,14 @@ u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler)
|
|||
return gMovesInfo[move].type;
|
||||
}
|
||||
|
||||
bool32 IsSpeciesRegionalForm(u32 species)
|
||||
{
|
||||
return gSpeciesInfo[species].isAlolanForm
|
||||
|| gSpeciesInfo[species].isGalarianForm
|
||||
|| gSpeciesInfo[species].isHisuianForm
|
||||
|| gSpeciesInfo[species].isPaldeanForm;
|
||||
}
|
||||
|
||||
bool32 IsSpeciesRegionalFormFromRegion(u32 species, u32 region)
|
||||
{
|
||||
switch (region)
|
||||
|
@ -6991,6 +6999,18 @@ bool32 IsSpeciesRegionalFormFromRegion(u32 species, u32 region)
|
|||
}
|
||||
}
|
||||
|
||||
bool32 SpeciesHasRegionalForm(u32 species)
|
||||
{
|
||||
u32 formId;
|
||||
const u16 *formTable = GetSpeciesFormTable(species);
|
||||
for (formId = 0; formTable != NULL && formTable[formId] != FORM_SPECIES_END; formId++)
|
||||
{
|
||||
if (IsSpeciesRegionalForm(formTable[formId]))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u32 GetRegionalFormByRegion(u32 species, u32 region)
|
||||
{
|
||||
u32 formId = 0;
|
||||
|
@ -7018,7 +7038,9 @@ bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion)
|
|||
u32 i;
|
||||
for (i = 0; i < REGIONS_COUNT; i++)
|
||||
{
|
||||
if (IsSpeciesRegionalFormFromRegion(species, i) && currentRegion != i)
|
||||
if (currentRegion != i && IsSpeciesRegionalFormFromRegion(species, i))
|
||||
return TRUE;
|
||||
else if (currentRegion == i && SpeciesHasRegionalForm(species) && !IsSpeciesRegionalFormFromRegion(species, i))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
|
@ -71,7 +71,6 @@ TEST("(Daycare) Shellos' form is always based on the mother's form")
|
|||
ASSUME(P_FAMILY_MEOWTH == TRUE);
|
||||
ASSUME(P_ALOLAN_FORMS == TRUE);
|
||||
ASSUME(P_GALARIAN_FORMS == TRUE);
|
||||
ASSUME(GetCurrentRegion() == REGION_GALAR);
|
||||
|
||||
ZeroPlayerPartyMons();
|
||||
PARAMETRIZE { offspring = SPECIES_SHELLOS_WEST; RUN_OVERWORLD_SCRIPT(givemon SPECIES_SHELLOS_EAST, 1, gender=MON_MALE; givemon SPECIES_SHELLOS_WEST, 1, gender=MON_FEMALE;); }
|
||||
|
@ -91,18 +90,43 @@ TEST("(Daycare) Pokémon with regional forms give the correct offspring")
|
|||
ASSUME(P_FAMILY_MEOWTH == TRUE);
|
||||
ASSUME(P_ALOLAN_FORMS == TRUE);
|
||||
ASSUME(P_GALARIAN_FORMS == TRUE);
|
||||
ASSUME(GetCurrentRegion() == REGION_HOENN);
|
||||
|
||||
ZeroPlayerPartyMons();
|
||||
|
||||
ASSUME(GetCurrentRegion() == REGION_HOENN);
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
// Cases provided by cawtds
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
/*
|
||||
// Tests for species bred in Alola. Manually tested, as we don't have any Alola maps.
|
||||
ASSUME(GetCurrentRegion() == REGION_ALOLA);
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
// Tests for species bred in Galar. Manually tested, as we don't have any Galar maps.
|
||||
ASSUME(GetCurrentRegion() == REGION_GALAR);
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); }
|
||||
*/
|
||||
STORE_IN_DAYCARE_AND_GET_EGG();
|
||||
|
||||
EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), offspring);
|
||||
|
|
Loading…
Reference in a new issue