Example #1
0
        private void SetForms()
        {
            int  species  = WinFormsUtil.GetIndex(CB_Species);
            bool hasForms = AltFormInfo.HasFormSelection(PersonalTable.AO[species], species, 6);

            CB_Form.Enabled = CB_Form.Visible = hasForms;

            CB_Form.InitializeBinding();
            CB_Form.DataSource = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation);
        }
        public static void SanitizeForm(this RegenTemplate set)
        {
            if (!AltFormInfo.IsBattleOnlyForm(set.Species, set.FormIndex, set.Format))
            {
                return;
            }

            if (set.Species == (int)Species.Darmanitan)
            {
                set.FormIndex &= 2;
            }
            else if (set.Species == (int)Species.Zygarde && set.FormIndex == 4)
            {
                set.FormIndex = 3; // Set to 50% Power Construct
            }
            else
            {
                set.FormIndex = 0;
            }
        }
Example #3
0
        private static bool DisallowSurpriseTrade(PKM pk)
        {
            // Anti-spam
            if (IsSpammyString(pk.OT_Name))
            {
                return(true);
            }

            // Surprise Trade currently bans Mythicals and Legendaries, not Sub-Legendaries.
            if (Legal.Legends.Contains(pk.Species))
            {
                return(true);
            }

            // Can't surprise trade fused stuff.
            if (AltFormInfo.IsFusedForm(pk.Species, pk.AltForm, pk.Format))
            {
                return(true);
            }

            return(false);
        }
 public static bool CanBeTraded(this PKM pkm)
 {
     return(!AltFormInfo.IsFusedForm(pkm.Species, pkm.AltForm, pkm.Format));
 }
Example #5
0
        private bool FillLBForms()
        {
            if (allModifying)
            {
                return(false);
            }
            LB_Forms.DataSource = null;
            LB_Forms.Items.Clear();

            int  fspecies = LB_Species.SelectedIndex + 1;
            var  bspecies = Dex.GetBaseSpecies(fspecies);
            bool hasForms = AltFormInfo.HasFormSelection(SAV.Personal[bspecies], bspecies, 7);

            LB_Forms.Enabled = hasForms;
            if (!hasForms)
            {
                return(false);
            }
            var ds = FormConverter.GetFormList(bspecies, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).ToList();

            if (ds.Count == 1 && string.IsNullOrEmpty(ds[0]))
            {
                // empty
                LB_Forms.Enabled = false;
                return(false);
            }

            // sanity check formes -- SM does not have totem form dex bits
            int count = SAV.Personal[bspecies].FormeCount;

            if (count < ds.Count)
            {
                ds.RemoveAt(count); // remove last
            }
            LB_Forms.DataSource = ds;
            if (fspecies <= SAV.MaxSpeciesID)
            {
                LB_Forms.SelectedIndex = 0;
            }
            else
            {
                int fc = SAV.Personal[bspecies].FormeCount;
                if (fc <= 1)
                {
                    return(true);
                }

                int f = Dex.DexFormIndexFetcher(bspecies, fc, SAV.MaxSpeciesID - 1);
                if (f < 0)
                {
                    return(true); // bit index valid
                }
                if (f > fspecies - LB_Forms.Items.Count - 1)
                {
                    LB_Forms.SelectedIndex = fspecies - f - 1;
                }
                else
                {
                    LB_Forms.SelectedIndex = -1;
                }
            }
            return(true);
        }