Fixed an issue where if an ability had more than one instance of the same type of CostPart (such as that of Demon's Herald, which has three sacrifice costs), the AI was able to get away with paying the cost only once.

This commit is contained in:
rikimbo
2014-06-13 00:17:15 +00:00
parent 3c66861b48
commit 12de3043d8

View File

@@ -157,8 +157,8 @@ public class CostPayment {
this.ability.setActivatingPlayer(decisionMaker.getPlayer());
}
Map<Class<? extends CostPart>, PaymentDecision> decisions = new HashMap<Class<? extends CostPart>, PaymentDecision>();
Map<CostPart, PaymentDecision> decisions = new HashMap<CostPart, PaymentDecision>();
// Set all of the decisions before attempting to pay anything
for (final CostPart part : this.cost.getCostParts()) {
PaymentDecision decision = part.accept(decisionMaker);
@@ -167,11 +167,11 @@ public class CostPayment {
if (decisionMaker.paysRightAfterDecision() && !part.payAsDecided(decisionMaker.getPlayer(), decision, ability))
return false;
decisions.put(part.getClass(), decision);
decisions.put(part, decision);
}
for (final CostPart part : this.cost.getCostParts()) {
if (!part.payAsDecided(decisionMaker.getPlayer(), decisions.get(part.getClass()), this.ability)) {
if (!part.payAsDecided(decisionMaker.getPlayer(), decisions.get(part), this.ability)) {
return false;
}
// abilities care what was used to pay for them