Search in sources :

Example 6 with DontUntapInControllersNextUntapStepTargetEffect

use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect in project mage by magefree.

the class TangleEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        List<Permanent> doNotUntapNextUntapStep = new ArrayList<>();
        for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
            doNotUntapNextUntapStep.add(permanent);
        }
        if (!doNotUntapNextUntapStep.isEmpty()) {
            ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("This creature");
            effect.setTargetPointer(new FixedTargets(doNotUntapNextUntapStep, game));
            game.addEffect(effect, source);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) 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 7 with DontUntapInControllersNextUntapStepTargetEffect

use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect in project mage by magefree.

the class GuardianOfTazeemEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent land = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
    Permanent targetCreature = game.getPermanent(source.getFirstTarget());
    if (land != null && targetCreature != null && land.hasSubtype(SubType.ISLAND, game)) {
        ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("that creature");
        effect.setTargetPointer(new FixedTarget(targetCreature, game));
        game.addEffect(effect, source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) DontUntapInControllersNextUntapStepTargetEffect(mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 8 with DontUntapInControllersNextUntapStepTargetEffect

use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect in project mage by magefree.

the class CodeOfConstraintEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    if (AddendumCondition.instance.apply(game, source)) {
        new TapTargetEffect().apply(game, source);
        game.addEffect(new DontUntapInControllersNextUntapStepTargetEffect(), source);
    }
    return true;
}
Also used : DontUntapInControllersNextUntapStepTargetEffect(mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect) TapTargetEffect(mage.abilities.effects.common.TapTargetEffect)

Example 9 with DontUntapInControllersNextUntapStepTargetEffect

use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect in project mage by magefree.

the class ExertedThisTurnWatcher method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    Permanent creature = game.getPermanent(event.getSourceId());
    Player controller = game.getPlayer(source.getControllerId());
    if (creature != null && controller != null) {
        if (exertOnlyOncePerTurn) {
            MageObjectReference creatureReference = new MageObjectReference(creature.getId(), creature.getZoneChangeCounter(game), game);
            ExertedThisTurnWatcher watcher = game.getState().getWatcher(ExertedThisTurnWatcher.class);
            if (watcher != null && watcher.getExertedThisTurnCreatures().contains(creatureReference)) {
                return false;
            }
        }
        if (controller.chooseUse(outcome, "Exert " + creature.getLogName() + '?', "An exerted creature won't untap during your next untap step.", "Yes", "No", source, game)) {
            if (!game.isSimulation()) {
                game.informPlayers(controller.getLogName() + " exerted " + creature.getName());
            }
            game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_EXERTED, creature.getId(), source, source.getControllerId()));
            ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("", creature.getControllerId());
            effect.setTargetPointer(new FixedTarget(creature, game));
            game.addEffect(effect, source);
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) DontUntapInControllersNextUntapStepTargetEffect(mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) MageObjectReference(mage.MageObjectReference)

Example 10 with DontUntapInControllersNextUntapStepTargetEffect

use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect in project mage by magefree.

the class MisstepEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    if (player != null) {
        List<Permanent> doNotUntapNextUntapStep = new ArrayList<>();
        for (Permanent creature : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, player.getId(), game)) {
            doNotUntapNextUntapStep.add(creature);
        }
        if (!doNotUntapNextUntapStep.isEmpty()) {
            ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("", player.getId());
            effect.setText("those creatures don't untap during that player's next untap step");
            effect.setTargetPointer(new FixedTargets(doNotUntapNextUntapStep, game));
            game.addEffect(effect, source);
        }
        return true;
    }
    return false;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) 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

DontUntapInControllersNextUntapStepTargetEffect (mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect)15 Permanent (mage.game.permanent.Permanent)13 ContinuousEffect (mage.abilities.effects.ContinuousEffect)11 Player (mage.players.Player)9 ArrayList (java.util.ArrayList)8 FixedTargets (mage.target.targetpointer.FixedTargets)7 FixedTarget (mage.target.targetpointer.FixedTarget)5 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)3 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)3 TapTargetEffect (mage.abilities.effects.common.TapTargetEffect)2 TargetPlayer (mage.target.TargetPlayer)2 MageObjectReference (mage.MageObjectReference)1 TargetLandPermanent (mage.target.common.TargetLandPermanent)1 BlockedAttackerWatcher (mage.watchers.common.BlockedAttackerWatcher)1