Exemple #1
0
        //----------------------------------------------------create the card-----------------------------------------------------------------
        private Card CreateCard(string cardId)
        {
            List <string> cardData = Database.selectCardData(cardId);
            string        cardname = cardData[0];
            float         damage   = float.Parse(cardData[1]);
            string        cardtype = cardData[2];
            string        element  = cardData[3];

            if (cardtype == "Monster")
            {
                switch (cardname)
                {
                case "Dragon":
                    Card dragonCard = new Dragon(damage);
                    return(dragonCard);

                case "FireElfe":
                    Card elfCard = new FireElfe(damage);
                    return(elfCard);

                case "Knight":
                    Card knightCard = new Knight(damage);
                    return(knightCard);

                case "Ork":
                    Card orkCard = new Ork(damage);
                    return(orkCard);

                case "WaterGoblin":
                    Card goblinCard = new WaterGoblin(damage);
                    return(goblinCard);

                case "Wizzard":
                    Card wizzardCard = new Wizzard(damage);
                    return(wizzardCard);
                }
            }
            else if (cardtype == "Spell")
            {
                switch (cardname)
                {
                case "RegularSpell":
                    Card normalCard = new NormalSpell(damage);
                    return(normalCard);

                case "FireSpell":
                    Card fireCard = new FireSpell(damage);
                    return(fireCard);

                case "WaterSpell":
                    Card waterCard = new WaterSpell(damage);
                    return(waterCard);
                }
            }


            return(null);
        }