Fix paying negative life

This commit is contained in:
tool4EvEr
2021-05-18 23:36:56 +02:00
parent bb6c5f8e44
commit e56b8545c7
2 changed files with 6 additions and 2 deletions

View File

@@ -76,9 +76,13 @@ public class CostPayLife extends CostPart {
Integer amount = this.convertAmount();
if (amount == null) { // try to calculate when it's defined.
amount = AbilityUtils.calculateAmount(ability.getHostCard(), getAmount(), ability);
// CR 107.1b
if (getAmount().contains("/Half")) {
amount = Math.max(amount, 0);
}
}
if ((amount != null) && !payer.canPayLife(amount)) {
if (amount != null && !payer.canPayLife(amount)) {
return false;
}

View File

@@ -589,7 +589,7 @@ public class Player extends GameEntity implements Comparable<Player> {
}
public final boolean canPayLife(final int lifePayment) {
if (life < lifePayment) {
if (lifePayment > 0 && life < lifePayment) {
return false;
}
return (lifePayment <= 0) || !hasKeyword("Your life total can't change.");