Added:
- Chat message cleaning to prevent HTML injection - Player hand size to game state - Deck automatically creates sets when it doesnt have any cards left
This commit is contained in:
13
Mau/Deck.cs
13
Mau/Deck.cs
@@ -6,6 +6,12 @@ public class Deck
|
||||
public List<Card> UsedDeck = new();
|
||||
|
||||
public Deck()
|
||||
{
|
||||
CreateSet();
|
||||
ShuffleDeck();
|
||||
}
|
||||
|
||||
private void CreateSet()
|
||||
{
|
||||
foreach (CardType cardType in Enum.GetValues(typeof(CardType)))
|
||||
{
|
||||
@@ -21,7 +27,6 @@ public class Deck
|
||||
UnusedDeck.Add(new Card(cardType, cardValue));
|
||||
}
|
||||
}
|
||||
ShuffleDeck();
|
||||
}
|
||||
|
||||
public List<Card> GetUnusedDeck()
|
||||
@@ -56,6 +61,12 @@ public class Deck
|
||||
{
|
||||
UnusedDeck.AddRange(UsedDeck);
|
||||
UsedDeck.Clear();
|
||||
|
||||
if (UnusedDeck.Count == 0)
|
||||
{
|
||||
CreateSet();
|
||||
}
|
||||
|
||||
ShuffleDeck();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,12 @@ public class PlayerDTO
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Id { get; set; }
|
||||
public int CardsLeft { get; set; }
|
||||
|
||||
public PlayerDTO(Player player)
|
||||
{
|
||||
Name = player.Connection.Name;
|
||||
Id = player.Connection.ConnectionId;
|
||||
CardsLeft = player.Hand.Count;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user