use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class SaddledRimestagWatcher method watch.
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.BATTLEFIELD && zEvent.getTarget().isCreature(game)) {
playerMap.putIfAbsent(zEvent.getTarget().getControllerId(), new HashSet<>());
playerMap.get(zEvent.getTarget().getControllerId()).add(zEvent.getTargetId());
}
}
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class SporogenesisRemoveCountersEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.isDiesEvent()) {
Permanent permanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
if (permanent != null && permanent.isCreature(game) && permanent.getCounters(game).containsKey(CounterType.FUNGUS)) {
Effect effect = this.getEffects().get(0);
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true;
}
}
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class TheDeckOfManyThingsDelayedTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (!zEvent.isDiesEvent() || !mor.refersTo(zEvent.getTarget(), game)) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(zEvent.getTarget().getOwnerId(), game));
return true;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class TravelingPlagueEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
Permanent enchantedCreature = game.getPermanentOrLKIBattlefield(event.getTargetId());
Permanent travelingPlague = game.getPermanentOrLKIBattlefield(sourceId);
if (enchantedCreature != null && enchantedCreature.getAttachments().contains(travelingPlague.getId())) {
game.getState().setValue("travelingPlague" + sourceId, enchantedCreature);
return true;
}
}
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class ValentinDeanOfTheVeinEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
((ZoneChangeEvent) event).setToZone(Zone.EXILED);
game.fireReflexiveTriggeredAbility(new ReflexiveTriggeredAbility(new DoIfCostPaid(new CreateTokenEffect(new Pest11GainLifeToken()), new GenericManaCost(2)), false, "you may pay {2}. If you do, create a 1/1 black and green " + "Pest creature token with \"When this creature dies, you gain 1 life.\""), source);
return false;
}
Aggregations