Search in sources :

Example 1 with FilterOpponentsCreaturePermanent

use of mage.filter.common.FilterOpponentsCreaturePermanent 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)

Aggregations

CantBlockAllEffect (mage.abilities.effects.common.combat.CantBlockAllEffect)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 FilterOpponentsCreaturePermanent (mage.filter.common.FilterOpponentsCreaturePermanent)1 PowerPredicate (mage.filter.predicate.mageobject.PowerPredicate)1 Permanent (mage.game.permanent.Permanent)1