diff --git a/forge-ai/src/main/java/forge/ai/ability/PumpAiBase.java b/forge-ai/src/main/java/forge/ai/ability/PumpAiBase.java index 96fd9b7a977..2245339c249 100644 --- a/forge-ai/src/main/java/forge/ai/ability/PumpAiBase.java +++ b/forge-ai/src/main/java/forge/ai/ability/PumpAiBase.java @@ -758,7 +758,7 @@ public abstract class PumpAiBase extends SpellAbilityAi { pumped.addChangedCardKeywords(kws, new ArrayList(), false, timestamp); Set types = c.getCounters().keySet(); for(CounterType ct : types) { - pumped.addCounter(ct, c.getCounters(ct), true); + pumped.addCounterFireNoEvents(ct, c.getCounters(ct), true); } //Copies tap-state and extra keywords (auras, equipment, etc.) if (c.isTapped()) { 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 38ffeb7f92e..8c642c76525 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -1194,6 +1194,13 @@ public class Card extends GameEntity implements Comparable, IIdentifiable } public final void addCounter(final CounterType counterType, final int n, final boolean applyMultiplier) { + this.addCounter(counterType, n, applyMultiplier, true); + } + public final void addCounterFireNoEvents(final CounterType counterType, final int n, final boolean applyMultiplier) { + this.addCounter(counterType, n, applyMultiplier, false); + } + + private void addCounter(final CounterType counterType, final int n, final boolean applyMultiplier, final boolean fireEvents) { int addAmount = n; final HashMap repParams = new HashMap(); repParams.put("Event", "AddCounter"); @@ -1218,22 +1225,25 @@ public class Card extends GameEntity implements Comparable, IIdentifiable } this.setTotalCountersToAdd(addAmount); - int powerBonusBefore = this.getPowerBonusFromCounters(); - int toughnessBonusBefore = this.getToughnessBonusFromCounters(); - int loyaltyBefore = this.getCurrentLoyalty(); + if (fireEvents) { + final int powerBonusBefore = this.getPowerBonusFromCounters(); + final int toughnessBonusBefore = this.getToughnessBonusFromCounters(); + final int loyaltyBefore = this.getCurrentLoyalty(); - Integer oldValue = this.counters.get(counterType); - int newValue = addAmount + (oldValue == null ? 0 : oldValue.intValue()); - this.counters.put(counterType, Integer.valueOf(newValue)); + final Integer oldValue = this.counters.get(counterType); + final int newValue = addAmount + (oldValue == null ? 0 : oldValue.intValue()); + this.counters.put(counterType, Integer.valueOf(newValue)); - //fire card stats changed event if p/t bonuses or loyalty changed from added counters - if (powerBonusBefore != getPowerBonusFromCounters() || toughnessBonusBefore != getToughnessBonusFromCounters() || loyaltyBefore != getCurrentLoyalty()) { - getGame().fireEvent(new GameEventCardStatsChanged(this)); + + //fire card stats changed event if p/t bonuses or loyalty changed from added counters + if (powerBonusBefore != getPowerBonusFromCounters() || toughnessBonusBefore != getToughnessBonusFromCounters() || loyaltyBefore != getCurrentLoyalty()) { + getGame().fireEvent(new GameEventCardStatsChanged(this)); + } + + // play the Add Counter sound + getGame().fireEvent(new GameEventCardCounters(this, counterType, oldValue == null ? 0 : oldValue.intValue(), newValue)); } - // play the Add Counter sound - getGame().fireEvent(new GameEventCardCounters(this, counterType, oldValue == null ? 0 : oldValue.intValue(), newValue)); - // Run triggers final Map runParams = new TreeMap(); runParams.put("Card", this);