Search in sources :

Example 6 with DamageEverythingEffect

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

the class AshlingThePilgrimEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent sourcePermanent = game.getPermanent(source.getSourceId());
    if (sourcePermanent != null) {
        int counters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1);
        if (counters < 1) {
            return false;
        }
        sourcePermanent.removeCounters(CounterType.P1P1.createInstance(counters), source, game);
        return new DamageEverythingEffect(counters, StaticFilters.FILTER_PERMANENT_CREATURE).apply(game, source);
    }
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) DamageEverythingEffect(mage.abilities.effects.common.DamageEverythingEffect) AbilityResolutionCountHint(mage.abilities.hint.common.AbilityResolutionCountHint)

Example 7 with DamageEverythingEffect

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

the class CycloneEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Permanent permanent = game.getPermanent(source.getSourceId());
    int total = permanent.getCounters(game).getCount(CounterType.WIND);
    StringBuilder greens = new StringBuilder(total);
    for (int i = 0; i < total; i++) {
        greens.append("{G}");
    }
    if (this.choice(game, source, player, new ManaCostsImpl(greens.toString()))) {
        DamageEverythingEffect dmg = new DamageEverythingEffect(total);
        dmg.apply(game, source);
    } else {
        permanent.sacrifice(source, game);
    }
    return true;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) DamageEverythingEffect(mage.abilities.effects.common.DamageEverythingEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Aggregations

DamageEverythingEffect (mage.abilities.effects.common.DamageEverythingEffect)7 Permanent (mage.game.permanent.Permanent)6 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)4 Player (mage.players.Player)4 List (java.util.List)1 UUID (java.util.UUID)1 MageObject (mage.MageObject)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1 ConditionalOneShotEffect (mage.abilities.decorator.ConditionalOneShotEffect)1 Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 DestroyTargetEffect (mage.abilities.effects.common.DestroyTargetEffect)1 DrawCardAllEffect (mage.abilities.effects.common.DrawCardAllEffect)1 DiscardHandAllEffect (mage.abilities.effects.common.discard.DiscardHandAllEffect)1 AbilityResolutionCountHint (mage.abilities.hint.common.AbilityResolutionCountHint)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterArtifactPermanent (mage.filter.common.FilterArtifactPermanent)1 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)1 PermanentIdPredicate (mage.filter.predicate.permanent.PermanentIdPredicate)1 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)1