forked from External/mage
Fix the counter removal code so it doesn't throw events when it's removing nonexistent counters.
This commit is contained in:
parent
5e12a141cb
commit
9ff3e2c670
3 changed files with 15 additions and 7 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue