use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class KunorosHoundOfAthreosCastEffect method applies.
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() != Zone.BATTLEFIELD || zEvent.getFromZone() != Zone.GRAVEYARD) {
return false;
}
Card card = game.getCard(zEvent.getTargetId());
return card != null && card.isCreature(game);
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class SludgeStriderEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
return true;
}
}
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
if (permanent == null) {
permanent = (Permanent) game.getLastKnownInformation(targetId, Zone.BATTLEFIELD);
}
return permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game);
}
}
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class SpiritSistersCallPredicate method applies.
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
UUID targetId = zEvent.getTargetId();
return targetId != null && targetId.equals(source.getSourceId()) && zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() != Zone.EXILED;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class SyrKonradTheGrimTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
// Whenever another creature dies
if (zEvent.isDiesEvent() && zEvent.getTarget() != null && !zEvent.getTargetId().equals(this.getSourceId()) && zEvent.getTarget().isCreature(game)) {
return true;
}
Card card = game.getCard(zEvent.getTargetId());
// Or a creature card is put into a graveyard from anywhere other than the battlefield
if (card == null || !card.isCreature(game)) {
return false;
}
if (zEvent.getToZone() == Zone.GRAVEYARD && zEvent.getFromZone() != Zone.BATTLEFIELD) {
return true;
}
// Or a creature card leaves your graveyard
return zEvent.getFromZone() == Zone.GRAVEYARD && zEvent.getPlayerId() == this.getControllerId();
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class UginsNexusExileEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent != null) {
permanent.moveToExile(null, "", source, game);
new AddExtraTurnControllerEffect().apply(game, source);
return true;
}
return false;
}
Aggregations