Search in sources :

Example 91 with ZoneChangeEvent

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());
        }
    }
}
Also used : ZoneChangeEvent(mage.game.events.ZoneChangeEvent)

Example 92 with ZoneChangeEvent

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;
}
Also used : ZoneChangeEvent(mage.game.events.ZoneChangeEvent)

Example 93 with ZoneChangeEvent

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;
}
Also used : SatyrCantBlockToken(mage.game.permanent.token.SatyrCantBlockToken) ZoneChangeEvent(mage.game.events.ZoneChangeEvent) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect)

Example 94 with ZoneChangeEvent

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;
}
Also used : ZoneChangeEvent(mage.game.events.ZoneChangeEvent) Permanent(mage.game.permanent.Permanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect)

Aggregations

ZoneChangeEvent (mage.game.events.ZoneChangeEvent)94 Permanent (mage.game.permanent.Permanent)56 Player (mage.players.Player)27 FixedTarget (mage.target.targetpointer.FixedTarget)23 Card (mage.cards.Card)20 UUID (java.util.UUID)14 MageObject (mage.MageObject)11 MageObjectReference (mage.MageObjectReference)10 Effect (mage.abilities.effects.Effect)9 FilterCard (mage.filter.FilterCard)8 PermanentToken (mage.game.permanent.PermanentToken)8 FilterPermanent (mage.filter.FilterPermanent)7 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)7 Ability (mage.abilities.Ability)6 OneShotEffect (mage.abilities.effects.OneShotEffect)6 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)6 Spell (mage.game.stack.Spell)6 Zone (mage.constants.Zone)5 TargetPermanent (mage.target.TargetPermanent)5 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)5