Esempio n. 1
0
        /// <summary>
        /// Checks if a Gen1 trade evolution must have occurred.
        /// </summary>
        private static bool IsTradeEvolutionRequired(LegalityAnalysis data, IEncounterTemplate enc)
        {
            // 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
            var pkm     = data.pkm;
            var species = pkm.Species;

            // This check is only applicable if it's a trade evolution that has not been evolved.
            if (!GBRestrictions.Trade_Evolution1.Contains(enc.Species) || enc.Species != species)
            {
                return(false);
            }

            // Context check is only applicable to gen1/2; transferring to Gen2 is a trade.
            // Stadium 2 can transfer across game/generation boundaries without initiating a trade.
            // Ignore this check if the environment's loaded trainer is not from Gen1/2 or is from GB Era.
            if (ParseSettings.ActiveTrainer.Generation >= 3 || ParseSettings.AllowGBCartEra)
            {
                return(false);
            }

            // Gen2 stuff can be traded between Gen2 games holding an Everstone, assuming it hasn't been transferred to Gen1 for special moves.
            if (enc.Generation == 2)
            {
                return(data.Info.Moves.All(z => z.Generation == 2));
            }
            // Gen1 stuff can only be un-evolved if it was never traded from the OT.
            if (data.Info.Moves.Any(z => z.Generation != 1))
            {
                return(true); // traded to Gen2 for special moves
            }
            if (pkm.Format != 1)
            {
                return(true);                                // traded to Gen2 (current state)
            }
            return(!ParseSettings.IsFromActiveTrainer(pkm)); // not with OT
        }
Esempio n. 2
0
        private void VerifyG1TradeEvo(LegalityAnalysis data)
        {
            var pkm        = data.pkm;
            var mustevolve = pkm.TradebackStatus == TradebackType.WasTradeback || (pkm.Format == 1 && !ParseSettings.IsFromActiveTrainer(pkm)) || GBRestrictions.IsTradedKadabraG1(pkm);

            if (!mustevolve)
            {
                return;
            }
            // Pokemon have been traded but it is not evolved, trade evos are sequential dex numbers
            var unevolved = LegalityAnalysis.SpeciesStrings[pkm.Species];
            var evolved   = LegalityAnalysis.SpeciesStrings[pkm.Species + 1];

            data.AddLine(GetInvalid(string.Format(LEvoTradeReqOutsider, unevolved, evolved)));
        }
Esempio n. 3
0
        private void VerifyG1TradeEvo(LegalityAnalysis data)
        {
            // Context check is only applicable to gen1/2; transferring to Gen2 is a trade.
            // Stadium 2 can transfer across game/generation boundaries without initiating a trade.
            if (ParseSettings.ActiveTrainer.Generation >= 3 || ParseSettings.AllowGBCartEra)
            {
                return;
            }

            var pkm        = data.pkm;
            var mustevolve = pkm.TradebackStatus == TradebackType.WasTradeback || (pkm.Format == 1 && !ParseSettings.IsFromActiveTrainer(pkm)) || GBRestrictions.IsTradedKadabraG1(pkm);

            if (!mustevolve)
            {
                return;
            }

            // Pokemon have been traded but it is not evolved, trade evolutions are sequential dex numbers
            var evolved   = ParseSettings.SpeciesStrings[pkm.Species + 1];
            var unevolved = ParseSettings.SpeciesStrings[pkm.Species];

            data.AddLine(GetInvalid(string.Format(LEvoTradeReqOutsider, unevolved, evolved)));
        }
Esempio n. 4
0
 private void VerifyG1TradeEvo(LegalityAnalysis data)
 {
     if (ParseSettings.ActiveTrainer.Generation >= 3)
         return; // context check is only applicable to gen1/2; transferring to gen2 is a trade.
     var pkm = data.pkm;
     var mustevolve = pkm.TradebackStatus == TradebackType.WasTradeback || (pkm.Format == 1 && !ParseSettings.IsFromActiveTrainer(pkm)) || GBRestrictions.IsTradedKadabraG1(pkm);
     if (!mustevolve)
         return;
     // Pokemon have been traded but it is not evolved, trade evos are sequential dex numbers
     var evolved = LegalityAnalysis.SpeciesStrings[pkm.Species + 1];
     var unevolved = LegalityAnalysis.SpeciesStrings[pkm.Species];
     data.AddLine(GetInvalid(string.Format(LEvoTradeReqOutsider, unevolved, evolved)));
 }