- Added some code for XChoice in decideAIPayment of CostTapType.

This commit is contained in:
Sloth
2011-11-22 20:03:28 +00:00
parent 77fcc3ad16
commit 861508bbe2

View File

@@ -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));