Beispiel #1
0
        private static bool CanKnowMove(PKM pkm, MemoryVariableSet memory, int gen, LegalInfo info, bool battleOnly = false)
        {
            var move = memory.Variable;

            if (move == 0)
            {
                return(false);
            }

            if (pkm.HasMove(move))
            {
                return(true);
            }

            if (Legal.GetCanKnowMove(pkm, memory.Variable, gen, info.EvoChainsAllGens))
            {
                return(true);
            }

            var enc = info.EncounterMatch;

            if (enc is IMoveset ms && ms.Moves.Contains(move))
            {
                return(true);
            }

            if (battleOnly)
            {
                // Some moves can only be known in battle; outside of battle they aren't obtainable as a memory parameter.
                switch (move)
                {
                case 781 when pkm.Species == (int)Species.Zacian:     // Behemoth Blade
                case 782 when pkm.Species == (int)Species.Zamazenta:  // Behemoth Blade
                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
        private static GBEncounterPriority GetGBEncounterPriority(PKM pkm, IEncounterable Encounter)
        {
            switch (Encounter)
            {
            case EncounterTrade1 t1:
                return(t1.IsEncounterTrade1Valid(pkm) ? GBEncounterPriority.TradeEncounterG1 : GBEncounterPriority.Least);

            case EncounterTrade2 _:
                return(GBEncounterPriority.TradeEncounterG2);

            case EncounterStatic s:
                if (s.Moves.Count != 0 && s.Moves[0] != 0 && pkm.HasMove(s.Moves[0]))
                {
                    return(GBEncounterPriority.SpecialEncounter);
                }
                return(GBEncounterPriority.StaticEncounter);

            case EncounterSlot _:
                return(GBEncounterPriority.WildEncounter);

            default:
                return(GBEncounterPriority.EggEncounter);
            }
        }