From 8632b0ffecdfd1a294f99803be6f9c5c2b2ebf6e Mon Sep 17 00:00:00 2001 From: Agetian Date: Thu, 17 Aug 2017 15:34:23 +0000 Subject: [PATCH] - Conspiracy: a little restructuring of chooseCardName in PlayerControllerAi. --- .../java/forge/ai/PlayerControllerAi.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java b/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java index 13823bd6c55..a295c5f2e0c 100644 --- a/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java +++ b/forge-ai/src/main/java/forge/ai/PlayerControllerAi.java @@ -859,25 +859,25 @@ public class PlayerControllerAi extends PlayerController { @Override public String chooseCardName(SpellAbility sa, Predicate cpp, String valid, String message) { - CardCollectionView aiLibrary = player.getCardsIn(ZoneType.Library); - CardCollectionView oppLibrary = ComputerUtil.getOpponentFor(player).getCardsIn(ZoneType.Library); - final Card source = sa.getHostCard(); + if (sa.hasParam("AILogic")) { + CardCollectionView aiLibrary = player.getCardsIn(ZoneType.Library); + CardCollectionView oppLibrary = ComputerUtil.getOpponentFor(player).getCardsIn(ZoneType.Library); + final Card source = sa.getHostCard(); + final String logic = sa.getParam("AILogic"); - if (source != null && source.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) { - // If any Conspiracies are present, try not to choose the same name twice - // (otherwise the AI will spam the same name) - for (Card consp : player.getCardsIn(ZoneType.Command)) { - if (consp.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) { - String chosenName = consp.getNamedCard(); - if (!chosenName.isEmpty()) { - aiLibrary = CardLists.filter(aiLibrary, Predicates.not(CardPredicates.nameEquals(chosenName))); + if (source != null && source.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) { + // If any Conspiracies are present, try not to choose the same name twice + // (otherwise the AI will spam the same name) + for (Card consp : player.getCardsIn(ZoneType.Command)) { + if (consp.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) { + String chosenName = consp.getNamedCard(); + if (!chosenName.isEmpty()) { + aiLibrary = CardLists.filter(aiLibrary, Predicates.not(CardPredicates.nameEquals(chosenName))); + } } } } - } - if (sa.hasParam("AILogic")) { - final String logic = sa.getParam("AILogic"); if (logic.equals("MostProminentInComputerDeck")) { return ComputerUtilCard.getMostProminentCardName(aiLibrary); } else if (logic.equals("MostProminentInHumanDeck")) {