diff --git a/forge-game/src/main/java/forge/game/cost/CostPayment.java b/forge-game/src/main/java/forge/game/cost/CostPayment.java index b9e0c3cb8af..6541f00bd2f 100644 --- a/forge-game/src/main/java/forge/game/cost/CostPayment.java +++ b/forge-game/src/main/java/forge/game/cost/CostPayment.java @@ -50,6 +50,10 @@ public class CostPayment { return this.cost; } + public final SpellAbility getAbility() { + return this.ability; + } + /** *

* Constructor for Cost_Payment. @@ -135,7 +139,7 @@ public class CostPayment { final List costParts = this.getCost().getCostPartsWithZeroMana(); for (final CostPart part : costParts) { // Wrap the cost and push onto the cost stack - decisionMaker.getPlayer().getGame().costPaymentStack.push(new IndividualCostPaymentInstance(part)); + decisionMaker.getPlayer().getGame().costPaymentStack.push(new IndividualCostPaymentInstance(part, this)); PaymentDecision pd = part.accept(decisionMaker); @@ -173,7 +177,7 @@ public class CostPayment { if (null == decision) return false; // wrap the payment and push onto the cost stack - decisionMaker.getPlayer().getGame().costPaymentStack.push(new IndividualCostPaymentInstance(part)); + decisionMaker.getPlayer().getGame().costPaymentStack.push(new IndividualCostPaymentInstance(part, this)); if (decisionMaker.paysRightAfterDecision() && !part.payAsDecided(decisionMaker.getPlayer(), decision, ability)) { decisionMaker.getPlayer().getGame().costPaymentStack.pop(); // cost is resolved return false; @@ -185,7 +189,7 @@ public class CostPayment { for (final CostPart part : this.cost.getCostParts()) { // wrap the payment and push onto the cost stack - decisionMaker.getPlayer().getGame().costPaymentStack.push(new IndividualCostPaymentInstance(part)); + decisionMaker.getPlayer().getGame().costPaymentStack.push(new IndividualCostPaymentInstance(part, this)); if (!part.payAsDecided(decisionMaker.getPlayer(), decisions.get(part), this.ability)) { decisionMaker.getPlayer().getGame().costPaymentStack.pop(); // cost is resolved diff --git a/forge-game/src/main/java/forge/game/cost/IndividualCostPaymentInstance.java b/forge-game/src/main/java/forge/game/cost/IndividualCostPaymentInstance.java index ab99faac732..10ac322c20f 100644 --- a/forge-game/src/main/java/forge/game/cost/IndividualCostPaymentInstance.java +++ b/forge-game/src/main/java/forge/game/cost/IndividualCostPaymentInstance.java @@ -8,14 +8,17 @@ public class IndividualCostPaymentInstance implements IIdentifiable { private final int id; private final CostPart cost; + private final CostPayment payment; - public IndividualCostPaymentInstance(final CostPart cost) { + public IndividualCostPaymentInstance(final CostPart cost, final CostPayment payment) { id = nextId(); this.cost = cost; + this.payment = payment; } public int getId() { return id; } public CostPart getCost() { return cost; } + public CostPayment getPayment() { return payment; } }