From 44394cf016bdbc32139f1cac7bc1924a18e2965c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 23 Jun 2020 21:28:43 -0400 Subject: [PATCH] added another fix for Chandra's Incinerator --- Mage.Sets/src/mage/cards/c/ChandrasIncinerator.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/ChandrasIncinerator.java b/Mage.Sets/src/mage/cards/c/ChandrasIncinerator.java index 7375c39911..5fd71a51ef 100644 --- a/Mage.Sets/src/mage/cards/c/ChandrasIncinerator.java +++ b/Mage.Sets/src/mage/cards/c/ChandrasIncinerator.java @@ -76,7 +76,7 @@ class ChandrasIncineratorCostReductionEffect extends CostModificationEffectImpl if (watcher == null) { return true; } - int reductionAmount = watcher.getDamage(source.getControllerId(), game); + int reductionAmount = watcher.getDamage(source.getControllerId()); CardUtil.reduceCost(abilityToModify, Math.max(0, reductionAmount)); return true; } @@ -108,7 +108,7 @@ class ChandrasIncineratorWatcher extends Watcher { || ((DamagedPlayerEvent) event).isCombatDamage()) { return; } - for (UUID playerId : game.getOpponents(event.getPlayerId())) { + for (UUID playerId : game.getOpponents(event.getTargetId())) { damageMap.compute(playerId, ((u, i) -> i == null ? event.getAmount() : Integer.sum(i, event.getAmount()))); } } @@ -119,13 +119,8 @@ class ChandrasIncineratorWatcher extends Watcher { super.reset(); } - int getDamage(UUID playerId, Game game) { - return game - .getOpponents(playerId) - .stream() - .filter(damageMap::containsKey) - .mapToInt(damageMap::get) - .sum(); + int getDamage(UUID playerId) { + return damageMap.getOrDefault(playerId, 0); } }