Bugfixes
This commit is contained in:
@@ -57,7 +57,12 @@ public final class DeterminingTrump extends RoundState {
|
||||
|
||||
@Override
|
||||
public void onTimeout(Game game) {
|
||||
Card.Suit[] suits = new Card.Suit[]{Card.Suit.BLUE, Card.Suit.GREEN, Card.Suit.RED, Card.Suit.YELLOW};
|
||||
Card.Suit[] suits;
|
||||
if (werewolf) {
|
||||
suits = new Card.Suit[]{Card.Suit.BLUE, Card.Suit.GREEN, Card.Suit.RED, Card.Suit.YELLOW, Card.Suit.NONE};
|
||||
} else {
|
||||
suits = new Card.Suit[]{Card.Suit.BLUE, Card.Suit.GREEN, Card.Suit.RED, Card.Suit.YELLOW};
|
||||
}
|
||||
transition(game, suits[game.getRandom().nextInt(suits.length)]);
|
||||
}
|
||||
|
||||
@@ -72,8 +77,10 @@ public final class DeterminingTrump extends RoundState {
|
||||
}
|
||||
|
||||
private void checkTrumpSuit(Card.Suit suit) {
|
||||
if (suit == Card.Suit.NONE) {
|
||||
if (!werewolf && suit == Card.Suit.NONE) {
|
||||
throw new IllegalArgumentException("Trump suit must not be " + Card.Suit.NONE + ".");
|
||||
} else if (suit == null) {
|
||||
throw new IllegalArgumentException("Trump suit must not be null.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,9 @@ public final class PlayingCard extends TrickState {
|
||||
@Override
|
||||
public void onMessage(Game game, UUID player, PlayerMessage message) {
|
||||
if (get(CURRENT_PLAYER).equals(player) && message instanceof PlayCardMessage cardMessage) {
|
||||
if (cardMessage.getCard() == null) {
|
||||
throw new IllegalArgumentException("Card must not be null.");
|
||||
}
|
||||
transition(game, cardMessage.getCard());
|
||||
} else {
|
||||
super.onMessage(game, player, message);
|
||||
|
@@ -57,7 +57,7 @@ public class CardUtils {
|
||||
} else if (card instanceof ColoredCard coloredCard) {
|
||||
if (coloredCard.getSuit() == trumpSuit) {
|
||||
return 200 + coloredCard.getValue();
|
||||
} else if (coloredCard.getSuit() == suit) {
|
||||
} else if (coloredCard.getSuit() == suit) {
|
||||
return 100 + coloredCard.getValue();
|
||||
} else {
|
||||
return coloredCard.getValue();
|
||||
|
Reference in New Issue
Block a user