diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index a67267fe39..d5965330f5 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -656,7 +656,9 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public void removeCounters(String name, int amount, Game game) { for (int i = 0; i < amount; i++) { - getCounters(game).removeCounter(name, 1); + if (!getCounters(game).removeCounter(name, 1)) { + break; + } GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, objectId, getControllerOrOwner()); event.setData(name); game.fireEvent(event); diff --git a/Mage/src/main/java/mage/counters/Counters.java b/Mage/src/main/java/mage/counters/Counters.java index 21842e5978..c52c7d6cef 100644 --- a/Mage/src/main/java/mage/counters/Counters.java +++ b/Mage/src/main/java/mage/counters/Counters.java @@ -74,26 +74,30 @@ public class Counters extends HashMap implements Serializable { } } - public void removeCounter(String name) { - removeCounter(name, 1); + public boolean removeCounter(String name) { + return removeCounter(name, 1); } - public void removeCounter(CounterType counterType, int amount) { + public boolean removeCounter(CounterType counterType, int amount) { if (this.containsKey(counterType.getName())) { get(counterType.getName()).remove(amount); if (get(counterType.getName()).count == 0) { this.remove(counterType.getName()); - } + } + return true; } + return false; } - public void removeCounter(String name, int amount) { + public boolean removeCounter(String name, int amount) { if (this.containsKey(name)) { this.get(name).remove(amount); if (this.get(name).getCount() == 0) { this.remove(name); } + return true; } + return false; } public void removeAllCounters(CounterType counterType){ diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 039f0b7075..15a6f39a60 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -1877,7 +1877,9 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public void removeCounters(String name, int amount, Ability source, Game game) { for (int i = 0; i < amount; i++) { - counters.removeCounter(name, 1); + if (!counters.removeCounter(name, 1)) { + break; + } GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, getId(), (source == null ? null : source.getSourceId()), (source == null ? null : source.getControllerId())); event.setData(name);