Example #1
0
    private CheckResult VerifyForm(LegalityAnalysis data)
    {
        var pk           = data.Entity;
        var PersonalInfo = data.PersonalInfo;

        int count = PersonalInfo.FormCount;
        var form  = pk.Form;

        if (count <= 1 && form == 0)
        {
            return(VALID); // no forms to check
        }
        var species = pk.Species;
        var enc     = data.EncounterMatch;
        var Info    = data.Info;

        if (!PersonalInfo.IsFormWithinRange(form) && !FormInfo.IsValidOutOfBoundsForm(species, form, Info.Generation))
        {
            return(GetInvalid(string.Format(LFormInvalidRange, count - 1, form)));
        }

        switch ((Species)species)
        {
        case Pikachu when Info.Generation == 6:     // Cosplay
            bool isStatic     = enc is EncounterStatic6;
            bool validCosplay = form == (isStatic ? enc.Form : 0);
            if (!validCosplay)
            {
                return(GetInvalid(isStatic ? LFormPikachuCosplayInvalid : LFormPikachuCosplay));
            }
            break;

        case Pikachu when form is not 0 && ParseSettings.ActiveTrainer is SAV7b {
                Version: GameVersion.GE
        } :

        case Eevee when form is not 0 && ParseSettings.ActiveTrainer is SAV7b {
                Version: GameVersion.GP
        } :
            return(GetInvalid(LFormBattle));