Fixed some bugs and added new features that came up while testing:
- Check for allowed card type was before the check for the mau cards, which caused incorrect cards to be played and mau cards to be passed to wrong players - Ending with a special card is now a faulty move, which grants the player 5 fault cards now - Grabbed cards could be registered as playable as it didnt include next allowed card type - If the first card is a joker, set the next allowed card type to a random other card type to prevent an instant softlock - Other cleanup :)
This commit is contained in:
25
Mau/Card.cs
25
Mau/Card.cs
@@ -31,22 +31,37 @@ public static class CardExtensions
|
||||
{
|
||||
return card1.IsSameCardType(card2) && card1.IsSameCardValue(card2);
|
||||
}
|
||||
|
||||
|
||||
public static bool IsSameCardType(this Card card1, Card card2)
|
||||
{
|
||||
return card1.CardType == card2.CardType;
|
||||
}
|
||||
|
||||
|
||||
public static bool IsSameCardValue(this Card card1, Card card2)
|
||||
{
|
||||
return card1.CardValue == card2.CardValue;
|
||||
}
|
||||
|
||||
|
||||
public static bool CanBePlayedOn(this Card playedCard, Card currentCard)
|
||||
{
|
||||
return playedCard.IsSameCardType(currentCard)
|
||||
|| playedCard.IsSameCardValue(currentCard)
|
||||
|| playedCard.CardType == CardType.JOKER;
|
||||
|| playedCard.IsSameCardValue(currentCard)
|
||||
|| playedCard.CardType == CardType.JOKER;
|
||||
}
|
||||
|
||||
public static bool IsSpecialCard(this Card card)
|
||||
{
|
||||
return card.IsMauCard() || card.CardValue is
|
||||
CardValue.SEVEN or
|
||||
CardValue.EIGHT or
|
||||
CardValue.JACK or
|
||||
CardValue.KING or
|
||||
CardValue.ACE;
|
||||
}
|
||||
|
||||
public static bool IsMauCard(this Card card)
|
||||
{
|
||||
return card.CardType == CardType.JOKER || card.CardValue is CardValue.TWO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user