61 lines
2.1 KiB
C#
61 lines
2.1 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace Squiddler_Server_Lite.TransferObjects
|
|
{
|
|
public class PlayedCards
|
|
{
|
|
public List<Card> word1 { get; set; }
|
|
public List<Card> word2 { get; set; }
|
|
public List<Card> word3 { get; set; }
|
|
public List<Card> word4 { get; set; }
|
|
public List<Card> word5 { get; set; }
|
|
public List<Card> unplayed { get; set; }
|
|
public Card discarded { get; set; }
|
|
public IEnumerable<Card> AllCards()
|
|
=> Words().Aggregate<IEnumerable<Card>>(Enumerable.Concat)
|
|
.Concat(unplayed).Append(discarded);
|
|
public IEnumerable<List<Card>> Words()
|
|
{
|
|
yield return word1;
|
|
yield return word2;
|
|
yield return word3;
|
|
yield return word4;
|
|
yield return word5;
|
|
}
|
|
public int BaseScore()
|
|
=> word1.Sum(c => c.value)
|
|
+ word2.Sum(c => c.value)
|
|
+ word3.Sum(c => c.value)
|
|
+ word4.Sum(c => c.value)
|
|
+ word5.Sum(c => c.value)
|
|
- unplayed.Sum(c => c.value);
|
|
public PlayedCards()
|
|
{
|
|
|
|
}
|
|
public PlayedCards(IEnumerable<Card> word1,
|
|
IEnumerable<Card> word2,
|
|
IEnumerable<Card> word3,
|
|
IEnumerable<Card> word4,
|
|
IEnumerable<Card> word5,
|
|
IEnumerable<Card> unplayed,
|
|
Card discarded)
|
|
{
|
|
this.word1 = word1.ToList();
|
|
this.word2 = word2.ToList();
|
|
this.word3 = word3.ToList();
|
|
this.word4 = word4.ToList();
|
|
this.word5 = word5.ToList();
|
|
this.unplayed = unplayed.ToList();
|
|
this.discarded = new(discarded);
|
|
}
|
|
public PlayedCards(PlayedCards playedCards)
|
|
: this(playedCards.word1, playedCards.word2, playedCards.word3,
|
|
playedCards.word4, playedCards.word5, playedCards.unplayed,
|
|
playedCards.discarded)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|