Prevent Gorilla Shaman refunding mana after there are no more remaining targets

This commit is contained in:
drdev
2014-09-14 16:55:10 +00:00
parent 4e5b5e4d6c
commit 1d40924d0a
2 changed files with 8 additions and 1 deletions

View File

@@ -334,6 +334,9 @@ public class ComputerUtilMana {
if (test) { if (test) {
refundMana(manaSpentToPay, ai, sa); refundMana(manaSpentToPay, ai, sa);
} }
else {
manaSpentToPay.clear(); //prevent mana spent to pay sticking around such that it can cause an improper refund later
}
handleOfferingsAI(sa, test, cost.isPaid()); handleOfferingsAI(sa, test, cost.isPaid());
return true; return true;
} }
@@ -461,6 +464,9 @@ public class ComputerUtilMana {
if (test) { if (test) {
refundMana(manaSpentToPay, ai, sa); refundMana(manaSpentToPay, ai, sa);
} }
else {
manaSpentToPay.clear(); //prevent mana spent to pay sticking around such that it can cause an improper refund later
}
sa.getHostCard().setColorsPaid(cost.getColorsPaid()); sa.getHostCard().setColorsPaid(cost.getColorsPaid());
// if (sa instanceof Spell_Permanent) // should probably add this // if (sa instanceof Spell_Permanent) // should probably add this
sa.getHostCard().setSunburstValue(cost.getSunburst()); sa.getHostCard().setSunburstValue(cost.getSunburst());

View File

@@ -231,10 +231,11 @@ public class ManaPool implements Iterable<Mana> {
paidAbs.add(saPayment); // assumes some part on the mana produced by the ability will get used paidAbs.add(saPayment); // assumes some part on the mana produced by the ability will get used
for (final Mana mana : abManaPart.getLastManaProduced()) { for (final Mana mana : abManaPart.getLastManaProduced()) {
if( tryPayCostWithMana(saPaidFor, manaCost, mana) ) if (tryPayCostWithMana(saPaidFor, manaCost, mana)) {
saPaidFor.getPayingMana().add(0, mana); saPaidFor.getPayingMana().add(0, mana);
} }
} }
}
public boolean tryPayCostWithColor(byte colorCode, SpellAbility saPaidFor, ManaCostBeingPaid manaCost) { public boolean tryPayCostWithColor(byte colorCode, SpellAbility saPaidFor, ManaCostBeingPaid manaCost) {
Mana manaFound = null; Mana manaFound = null;