public void doTurn(int player) { printDebugMessage("Player " + player + " attacking.", OutputPriority.ATTACKERS); BoardSide current = getBoardFromPlayer(player); BoardSide other = player == 1 ? p2Board : p1Board; if (!current.hasAvailableAttackers(this)) { printDebugMessage("Player " + player + " has no minions to attack with.", OutputPriority.ATTACKERS); return; } Card attacker = getHighestPriorityCard(current); if (attacker.attackPriority == Card.MAX_PRIORITY) { setAttackPriorities(player); attacker = getHighestPriorityCard(current); } while (attacker.getAttack(this) == 0) { attacker.attackPriority = Card.MAX_PRIORITY; attacker = getHighestPriorityCard(current); } attacker.performAttack(chooseTarget(player, attacker), this); printDebugMessage("Checking for windfury: " + attacker.windfury + " isAlive: " + attacker.isAlive() + " Count:" + other.Count, OutputPriority.INTENSEDEBUG); if (attacker.isAlive() && attacker.windfury && other.Count != 0) { attacker.performAttack(chooseTarget(player, attacker), this); } }
public bool doTurnIfNotOver(int player) { if (p1Board.Count == 0 || p2Board.Count == 0) { printDebugMessage("Determined that it is game over, one side is empty", OutputPriority.INTENSEDEBUG); return(false); } else if (!p1Board.hasAvailableAttackers(this) && !p2Board.hasAvailableAttackers(this)) { printDebugMessage("Determining that its game over. No side has any attackers", OutputPriority.INTENSEDEBUG); return(false); } else { printDebugMessage("Determining that its not game over: " + p1Board.Count + " " + p2Board.Count, OutputPriority.INTENSEDEBUG); doTurn(player); return(true); } }