mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
CostPayment & IndividualCostPaymentInstance: need access to the SpellAblity from the PaymentInstance over the CostPayment object
This commit is contained in:
@@ -50,6 +50,10 @@ public class CostPayment {
|
|||||||
return this.cost;
|
return this.cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final SpellAbility getAbility() {
|
||||||
|
return this.ability;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Constructor for Cost_Payment.
|
* Constructor for Cost_Payment.
|
||||||
@@ -135,7 +139,7 @@ public class CostPayment {
|
|||||||
final List<CostPart> costParts = this.getCost().getCostPartsWithZeroMana();
|
final List<CostPart> costParts = this.getCost().getCostPartsWithZeroMana();
|
||||||
for (final CostPart part : costParts) {
|
for (final CostPart part : costParts) {
|
||||||
// Wrap the cost and push onto the cost stack
|
// 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);
|
PaymentDecision pd = part.accept(decisionMaker);
|
||||||
|
|
||||||
@@ -173,7 +177,7 @@ public class CostPayment {
|
|||||||
if (null == decision) return false;
|
if (null == decision) return false;
|
||||||
|
|
||||||
// wrap the payment and push onto the cost stack
|
// 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)) {
|
if (decisionMaker.paysRightAfterDecision() && !part.payAsDecided(decisionMaker.getPlayer(), decision, ability)) {
|
||||||
decisionMaker.getPlayer().getGame().costPaymentStack.pop(); // cost is resolved
|
decisionMaker.getPlayer().getGame().costPaymentStack.pop(); // cost is resolved
|
||||||
return false;
|
return false;
|
||||||
@@ -185,7 +189,7 @@ public class CostPayment {
|
|||||||
|
|
||||||
for (final CostPart part : this.cost.getCostParts()) {
|
for (final CostPart part : this.cost.getCostParts()) {
|
||||||
// wrap the payment and push onto the cost stack
|
// 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)) {
|
if (!part.payAsDecided(decisionMaker.getPlayer(), decisions.get(part), this.ability)) {
|
||||||
decisionMaker.getPlayer().getGame().costPaymentStack.pop(); // cost is resolved
|
decisionMaker.getPlayer().getGame().costPaymentStack.pop(); // cost is resolved
|
||||||
|
|||||||
@@ -8,14 +8,17 @@ public class IndividualCostPaymentInstance implements IIdentifiable {
|
|||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
private final CostPart cost;
|
private final CostPart cost;
|
||||||
|
private final CostPayment payment;
|
||||||
|
|
||||||
public IndividualCostPaymentInstance(final CostPart cost) {
|
public IndividualCostPaymentInstance(final CostPart cost, final CostPayment payment) {
|
||||||
id = nextId();
|
id = nextId();
|
||||||
this.cost = cost;
|
this.cost = cost;
|
||||||
|
this.payment = payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() { return id; }
|
public int getId() { return id; }
|
||||||
|
|
||||||
public CostPart getCost() { return cost; }
|
public CostPart getCost() { return cost; }
|
||||||
|
public CostPayment getPayment() { return payment; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user