Ejemplo n.º 1
0
        private void VerifySWSHStats(LegalityAnalysis data, PK8 pk8)
        {
            if (pk8.Favorite)
            {
                data.AddLine(GetInvalid(LFavoriteMarkingUnavailable, Encounter));
            }

            var gflag = data.EncounterMatch is IGigantamax g && g.CanGigantamax;

            if (gflag != pk8.CanGigantamax)
            {
                data.AddLine(GetInvalid(LStatGigantamaxInvalid));
            }

            if (pk8.DynamaxLevel != 0)
            {
                if (pk8.IsEgg || pk8.DynamaxLevel > 10 || pk8.Species >= (int)Species.Zacian)
                {
                    data.AddLine(GetInvalid(LStatDynamaxInvalid));
                }
            }

            PersonalInfo?pi = null;

            for (int i = 0; i < 100; i++)
            {
                if (!pk8.GetMoveRecordFlag(i))
                {
                    continue;
                }
                if (!(pi ??= pk8.PersonalInfo).TMHM[i + 100])
                {
                    data.AddLine(GetInvalid(string.Format(LMoveSourceTR, LegalityAnalysis.MoveStrings[Legal.TMHM_SWSH[i + 100]])));
                }
            }

            // weight/height scalars can be legally 0 (1:65536) so don't bother checking
        }
Ejemplo n.º 2
0
        private void VerifySWSHStats(LegalityAnalysis data, PK8 pk8)
        {
            if (pk8.Favorite)
            {
                data.AddLine(GetInvalid(LFavoriteMarkingUnavailable, Encounter));
            }

            var sn = pk8.StatNature;

            if (sn != pk8.Nature)
            {
                // Only allow Serious nature (12); disallow all other neutral natures.
                if (sn != 12 && (sn > 24 || sn % 6 == 0))
                {
                    data.AddLine(GetInvalid(LStatNatureInvalid));
                }
            }

            var bv = pk8.BattleVersion;

            if (bv != 0)
            {
                if ((bv != (int)GameVersion.SW && bv != (int)GameVersion.SH) || pk8.SWSH)
                {
                    data.AddLine(GetInvalid(LStatBattleVersionInvalid));
                }
            }

            var  enc        = data.EncounterMatch;
            bool originGMax = enc is IGigantamax g && g.CanGigantamax;

            if (originGMax != pk8.CanGigantamax)
            {
                bool ok  = !pk8.IsEgg && pk8.CanToggleGigantamax(pk8.Species, pk8.AltForm, enc.Species, enc.Form);
                var  chk = ok ? GetValid(LStatGigantamaxValid) : GetInvalid(LStatGigantamaxInvalid);
                data.AddLine(chk);
            }

            if (pk8.DynamaxLevel != 0)
            {
                if (!pk8.CanHaveDynamaxLevel(pk8) || pk8.DynamaxLevel > 10)
                {
                    data.AddLine(GetInvalid(LStatDynamaxInvalid));
                }
            }

            PersonalInfo?pi = null;

            for (int i = 0; i < 100; i++)
            {
                if (!pk8.GetMoveRecordFlag(i))
                {
                    continue;
                }
                if ((pi ??= pk8.PersonalInfo).TMHM[i + 100])
                {
                    continue;
                }

                // Calyrex-0 can have TR flags for Calyrex-1/2 after it has force unlearned them.
                // Re-fusing can be reacquire the move via relearner, rather than needing another TR.
                // Calyrex-0 cannot reacquire the move via relearner, even though the TR is checked off in the TR list.
                if (pk8.Species == (int)Species.Calyrex)
                {
                    var form = pk8.AltForm;
                    // Check if another alt form can learn the TR
                    if ((form != 1 && CanLearnTR((int)Species.Calyrex, 1, i)) || (form != 2 && CanLearnTR((int)Species.Calyrex, 2, i)))
                    {
                        continue;
                    }
                }

                data.AddLine(GetInvalid(string.Format(LMoveSourceTR, ParseSettings.MoveStrings[Legal.TMHM_SWSH[i + 100]])));
            }

            // weight/height scalars can be legally 0 (1:65536) so don't bother checking
        }
Ejemplo n.º 3
0
        private void VerifySWSHStats(LegalityAnalysis data, PK8 pk8)
        {
            if (pk8.Favorite)
            {
                data.AddLine(GetInvalid(LFavoriteMarkingUnavailable, Encounter));
            }

            var sn = pk8.StatNature;

            if (sn != pk8.Nature)
            {
                // Only allow Serious nature (12); disallow all other neutral natures.
                if (sn != 12 && (sn > 24 || sn % 6 == 0))
                {
                    data.AddLine(GetInvalid(LStatNatureInvalid));
                }
            }

            var bv = pk8.BattleVersion;

            if (bv != 0)
            {
                if ((bv != (int)GameVersion.SW && bv != (int)GameVersion.SH) || pk8.SWSH)
                {
                    data.AddLine(GetInvalid(LStatBattleVersionInvalid));
                }
            }

            var  enc        = data.EncounterMatch;
            bool originGMax = enc is IGigantamax g && g.CanGigantamax;

            if (originGMax != pk8.CanGigantamax)
            {
                bool ok  = pk8.CanToggleGigantamax(pk8.Species, pk8.AltForm, enc.Species, enc.Form);
                var  chk = ok ? GetValid(LStatGigantamaxValid) : GetInvalid(LStatGigantamaxInvalid);
                data.AddLine(chk);
            }

            if (pk8.DynamaxLevel != 0)
            {
                if (!pk8.CanHaveDynamaxLevel(pk8) || pk8.DynamaxLevel > 10)
                {
                    data.AddLine(GetInvalid(LStatDynamaxInvalid));
                }
            }

            PersonalInfo?pi = null;

            for (int i = 0; i < 100; i++)
            {
                if (!pk8.GetMoveRecordFlag(i))
                {
                    continue;
                }
                if (!(pi ??= pk8.PersonalInfo).TMHM[i + 100])
                {
                    data.AddLine(GetInvalid(string.Format(LMoveSourceTR, LegalityAnalysis.MoveStrings[Legal.TMHM_SWSH[i + 100]])));
                }
            }

            // weight/height scalars can be legally 0 (1:65536) so don't bother checking
        }