- Fix an issue with Retribution of the Ancients causing a NPE when X=0.

This commit is contained in:
Agetian
2015-05-22 13:44:42 +00:00
parent 41760b1449
commit 931359980b

View File

@@ -898,6 +898,10 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
private int getDistibutedCounters() { private int getDistibutedCounters() {
if (cardsChosen == null) {
return 0;
}
int sum = 0; int sum = 0;
for (final Entry<Card, Integer> kv : cardsChosen.entrySet()) { for (final Entry<Card, Integer> kv : cardsChosen.entrySet()) {
sum += kv.getValue().intValue(); sum += kv.getValue().intValue();
@@ -965,6 +969,10 @@ public class HumanCostDecision extends CostDecisionMakerBase {
final CardCollectionView validCards = CardLists.getValidCards(player.getCardsIn(cost.zone), type.split(";"), player, source); final CardCollectionView validCards = CardLists.getValidCards(player.getCardsIn(cost.zone), type.split(";"), player, source);
if (cost.zone.equals(ZoneType.Battlefield)) { if (cost.zone.equals(ZoneType.Battlefield)) {
if (cntRemoved == 0) {
return PaymentDecision.card(source, 0);
}
final InputSelectCardToRemoveCounter inp = new InputSelectCardToRemoveCounter(controller, cntRemoved, cost.counter, validCards); final InputSelectCardToRemoveCounter inp = new InputSelectCardToRemoveCounter(controller, cntRemoved, cost.counter, validCards);
inp.setMessage("Remove %d " + cost.counter.getName() + " counters from " + cost.getDescriptiveType()); inp.setMessage("Remove %d " + cost.counter.getName() + " counters from " + cost.getDescriptiveType());
inp.setCancelAllowed(true); inp.setCancelAllowed(true);