Fix Heat Stroke

This commit is contained in:
Noah Gleason 2018-06-23 11:11:35 -04:00
parent 9eeebcd3d3
commit c78cbc40eb
No known key found for this signature in database
GPG key ID: 38D5F989A472EC21
3 changed files with 119 additions and 11 deletions

View file

@ -0,0 +1,53 @@
package mage.watchers.common;
import mage.MageObjectReference;
import mage.constants.WatcherScope;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.watchers.Watcher;
import java.util.HashSet;
import java.util.Set;
/**
*
* @author noahg
*/
public class WasBlockedThisTurnWatcher extends Watcher {
private final Set<MageObjectReference> wasBlockedThisTurnCreatures;
public WasBlockedThisTurnWatcher() {
super(WasBlockedThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
wasBlockedThisTurnCreatures = new HashSet<>();
}
public WasBlockedThisTurnWatcher(final WasBlockedThisTurnWatcher watcher) {
super(watcher);
wasBlockedThisTurnCreatures = new HashSet<>(watcher.wasBlockedThisTurnCreatures);
}
@Override
public Watcher copy() {
return new WasBlockedThisTurnWatcher(this);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) {
this.wasBlockedThisTurnCreatures.add(new MageObjectReference(event.getTargetId(), game));
}
}
public Set<MageObjectReference> getWasBlockedThisTurnCreatures() {
return this.wasBlockedThisTurnCreatures;
}
@Override
public void reset() {
super.reset();
wasBlockedThisTurnCreatures.clear();
}
}