From 4629ff737f354b3af7aca5893bee6694453bf6c1 Mon Sep 17 00:00:00 2001 From: Pedro Osorio Date: Thu, 16 Jun 2022 23:53:05 -0700 Subject: [PATCH] Fix task prioritization bug Playing TASK_PRIORITIZATION should check we have more than 0 cards of the type we want to throw, and more than 1 card if we want to throw TASK_PRIORITIZATION. Instead, it makes this check for CONTINUOUS_INTEGRATION (possibly copied from line 274?), requiring the player to have 2 cards of the latter type if they want to throw that card away. --- src/main/java/com/codingame/game/CommandManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/codingame/game/CommandManager.java b/src/main/java/com/codingame/game/CommandManager.java index ff6dd0f..b19bcfc 100644 --- a/src/main/java/com/codingame/game/CommandManager.java +++ b/src/main/java/com/codingame/game/CommandManager.java @@ -235,7 +235,7 @@ public void parseCommand(Player player, String command, Game game, GamePhase gam } CardType cardType = CardType.values()[cardTypeToThrow]; int cardsCount = (int)player.getCardsInHand().stream().filter(c -> c.getCardType().equals(cardType)).count(); - if (cardsCount==0 || (cardsCount==1 && cardType.equals(CardType.CONTINUOUS_INTEGRATION))) { + if (cardsCount==0 || (cardsCount==1 && cardType.equals(CardType.TASK_PRIORITIZATION))) { throw new GameRuleException(command, String.format("you do not have a card of type %s to deprioritize", cardType)); } int cardTypeToTake = Integer.parseInt(match.group("cardTypeToTake"));