Exemple #1
0
        /// <summary>
        /// Modifies the provided <see cref="pk"/> to the specifications required by <see cref="set"/>.
        /// </summary>
        /// <param name="pk">Converted final pkm to apply details to</param>
        /// <param name="set">Set details required</param>
        /// <param name="unconverted">Original pkm data</param>
        /// <param name="handler">Trainer to handle the Pokémon</param>
        /// <param name="enc">Encounter details matched to the Pokémon</param>
        /// <param name="regen">Regeneration information</param>
        private static void ApplySetDetails(PKM pk, IBattleTemplate set, PKM unconverted, ITrainerInfo handler, IEncounterable enc, RegenSet regen)
        {
            int Form        = set.FormIndex;
            var pidiv       = MethodFinder.Analyze(pk);
            var abilitypref = GetAbilityPreference(pk, enc);
            var language    = regen.Extra.Language;

            pk.SetVersion(unconverted); // Preemptive Version setting
            pk.SetLanguage(language);
            pk.SetSpeciesLevel(set, Form, enc, language);
            pk.SetRecordFlags(set.Moves);
            pk.SetMovesEVs(set);
            pk.SetHandlerandMemory(handler);
            pk.SetNatureAbility(set, abilitypref);
            pk.GetSuggestedTracker();
            pk.SetIVsPID(set, pidiv.Type, set.HiddenPowerType, unconverted);
            pk.SetHeldItem(set);
            pk.SetHyperTrainingFlags(set); // Hypertrain
            pk.SetEncryptionConstant(enc);
            pk.FixFatefulFlag(enc);
            pk.SetShinyBoolean(set.Shiny, enc, regen.Extra.ShinyType);
            pk.FixGender(set);
            pk.SetSuggestedRibbons(SetAllLegalRibbons);
            pk.SetSuggestedMemories();
            pk.SetHTLanguage();
            pk.SetDynamaxLevel();
            pk.SetFriendship(enc);
            pk.SetBelugaValues();
            pk.FixEdgeCases();
            pk.SetSuggestedBall(SetMatchingBalls, ForceSpecifiedBall, regen.Extra.Ball);
            pk.ApplyMarkings(UseMarkings, UseCompetitiveMarkings);
            pk.ApplyHeightWeight(enc);
            pk.ApplyBattleVersion(handler);

            // Extra legality unchecked by PKHeX
            pk.SetDatelocks(enc);
        }