Exemplo n.º 1
0
        protected virtual void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
        {
            pk.EncryptionConstant = Util.Rand32();
            pk.Species            = Species;
            pk.AltForm            = Form;

            int lang    = (int)Language.GetSafeLanguage(Generation, (LanguageID)sav.Language);
            int level   = GetMinimalLevel();
            var version = this.GetCompatibleVersion((GameVersion)sav.Game);

            SanityCheckVersion(ref version);

            pk.Language = lang = GetEdgeCaseLanguage(pk, lang);
            pk.Nickname = SpeciesName.GetSpeciesNameGeneration(Species, lang, Generation);

            pk.CurrentLevel  = level;
            pk.Version       = (int)version;
            pk.Ball          = Ball;
            pk.HeldItem      = HeldItem;
            pk.OT_Friendship = pk.PersonalInfo.BaseFriendship;

            var today = DateTime.Today;

            SetMetData(pk, level, today);
            if (EggEncounter)
            {
                SetEggMetData(pk, sav, today);
            }

            SetPINGA(pk, criteria);
            SetEncounterMoves(pk, version, level);

            if (Fateful)
            {
                pk.FatefulEncounter = true;
            }

            if (pk.Format < 6)
            {
                return;
            }

            if (this is IRelearn relearn)
            {
                pk.SetRelearnMoves(relearn.Relearn);
            }

            sav.ApplyHandlingTrainerInfo(pk);
            pk.SetRandomEC();

            if (this is IGigantamax g && pk is IGigantamax pg)
            {
                pg.CanGigantamax = g.CanGigantamax;
            }
            if (this is IDynamaxLevel d && pk is IDynamaxLevel pd)
            {
                pd.DynamaxLevel = d.DynamaxLevel;
            }
        }