game: fixed game error in some multi blocker damage use cases (NPE error);

This commit is contained in:
Oleg Agafonov 2023-08-25 19:32:28 +04:00
parent 1179ca6874
commit 93cb4404e3

View file

@ -361,14 +361,16 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
if (power != null) {
// might be missing canDamage condition?
Permanent blocker = game.getPermanent(blockerId);
if (!assignsDefendingPlayerAndOrDefendingCreaturesDividedDamage(blocker, blocker.getControllerId(), first, game, false)) {
if (blocker != null && !assignsDefendingPlayerAndOrDefendingCreaturesDividedDamage(blocker, blocker.getControllerId(), first, game, false)) {
attacker.markDamage(power, blockerId, null, game, true, true);
}
}
}
for (Map.Entry<UUID, Integer> entry : assigned.entrySet()) {
Permanent blocker = game.getPermanent(entry.getKey());
blocker.markDamage(entry.getValue(), attacker.getId(), null, game, true, true);
if (blocker != null) {
blocker.markDamage(entry.getValue(), attacker.getId(), null, game, true, true);
}
}
} else {
for (UUID blockerId : blockerOrder) {