Search in sources :

Example 66 with FixedTarget

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

the class CommandersPlateEffect method init.

@Override
public void init(Ability source, Game game) {
    super.init(source, game);
    if (!affectedObjectsSet) {
        return;
    }
    Permanent equipment = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (equipment == null || equipment.getAttachedTo() == null) {
        return;
    }
    this.setTargetPointer(new FixedTarget(equipment.getAttachedTo(), game));
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) TargetPermanent(mage.target.TargetPermanent)

Example 67 with FixedTarget

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

the class CoffinQueenDelayedTriggeredAbility method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent controlledCreature = game.getPermanent(source.getFirstTarget());
    if (controlledCreature != null) {
        DelayedTriggeredAbility delayedAbility = new CoffinQueenDelayedTriggeredAbility();
        delayedAbility.getEffects().get(0).setTargetPointer(new FixedTarget(controlledCreature, game));
        game.addDelayedTriggeredAbility(delayedAbility, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility)

Example 68 with FixedTarget

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

the class CommandoRaidEffect method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
    Player opponent = game.getPlayer(event.getPlayerId());
    if (!damageEvent.isCombatDamage() || !event.getSourceId().equals(this.getSourceId()) || opponent == null) {
        return false;
    }
    FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
    filter.add(new ControllerIdPredicate(opponent.getId()));
    this.getTargets().clear();
    this.addTarget(new TargetCreaturePermanent(filter));
    for (Effect effect : this.getAllEffects()) {
        effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
        effect.setValue("damage", event.getAmount());
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) Player(mage.players.Player) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) DamagedPlayerEvent(mage.game.events.DamagedPlayerEvent)

Example 69 with FixedTarget

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

the class DarkDabblingEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    if (SpellMasteryCondition.instance.apply(game, source)) {
        for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
            if (!permanent.getId().equals(getTargetPointer().getFirst(game, source))) {
                RegenerateTargetEffect regenEffect = new RegenerateTargetEffect();
                regenEffect.setTargetPointer(new FixedTarget(permanent, game));
                game.addEffect(regenEffect, source);
            }
        }
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) RegenerateTargetEffect(mage.abilities.effects.common.RegenerateTargetEffect)

Example 70 with FixedTarget

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

the class DarkDecisionEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    if (controller != null && sourceObject != null) {
        TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard());
        target.setCardLimit(10);
        if (controller.searchLibrary(target, source, game)) {
            UUID targetId = target.getFirstTarget();
            Card card = game.getCard(targetId);
            if (card != null) {
                controller.moveCardsToExile(card, source, game, true, source.getSourceId(), sourceObject.getIdName());
                ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn);
                effect.setTargetPointer(new FixedTarget(card.getId(), game));
                game.addEffect(effect, source);
            }
            controller.shuffleLibrary(source, game);
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) FilterNonlandCard(mage.filter.common.FilterNonlandCard) PlayFromNotOwnHandZoneTargetEffect(mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect) MageObject(mage.MageObject) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UUID(java.util.UUID) TargetCardInLibrary(mage.target.common.TargetCardInLibrary) FilterNonlandCard(mage.filter.common.FilterNonlandCard) 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