CostPayment: reset CardMatrix after being used

This commit is contained in:
Hans Mackowiak
2020-05-12 10:19:29 +00:00
committed by Michael Kamensky
parent 15eca3f80a
commit d25825c595
2 changed files with 25 additions and 9 deletions

View File

@@ -146,6 +146,16 @@ public class CostPartMana extends CostPart {
}
}
@Override
public CostPart copy() {
CostPart copied = super.copy();
// when copied, clear cardMatrix
if (copied instanceof CostPartMana) {
((CostPartMana)copied).cardMatrix = null;
}
return copied;
}
@Override
public boolean payAsDecided(Player payer, PaymentDecision pd, SpellAbility sa) {
// TODO Auto-generated method stub

View File

@@ -145,11 +145,17 @@ public class CostPayment extends ManaConversionMatrix {
}
if (pd == null || !part.payAsDecided(decisionMaker.getPlayer(), pd, ability)) {
if (part instanceof CostPartMana) {
((CostPartMana)part).setCardMatrix(null);
}
game.costPaymentStack.pop(); // cost is resolved
return false;
}
this.paidCostParts.add(part);
if (part instanceof CostPartMana) {
((CostPartMana)part).setCardMatrix(null);
}
game.costPaymentStack.pop(); // cost is resolved
}