mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Fix Heat Stroke
This commit is contained in:
parent
9eeebcd3d3
commit
c78cbc40eb
3 changed files with 119 additions and 11 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue