Ejemplo n.º 1
0
        private void UpdateFilters(object sender, EventArgs e)
        {
            TitleOnly       = TitleOnly_CheckBox.IsChecked.Value;
            DescriptionOnly = DescriptionOnly_CheckBox.IsChecked.Value;
            ExactWords      = ExactWords_CheckBox.IsChecked.Value;
            SortAlpha       = (Sorting_ComboBox.SelectedIndex == 0);
            SearchArchetype = SearchArchetype_CheckBox.IsChecked.Value;
            UseGOATFormat   = UseGoatFormat.IsChecked;

            ChosenCardType         = Helper.GetSelection <CardType>(CardType_ComboBox.SelectedIndex);
            ChosenMonsterCardType  = Helper.GetSelection <MonsterCardType>(MonsterCardType_ComboBox.SelectedIndex);
            ChosenMonsterAttribute = Helper.GetSelection <MonsterAttribute>(MonsterAttribute_ComboBox.SelectedIndex);
            ChosenMonsterType      = Helper.GetSelection <MonsterType>(MonsterType_ComboBox.SelectedIndex);
            ChosenMonster2ndType   = Helper.GetSelection <Monster2ndType>(Monster2ndType_ComboBox.SelectedIndex);
            ChosenSpellType        = Helper.GetSelection <SpellType>(SpellType_ComboBox.SelectedIndex);
            ChosenTrapType         = Helper.GetSelection <TrapType>(TrapType_ComboBox.SelectedIndex);

            LvlMin           = (LvlMin_TextBox.Text == "") ? -1 : int.Parse(LvlMin_TextBox.Text);
            LvlMax           = (LvlMax_TextBox.Text == "") ? -1 : int.Parse(LvlMax_TextBox.Text);
            AtkMin           = (AtkMin_TextBox.Text == "") ? -1 : int.Parse(AtkMin_TextBox.Text);
            AtkMax           = (AtkMax_TextBox.Text == "") ? -1 : int.Parse(AtkMax_TextBox.Text);
            DefMin           = (DefMin_TextBox.Text == "") ? -1 : int.Parse(DefMin_TextBox.Text);
            DefMax           = (DefMax_TextBox.Text == "") ? -1 : int.Parse(DefMax_TextBox.Text);
            PendulumScaleMin = (PendulumScalesMin_TextBox.Text == "") ? -1 : int.Parse(PendulumScalesMin_TextBox.Text);
            PendulumScaleMax = (PendulumScalesMax_TextBox.Text == "") ? -1 : int.Parse(PendulumScalesMax_TextBox.Text);

            CardLimitation = Limit_ComboBox.SelectedIndex - 1;

            MonsterCardType_ComboBox.Visibility    = Helper.CardTypeIsOfType(ChosenCardType, CardType.MONSTER) ? Visibility.Visible : Visibility.Collapsed;
            MonsterType_WrapPanel.Visibility       = Helper.CardTypeIsOfType(ChosenCardType, CardType.MONSTER) ? Visibility.Visible : Visibility.Collapsed;
            MonsterAttributes_WrapPanel.Visibility = Helper.CardTypeIsOfType(ChosenCardType, CardType.MONSTER) ? Visibility.Visible : Visibility.Collapsed;
            SpellType_WrapPanel.Visibility         = Helper.CardTypeIsOfType(ChosenCardType, CardType.SPELL) ? Visibility.Visible : Visibility.Collapsed;
            TrapType_WrapPanel.Visibility          = Helper.CardTypeIsOfType(ChosenCardType, CardType.TRAP) ? Visibility.Visible : Visibility.Collapsed;
            PendulumScales_WrapPanel.Visibility    = ChosenMonster2ndType.HasFlag(Monster2ndType.PENDULUM) ? Visibility.Visible : Visibility.Collapsed;

            if (CardType_ComboBox.SelectedIndex == 0)
            {
                ResetFilters(null, null);
            }

            UpdateDeck();
        }
Ejemplo n.º 2
0
        public static string ToString(MonsterCardType MonsterCardType, MonsterType MonsterType, Monster2ndType Monster2ndType, MonsterAttribute MonsterAttribute)
        {
            string ToReturn = "";

            if (Enum.IsDefined(MonsterAttribute.GetType(), MonsterAttribute))
            {
                ToReturn += '[' + MonsterAttribute.ToString() + "] ";
            }

            switch (MonsterType)
            {
            case MonsterType.AQUA:
                ToReturn += "Aqua";
                break;

            case MonsterType.BEAST:
                ToReturn += "Beast";
                break;

            case MonsterType.BEAST_WARRIOR:
                ToReturn += "Beast-Warrior";
                break;

            case MonsterType.CREATOR_GOD:
                ToReturn += "Creator-God";
                break;

            case MonsterType.CYBERSE:
                ToReturn += "Cyberse";
                break;

            case MonsterType.DINOSAUR:
                ToReturn += "Dinosaur";
                break;

            case MonsterType.DIVINE_BEAST:
                ToReturn += "Divine-Beast";
                break;

            case MonsterType.DRAGON:
                ToReturn += "Dragon";
                break;

            case MonsterType.FAIRY:
                ToReturn += "Fairy";
                break;

            case MonsterType.FIEND:
                ToReturn += "Fiend";
                break;

            case MonsterType.FISH:
                ToReturn += "Fish";
                break;

            case MonsterType.INSECT:
                ToReturn += "Insect";
                break;

            case MonsterType.MACHINE:
                ToReturn += "Machine";
                break;

            case MonsterType.PLANT:
                ToReturn += "Plant";
                break;

            case MonsterType.PSYCHIC:
                ToReturn += "Psychic";
                break;

            case MonsterType.PYRO:
                ToReturn += "Pyro";
                break;

            case MonsterType.REPTILE:
                ToReturn += "Reptile";
                break;

            case MonsterType.ROCK:
                ToReturn += "Rock";
                break;

            case MonsterType.SEA_SERPENT:
                ToReturn += "Sea Serpent";
                break;

            case MonsterType.SPELLCASTER:
                ToReturn += "Spellcaster";
                break;

            case MonsterType.THUNDER:
                ToReturn += "Thunder";
                break;

            case MonsterType.WARRIOR:
                ToReturn += "Warrior";
                break;

            case MonsterType.WINGED_BEAST:
                ToReturn += "Winged-Beast";
                break;

            case MonsterType.WYRM:
                ToReturn += "Wyrm";
                break;

            case MonsterType.ZOMBIE:
                ToReturn += "Zombie";
                break;

            default:
                return("");
            }

            switch (Monster2ndType)
            {
            case Monster2ndType.FLIP:
                ToReturn += "/Flip";
                break;

            case Monster2ndType.GEMINI:
                ToReturn += "/Gemini";
                break;

            case Monster2ndType.PENDULUM:
                ToReturn += "/Pendulum";
                break;

            case Monster2ndType.SPIRIT:
                ToReturn += "/Spirit";
                break;

            case Monster2ndType.TOON:
                ToReturn += "/Toon";
                break;

            case Monster2ndType.TUNER:
                ToReturn += "/Tuner";
                break;

            case Monster2ndType.UNION:
                ToReturn += "/Union";
                break;
            }

            switch (MonsterCardType)
            {
            case MonsterCardType.NORMAL:
                ToReturn += "/Normal";
                break;

            case MonsterCardType.EFFECT:
                ToReturn += "/Effect";
                break;

            case MonsterCardType.RITUAL:
                ToReturn += "/Ritual";
                break;

            case MonsterCardType.FUSION:
                ToReturn += "/Fusion";
                break;

            case MonsterCardType.SYNCHRO:
                ToReturn += "/Synchro";
                break;

            case MonsterCardType.XYZ:
                ToReturn += "/Xyz";
                break;

            case MonsterCardType.LINK:
                ToReturn += "/Link";
                break;
            }

            return(ToReturn);
        }
Ejemplo n.º 3
0
        public bool CheckCardCriteria(string UserInput,
                                      bool titleOnly,
                                      bool descriptionOnly,
                                      bool exactWords,
                                      bool SearchArchetype,
                                      CardType ChosenCardType,
                                      MonsterCardType ChosenMonsterCardType,
                                      MonsterAttribute ChosenMonsterAttribute,
                                      MonsterType ChosenMonsterType,
                                      Monster2ndType ChosenMonster2ndType,
                                      SpellType ChosenSpellType,
                                      TrapType ChosenTrapType,
                                      int LvlMin, int LvlMax,
                                      int AtkMin, int AtkMax,
                                      int DefMin, int DefMax,
                                      int PendulumScaleMin, int PendulumScaleMax,
                                      int CardLimitation)
        {
            bool ToReturn = ((ChosenCardType & Type) != 0);

            if (SearchArchetype && Archetype != null && ToReturn)
            {
                ToReturn |= Helper.CheckString(Archetype, UserInput);
            }

            if (titleOnly && !descriptionOnly)
            {
                ToReturn &= Helper.CheckString(Name, UserInput);
            }
            else if (descriptionOnly && !titleOnly)
            {
                ToReturn &= Helper.CheckString(Description, UserInput);
            }
            else
            {
                ToReturn &= (Helper.CheckString(Name, UserInput) || Helper.CheckString(Description, UserInput));
            }

            switch (Type)
            {
            case CardType.MONSTER:
                ToReturn &= ((ChosenMonsterCardType & MonsterCardType) != 0);
                ToReturn &= ((ChosenMonsterAttribute & MonsterAttribute) != 0);
                ToReturn &= ((ChosenMonsterType & MonsterType) != 0);
                ToReturn &= ((ChosenMonster2ndType & Monster2ndType) != 0 || (int)ChosenMonster2ndType == (1 << 8) - 1);
                if (LvlMin >= 0)
                {
                    ToReturn &= (LvlMin <= Level);
                }
                if (LvlMax >= 0)
                {
                    ToReturn &= (Level <= LvlMax);
                }
                if (AtkMin >= 0)
                {
                    ToReturn &= (AtkMin <= Atk);
                }
                if (AtkMax >= 0)
                {
                    ToReturn &= (Atk <= AtkMax);
                }
                if (DefMin >= 0)
                {
                    ToReturn &= (DefMin <= Def);
                }
                if (DefMax >= 0)
                {
                    ToReturn &= (Def <= DefMax);
                }
                if (Monster2ndType.HasFlag(Monster2ndType.PENDULUM) && PendulumScaleMin >= 0)
                {
                    ToReturn &= (PendulumScaleMin <= PendulumScale);
                }
                if (Monster2ndType.HasFlag(Monster2ndType.PENDULUM) && PendulumScaleMax >= 0)
                {
                    ToReturn &= (PendulumScale <= PendulumScaleMax);
                }
                break;

            case CardType.SPELL:
                ToReturn &= ((ChosenSpellType & SpellType) != 0);
                break;

            case CardType.TRAP:
                ToReturn &= ((ChosenTrapType & TrapType) != 0);
                break;

            default:
                return(false);
            }
            if (CardLimitation >= 0)
            {
                ToReturn &= (Limitation == CardLimitation);
            }
            return(ToReturn);
        }
Ejemplo n.º 4
0
        public Card(JToken Token, bool UseGoatFormat)
        {
            try
            {
                Id          = Token.Value <string>("id");
                Name        = Token.Value <string>("name");
                Description = Token.Value <string>("desc");
                Limitation  = Helper.GetLimitationByString(Token.Value <string>("ban_tcg"));
                if (UseGoatFormat)
                {
                    Limitation = Helper.GetLimitationByString(Token.Value <string>("ban_goat"));
                }

                Type     = Helper.GetCardTypeByString(Token.Value <string>("type"));
                DeckPart = DeckPart.MAIN_DECK;

                switch (Type)
                {
                case CardType.MONSTER:
                    MonsterCardType = Helper.GetMonsterCardTypeByString(Token.Value <string>("type"));
                    if (MonsterCardType == MonsterCardType.FUSION ||
                        MonsterCardType == MonsterCardType.SYNCHRO ||
                        MonsterCardType == MonsterCardType.XYZ ||
                        MonsterCardType == MonsterCardType.LINK)
                    {
                        DeckPart = DeckPart.EXTRA_DECK;
                    }
                    MonsterType      = Helper.GetMonsterTypeByString(Token.Value <string>("race"));
                    Monster2ndType   = Helper.GetMonster2ndCardTypeByString(Token.Value <string>("type"));
                    MonsterAttribute = Helper.GetMonsterAttributeByString(Token.Value <string>("attribute"));
                    Atk = Token.Value <int>("atk");
                    if (MonsterCardType != MonsterCardType.LINK)
                    {
                        Level = Token.Value <int>("level");
                        Def   = Token.Value <int>("def");
                        if (Monster2ndType == Monster2ndType.PENDULUM)
                        {
                            PendulumScale = Token.Value <int>("scale");
                        }
                    }
                    else
                    {
                        Level = Token.Value <int>("linkval");
                    }
                    break;

                case CardType.SPELL:
                    SpellType = Helper.GetSpellTypeByString(Token.Value <string>("race"));
                    break;

                case CardType.TRAP:
                    TrapType = Helper.GetTrapTypeByString(Token.Value <string>("race"));
                    break;

                default:
                    break;
                }

                this.ImgUrl      = Token.Value <string>("image_url");
                this.ImgUrlSmall = Token.Value <string>("image_url_small");
                this.Archetype   = Token.Value <string>("archetype");
            }
            catch (Exception e)
            {
            }
        }