diff --git a/src/main/java/forge/card/cost/CostTapType.java b/src/main/java/forge/card/cost/CostTapType.java index 594dc6b8789..0fe89c4dc98 100644 --- a/src/main/java/forge/card/cost/CostTapType.java +++ b/src/main/java/forge/card/cost/CostTapType.java @@ -165,9 +165,18 @@ public class CostTapType extends CostPartWithList { @Override public final boolean decideAIPayment(final SpellAbility ability, final Card source, final CostPayment payment) { final boolean tap = payment.getCost().getTap(); - final Integer c = this.convertAmount(); + final String amount = this.getAmount(); + Integer c = this.convertAmount(); if (c == null) { - // Determine Amount + final String sVar = source.getSVar(amount); + if (sVar.equals("XChoice")) { + CardList typeList = ability.getActivatingPlayer().getCardsIn(Zone.Battlefield); + typeList = typeList.getValidCards(this.getType().split(";"), ability.getActivatingPlayer(), + ability.getSourceCard()); + typeList = typeList.filter(CardListFilter.UNTAPPED); + c = typeList.size(); + source.setSVar("ChosenX", "Number$" + Integer.toString(c)); + } } this.setList(ComputerUtil.chooseTapType(this.getType(), source, tap, c));