use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class DiesReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && permanent != null) {
return controller.moveCards(permanent, Zone.EXILED, source, game);
}
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class KothophedSoulHoarderTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.GRAVEYARD && zEvent.getFromZone() == Zone.BATTLEFIELD) {
Card card = game.getCard(zEvent.getTargetId());
Player controller = game.getPlayer(getControllerId());
return card != null && controller != null && controller.hasOpponent(card.getOwnerId(), game);
}
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class MillicentRestlessRevenantTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent;
switch(event.getType()) {
case ZONE_CHANGE:
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (!zEvent.isDiesEvent()) {
return false;
}
permanent = zEvent.getTarget();
break;
case DAMAGED_PLAYER:
if (!((DamagedEvent) event).isCombatDamage()) {
return false;
}
permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
break;
default:
return false;
}
if (permanent == null) {
return false;
}
return permanent.getId().equals(this.getSourceId()) || (!(permanent instanceof PermanentToken) && permanent.hasSubtype(SubType.SPIRIT, game));
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class ProperBurialTriggeredAbility 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)) {
this.getEffects().clear();
this.addEffect(new GainLifeEffect(permanent.getToughness().getValue()));
return true;
}
}
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class SanctifierEnVecEffect method applies.
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.GRAVEYARD) {
Permanent permanent = zEvent.getTarget();
if (permanent != null) {
return permanent.getColor(game).contains(ObjectColor.BLACK) || permanent.getColor(game).contains(ObjectColor.RED);
}
Card card = game.getCard(zEvent.getTargetId());
if (card != null) {
return card.getColor(game).contains(ObjectColor.BLACK) || card.getColor(game).contains(ObjectColor.RED);
}
}
return false;
}
Aggregations