Beispiel #1
0
        public void VerifyG1(LegalityAnalysis data)
        {
            var pkm            = data.pkm;
            var EncounterMatch = data.EncounterOriginal;

            if (pkm.IsEgg)
            {
                int elvl = Legal.GetEggHatchLevel(pkm);
                if (elvl != pkm.CurrentLevel)
                {
                    data.AddLine(GetInvalid(string.Format(LEggFMetLevel_0, elvl)));
                }
                return;
            }
            if (pkm.Met_Location != 0) // crystal
            {
                int lvl = pkm.CurrentLevel;
                if (lvl < pkm.Met_Level)
                {
                    data.AddLine(GetInvalid(LLevelMetBelow));
                }
            }

            // There is no way to prevent a gen1 trade evolution as held items (everstone) did not exist.
            // Machoke, Graveler, Haunter and Kadabra captured in the second phase evolution, excluding in-game trades, are already checked
            if (pkm.Format <= 2 && !(EncounterMatch is EncounterTrade) && EncounterMatch.Species == pkm.Species && GBRestrictions.Trade_Evolution1.Contains(EncounterMatch.Species))
            {
                VerifyG1TradeEvo(data);
            }
        }
Beispiel #2
0
        public override void Verify(LegalityAnalysis data)
        {
            var pkm            = data.pkm;
            var EncounterMatch = data.EncounterMatch;

            if (EncounterMatch is MysteryGift gift)
            {
                if (gift.Level != pkm.Met_Level && pkm.HasOriginalMetLocation)
                {
                    switch (gift)
                    {
                    case WC3 wc3 when wc3.Met_Level == pkm.Met_Level || wc3.IsEgg:
                        break;

                    case WC7 wc7 when wc7.MetLevel == pkm.Met_Level:
                        break;

                    default:
                        data.AddLine(GetInvalid(V83));
                        return;
                    }
                }
                if (gift.Level > pkm.CurrentLevel)
                {
                    data.AddLine(GetInvalid(V84));
                    return;
                }
            }

            if (pkm.IsEgg)
            {
                int elvl = Legal.GetEggHatchLevel(pkm);
                if (elvl != pkm.CurrentLevel)
                {
                    data.AddLine(GetInvalid(string.Format(V52, elvl)));
                }
                return;
            }

            int lvl = pkm.CurrentLevel;

            if (lvl < pkm.Met_Level)
            {
                data.AddLine(GetInvalid(V85));
            }
            else if (!EncounterMatch.IsWithinRange(pkm) && lvl != 100 && pkm.EXP == PKX.GetEXP(lvl, pkm.Species))
            {
                data.AddLine(Get(V87, Severity.Fishy));
            }
            else
            {
                data.AddLine(GetValid(V88));
            }
        }
Beispiel #3
0
        public override void Verify(LegalityAnalysis data)
        {
            var pkm            = data.pkm;
            var EncounterMatch = data.EncounterOriginal;

            if (EncounterMatch is MysteryGift gift)
            {
                if (gift.Level != pkm.Met_Level && pkm.HasOriginalMetLocation)
                {
                    switch (gift)
                    {
                    case WC3 wc3 when wc3.Met_Level == pkm.Met_Level || wc3.IsEgg:
                        break;

                    case WC7 wc7 when wc7.MetLevel == pkm.Met_Level:
                        break;

                    default:
                        data.AddLine(GetInvalid(LLevelMetGift));
                        return;
                    }
                }
                if (gift.Level > pkm.CurrentLevel)
                {
                    data.AddLine(GetInvalid(LLevelMetGiftFail));
                    return;
                }
            }

            if (pkm.IsEgg)
            {
                int elvl = Legal.GetEggHatchLevel(pkm);
                if (elvl != pkm.CurrentLevel)
                {
                    data.AddLine(GetInvalid(string.Format(LEggFMetLevel_0, elvl)));
                    return;
                }

                var reqEXP = EncounterMatch is EncounterStatic s && s.Version == GameVersion.C
                    ? 125 // Gen2 Dizzy Punch gifts always have 125 EXP, even if it's more than the Lv5 exp required.
                    : Experience.GetEXP(elvl, pkm.Species, pkm.AltForm);
                if (reqEXP != pkm.EXP)
                {
                    data.AddLine(GetInvalid(LEggEXP));
                }
                return;
            }

            int lvl = pkm.CurrentLevel;

            if (lvl < pkm.Met_Level)
            {
                data.AddLine(GetInvalid(LLevelMetBelow));
            }
            else if (!EncounterMatch.IsWithinRange(pkm) && lvl != 100 && pkm.EXP == Experience.GetEXP(lvl, pkm.Species, pkm.AltForm))
            {
                data.AddLine(Get(LLevelEXPThreshold, Severity.Fishy));
            }
            else
            {
                data.AddLine(GetValid(LLevelMetSane));
            }
        }