- Conspiracy: a little restructuring of chooseCardName in PlayerControllerAi.

This commit is contained in:
Agetian
2017-08-17 15:34:23 +00:00
parent bc0b69857a
commit 8632b0ffec

View File

@@ -859,25 +859,25 @@ public class PlayerControllerAi extends PlayerController {
@Override @Override
public String chooseCardName(SpellAbility sa, Predicate<ICardFace> cpp, String valid, String message) { public String chooseCardName(SpellAbility sa, Predicate<ICardFace> cpp, String valid, String message) {
CardCollectionView aiLibrary = player.getCardsIn(ZoneType.Library); if (sa.hasParam("AILogic")) {
CardCollectionView oppLibrary = ComputerUtil.getOpponentFor(player).getCardsIn(ZoneType.Library); CardCollectionView aiLibrary = player.getCardsIn(ZoneType.Library);
final Card source = sa.getHostCard(); 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 (source != null && source.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) {
// If any Conspiracies are present, try not to choose the same name twice // If any Conspiracies are present, try not to choose the same name twice
// (otherwise the AI will spam the same name) // (otherwise the AI will spam the same name)
for (Card consp : player.getCardsIn(ZoneType.Command)) { for (Card consp : player.getCardsIn(ZoneType.Command)) {
if (consp.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) { if (consp.getState(CardStateName.Original).hasIntrinsicKeyword("Hidden agenda")) {
String chosenName = consp.getNamedCard(); String chosenName = consp.getNamedCard();
if (!chosenName.isEmpty()) { if (!chosenName.isEmpty()) {
aiLibrary = CardLists.filter(aiLibrary, Predicates.not(CardPredicates.nameEquals(chosenName))); aiLibrary = CardLists.filter(aiLibrary, Predicates.not(CardPredicates.nameEquals(chosenName)));
}
} }
} }
} }
}
if (sa.hasParam("AILogic")) {
final String logic = sa.getParam("AILogic");
if (logic.equals("MostProminentInComputerDeck")) { if (logic.equals("MostProminentInComputerDeck")) {
return ComputerUtilCard.getMostProminentCardName(aiLibrary); return ComputerUtilCard.getMostProminentCardName(aiLibrary);
} else if (logic.equals("MostProminentInHumanDeck")) { } else if (logic.equals("MostProminentInHumanDeck")) {