Ejemplo n.º 1
0
 public RegenTemplate(PKM pk, int gen = PKX.Generation) : this(new ShowdownSet(pk), gen)
 {
     this.FixGender(pk.PersonalInfo);
     if (!pk.IsNicknamed)
     {
         Nickname = string.Empty;
     }
     Regen = new RegenSet(pk);
     Shiny = Regen.Extra.IsShiny;
 }
Ejemplo n.º 2
0
 private static ITrainerInfo GetTrainer(RegenSet regen, GameVersion ver, int gen)
 {
     if (AllowTrainerOverride && regen.HasTrainerSettings && regen.Trainer != null)
     {
         return(regen.Trainer.MutateLanguage(regen.Extra.Language));
     }
     if (UseTrainerData)
     {
         return(TrainerSettings.GetSavedTrainerData(ver, gen).MutateLanguage(regen.Extra.Language));
     }
     return(TrainerSettings.DefaultFallback(gen, regen.Extra.Language));
 }
Ejemplo n.º 3
0
        public RegenTemplate(ShowdownSet set, int gen = PKX.Generation) : this(set, gen, set.Text)
        {
            this.SanitizeForm();
            this.SanitizeBattleMoves();

            var shiny = Shiny ? Core.Shiny.Always : Core.Shiny.Never;

            if (set.InvalidLines.Count != 0)
            {
                Regen = new RegenSet(set.InvalidLines, gen, shiny);
                Shiny = Regen.Extra.IsShiny;
                set.InvalidLines.Clear();
            }
            else
            {
                Regen.Extra.ShinyType = shiny;
            }
        }
Ejemplo n.º 4
0
        public RegenTemplate(ShowdownSet set, int gen = PKX.Generation) : this(set, gen, set.Text)
        {
            this.SanitizeForm();
            this.SanitizeBattleMoves();

            var shiny = Shiny ? Core.Shiny.Always : Core.Shiny.Never;

            if (set.InvalidLines.Count == 0)
            {
                Regen.Extra.ShinyType = shiny;
                return;
            }

            Regen = new RegenSet(set.InvalidLines, gen, shiny);
            Shiny = Regen.Extra.IsShiny;
            if (Ability == -1)
            {
                Ability = RegenUtil.GetRegenAbility(set.Species, gen, Regen.Extra.Ability);
            }
            set.InvalidLines.Clear();
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 private static bool IsIgnored(string s, RegenSet regen)
 {
     return(regen.HasExtraSettings && s.StartsWith("Shiny: "));
 }
Ejemplo n.º 7
0
 public RegenTemplate(PKM pk, int gen = PKX.Generation) : this(new ShowdownSet(pk), gen)
 {
     this.FixGender(pk.PersonalInfo);
     Regen = new RegenSet(pk);
     Shiny = Regen.Extra.IsShiny;
 }