Search in sources :

Example 1 with DamageEverythingEffect

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

the class RancidEarthEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Effect effect1 = new DestroyTargetEffect("destroy that land");
    effect1.apply(game, source);
    return new DamageEverythingEffect(1).apply(game, source);
}
Also used : DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) DamageEverythingEffect(mage.abilities.effects.common.DamageEverythingEffect) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) DamageEverythingEffect(mage.abilities.effects.common.DamageEverythingEffect) Effect(mage.abilities.effects.Effect) ConditionalOneShotEffect(mage.abilities.decorator.ConditionalOneShotEffect)

Example 2 with DamageEverythingEffect

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

the class MagmasaurEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Permanent sourceObject = (Permanent) source.getSourceObjectIfItStillExists(game);
    if (sourceObject != null && controller != null) {
        if (controller.chooseUse(outcome, "Remove a +1/+1 counter from " + sourceObject.getLogName() + '?', source, game)) {
            sourceObject.removeCounters(CounterType.P1P1.getName(), 1, source, game);
        } else {
            int counters = sourceObject.getCounters(game).getCount(CounterType.P1P1);
            sourceObject.sacrifice(source, game);
            new DamageEverythingEffect(counters, filter).apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) DamageEverythingEffect(mage.abilities.effects.common.DamageEverythingEffect)

Example 3 with DamageEverythingEffect

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

the class ArcbondEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int damage = (Integer) this.getValue("damage");
    UUID sourceId = (UUID) this.getValue("sourceId");
    MageObject sourceObject = game.getObject(source.getSourceId());
    if (sourceObject != null && damage > 0 && sourceId != null) {
        Permanent targetObject = game.getPermanentOrLKIBattlefield(sourceId);
        if (targetObject != null) {
            game.informPlayers(sourceObject.getLogName() + ": " + targetObject.getLogName() + " deals " + damage + " damage to each other creature and each player");
        }
        FilterPermanent filter = new FilterCreaturePermanent("each other creature");
        filter.add(Predicates.not(new PermanentIdPredicate(sourceId)));
        return new DamageEverythingEffect(StaticValue.get(damage), filter, sourceId).apply(game, source);
    }
    return false;
}
Also used : PermanentIdPredicate(mage.filter.predicate.permanent.PermanentIdPredicate) FilterPermanent(mage.filter.FilterPermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) FilterPermanent(mage.filter.FilterPermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) DamageEverythingEffect(mage.abilities.effects.common.DamageEverythingEffect) MageObject(mage.MageObject) UUID(java.util.UUID)

Example 4 with DamageEverythingEffect

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

the class RuptureEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null) {
        int power = 0;
        TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent("creature to sacrifice"), true);
        if (target.canChoose(source.getSourceId(), player.getId(), game)) {
            while (!target.isChosen() && target.canChoose(source.getSourceId(), player.getId(), game) && player.canRespond()) {
                player.chooseTarget(Outcome.Sacrifice, target, source, game);
            }
            Permanent permanent = game.getPermanent(target.getFirstTarget());
            if (permanent != null) {
                power = permanent.getPower().getValue();
                permanent.sacrifice(source, game);
            }
        }
        if (power > 0) {
            new DamageEverythingEffect(power, filter).apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) DamageEverythingEffect(mage.abilities.effects.common.DamageEverythingEffect) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent)

Example 5 with DamageEverythingEffect

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

the class StrategySchmategyffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    int numTimesToDo = 1;
    if (controller != null) {
        // 6 - Repeat this process two more times
        while (numTimesToDo > 0) {
            // ai must try to choose min
            int amount = controller.rollDice(Outcome.Detriment, source, game, 6);
            numTimesToDo--;
            if (amount == 2) {
                List<Permanent> artifactPermanents = game.getBattlefield().getActivePermanents(new FilterArtifactPermanent(), controller.getId(), game);
                for (Permanent permanent : artifactPermanents) {
                    permanent.destroy(source, game, false);
                }
            } else if (amount == 3) {
                List<Permanent> landPermanents = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LANDS, controller.getId(), game);
                for (Permanent permanent : landPermanents) {
                    permanent.destroy(source, game, false);
                }
            } else if (amount == 4) {
                new DamageEverythingEffect(3, new FilterCreaturePermanent()).apply(game, source);
            } else if (amount == 5) {
                new DiscardHandAllEffect().apply(game, source);
                new DrawCardAllEffect(7).apply(game, source);
            } else if (amount == 6) {
                numTimesToDo += 2;
            }
        }
    }
    return false;
}
Also used : Player(mage.players.Player) FilterArtifactPermanent(mage.filter.common.FilterArtifactPermanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) DrawCardAllEffect(mage.abilities.effects.common.DrawCardAllEffect) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) FilterArtifactPermanent(mage.filter.common.FilterArtifactPermanent) DamageEverythingEffect(mage.abilities.effects.common.DamageEverythingEffect) List(java.util.List) DiscardHandAllEffect(mage.abilities.effects.common.discard.DiscardHandAllEffect)

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