Fixed some bugs and added new features that came up while testing:
All checks were successful
Build Mau & Deploy Mau / build (push) Successful in 1m29s
Build Mau & Deploy Mau / deploy (push) Has been skipped

- 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:
2024-06-12 15:57:09 +02:00
parent 2ef1de9d64
commit 0918b2b3cc
3 changed files with 126 additions and 78 deletions

View File

@@ -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;
}
}