- Prevent Crew from taking negative power of creatures on the battlefield into consideration when determining the total amount of power available on the battlefield (instead treating them as 0 now).

This commit is contained in:
Agetian
2017-01-11 14:35:33 +00:00
parent e86a709d72
commit f14de08c20
3 changed files with 7 additions and 4 deletions

View File

@@ -350,11 +350,14 @@ public class CardLists {
/** /**
* Given a list of cards, return their combined power * Given a list of cards, return their combined power
*
* @param cardList the list of creature cards for which to sum the power
* @param ignoreNegativePower if true, treats negative power as 0
*/ */
public static int getTotalPower(Iterable<Card> cardList) { public static int getTotalPower(Iterable<Card> cardList, boolean ignoreNegativePower) {
int total = 0; int total = 0;
for (final Card crd : cardList) { for (final Card crd : cardList) {
total += crd.getNetPower(); total += ignoreNegativePower ? Math.max(0, crd.getNetPower()) : crd.getNetPower();
} }
return total; return total;
} }

View File

@@ -148,7 +148,7 @@ public class CostTapType extends CostPartWithList {
if (totalPower) { if (totalPower) {
final int i = Integer.parseInt(totalP); final int i = Integer.parseInt(totalP);
return CardLists.getTotalPower(typeList) >= i; return CardLists.getTotalPower(typeList, true) >= i;
} }
final Integer amount = this.convertAmount(); final Integer amount = this.convertAmount();

View File

@@ -1169,7 +1169,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
if (inp.hasCancelled() || CardLists.getTotalPower(inp.getSelected()) < i) { if (inp.hasCancelled() || CardLists.getTotalPower(inp.getSelected(), true) < i) {
return null; return null;
} }
return PaymentDecision.card(inp.getSelected()); return PaymentDecision.card(inp.getSelected());