update ChooseCardAi with "NotSelf" consumable

This commit is contained in:
Northmoc
2022-11-06 14:30:36 -05:00
parent e637a2279b
commit 0c06184da8
2 changed files with 11 additions and 3 deletions

View File

@@ -162,9 +162,17 @@ public class ChooseCardAi extends SpellAbilityAi {
public Card chooseSingleCard(final Player ai, final SpellAbility sa, Iterable<Card> options, boolean isOptional, Player targetedPlayer, Map<String, Object> params) {
final Card host = sa.getHostCard();
final Player ctrl = host.getController();
final String logic = sa.getParam("AILogic");
String logic = sa.getParamOrDefault("AILogic", "");
if (logic.contains("NotSelf")) {
CardCollection opt = (CardCollection) options;
if (opt.contains(host)) {
opt.remove(host);
}
options = opt;
logic = logic.replace("NotSelf", "");
}
Card choice = null;
if (logic == null) {
if (logic.equals("")) {
// Base Logic is choose "best"
choice = ComputerUtilCard.getBestAI(options);
} else if ("WorstCard".equals(logic)) {