コード例 #1
0
        private static void ApplyEncounterAttributes(PKM pk, IBattleTemplate set, EncounterStatic el)
        {
            pk.Met_Location     = el.Location;
            pk.Met_Level        = el.Level;
            pk.CurrentLevel     = 100;
            pk.FatefulEncounter = el.Fateful;
            if (el.RibbonWishing && pk is IRibbonSetEvent4 e4)
            {
                e4.RibbonWishing = true;
            }
            pk.SetRelearnMoves(el.Relearn);

            if (set.Shiny && (el.Shiny == Shiny.Always || el.Shiny == Shiny.Random))
            {
                pk.SetShiny();
            }
            else if (el.Shiny == Shiny.Never && pk.IsShiny)
            {
                pk.PID ^= 0x10000000;
            }
            else
            {
                pk.SetPIDGender(pk.Gender);
            }
        }
コード例 #2
0
ファイル: EncounterStatic.cs プロジェクト: sonnynomnom/PKHeX
 public EncounterStatic[] Clone(int[] locations)
 {
     EncounterStatic[] Encounters = new EncounterStatic[locations.Length];
     for (int i = 0; i < locations.Length; i++)
     {
         Encounters[i] = Clone(locations[i]);
     }
     return(Encounters);
 }
コード例 #3
0
ファイル: EncounterStatic.cs プロジェクト: sonnynomnom/PKHeX
 public EncounterStatic[] DreamRadarClone()
 {
     EncounterStatic[] Encounters = new EncounterStatic[8];
     for (int i = 0; i < 8; i++)
     {
         Encounters[i] = DreamRadarClone(5 * i + 5);  //Level from 5->40 depends on the number of badage
     }
     return(Encounters);
 }
コード例 #4
0
        /// <summary>
        /// Secondary fallback if PIDType.None to slot the PKM into its most likely type
        /// </summary>
        /// <param name="pk">PKM to modify</param>
        /// <returns>PIDType that is likely used</returns>
        private static PIDType FindLikelyPIDType(PKM pk)
        {
            if (BruteForce.UsesEventBasedMethod(pk.Species, pk.Moves, PIDType.BACD_R))
            {
                return(PIDType.BACD_R);
            }
            if (BruteForce.UsesEventBasedMethod(pk.Species, pk.Moves, PIDType.Method_2))
            {
                return(PIDType.Method_2);
            }
            if (pk.Species == (int)Species.Manaphy && pk.Gen4)
            {
                pk.Egg_Location = Locations.LinkTrade4; // todo: really shouldn't be doing this, don't modify pkm
                return(PIDType.Method_1);
            }
            switch (pk.GenNumber)
            {
            case 3:
                switch (EncounterFinder.FindVerifiedEncounter(pk).EncounterMatch)
                {
                case WC3 g:
                    return(g.Method);

                case EncounterStatic _:
                    switch (pk.Version)
                    {
                    case (int)GameVersion.CXD: return(PIDType.CXD);

                    case (int)GameVersion.E: return(PIDType.Method_1);

                    case (int)GameVersion.FR:
                    case (int)GameVersion.LG:
                        return(PIDType.Method_1);            // roamer glitch

                    default:
                        return(PIDType.Method_1);
                    }

                case EncounterSlot _ when pk.Version == (int)GameVersion.CXD:
                    return(PIDType.PokeSpot);

                case EncounterSlot _:
                    return(pk.Species == (int)Species.Unown ? PIDType.Method_1_Unown : PIDType.Method_1);

                default:
                    return(PIDType.None);
                }

            case 4:
                return(EncounterFinder.FindVerifiedEncounter(pk).EncounterMatch switch
                {
                    EncounterStatic s when s.Location == Locations.PokeWalker4 && s.Gift => PIDType.Pokewalker,
                    EncounterStatic s => (s.Shiny == Shiny.Always ? PIDType.ChainShiny : PIDType.Method_1),
                    PGT _ => PIDType.Method_1,
                    _ => PIDType.None
                });
コード例 #5
0
 private static int GetForm(IEncounterable enc)
 {
     return(enc switch
     {
         EncounterSlot s => s.Form,
         EncounterStatic s => s.Form,
         MysteryGift m => m.Form,
         EncounterTrade t => t.Form,
         _ => 0
     });