diff --git a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneAllEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneAllEffect.java index 3c5063a0c05..3066be8da31 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneAllEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneAllEffect.java @@ -1,6 +1,5 @@ package forge.game.ability.effects; -import com.google.common.base.Predicates; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; @@ -20,7 +19,6 @@ import forge.game.zone.Zone; import forge.game.zone.ZoneType; import forge.util.Lang; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -80,7 +78,7 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect { if (!libCards.isEmpty()) { sa.getActivatingPlayer().getController().reveal(libCards, ZoneType.Library, libCards.get(0).getOwner()); } - final HashMap runParams = new HashMap(); + final Map runParams = Maps.newHashMap(); runParams.put("Player", sa.getActivatingPlayer()); runParams.put("Target", tgtPlayers); game.getTriggerHandler().runTrigger(TriggerType.SearchedLibrary, runParams, false); @@ -218,7 +216,7 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect { } if (!triggerList.isEmpty()) { - final HashMap runParams = new HashMap(); + final Map runParams = Maps.newHashMap(); runParams.put("Cards", triggerList); runParams.put("Destination", destination); game.getTriggerHandler().runTrigger(TriggerType.ChangesZoneAll, runParams, false); diff --git a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java index 38c074d2242..5242a135c93 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java @@ -475,7 +475,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { } if (sa.hasParam("WithCounters")) { String[] parse = sa.getParam("WithCounters").split("_"); - tgtC.addEtbCounter(CounterType.getType(parse[0]), Integer.parseInt(parse[1])); + tgtC.addEtbCounter(CounterType.getType(parse[0]), Integer.parseInt(parse[1]), hostCard); } if (sa.hasParam("GainControl")) { if (sa.hasParam("NewController")) { diff --git a/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java b/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java index 8b731a761cb..f2fb6ce7bf4 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/CountersPutEffect.java @@ -193,7 +193,7 @@ public class CountersPutEffect extends SpellAbilityEffect { final Zone zone = tgtCard.getGame().getZoneOf(tgtCard); if (zone == null || zone.is(ZoneType.Battlefield) || zone.is(ZoneType.Stack)) { if (etbcounter) { - tgtCard.addEtbCounter(counterType, counterAmount); + tgtCard.addEtbCounter(counterType, counterAmount, card); } else { tgtCard.addCounter(counterType, counterAmount, card, true); } @@ -224,7 +224,7 @@ public class CountersPutEffect extends SpellAbilityEffect { // adding counters to something like re-suspend cards // etbcounter should apply multiplier if (etbcounter) { - tgtCard.addEtbCounter(counterType, counterAmount); + tgtCard.addEtbCounter(counterType, counterAmount, card); } else { tgtCard.addCounter(counterType, counterAmount, card, false); } diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 23bcb46698d..84b360759f1 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -254,7 +254,7 @@ public class Card extends GameEntity implements Comparable { private CardRules cardRules; private final CardView view; - private Map etbCounters = Maps.newEnumMap(CounterType.class); + private Table etbCounters = HashBasedTable.create(); // Enumeration for CMC request types public enum SplitCMCMode { @@ -7118,14 +7118,14 @@ public class Card extends GameEntity implements Comparable { * ETBCounters are only used between replacementEffects * and when the Card really enters the Battlefield with the counters * @return map of counters - */ - public final Map getEtbCounters() { - return etbCounters; + */ + public final void addEtbCounter(CounterType type, Integer val) { + addEtbCounter(type, val, this); } - public final void addEtbCounter(CounterType type, Integer val) { - int old = etbCounters.containsKey(type) ? etbCounters.get(type) : 0; - etbCounters.put(type, old + val); + public final void addEtbCounter(CounterType type, Integer val, final Card source) { + int old = etbCounters.get(source, type); + etbCounters.put(source, type, old + val); } public final void clearEtbCounters() { @@ -7133,8 +7133,8 @@ public class Card extends GameEntity implements Comparable { } public final void putEtbCounters() { - for (Map.Entry e : etbCounters.entrySet()) { - this.addCounter(e.getKey(), e.getValue(), this, true); + for (Table.Cell e : etbCounters.cellSet()) { + this.addCounter(e.getColumnKey(), e.getValue(), e.getRowKey(), true); } }