From fb2d08032d6f5fb6e4eebb43d38731f7084ce4f6 Mon Sep 17 00:00:00 2001 From: Sloth Date: Mon, 17 Jun 2013 19:56:26 +0000 Subject: [PATCH] - The AI can now use Delve. --- src/main/java/forge/card/cost/CostPartMana.java | 2 +- src/main/java/forge/card/mana/ManaCostBeingPaid.java | 8 +++++--- src/main/java/forge/game/ai/ComputerUtilMana.java | 2 +- src/main/java/forge/game/player/HumanPlay.java | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/forge/card/cost/CostPartMana.java b/src/main/java/forge/card/cost/CostPartMana.java index 8d1c1f763e6..8a3b907a8a1 100644 --- a/src/main/java/forge/card/cost/CostPartMana.java +++ b/src/main/java/forge/card/cost/CostPartMana.java @@ -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; diff --git a/src/main/java/forge/card/mana/ManaCostBeingPaid.java b/src/main/java/forge/card/mana/ManaCostBeingPaid.java index 74abb4dd35a..4c508e32f8a 100644 --- a/src/main/java/forge/card/mana/ManaCostBeingPaid.java +++ b/src/main/java/forge/card/mana/ManaCostBeingPaid.java @@ -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 mutableGrave = Lists.newArrayList(pc.getZone(ZoneType.Graveyard).getCards()); + final List mutableGrave = new ArrayList(pc.getCardsIn(ZoneType.Graveyard)); final List 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); diff --git a/src/main/java/forge/game/ai/ComputerUtilMana.java b/src/main/java/forge/game/ai/ComputerUtilMana.java index 9c238a5dac8..3663581dad9 100644 --- a/src/main/java/forge/game/ai/ComputerUtilMana.java +++ b/src/main/java/forge/game/ai/ComputerUtilMana.java @@ -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 diff --git a/src/main/java/forge/game/player/HumanPlay.java b/src/main/java/forge/game/player/HumanPlay.java index c2cf4fd274c..7dedd40abac 100644 --- a/src/main/java/forge/game/player/HumanPlay.java +++ b/src/main/java/forge/game/player/HumanPlay.java @@ -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();