Search in sources :

Example 11 with DontUntapInControllersNextUntapStepTargetEffect

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

the class ExertSourceCost method pay.

@Override
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
    Player player = game.getPlayer(controllerId);
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (player != null && permanent != null) {
        game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_EXERTED, permanent.getId(), source, source.getControllerId()));
        ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("", permanent.getControllerId());
        effect.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect, ability);
        paid = true;
    }
    return paid;
}
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)

Example 12 with DontUntapInControllersNextUntapStepTargetEffect

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

the class PollenLullabyEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
    if (player != null) {
        List<Permanent> doNotUntapNextUntapStep = new ArrayList<>();
        for (Permanent creature : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), 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;
    }
    return false;
}
Also used : 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)

Example 13 with DontUntapInControllersNextUntapStepTargetEffect

use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect 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 14 with DontUntapInControllersNextUntapStepTargetEffect

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

the class ChandrasRevolutionEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    boolean applied = false;
    // Chandra's Revolution deals 4 damage to target creature.
    Permanent permanent = game.getPermanent(source.getTargets().get(0).getFirstTarget());
    if (permanent != null) {
        applied |= permanent.damage(4, source.getSourceId(), source, game, false, true) > 0;
    }
    permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
    if (permanent != null) {
        // Tap target land. That land doesn't untap during its controller's next untap step.
        permanent.tap(source, game);
        ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("that land");
        effect.setTargetPointer(new FixedTarget(permanent, game));
        game.addEffect(effect, source);
    }
    return applied;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) TargetLandPermanent(mage.target.common.TargetLandPermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) DontUntapInControllersNextUntapStepTargetEffect(mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect)

Example 15 with DontUntapInControllersNextUntapStepTargetEffect

use of mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect 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

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