Search in sources :

Example 6 with DestroyAllEffect

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

the class WaveOfTerrorEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (permanent == null) {
        return false;
    }
    FilterCreaturePermanent filter = new FilterCreaturePermanent();
    filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, permanent.getCounters(game).getCount(CounterType.AGE)));
    return new DestroyAllEffect(filter, true).apply(game, source);
}
Also used : ManaValuePredicate(mage.filter.predicate.mageobject.ManaValuePredicate) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) DestroyAllEffect(mage.abilities.effects.common.DestroyAllEffect)

Example 7 with DestroyAllEffect

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

the class KindredDominanceEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
    if (controller != null && controller.choose(outcome, typeChoice, game)) {
        game.informPlayers(controller.getLogName() + " has chosen " + typeChoice.getChoice());
        FilterCreaturePermanent filter = new FilterCreaturePermanent("All creatures not of the chosen type");
        filter.add(Predicates.not(SubType.byDescription(typeChoice.getChoice()).getPredicate()));
        return new DestroyAllEffect(filter).apply(game, source);
    }
    return false;
}
Also used : Player(mage.players.Player) Choice(mage.choices.Choice) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ChoiceCreatureType(mage.choices.ChoiceCreatureType) DestroyAllEffect(mage.abilities.effects.common.DestroyAllEffect)

Example 8 with DestroyAllEffect

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

the class DeadlyVanityEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    TargetPermanent target = new TargetCreatureOrPlaneswalker();
    target.setNotTarget(true);
    controller.choose(outcome, target, source.getId(), game);
    FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent();
    UUID targetId = target.getFirstTarget();
    if (targetId != null) {
        filter.add(Predicates.not(new PermanentIdPredicate(targetId)));
    }
    return new DestroyAllEffect(filter).apply(game, source);
}
Also used : PermanentIdPredicate(mage.filter.predicate.permanent.PermanentIdPredicate) Player(mage.players.Player) FilterPermanent(mage.filter.FilterPermanent) TargetCreatureOrPlaneswalker(mage.target.common.TargetCreatureOrPlaneswalker) TargetPermanent(mage.target.TargetPermanent) UUID(java.util.UUID) FilterCreatureOrPlaneswalkerPermanent(mage.filter.common.FilterCreatureOrPlaneswalkerPermanent) DestroyAllEffect(mage.abilities.effects.common.DestroyAllEffect)

Example 9 with DestroyAllEffect

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

the class BlastZoneEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
    int xValue = permanent.getCounters(game).getCount(CounterType.CHARGE);
    FilterPermanent filter = new FilterNonlandPermanent();
    filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, xValue));
    return new DestroyAllEffect(filter).apply(game, source);
}
Also used : ManaValuePredicate(mage.filter.predicate.mageobject.ManaValuePredicate) FilterPermanent(mage.filter.FilterPermanent) FilterNonlandPermanent(mage.filter.common.FilterNonlandPermanent) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) FilterNonlandPermanent(mage.filter.common.FilterNonlandPermanent) DestroyAllEffect(mage.abilities.effects.common.DestroyAllEffect)

Example 10 with DestroyAllEffect

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

the class LastOneStandingEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    List<Permanent> creatureList = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game);
    if (creatureList.size() < 2) {
        return true;
    }
    int toSave = RandomUtil.nextInt(creatureList.size());
    FilterCreaturePermanent filter = new FilterCreaturePermanent();
    filter.add(Predicates.not(new PermanentIdPredicate(creatureList.get(toSave).getId())));
    return new DestroyAllEffect(filter).apply(game, source);
}
Also used : PermanentIdPredicate(mage.filter.predicate.permanent.PermanentIdPredicate) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) DestroyAllEffect(mage.abilities.effects.common.DestroyAllEffect)

Aggregations

DestroyAllEffect (mage.abilities.effects.common.DestroyAllEffect)15 Player (mage.players.Player)9 FilterPermanent (mage.filter.FilterPermanent)8 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)7 Permanent (mage.game.permanent.Permanent)7 ManaValuePredicate (mage.filter.predicate.mageobject.ManaValuePredicate)5 UUID (java.util.UUID)3 FilterNonlandPermanent (mage.filter.common.FilterNonlandPermanent)3 OneShotEffect (mage.abilities.effects.OneShotEffect)2 Choice (mage.choices.Choice)2 ChoiceCreatureType (mage.choices.ChoiceCreatureType)2 TwoChoiceVote (mage.choices.TwoChoiceVote)2 PermanentIdPredicate (mage.filter.predicate.permanent.PermanentIdPredicate)2 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 Objects (java.util.Objects)1 MageInt (mage.MageInt)1 MageObject (mage.MageObject)1