use of mage.game.events.NumberOfTriggersEvent in project mage by magefree.
the class AncientGreenwardenEffect method applies.
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!(event instanceof NumberOfTriggersEvent)) {
return false;
}
NumberOfTriggersEvent numberOfTriggersEvent = (NumberOfTriggersEvent) event;
if (!source.isControlledBy(event.getPlayerId())) {
return false;
}
GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent();
if (sourceEvent == null || sourceEvent.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD || !(sourceEvent instanceof EntersTheBattlefieldEvent) || !((EntersTheBattlefieldEvent) sourceEvent).getTarget().isLand(game)) {
return false;
}
return game.getPermanent(numberOfTriggersEvent.getSourceId()) != null;
}
Aggregations