mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
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:
@@ -157,7 +157,7 @@ public class CostPayment {
|
|||||||
this.ability.setActivatingPlayer(decisionMaker.getPlayer());
|
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
|
// Set all of the decisions before attempting to pay anything
|
||||||
for (final CostPart part : this.cost.getCostParts()) {
|
for (final CostPart part : this.cost.getCostParts()) {
|
||||||
@@ -167,11 +167,11 @@ public class CostPayment {
|
|||||||
if (decisionMaker.paysRightAfterDecision() && !part.payAsDecided(decisionMaker.getPlayer(), decision, ability))
|
if (decisionMaker.paysRightAfterDecision() && !part.payAsDecided(decisionMaker.getPlayer(), decision, ability))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
decisions.put(part.getClass(), decision);
|
decisions.put(part, decision);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final CostPart part : this.cost.getCostParts()) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
// abilities care what was used to pay for them
|
// abilities care what was used to pay for them
|
||||||
|
|||||||
Reference in New Issue
Block a user