mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
- 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:
@@ -350,11 +350,14 @@ public class CardLists {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
for (final Card crd : cardList) {
|
||||
total += crd.getNetPower();
|
||||
total += ignoreNegativePower ? Math.max(0, crd.getNetPower()) : crd.getNetPower();
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class CostTapType extends CostPartWithList {
|
||||
|
||||
if (totalPower) {
|
||||
final int i = Integer.parseInt(totalP);
|
||||
return CardLists.getTotalPower(typeList) >= i;
|
||||
return CardLists.getTotalPower(typeList, true) >= i;
|
||||
}
|
||||
|
||||
final Integer amount = this.convertAmount();
|
||||
|
||||
@@ -1169,7 +1169,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
||||
inp.setCancelAllowed(true);
|
||||
inp.showAndWait();
|
||||
|
||||
if (inp.hasCancelled() || CardLists.getTotalPower(inp.getSelected()) < i) {
|
||||
if (inp.hasCancelled() || CardLists.getTotalPower(inp.getSelected(), true) < i) {
|
||||
return null;
|
||||
}
|
||||
return PaymentDecision.card(inp.getSelected());
|
||||
|
||||
Reference in New Issue
Block a user