appliedEffects parameter added to addCounters methods for tracking replacementEffect consumation

This commit is contained in:
LevelX2 2012-10-13 00:54:52 +02:00
parent 116da59f48
commit a2506ffa69
2 changed files with 18 additions and 1 deletions

View file

@ -103,8 +103,12 @@ public interface Permanent extends Card, Controllable {
public void removeAllDamage(Game game);
public Counters getCounters();
public void addCounters(String name, int amount, Game game);
public void addCounters(String name, int amount, Game game, ArrayList<UUID> appliedEffects);
public void addCounters(Counter counter, Game game);
public void addCounters(Counter counter, Game game, ArrayList<UUID> appliedEffects);
public void removeCounters(String name, int amount, Game game);
public void removeCounters(Counter counter, Game game);
public void reset(Game game);

View file

@ -205,7 +205,13 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
@Override
public void addCounters(String name, int amount, Game game) {
addCounters(name, amount, game, null);
}
@Override
public void addCounters(String name, int amount, Game game, ArrayList<UUID> appliedEffects) {
GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, name, amount);
event.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(event)) {
counters.addCounter(name, amount);
game.fireEvent(GameEvent.getEvent(EventType.COUNTER_ADDED, objectId, controllerId, name, amount));
@ -214,7 +220,14 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
@Override
public void addCounters(Counter counter, Game game) {
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, counter.getName(), counter.getCount()))) {
addCounters(counter, game, null);
}
@Override
public void addCounters(Counter counter, Game game, ArrayList<UUID> appliedEffects) {
GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, counter.getName(), counter.getCount());
event.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(event)) {
counters.addCounter(counter);
game.fireEvent(GameEvent.getEvent(EventType.COUNTER_ADDED, objectId, controllerId, counter.getName(), counter.getCount()));
}