Fixed some possible exception bugs.

This commit is contained in:
LevelX2 2016-04-06 20:25:13 +02:00
parent ebac7426dc
commit 1ec61abb8e
5 changed files with 45 additions and 35 deletions

View file

@ -364,19 +364,21 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
Map<UUID, Integer> assigned = new HashMap<>();
for (UUID attackerId : attackerOrder) {
Permanent attacker = game.getPermanent(attackerId);
int lethalDamage;
if (blocker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
lethalDamage = 1;
} else {
lethalDamage = attacker.getToughness().getValue() - attacker.getDamage();
if (attacker != null) {
int lethalDamage;
if (blocker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
lethalDamage = 1;
} else {
lethalDamage = attacker.getToughness().getValue() - attacker.getDamage();
}
if (lethalDamage >= damage) {
assigned.put(attackerId, damage);
break;
}
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + attacker.getName(), game);
assigned.put(attackerId, damageAssigned);
damage -= damageAssigned;
}
if (lethalDamage >= damage) {
assigned.put(attackerId, damage);
break;
}
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + attacker.getName(), game);
assigned.put(attackerId, damageAssigned);
damage -= damageAssigned;
}
for (Map.Entry<UUID, Integer> entry : assigned.entrySet()) {