public void Attack(CardState attacker, Targets defender) { if (defender.cards.Count + defender.players.Count != 1) { Debug.LogError("There must be exactly one defender, found " + (defender.cards.Count + defender.players.Count).ToString()); return; } int turnPlayer = board.turn % 2; if (turnPlayer != attacker.playerNum) { Debug.LogError("Tried to attack with opponents creature!!"); return; } Targets combatants = new Targets(attacker); if (defender.cards.Count == 0) { if (turnPlayer == defender.players[0]) { Debug.LogError("Tried to attack themselves!"); return; } combatants.players.Add(defender.players[0]); } else { if (turnPlayer == defender.cards[0].playerNum) { Debug.LogError("Tried to attack their own creature!"); return; } combatants.cards.Add(defender.cards[0]); } informer.Attack(attacker, defender); foreach (CardState boardCard in board.playOrder) { boardCard.TryTrigger(EffectTrigger.ATTACK, this, board, combatants); } if (defender.cards.Count == 0) { Damage(defender.players[0], attacker.attack); } else { Damage(defender.cards[0], attacker.attack); } }