Example #1
0
        public static bool ValidateAttack(BaseCards Player1, BaseCards Player2)
        {
            if ((Player1.getCardProperty() == cardProperty.Goblin) && (Player2.getCardProperty() == cardProperty.Dragon))
            {
                Console.WriteLine("Goblin cannot attack Dragon");
                return(false);
            }
            else if ((Player1.getCardProperty() == cardProperty.Ork) && (Player2.getCardProperty() == cardProperty.Wizard))
            {
                Console.WriteLine("Org cannot attack Wizard");
                return(false);
            }
            else if ((Player1.getCardProperty() == cardProperty.Knight) && (Player2.getCardType() == cardTypes.Spell) && (Player2.getElementTypes() == elementTypes.Water))
            {
                Console.WriteLine("Knight cannot attack WaterSpell");
                return(false);
            }
            else if ((Player1.getCardProperty() == cardProperty.Kraken) && (Player2.getCardType() == cardTypes.Spell))
            {
                Console.WriteLine("Kraken is immune to Spells");
                return(false);
            }
            else if ((Player1.getCardProperty() == cardProperty.Dragon) && (Player2.getCardProperty() == cardProperty.Elf) && (Player2.getElementTypes() == elementTypes.Fire))
            {
                Console.WriteLine("Dragon cannot attack FireElves");
                return(false);
            }


            return(true);
        }
Example #2
0
        public static bool ChekTrade(string cardWantToHave, List <TradingObject> cardListToTrade, string choiceToTrade, List <BaseCards> userCardcollection, string answerToTrade)
        {
            BaseCards     card          = userCardcollection[Int32.Parse(choiceToTrade) - 1];
            BaseCards     checkFromCard = cardListToTrade[Int32.Parse(cardWantToHave) - 1].card;
            TradingObject tempObject    = cardListToTrade[Int32.Parse(cardWantToHave) - 1];
            bool          indicator     = false;

            int    damage = tempObject.requiredDamage; //damage den man will
            string temp   = tempObject.wantedCardType;

            if (temp.Contains("Spell"))
            {
                if (MyEnum.cardTypes.Spell == card.getCardType())
                {
                    if (card.getCardDamage() >= damage)
                    {
                        indicator = true;
                    }
                }
            }
            else if (temp.Contains("Monster"))
            {
                if (MyEnum.cardTypes.Monster == card.getCardType())
                {
                    if (card.getCardDamage() >= damage)
                    {
                        indicator = true;
                    }
                }
            }
            return(indicator);
        }
Example #3
0
 static string CheckCardtype(BaseCards Player)
 {
     if (Player.getCardType() == cardTypes.Monster)
     {
         return(Player.getCardProperty().ToString() + ", ");
     }
     return("");
 }
Example #4
0
        public static BaseCards Attack(BaseCards attacker, BaseCards defender)
        {
            int damageAttacker;
            int damageDefender;

            switch (attacker.getCardType())
            {
            case cardTypes.Monster when defender.getCardType() == cardTypes.Monster:

                Console.WriteLine($"Der effektive Damage ist: {attacker.getCardDamage()} ");

                Console.WriteLine($"Der effektive Damage ist: {defender.getCardDamage()} ");

                if (attacker.getCardDamage() > defender.getCardDamage())
                {
                    return(attacker);
                }

                return(defender);

            case cardTypes.Monster when defender.getCardType() == cardTypes.Spell:
                // monster attacks Spell
                damageAttacker = GetEffektivDemage(attacker, defender);

                damageDefender = GetEffektivDemage(defender, attacker);

                if (damageAttacker > damageDefender)
                {
                    return(attacker);
                }

                return(defender);

            case cardTypes.Spell when defender.getCardType() == cardTypes.Monster:


                // nur wenn nicht beide NORMAL sind
                damageAttacker = GetEffektivDemage(attacker, defender);

                damageDefender = GetEffektivDemage(defender, attacker);

                if (damageAttacker > damageDefender)
                {
                    return(attacker);
                }

                else
                {
                    return(defender);
                }

            case cardTypes.Spell when defender.getCardType() == cardTypes.Spell:

                //Spell attacks Spell
                damageAttacker = GetEffektivDemage(attacker, defender);

                damageDefender = GetEffektivDemage(defender, attacker);

                if (damageAttacker > damageDefender)
                {
                    return(attacker);
                }

                return(defender);

            default:

                // TODO: consider throw new InvalidDataException ?
                Console.WriteLine("Error occured!");
                return(attacker);
            }
        }
Example #5
0
 static void PrintInformationFromOneCard(BaseCards Player1, BaseCards Player2)
 {
     Console.WriteLine($"{Player1.getCardType()}, {Player1.getElementTypes()}, {CheckCardtype(Player1)} {Player1.getCardName()}, | attacks | {Player2.getCardType()}, {Player2.getElementTypes()}, {CheckCardtype(Player2)} {Player2.getCardName()}");
 }
Example #6
0
        public static string MakeQueryForCreateNewCard(BaseCards baseCard)
        {
            string temp = "Insert into cardcollection\n" +
                          "(card_uid, element_type, card_property, card_type, card_name, card_damage)\n" +
                          "VALUES\n" +
                          "('" + baseCard.getUID() + "', '" + baseCard.getElementTypes() + "', '" + baseCard.getCardProperty() + "', '" + baseCard.getCardType() + "', '" + baseCard.getCardName() + "', '" + baseCard.getCardDamage() + "');";

            return(temp);
        }