fixed regional variant breeding

This commit is contained in:
cawtds 2024-06-02 09:39:24 +02:00
parent c58b846165
commit 1002d2cabd
8 changed files with 74 additions and 32 deletions

View File

@ -134,6 +134,8 @@ ViridianCity_Mart_Items::
.2byte ITEM_DYNAMAX_CANDY
.2byte ITEM_ROTOM_CATALOG
.2byte ITEM_ZYGARDE_CUBE
.2byte ITEM_METEORITE
.2byte ITEM_YELLOW_NECTAR
.2byte ITEM_NONE
release
end

View File

@ -18,6 +18,8 @@ void ItemUseOutOfBattle_EscapeRope(u8 taskId);
void ItemUseOutOfBattle_EnigmaBerry(u8 taskId);
void ItemUseOutOfBattle_EvolutionStone(u8 taskId);
void ItemUseOutOfBattle_FameChecker(u8 taskId);
void ItemUseOutOfBattle_FormChange(u8 taskId);
void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8 taskId);
void ItemUseOutOfBattle_Itemfinder(u8 taskId);
void ItemUseOutOfBattle_Mail(u8 taskId);
void ItemUseOutOfBattle_Medicine(u8 taskId);

View File

@ -90,6 +90,8 @@ void ChooseMonForDaycare(void);
void ChoosePartyMonByMenuType(u8 menuType);
void ItemUseCB_BattleChooseMove(u8 taskId, TaskFunc task);
const u8* GetItemEffect(u16 item);
void ItemUseCB_FormChange(u8 taskId, TaskFunc task);
void ItemUseCB_FormChange_ConsumedOnUse(u8 taskId, TaskFunc task);
void ItemUseCB_RotomCatalog(u8 taskId, TaskFunc task);
void ItemUseCB_ZygardeCube(u8 taskId, TaskFunc task);

View File

@ -3892,7 +3892,7 @@ const struct Item gItemsInfo[] =
.description = sNectarDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_TYPE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_FormChange_ConsumedOnUse,
.flingPower = 10,
},
@ -3904,7 +3904,7 @@ const struct Item gItemsInfo[] =
.description = sNectarDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_TYPE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_FormChange_ConsumedOnUse,
.flingPower = 10,
},
@ -3916,7 +3916,7 @@ const struct Item gItemsInfo[] =
.description = sNectarDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_TYPE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_FormChange_ConsumedOnUse,
.flingPower = 10,
},
@ -3928,7 +3928,7 @@ const struct Item gItemsInfo[] =
.description = sNectarDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_TYPE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_FormChange_ConsumedOnUse,
.flingPower = 10,
},
@ -10789,7 +10789,7 @@ const struct Item gItemsInfo[] =
"token of gratitude."),
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_TYPE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_FormChange,
},
[ITEM_REVEAL_GLASS] =
@ -10804,7 +10804,7 @@ const struct Item gItemsInfo[] =
"its original form."),
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_TYPE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_FormChange,
},
[ITEM_DNA_SPLICERS] =
@ -10847,7 +10847,7 @@ const struct Item gItemsInfo[] =
"\nPokémon long ago."),
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_TYPE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_FormChange,
},
[ITEM_N_SOLARIZER] =
@ -11473,7 +11473,7 @@ const struct Item gItemsInfo[] =
.importance = 1,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_TYPE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_FormChange,
},
[ITEM_MAGMA_EMBLEM] =

View File

@ -8263,32 +8263,32 @@
{
"min_level": 3,
"max_level": 3,
"species": "SPECIES_ZYGARDE"
"species": "SPECIES_DEOXYS"
},
{
"min_level": 3,
"max_level": 3,
"species": "SPECIES_ZYGARDE"
"species": "SPECIES_DEOXYS"
},
{
"min_level": 3,
"max_level": 3,
"species": "SPECIES_ZYGARDE"
"species": "SPECIES_DEOXYS"
},
{
"min_level": 3,
"max_level": 3,
"species": "SPECIES_ZYGARDE"
"species": "SPECIES_ORICORIO"
},
{
"min_level": 2,
"max_level": 2,
"species": "SPECIES_ZYGARDE"
"species": "SPECIES_ORICORIO"
},
{
"min_level": 2,
"max_level": 2,
"species": "SPECIES_ZYGARDE"
"species": "SPECIES_ORICORIO"
},
{
"min_level": 3,

View File

@ -1142,7 +1142,8 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent
{
u16 i;
u16 species[DAYCARE_MON_COUNT];
u16 eggSpecies;
u16 eggSpecies, parentSpecies;
bool32 hasMotherEverstone;
for (i = 0; i < DAYCARE_MON_COUNT; i++)
{
@ -1159,34 +1160,28 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent
}
}
hasMotherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE;
if (GET_BASE_SPECIES_ID(species[parentSlots[0]]) == GET_BASE_SPECIES_ID(species[parentSlots[1]]))
{
bool32 hasSlot0Everstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE;
bool32 hasSlot1Everstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE;
u16 parentSpecies;
if (hasSlot0Everstone && hasSlot1Everstone)
{
bool32 hasFatherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE;
if (hasMotherEverstone && hasFatherEverstone)
parentSpecies = species[parentSlots[Random() & 1]];
}
else if (hasSlot0Everstone)
{
else if (hasMotherEverstone)
parentSpecies = species[parentSlots[0]];
}
else if (hasSlot1Everstone)
{
else if (hasFatherEverstone)
parentSpecies = species[parentSlots[1]];
}
else
{
parentSpecies = GET_BASE_SPECIES_ID(species[parentSlots[0]]);
}
eggSpecies = GetEggSpecies(parentSpecies);
}
else
{
eggSpecies = GetEggSpecies(species[parentSlots[0]]);
if (hasMotherEverstone)
parentSpecies = species[parentSlots[0]];
else
parentSpecies = GET_BASE_SPECIES_ID(species[parentSlots[0]]);
}
eggSpecies = GetEggSpecies(parentSpecies);
if (eggSpecies == SPECIES_NIDORAN_F && daycare->offspringPersonality & EGG_GENDER_MALE)
eggSpecies = SPECIES_NIDORAN_M;

View File

@ -252,6 +252,36 @@ void ItemUseOutOfBattle_Rod(u8 taskId)
PrintNotTheTimeToUseThat(taskId, gTasks[taskId].data[3]);
}
void ItemUseOutOfBattle_FormChange(u8 taskId)
{
if (!gTasks[taskId].tUsingRegisteredKeyItem)
{
gItemUseCB = ItemUseCB_FormChange;
gTasks[taskId].data[0] = FALSE;
SetUpItemUseOnFieldCallback(taskId);
}
else
{
// TODO: handle key items with callbacks to menus allow to be used by registering them.
PrintNotTheTimeToUseThat(taskId, gTasks[taskId].tUsingRegisteredKeyItem);
}
}
void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8 taskId)
{
if (!gTasks[taskId].tUsingRegisteredKeyItem)
{
gItemUseCB = ItemUseCB_FormChange_ConsumedOnUse;
gTasks[taskId].data[0] = TRUE;
SetUpItemUseOnFieldCallback(taskId);
}
else
{
// TODO: handle key items with callbacks to menus allow to be used by registering them.
PrintNotTheTimeToUseThat(taskId, gTasks[taskId].tUsingRegisteredKeyItem);
}
}
void ItemUseOutOfBattle_RotomCatalog(u8 taskId)
{
if (!gTasks[taskId].tUsingRegisteredKeyItem)

View File

@ -7209,6 +7209,17 @@ bool32 TryMultichoiceFormChange(u8 taskId)
}
}
void ItemUseCB_FormChange(u8 taskId, TaskFunc task)
{
TryItemUseFormChange(taskId, task);
}
void ItemUseCB_FormChange_ConsumedOnUse(u8 taskId, TaskFunc task)
{
if (TryItemUseFormChange(taskId, task))
RemoveBagItem(gSpecialVar_ItemId, 1);
}
void ItemUseCB_RotomCatalog(u8 taskId, TaskFunc task)
{
PartyMenuRemoveWindow(&sPartyMenuInternal->windowId[0]);