Search in sources :

Example 46 with FixedTarget

use of mage.target.targetpointer.FixedTarget in project mage by magefree.

the class StanggExileTokenEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (sourceObject != null) {
        CreateTokenEffect effect = new CreateTokenEffect(new StanggTwinToken());
        effect.apply(game, source);
        game.getState().setValue(source.getSourceId() + "_token", effect.getLastAddedTokenIds());
        for (UUID addedTokenId : effect.getLastAddedTokenIds()) {
            Effect sacrificeEffect = new SacrificeTargetEffect("sacrifice " + sourceObject.getName());
            sacrificeEffect.setTargetPointer(new FixedTarget(sourceObject, game));
            LeavesBattlefieldTriggeredAbility triggerAbility = new LeavesBattlefieldTriggeredAbility(sacrificeEffect, false);
            ContinuousEffect continuousEffect = new GainAbilityTargetEffect(triggerAbility, Duration.WhileOnBattlefield);
            continuousEffect.setTargetPointer(new FixedTarget(addedTokenId, game));
            game.addEffect(continuousEffect, source);
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) LeavesBattlefieldTriggeredAbility(mage.abilities.common.LeavesBattlefieldTriggeredAbility) StanggTwinToken(mage.game.permanent.token.StanggTwinToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) Effect(mage.abilities.effects.Effect) InfoEffect(mage.abilities.effects.common.InfoEffect) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UUID(java.util.UUID)

Example 47 with FixedTarget

use of mage.target.targetpointer.FixedTarget 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;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) ZoneChangeEvent(mage.game.events.ZoneChangeEvent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect)

Example 48 with FixedTarget

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

Example 49 with FixedTarget

use of mage.target.targetpointer.FixedTarget in project mage by magefree.

the class TezzeretMasterOfMetalControlEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, targetPointer.getFirst(game, source), game);
    for (Permanent permanent : permanents) {
        ContinuousEffect effect = new TezzeretMasterOfMetalControlEffect(source.getControllerId());
        effect.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect, source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 50 with FixedTarget

use of mage.target.targetpointer.FixedTarget in project mage by magefree.

the class TransmogrifyingWandEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent creature = game.getPermanent(source.getFirstTarget());
    if (creature == null) {
        return false;
    }
    Effect effect = new CreateTokenTargetEffect(new OxToken());
    effect.setTargetPointer(new FixedTarget(creature.getControllerId(), game));
    new DestroyTargetEffect().apply(game, source);
    return effect.apply(game, source);
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) OxToken(mage.game.permanent.token.OxToken) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) CreateTokenTargetEffect(mage.abilities.effects.common.CreateTokenTargetEffect) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) CreateTokenTargetEffect(mage.abilities.effects.common.CreateTokenTargetEffect) AddCountersSourceEffect(mage.abilities.effects.common.counter.AddCountersSourceEffect) Effect(mage.abilities.effects.Effect)

Aggregations

FixedTarget (mage.target.targetpointer.FixedTarget)746 Permanent (mage.game.permanent.Permanent)491 Player (mage.players.Player)385 ContinuousEffect (mage.abilities.effects.ContinuousEffect)248 Effect (mage.abilities.effects.Effect)222 OneShotEffect (mage.abilities.effects.OneShotEffect)185 UUID (java.util.UUID)178 Card (mage.cards.Card)174 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)116 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)109 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)101 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)87 TargetPermanent (mage.target.TargetPermanent)84 FilterPermanent (mage.filter.FilterPermanent)71 MageObject (mage.MageObject)68 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)63 BoostTargetEffect (mage.abilities.effects.common.continuous.BoostTargetEffect)53 GainControlTargetEffect (mage.abilities.effects.common.continuous.GainControlTargetEffect)53 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)50 FilterCard (mage.filter.FilterCard)46