mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Refactor - moved ZuberasDiedWatcher to shared area
This commit is contained in:
parent
08ac7ab342
commit
8e6389040d
6 changed files with 53 additions and 42 deletions
|
|
@ -0,0 +1,48 @@
|
|||
package mage.watchers.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
* Created by Eric on 9/24/2016.
|
||||
*/
|
||||
public class ZuberasDiedWatcher extends Watcher {
|
||||
|
||||
public int zuberasDiedThisTurn = 0;
|
||||
|
||||
public ZuberasDiedWatcher() {
|
||||
super("ZuberasDied", WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public ZuberasDiedWatcher(final ZuberasDiedWatcher watcher) {
|
||||
super(watcher);
|
||||
this.zuberasDiedThisTurn = watcher.zuberasDiedThisTurn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZuberasDiedWatcher copy() {
|
||||
return new ZuberasDiedWatcher(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) {
|
||||
MageObject card = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
||||
if (card != null && card.hasSubtype("Zubera", game)) {
|
||||
zuberasDiedThisTurn++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
zuberasDiedThisTurn = 0;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue