use of mage.watchers.common.CastFromGraveyardWatcher in project mage by magefree.
the class BreathlessKnightTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof EntersTheBattlefieldEvent) {
EntersTheBattlefieldEvent entersEvent = (EntersTheBattlefieldEvent) event;
Permanent permanent = entersEvent.getTarget();
if (permanent != null && permanent.isCreature(game) && permanent.isControlledBy(this.getControllerId())) {
if (entersEvent.getFromZone() == Zone.GRAVEYARD) {
return true;
}
CastFromGraveyardWatcher watcher = game.getState().getWatcher(CastFromGraveyardWatcher.class);
int zcc = game.getState().getZoneChangeCounter(entersEvent.getSourceId());
return watcher != null && watcher.spellWasCastFromGraveyard(entersEvent.getSourceId(), zcc - 1);
}
}
return false;
}
Aggregations