Search in sources :

Example 6 with FixedTarget

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

the class ChemistersTrickEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, source.getControllerId(), source.getSourceId(), game)) {
        AttacksIfAbleTargetEffect effect = new AttacksIfAbleTargetEffect(Duration.EndOfTurn);
        effect.setTargetPointer(new FixedTarget(creature.getId(), game));
        game.addEffect(effect, source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) AttacksIfAbleTargetEffect(mage.abilities.effects.common.combat.AttacksIfAbleTargetEffect)

Example 7 with FixedTarget

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

the class ChaosMoonEvenReplacementEffect method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    Permanent land = ((TappedForManaEvent) event).getPermanent();
    if (land == null || !land.hasSubtype(SubType.MOUNTAIN, game)) {
        return false;
    }
    this.getEffects().setTargetPointer(new FixedTarget(land.getControllerId()));
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 8 with FixedTarget

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

the class CharmingPrinceEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = game.getObject(source.getSourceId());
    if (controller == null || sourceObject == null) {
        return false;
    }
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent == null) {
        return false;
    }
    if (!controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source, game, Zone.BATTLEFIELD, true)) {
        return false;
    }
    // create delayed triggered ability
    Effect effect = new ReturnToBattlefieldUnderYourControlTargetEffect();
    effect.setText("Return it to the battlefield under your control at the beginning of the next end step");
    effect.setTargetPointer(new FixedTarget(permanent.getId(), game));
    game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) MageObject(mage.MageObject) ReturnToBattlefieldUnderYourControlTargetEffect(mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) ReturnToBattlefieldUnderYourControlTargetEffect(mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect) ScryEffect(mage.abilities.effects.keyword.ScryEffect) GainLifeEffect(mage.abilities.effects.common.GainLifeEffect) Effect(mage.abilities.effects.Effect)

Example 9 with FixedTarget

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

the class DefiantVanguardEffect method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    Permanent blocker = game.getPermanent(event.getSourceId());
    Permanent blocked = game.getPermanent(event.getTargetId());
    if (blocker != null && blocked != null) {
        // in case the attacker changes zone
        game.getState().setValue(blocked.toString(), blocked.getZoneChangeCounter(game));
        // in case the blocker changes zone
        game.getState().setValue(blocker.toString(), blocker.getZoneChangeCounter(game));
        getAllEffects().setTargetPointer(new FixedTarget(blocked.getId()));
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent)

Example 10 with FixedTarget

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

the class DiluvianPrimordialReplacementEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        for (Target target : source.getTargets()) {
            if (target instanceof TargetCardInOpponentsGraveyard) {
                Card targetCard = game.getCard(target.getFirstTarget());
                if (targetCard != null) {
                    if (controller.chooseUse(Outcome.PlayForFree, "Cast " + targetCard.getLogName() + '?', source, game)) {
                        game.getState().setValue("PlayFromNotOwnHandZone" + targetCard.getId(), Boolean.TRUE);
                        Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(targetCard, game, true), game, true, new ApprovingObject(source, game));
                        game.getState().setValue("PlayFromNotOwnHandZone" + targetCard.getId(), null);
                        if (cardWasCast) {
                            ContinuousEffect effect = new DiluvianPrimordialReplacementEffect();
                            effect.setTargetPointer(new FixedTarget(targetCard.getId(), game.getState().getZoneChangeCounter(targetCard.getId())));
                            game.addEffect(effect, source);
                        }
                    }
                }
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Target(mage.target.Target) FixedTarget(mage.target.targetpointer.FixedTarget) ApprovingObject(mage.ApprovingObject) TargetCardInOpponentsGraveyard(mage.target.common.TargetCardInOpponentsGraveyard) ContinuousEffect(mage.abilities.effects.ContinuousEffect) FilterCard(mage.filter.FilterCard) Card(mage.cards.Card)

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