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);
}
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;
}
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);
}
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);
}
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);
}
Aggregations