public SimulationCard(SimulationCard card) { parent = card.parent; attack = card.attack; health = card.health; hasGuard = card.hasGuard; hasLethal = card.hasLethal; hasWard = card.hasWard; }
public static void FindTrades(Player player, SimulationGroup parent = null) { var enemyPlayer = player.isMe ? Player.enemy : Player.me; var enemyCards = enemyPlayer.boardCards .OrderBy(c => c.hasGuard ? 0 : 1) .ThenByDescending(c => c.health); /*var print = player.isMe ? "My " : "Enemy "; * print += "Useable Cards: "; * * foreach(var card in player.usableCards) * { * print += card.id + " "; * } * * Console.Error.WriteLine(print);*/ List <Card> newUseableCards = parent != null? player.usableCards.Where(c => !parent.targets.Contains(c)).ToList() : player.usableCards; foreach (var enemy in enemyCards) { if (parent != null) { var target = SimulationCard.GetSimulationCard(enemy, parent); if (target != null) { if (!(target.health > 0 && (target.attack > 0 || target.hasGuard))) { continue; } } } if (enemy.health > 0 && (enemy.attack > 0 || enemy.hasGuard)) { GetTradeOptions(newUseableCards, player, enemy, parent); } } }
public bool ComputeScoreHelper(Card spellTarget = null, List <SimulationCard> storedSimulatedCards = null) { enemyCost = 0; myCost = 0; bonusScore = 0; SimulationCard sTarget = SimulationCard.NewSimulationCard(target, playerTrade); foreach (var card in myCards) { if (sTarget.health <= 0) //overkill { overkill = true; break; } simulationCards.Add(card); SimulationCard sCard = SimulationCard.NewSimulationCard(card, playerTrade); if (storedSimulatedCards != null) { storedSimulatedCards.Add(sCard); } else { card.simulationCards.Add(this, sCard); } if (card.type == CardType.Creature) { //check if enough room for summon if (card.hasCharge && card.location == CardLocation.PlayerHands) { } if (spellTarget != null && spellTarget == card) { if (spellCard.hasWard) { sCard.hasWard = true; } if (spellCard.hasLethal) { sCard.hasLethal = true; } sCard.attack += spellCard.attack; sCard.health += spellCard.health; } if (sTarget.hasWard)// && card.attack > 0) { sTarget.hasWard = false; } else { if (sCard.hasLethal) { sTarget.health = 0; } else { sTarget.health -= sCard.attack; } } var cardHealthLeft = sCard.health - sTarget.attack; if (!sCard.hasWard) { if (sTarget.hasLethal) { cardHealthLeft = 0; } if (cardHealthLeft <= 0) { myCost += sCard.health + sCard.attack; } else { myCost += sCard.health - cardHealthLeft; //bonusScore += cardAttack; } } } else { if (card.type == CardType.Red || card.type == CardType.Blue) { myCost += card.cost * 2; bonusScore += card.cardDraw * 3; if (card.health < 0) { if (sTarget.hasWard) { sTarget.hasWard = false; } else { sTarget.health += card.health; } } sTarget.attack += card.attack; if (card.hasWard) { sTarget.hasWard = false; } if (card.hasLethal) { sTarget.hasLethal = false; } if (card.hasGuard) //lazy coding { if (target.hasGuard) { //score = target.health; //return true; } } } } } enemyCost = target.health + target.attack + target.bonusValue; /*if (target.hasLethal) * { * if (Player.me.highestCardOnBoard != null) * { * enemyCost += Player.me.highestCardOnBoard.health + Player.me.highestCardOnBoard.attack; * } * }*/ score = enemyCost - myCost + bonusScore; if (sTarget.health <= 0 && overkill == false) { targetKilleable = true; return(true); } else { return(false); } }