use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class BellowingElkWatcher 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 DesertionReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zce = (ZoneChangeEvent) event;
zce.setToZone(Zone.BATTLEFIELD);
zce.setPlayerId(source.getControllerId());
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class AnaxHardenedInTheForgeTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (super.checkTrigger(event, game)) {
int tokenCount = ((ZoneChangeEvent) event).getTarget().getPower().getValue() > 3 ? 2 : 1;
this.getEffects().clear();
this.addEffect(new CreateTokenEffect(new SatyrCantBlockToken(), tokenCount));
return true;
}
return false;
}
use of mage.game.events.ZoneChangeEvent in project mage by magefree.
the class DeathsPresenceTriggeredAbility 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.getTargets().clear();
this.addTarget(new TargetControlledCreaturePermanent());
this.getEffects().clear();
this.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(permanent.getPower().getValue())));
return true;
}
}
return false;
}
Aggregations