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); }
public void TestMethod() { //arrange //act BaseCards winner = BattleLogic.Attack(_firedragon, _waterSpell); //assert Assert.AreEqual(_waterSpell.getCardDamage(), winner.getCardDamage()); }
public static int CalcPreis(BaseCards card) { float temp = 0; temp = card.getCardDamage() * 0.25f - 1f; //weil man in einem Pack 4 Karten bekommt, ein pack 25 coins kostet und der damage von 0 bis 50 sein kann if (temp == 0) { temp = 1; } return(Convert.ToInt32(temp)); }
public static int GetEffektivDemage(BaseCards first, BaseCards second) { double temp = first.getCardDamage(); switch (first.getElementTypes()) { case elementTypes.Fire: { if (second.getElementTypes() == elementTypes.Normal) { Console.WriteLine("Feuer ist effektiv gegen Normal"); temp = first.getCardDamage() * 1.5; } else { temp = first.getCardDamage(); } break; } case elementTypes.Water: { if (second.getElementTypes() == elementTypes.Fire) { Console.WriteLine("Wasser ist effektiv gegen Feuer"); temp = first.getCardDamage() * 1.5; } else { temp = first.getCardDamage(); } break; } case elementTypes.Normal: { if (second.getElementTypes() == elementTypes.Water) { Console.WriteLine("Normal ist effektiv gegen Wasser"); temp = first.getCardDamage() * 1.5; } else { temp = first.getCardDamage(); } break; } } Console.WriteLine($"Der effektive Damage ist: {Convert.ToInt32(temp)} "); return(Convert.ToInt32(temp)); }
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); } }
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); }