- Expanded checkDiscardCost.

- Added Phantasmagorian.
This commit is contained in:
Sloth
2012-12-03 15:47:49 +00:00
parent c438325d63
commit 03ca3d4872
5 changed files with 30 additions and 5 deletions

View File

@@ -379,7 +379,6 @@ public final class GameActionUtil {
final ArrayList<CostPart> parts = cost.getCostParts();
ArrayList<CostPart> remainingParts = new ArrayList<CostPart>(cost.getCostParts());
CostPart costPart = null;
int num_parts = parts.size();
if (!parts.isEmpty()) {
costPart = parts.get(0);
}
@@ -396,7 +395,7 @@ public final class GameActionUtil {
return;
}
boolean hasPaid = true;
//the three following costs do not need inputs
//the following costs do not need inputs
for (CostPart part : parts) {
if (part instanceof CostPayLife) {
String amountString = part.getAmount();
@@ -449,6 +448,7 @@ public final class GameActionUtil {
}
remainingParts.remove(part);
}
else if (part instanceof CostExile) {
Player p = Singletons.getControl().getPlayer();
if ("All".equals(part.getType())) {
@@ -486,6 +486,7 @@ public final class GameActionUtil {
}
}
}
else if (part instanceof CostSacrifice) {
CostSacrifice sacCost = (CostSacrifice) part;
@@ -522,7 +523,10 @@ public final class GameActionUtil {
list.remove(c);
}
}
remainingParts.remove(part);
}
else if (part instanceof CostMana && ((CostMana) part).getManaToPay().equals("0")) {
remainingParts.remove(part);
}
}

View File

@@ -1628,6 +1628,7 @@ public class AbilityFactory {
}
if (ComputerUtil.canPayCost(ability, payer) && CostUtil.checkLifeCost(payer, cost, source, 4, sa)
&& CostUtil.checkDamageCost(payer, cost, source, 4)
&& CostUtil.checkDiscardCost(payer, cost, source)
&& (!source.getName().equals("Tyrannize") || payer.getCardsIn(ZoneType.Hand).size() > 2)
&& (!source.getName().equals("Breaking Point") || payer.getCreaturesInPlay().size() > 1)) {
// AI was crashing because the blank ability used to pay costs

View File

@@ -215,8 +215,14 @@ public class CostUtil {
if (typeList.size() > ai.getMaxHandSize()) {
continue;
}
if (ComputerUtil.getCardPreference(ai, source, "DiscardCost", typeList) == null) {
return false;
int num = AbilityFactory.calculateAmount(source, disc.getAmount(), null);
for (int i = 0; i < num; i++) {
Card pref = ComputerUtil.getCardPreference(ai, source, "DiscardCost", typeList);
if (pref == null) {
return false;
} else {
typeList.remove(pref);
}
}
}
}