Search in sources :

Example 1 with CantBlockAllEffect

use of mage.abilities.effects.common.combat.CantBlockAllEffect in project mage by magefree.

the class RumblingRuinEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int counter = 1;
    for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
        if (permanent == null || !permanent.isCreature(game)) {
            continue;
        }
        counter += permanent.getCounters(game).getCount(CounterType.P1P1);
    }
    FilterCreaturePermanent filter = new FilterOpponentsCreaturePermanent();
    filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, counter));
    game.addEffect(new CantBlockAllEffect(filter, Duration.EndOfTurn), source);
    return true;
}
Also used : FilterOpponentsCreaturePermanent(mage.filter.common.FilterOpponentsCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) FilterOpponentsCreaturePermanent(mage.filter.common.FilterOpponentsCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) CantBlockAllEffect(mage.abilities.effects.common.combat.CantBlockAllEffect) PowerPredicate(mage.filter.predicate.mageobject.PowerPredicate)

Example 2 with CantBlockAllEffect

use of mage.abilities.effects.common.combat.CantBlockAllEffect in project mage by magefree.

the class EmberGaleEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player targetPlayer = game.getPlayer(source.getFirstTarget());
    if (targetPlayer != null) {
        FilterCreaturePermanent filter = new FilterCreaturePermanent();
        filter.add(new ControllerIdPredicate(targetPlayer.getId()));
        RestrictionEffect effect = new CantBlockAllEffect(filter, Duration.EndOfTurn);
        game.addEffect(effect, source);
        FilterPermanent filter2 = new FilterPermanent();
        filter2.add(new ControllerIdPredicate(targetPlayer.getId()));
        filter2.add(Predicates.or(new ColorPredicate(ObjectColor.WHITE), new ColorPredicate(ObjectColor.BLUE)));
        filter2.add(CardType.CREATURE.getPredicate());
        for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter2, targetPlayer.getId(), game)) {
            creature.damage(1, source.getSourceId(), source, game, false, true);
        }
        return true;
    }
    return false;
}
Also used : ColorPredicate(mage.filter.predicate.mageobject.ColorPredicate) TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) FilterPermanent(mage.filter.FilterPermanent) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) CantBlockAllEffect(mage.abilities.effects.common.combat.CantBlockAllEffect) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate) RestrictionEffect(mage.abilities.effects.RestrictionEffect)

Example 3 with CantBlockAllEffect

use of mage.abilities.effects.common.combat.CantBlockAllEffect in project mage by magefree.

the class MarkForDeathEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent target = game.getPermanent(source.getFirstTarget());
    if (target == null) {
        return false;
    }
    FilterCreaturePermanent filter = new FilterCreaturePermanent();
    filter.add(new ControllerIdPredicate(target.getControllerId()));
    filter.add(Predicates.not(new CardIdPredicate(target.getId())));
    ContinuousEffect effect = new BlocksIfAbleTargetEffect(Duration.EndOfTurn);
    effect.setTargetPointer(new FixedTarget(target.getId()));
    game.addEffect(effect, source);
    target.untap(game);
    ContinuousEffect effect2 = new CantBlockAllEffect(filter, Duration.EndOfTurn);
    game.addEffect(effect2, source);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) BlocksIfAbleTargetEffect(mage.abilities.effects.common.combat.BlocksIfAbleTargetEffect) CantBlockAllEffect(mage.abilities.effects.common.combat.CantBlockAllEffect) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate) ContinuousEffect(mage.abilities.effects.ContinuousEffect) CardIdPredicate(mage.filter.predicate.mageobject.CardIdPredicate)

Aggregations

CantBlockAllEffect (mage.abilities.effects.common.combat.CantBlockAllEffect)3 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)3 Permanent (mage.game.permanent.Permanent)3 ControllerIdPredicate (mage.filter.predicate.permanent.ControllerIdPredicate)2 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 RestrictionEffect (mage.abilities.effects.RestrictionEffect)1 BlocksIfAbleTargetEffect (mage.abilities.effects.common.combat.BlocksIfAbleTargetEffect)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterOpponentsCreaturePermanent (mage.filter.common.FilterOpponentsCreaturePermanent)1 CardIdPredicate (mage.filter.predicate.mageobject.CardIdPredicate)1 ColorPredicate (mage.filter.predicate.mageobject.ColorPredicate)1 PowerPredicate (mage.filter.predicate.mageobject.PowerPredicate)1 Player (mage.players.Player)1 TargetPlayer (mage.target.TargetPlayer)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1