use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class DeathsOasisEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!super.checkTrigger(event, game)) {
return false;
}
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getTarget() == null) {
return false;
}
this.getEffects().clear();
this.addEffect(new MillCardsControllerEffect(2));
this.addEffect(new DeathsOasisEffect(zEvent.getTarget().getManaValue()));
return true;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class DiabolicServitudeSourceLeftBattlefieldEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (((ZoneChangeEvent) event).isDiesEvent()) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Object object = game.getState().getValue(getSourceId().toString() + "returnedCreature");
if ((object instanceof MageObjectReference) && ((MageObjectReference) object).refersTo(zEvent.getTarget(), game)) {
return true;
}
}
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class CardPutIntoOpponentGraveThisTurn method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
UUID cardId = event.getTargetId();
Card card = game.getCard(cardId);
if (card != null && zEvent.getToZone() == Zone.GRAVEYARD && !card.isCopy() && game.getOpponents(controllerId).contains(card.getOwnerId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(card.getOwnerId()));
}
return true;
}
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class GraveBetrayalReplacementEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zoneChangeEvent = (ZoneChangeEvent) event;
if (zoneChangeEvent.isDiesEvent()) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent != null && !permanent.isControlledBy(this.getControllerId()) && permanent.isCreature(game)) {
Card card = (Card) game.getObject(permanent.getId());
if (card != null) {
Effect effect = new GraveBetrayalEffect();
effect.setTargetPointer(new FixedTarget(card, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
game.addDelayedTriggeredAbility(delayedAbility, this);
return true;
}
}
}
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class OrahSkyclaveHierophantTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (!zEvent.isDiesEvent() || !zEvent.getTarget().isControlledBy(getControllerId()) || (!zEvent.getTarget().hasSubtype(SubType.CLERIC, game) && !zEvent.getTarget().getId().equals(getSourceId()))) {
return false;
}
FilterCard filterCard = new FilterCard("Cleric card with mana value less than " + (zEvent.getTarget().getManaValue()));
filterCard.add(SubType.CLERIC.getPredicate());
filterCard.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, zEvent.getTarget().getManaValue()));
this.getTargets().clear();
this.addTarget(new TargetCardInYourGraveyard(filterCard));
return true;
}
Aggregations