diff --git a/src/script_pokemon_util.c b/src/script_pokemon_util.c index 93a747772..c24255ccd 100755 --- a/src/script_pokemon_util.c +++ b/src/script_pokemon_util.c @@ -64,11 +64,23 @@ u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 u int sentToPc; u8 heldItem[2]; struct Pokemon mon; + u16 targetSpecies; CreateMon(&mon, species, level, USE_RANDOM_IVS, 0, 0, OT_ID_PLAYER_ID, 0); heldItem[0] = item; heldItem[1] = item >> 8; SetMonData(&mon, MON_DATA_HELD_ITEM, heldItem); + + // In case a mon with a form changing item is given. Eg: SPECIES_ARCEUS with ITEM_SPLASH_PLATE will transform into SPECIES_ARCEUS_WATER upon gifted. + targetSpecies = GetFormChangeTargetSpecies(&mon, FORM_ITEM_HOLD_ABILITY, 0); + if (targetSpecies == SPECIES_NONE) + targetSpecies = GetFormChangeTargetSpecies(&mon, FORM_ITEM_HOLD, 0); + if (targetSpecies != SPECIES_NONE) + { + SetMonData(&mon, MON_DATA_SPECIES, &targetSpecies); + CalculateMonStats(&mon); + } + sentToPc = GiveMonToPlayer(&mon); nationalDexNum = SpeciesToNationalPokedexNum(species);