- The AI can now use Delve.

This commit is contained in:
Sloth
2013-06-17 19:56:26 +00:00
parent 1dcd260feb
commit fb2d08032d
4 changed files with 8 additions and 6 deletions

View File

@@ -128,7 +128,7 @@ public class CostPartMana extends CostPart {
}
InputPayMana inpPayment;
toPay.applySpellCostChange(ability);
toPay.applySpellCostChange(ability, false);
if (ability.isOffering() && ability.getSacrificedAsOffering() == null) {
System.out.println("Sacrifice input for Offering cancelled");
return false;

View File

@@ -506,7 +506,7 @@ public class ManaCostBeingPaid {
unpaidShards.remove(ManaCostShard.COLORLESS);
}
public final void applySpellCostChange(final SpellAbility sa) {
public final void applySpellCostChange(final SpellAbility sa, boolean test) {
final Game game = sa.getActivatingPlayer().getGame();
// Beached
final Card originalCard = sa.getSourceCard();
@@ -524,11 +524,13 @@ public class ManaCostBeingPaid {
if (spell.isSpell()) {
if (spell.isDelve()) {
final Player pc = originalCard.getController();
final List<Card> mutableGrave = Lists.newArrayList(pc.getZone(ZoneType.Graveyard).getCards());
final List<Card> mutableGrave = new ArrayList<Card>(pc.getCardsIn(ZoneType.Graveyard));
final List<Card> toExile = pc.getController().chooseCardsToDelve(this.getColorlessManaAmount(), mutableGrave);
for (final Card c : toExile) {
pc.getGame().getAction().exile(c);
decreaseColorlessMana(1);
if (!test) {
pc.getGame().getAction().exile(c);
}
}
} else if (spell.getSourceCard().hasKeyword("Convoke")) {
adjustCostByConvoke(sa, spell);

View File

@@ -474,7 +474,7 @@ public class ComputerUtilMana {
restriction = payCosts.getCostMana().getRestiction();
}
ManaCostBeingPaid cost = new ManaCostBeingPaid(mana, restriction);
cost.applySpellCostChange(sa);
cost.applySpellCostChange(sa, test);
final Card card = sa.getSourceCard();
// Tack xMana Payments into mana here if X is a set value

View File

@@ -157,7 +157,7 @@ public class HumanPlay {
manaCost = new ManaCostBeingPaid(ManaCost.ZERO);
} else {
manaCost = new ManaCostBeingPaid(sa.getPayCosts().getTotalMana());
manaCost.applySpellCostChange(sa);
manaCost.applySpellCostChange(sa, false);
}
boolean isPaid = manaCost.isPaid();