/// <summary> /// return true if is a valid hand and is greater than lastHand /// return false if not valid /// </summary> /// <param name="cards"></param> /// <returns></returns> public bool PlayHand(List <Card> cards, Hand lastHand) { Hand hand; try { hand = new Hand(cards); } catch (Exception e) { BackToFront.CreateErrorMessage(_client, "Hand is not valid"); return(false); } if (hand.CompareHand(lastHand)) { foreach (var card in cards) { _cardsInHand.Remove(card); } BackToFront.HandIsValidBackend(_client); return(true); } BackToFront.CreateErrorMessage(_client, "Hand is not greater than the previous one"); return(false); }
public void ReturnTribute(Player p, int returnNumber) { bool valid = false; while (!valid) { BackToFront.AskReturnTributeBackend(_client); var userReturn = PlayerHubTempData.returnCards; if (userReturn.Count != returnNumber) { BackToFront.CreateErrorMessage(_client, "Tribute Return Not Valid"); } else { BackToFront.ReturnIsValidBackend(_client); valid = true; } } foreach (var card in PlayerHubTempData.returnCards) { this._cardsInHand.Remove(card); } p.AddCards(PlayerHubTempData.returnCards); p.OrganizeHand(); PlayerHubTempData.returnCards = new List <Card> { }; }
public void GameOverBackend(string message) { BackToFront.CreateErrorMessage(_client, message); }
public void PaytributeBegin(List <Player> finishOrder) { var list = finishOrder.Select(o => o.Name).ToList(); BackToFront.CreateErrorMessage(_client, String.Join("<- ", list.ToArray())); }