Partial rewrite, missing:
Some checks failed
Build Mau & Deploy Mau / build (push) Failing after 1m15s
Build Mau & Deploy Mau / deploy (push) Has been skipped

- Correctly parsing incoming messages
- Sending the gamestate after relevant actions
This commit is contained in:
DTieman
2024-05-04 19:55:11 +02:00
parent 0c2cb8272d
commit 694bc6147a
20 changed files with 612 additions and 294 deletions

View File

@@ -13,5 +13,25 @@ public class Player
Connection = connection;
}
public bool IsMe(string playerId) => Connection.ConnectionId == playerId;
public void GiveCard(Card card)
{
Hand.Add(card);
}
public void GiveCards(IEnumerable<Card> cards)
{
Hand.AddRange(cards);
}
public Card? TakeCardFromHand(Card card)
{
return Hand.FirstOrDefault(handCard => handCard.IsSameCard(card));
}
public bool IsMe(string playerId) => Connection.Id == playerId;
public bool CanPlayCard(Card currentCard)
{
return Hand.Any(card => card.CanBePlayedOn(currentCard));
}
}