Fixed lethal damage potentially dipping into negative values

Example: in multiple multi-blocker creatures blocking the same creatures (if one of them assigns more than lethal to the first creature in its attackerOrder)
This commit is contained in:
Zzooouhh 2017-12-28 16:49:51 +01:00 committed by GitHub
parent 6d17199129
commit f166bebe8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -311,7 +311,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
if (attacker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
lethalDamage = 1;
} else {
lethalDamage = blocker.getToughness().getValue() - blocker.getDamage();
lethalDamage = Math.max(blocker.getToughness().getValue() - blocker.getDamage(), 0);
}
if (lethalDamage >= damage) {
if (!oldRuleDamage) {
@ -483,7 +483,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
if (blocker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
lethalDamage = 1;
} else {
lethalDamage = attacker.getToughness().getValue() - attacker.getDamage();
lethalDamage = Math.max(attacker.getToughness().getValue() - attacker.getDamage(), 0);
}
if (lethalDamage >= damage) {
assigned.put(attackerId, damage);