Regional form tests
This commit is contained in:
parent
982bcd5281
commit
1814960df3
4 changed files with 43 additions and 13 deletions
|
@ -911,7 +911,7 @@ const u8 *GetMoveAnimationScript(u16 moveId);
|
||||||
void UpdateDaysPassedSinceFormChange(u16 days);
|
void UpdateDaysPassedSinceFormChange(u16 days);
|
||||||
void TrySetDayLimitToFormChange(struct Pokemon *mon);
|
void TrySetDayLimitToFormChange(struct Pokemon *mon);
|
||||||
u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler);
|
u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler);
|
||||||
u16 GetRegionalForm(u32 species, u32 region);
|
u32 GetRegionalForm(u32 species, u32 region);
|
||||||
bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion);
|
bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion);
|
||||||
|
|
||||||
#endif // GUARD_POKEMON_H
|
#endif // GUARD_POKEMON_H
|
||||||
|
|
|
@ -1002,8 +1002,8 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent
|
||||||
|
|
||||||
motherEggSpecies = GetEggSpecies(species[parentSlots[0]]);
|
motherEggSpecies = GetEggSpecies(species[parentSlots[0]]);
|
||||||
fatherEggSpecies = GetEggSpecies(species[parentSlots[1]]);
|
fatherEggSpecies = GetEggSpecies(species[parentSlots[1]]);
|
||||||
hasMotherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE;
|
hasMotherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[parentSlots[0]].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE;
|
||||||
hasFatherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE;
|
hasFatherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[parentSlots[1]].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE;
|
||||||
motherIsForeign = IsSpeciesForeignRegionalForm(motherEggSpecies, REGION_CURRENT);
|
motherIsForeign = IsSpeciesForeignRegionalForm(motherEggSpecies, REGION_CURRENT);
|
||||||
fatherIsForeign = IsSpeciesForeignRegionalForm(fatherEggSpecies, REGION_CURRENT);
|
fatherIsForeign = IsSpeciesForeignRegionalForm(fatherEggSpecies, REGION_CURRENT);
|
||||||
|
|
||||||
|
|
|
@ -6979,22 +6979,29 @@ u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler)
|
||||||
return gMovesInfo[move].type;
|
return gMovesInfo[move].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 GetRegionalForm(u32 species, u32 region)
|
u32 GetRegionalForm(u32 species, u32 region)
|
||||||
{
|
{
|
||||||
u32 formId = 0;
|
u32 formId = 0;
|
||||||
u32 foundSpecies = 0;
|
u32 firstFoundSpecies = 0;
|
||||||
|
const u16 *formTable = GetSpeciesFormTable(species);
|
||||||
|
|
||||||
if (GetSpeciesFormTable(species) != NULL)
|
if (formTable != NULL)
|
||||||
{
|
{
|
||||||
for (formId = 0; GetSpeciesFormTable(species)[formId] != FORM_SPECIES_END; formId++)
|
for (formId = 0; formTable[formId] != FORM_SPECIES_END; formId++)
|
||||||
{
|
{
|
||||||
foundSpecies = GetSpeciesFormTable(species)[formId];
|
if (firstFoundSpecies == 0)
|
||||||
if ((gSpeciesInfo[foundSpecies].isAlolanForm && region == REGION_ALOLA)
|
firstFoundSpecies = formTable[formId];
|
||||||
|| (gSpeciesInfo[foundSpecies].isGalarianForm && region == REGION_GALAR)
|
|
||||||
|| (gSpeciesInfo[foundSpecies].isHisuianForm && region == REGION_HISUI)
|
if ((gSpeciesInfo[formTable[formId]].isAlolanForm && region == REGION_ALOLA)
|
||||||
|| (gSpeciesInfo[foundSpecies].isPaldeanForm && region == REGION_PALDEA))
|
|| (gSpeciesInfo[formTable[formId]].isGalarianForm && region == REGION_GALAR)
|
||||||
return foundSpecies;
|
|| (gSpeciesInfo[formTable[formId]].isHisuianForm && region == REGION_HISUI)
|
||||||
|
|| (gSpeciesInfo[formTable[formId]].isPaldeanForm && region == REGION_PALDEA))
|
||||||
|
{
|
||||||
|
return formTable[formId];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (firstFoundSpecies != 0)
|
||||||
|
return firstFoundSpecies;
|
||||||
}
|
}
|
||||||
return species;
|
return species;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,3 +64,26 @@ TEST("Daycare Pokémon can breed with Ditto if they don't belong to the Ditto or
|
||||||
EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_NONE);
|
EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_NONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST("Daycare Pokémon with regional forms give the correct offspring")
|
||||||
|
{
|
||||||
|
u32 offspring = 0;
|
||||||
|
ASSUME(P_FAMILY_MEOWTH == TRUE);
|
||||||
|
ASSUME(P_ALOLAN_FORMS == TRUE);
|
||||||
|
ASSUME(P_GALARIAN_FORMS == TRUE);
|
||||||
|
ASSUME(REGION_CURRENT == REGION_HOENN);
|
||||||
|
|
||||||
|
ZeroPlayerPartyMons();
|
||||||
|
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;); }
|
||||||
|
STORE_IN_DAYCARE_AND_GET_EGG();
|
||||||
|
|
||||||
|
EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), offspring);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue