Search in sources :

Example 36 with EntersTheBattlefieldEvent

use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.

the class NeoformReplacementEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
    if (creature != null) {
        creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects());
    }
    discard();
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) EntersTheBattlefieldEvent(mage.game.events.EntersTheBattlefieldEvent)

Example 37 with EntersTheBattlefieldEvent

use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.

the class SavageSummoningEntersBattlefieldEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
    if (creature != null) {
        creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects());
    }
    discard();
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) EntersTheBattlefieldEvent(mage.game.events.EntersTheBattlefieldEvent)

Example 38 with EntersTheBattlefieldEvent

use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.

the class TheoreticalDuplicationTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    EntersTheBattlefieldEvent eEvent = (EntersTheBattlefieldEvent) event;
    if (!eEvent.getTarget().isCreature(game) || eEvent.getTarget() instanceof PermanentToken || !game.getOpponents(getControllerId()).contains(eEvent.getTarget().getControllerId())) {
        return false;
    }
    getEffects().setTargetPointer(new FixedTarget(eEvent.getTarget(), game));
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) EntersTheBattlefieldEvent(mage.game.events.EntersTheBattlefieldEvent) PermanentToken(mage.game.permanent.PermanentToken)

Example 39 with EntersTheBattlefieldEvent

use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.

the class UndyingMaliceCounterEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
    if (creature == null) {
        return false;
    }
    creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects());
    discard();
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) EntersTheBattlefieldEvent(mage.game.events.EntersTheBattlefieldEvent)

Example 40 with EntersTheBattlefieldEvent

use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.

the class YarokTheDesecratedEffect method applies.

@Override
public boolean applies(GameEvent event, Ability source, Game game) {
    if (!(event instanceof NumberOfTriggersEvent)) {
        return false;
    }
    NumberOfTriggersEvent numberOfTriggersEvent = (NumberOfTriggersEvent) event;
    if (!source.isControlledBy(event.getPlayerId())) {
        return false;
    }
    GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent();
    // Only EtB triggers
    if (sourceEvent == null || sourceEvent.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD || !(sourceEvent instanceof EntersTheBattlefieldEvent)) {
        return false;
    }
    // Only for triggers of permanents
    return game.getPermanent(numberOfTriggersEvent.getSourceId()) != null;
}
Also used : NumberOfTriggersEvent(mage.game.events.NumberOfTriggersEvent) EntersTheBattlefieldEvent(mage.game.events.EntersTheBattlefieldEvent) GameEvent(mage.game.events.GameEvent)

Aggregations

EntersTheBattlefieldEvent (mage.game.events.EntersTheBattlefieldEvent)43 Permanent (mage.game.permanent.Permanent)36 Player (mage.players.Player)8 FixedTarget (mage.target.targetpointer.FixedTarget)6 TargetControlledPermanent (mage.target.common.TargetControlledPermanent)5 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)5 ContinuousEffect (mage.abilities.effects.ContinuousEffect)4 FilterPermanent (mage.filter.FilterPermanent)4 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)4 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)4 UUID (java.util.UUID)3 Effect (mage.abilities.effects.Effect)3 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)3 Target (mage.target.Target)3 MageObject (mage.MageObject)2 MageObjectReference (mage.MageObjectReference)2 LoseLifeTargetEffect (mage.abilities.effects.common.LoseLifeTargetEffect)2 SetPowerToughnessSourceEffect (mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect)2 Card (mage.cards.Card)2 GameEvent (mage.game.events.GameEvent)2