/// <summary> /// Compare cards played /// </summary> /// <param name="spoils"></param> private void CompareCards(List <Card> spoils) { //initialize spoils if (null == spoils) { spoils = new List <Card>(); } //draw card to compare from player deck Card p1Card = Player1.Draw(); Card p2Card = Player2.Draw(); if (p1Card != null) { spoils.Add(p1Card); } if (p2Card != null) { spoils.Add(p2Card); } //log fight GameLog.AppendLine(string.Format("FIGHT -> {0} : {1} - {2} : {3} ", Player1.Name, p1Card?.GetInfo() ?? "No Card Drawn", Player2.Name, p2Card?.GetInfo() ?? "No Card Drawn")); //compare cards if (p2Card == null) { Player1.AddToDeck(spoils); } else if (p1Card == null) { Player2.AddToDeck(spoils); } else if ((int)p1Card.Rank > (int)p2Card.Rank) { Player1.AddToDeck(spoils); } else if ((int)p2Card.Rank > (int)p1Card.Rank) { Player2.AddToDeck(spoils); } else { //declare war GameLog.AppendLine("WAR---WAR---WAR---WAR---WAR---WAR"); //log and add MAX_SPOILS cards to spoils for (int i = 0; i < MAX_SPOILS; i++) { Card p1Spoils = Player1.Draw(); Card p2Spoils = Player2.Draw(); if (p1Spoils != null) { spoils.Add(p1Spoils); } if (p2Spoils != null) { spoils.Add(p2Spoils); } GameLog.AppendLine(string.Format("WAR -> {0} : {1} - {2} : {3} ", Player1.Name, p1Spoils?.GetInfo() ?? "No Card Drawn", Player2.Name, p2Spoils?.GetInfo() ?? "No Card Drawn")); } GameLog.AppendLine("WAR---WAR---WAR---WAR---WAR---WAR"); //do it again CompareCards(spoils); } }