mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +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
|
* 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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());
|
||||||
|
|||||||
Reference in New Issue
Block a user