Search in sources :

Example 56 with FixedTargets

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

the class DeadIronSledgeDestroyEffect method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    Permanent equipment = game.getPermanent(sourceId);
    if (equipment != null && equipment.getAttachedTo() != null) {
        Permanent equipped = game.getPermanent(equipment.getAttachedTo());
        if (equipped.getId().equals(event.getTargetId()) || equipped.getId().equals(event.getSourceId())) {
            List<Permanent> targets = new ArrayList<>();
            Permanent blocker = game.getPermanent(event.getSourceId());
            if (blocker != null) {
                targets.add(blocker);
            }
            Permanent blocked = game.getPermanent(event.getTargetId());
            if (blocked != null) {
                targets.add(blocked);
            }
            this.getEffects().get(0).setTargetPointer(new FixedTargets(targets, game));
            return true;
        }
    }
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) FixedTargets(mage.target.targetpointer.FixedTargets) ArrayList(java.util.ArrayList)

Example 57 with FixedTargets

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

the class BreachingLeviathanEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    List<Permanent> doNotUntapNextUntapStep = new ArrayList<>();
    for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
        creature.tap(source, game);
        doNotUntapNextUntapStep.add(creature);
    }
    if (!doNotUntapNextUntapStep.isEmpty()) {
        ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("This creature");
        effect.setTargetPointer(new FixedTargets(doNotUntapNextUntapStep, game));
        game.addEffect(effect, source);
    }
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) DontUntapInControllersNextUntapStepTargetEffect(mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect) FixedTargets(mage.target.targetpointer.FixedTargets) ArrayList(java.util.ArrayList) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 58 with FixedTargets

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

the class ClingingMistsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    List<Permanent> doNotUntapNextUntapStep = new ArrayList<>();
    for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_ATTACKING_CREATURES, source.getControllerId(), source.getSourceId(), game)) {
        creature.tap(source, game);
        doNotUntapNextUntapStep.add(creature);
    }
    if (!doNotUntapNextUntapStep.isEmpty()) {
        ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("This creature");
        effect.setTargetPointer(new FixedTargets(doNotUntapNextUntapStep, game));
        game.addEffect(effect, source);
    }
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) DontUntapInControllersNextUntapStepTargetEffect(mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect) FixedTargets(mage.target.targetpointer.FixedTargets) ArrayList(java.util.ArrayList) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Aggregations

FixedTargets (mage.target.targetpointer.FixedTargets)58 Player (mage.players.Player)36 Permanent (mage.game.permanent.Permanent)28 ArrayList (java.util.ArrayList)19 UUID (java.util.UUID)19 OneShotEffect (mage.abilities.effects.OneShotEffect)15 CardsImpl (mage.cards.CardsImpl)15 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)14 ContinuousEffect (mage.abilities.effects.ContinuousEffect)14 Effect (mage.abilities.effects.Effect)14 Card (mage.cards.Card)14 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)13 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)10 Cards (mage.cards.Cards)10 Token (mage.game.permanent.token.Token)9 TargetPermanent (mage.target.TargetPermanent)8 HashSet (java.util.HashSet)7 MageObject (mage.MageObject)7 DontUntapInControllersNextUntapStepTargetEffect (mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect)7 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)6