Clean up Shedinja code (#5501)

This commit is contained in:
Bassoonian 2024-10-11 19:50:41 +02:00 committed by GitHub
parent 130d6042e0
commit d7c5bfee68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -545,19 +545,13 @@ static void CB2_TradeEvolutionSceneUpdate(void)
static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon)
{
u32 data = 0;
#if P_SHEDINJA_BALL >= GEN_4
u16 ball = ITEM_POKE_BALL;
#endif
const struct Evolution *evolutions = GetSpeciesEvolutions(preEvoSpecies);
if (evolutions == NULL)
return;
if (evolutions[0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < PARTY_SIZE
#if P_SHEDINJA_BALL >= GEN_4
&& (CheckBagHasItem(ball, 1))
#endif
)
if (evolutions[0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < PARTY_SIZE && (P_SHEDINJA_BALL < GEN_4 || CheckBagHasItem(ball, 1)))
{
s32 i;
struct Pokemon *shedinja = &gPlayerParty[gPlayerPartyCount];
@ -567,10 +561,11 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon)
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, GetSpeciesName(evolutions[1].targetSpecies));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, &data);
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, &data);
#if P_SHEDINJA_BALL >= GEN_4
if (P_SHEDINJA_BALL >= GEN_4)
{
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_POKEBALL, &ball);
RemoveBagItem(ball, 1);
#endif
}
for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + CONTEST_CATEGORIES_COUNT; i++)
SetMonData(&gPlayerParty[gPlayerPartyCount], i, &data);