use of mage.watchers.common.CastFromHandWatcher in project mage by magefree.
the class HarnessTheStormEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (super.checkTrigger(event, game)) {
CastFromHandWatcher watcher = game.getState().getWatcher(CastFromHandWatcher.class);
if (watcher != null && watcher.spellWasCastFromHand(event.getSourceId())) {
Spell spell = game.getState().getStack().getSpell(event.getSourceId());
if (spell != null) {
FilterCard filterCard = new FilterCard("a card named " + spell.getName() + " in your graveyard");
filterCard.add(new NamePredicate(spell.getName()));
this.getTargets().clear();
this.getTargets().add(new TargetCardInYourGraveyard(filterCard));
return true;
}
}
}
return false;
}
use of mage.watchers.common.CastFromHandWatcher in project mage by magefree.
the class BanishIntoFableEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!super.checkTrigger(event, game)) {
return false;
}
CastFromHandWatcher watcher = game.getState().getWatcher(CastFromHandWatcher.class);
if (watcher == null || !watcher.spellWasCastFromHand(event.getSourceId())) {
return false;
}
Spell spell = game.getState().getStack().getSpell(event.getSourceId());
if (spell == null) {
return false;
}
this.getEffects().clear();
this.addEffect(new BanishIntoFableEffect(spell.getId()));
return true;
}
Aggregations