Search in sources :

Example 1 with AddCountersAllEffect

use of mage.abilities.effects.common.counter.AddCountersAllEffect in project mage by magefree.

the class MisfortuneEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Player chosenOpponent = game.getPlayer(targetPointer.getFirst(game, source));
    if (controller != null && chosenOpponent != null) {
        if (chosenOpponent.chooseUse(Outcome.Neutral, "If you choose Yes, the controller puts a +1/+1 counter" + "on each creature they control and they gain 4 life. If no, the controller puts a -1/-1 counter" + "on each creature you control and {this} deals 4 damage to you.", source, game)) {
            Effect putP1P1CounterOnEachControlledCreature = new AddCountersAllEffect(CounterType.P1P1.createInstance(), new FilterControlledCreaturePermanent());
            putP1P1CounterOnEachControlledCreature.apply(game, source);
            controller.gainLife(4, game, source);
        } else {
            FilterCreaturePermanent filterOpponentCreatures = new FilterCreaturePermanent();
            filterOpponentCreatures.add(new ControllerIdPredicate(chosenOpponent.getId()));
            Effect putM1M1CounterOnEachOpponentCreature = new AddCountersAllEffect(CounterType.M1M1.createInstance(), filterOpponentCreatures);
            putM1M1CounterOnEachOpponentCreature.apply(game, source);
            chosenOpponent.damage(4, source.getSourceId(), source, game);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) ControllerIdPredicate(mage.filter.predicate.permanent.ControllerIdPredicate) FilterControlledCreaturePermanent(mage.filter.common.FilterControlledCreaturePermanent) OneShotEffect(mage.abilities.effects.OneShotEffect) AddCountersAllEffect(mage.abilities.effects.common.counter.AddCountersAllEffect) Effect(mage.abilities.effects.Effect) AddCountersAllEffect(mage.abilities.effects.common.counter.AddCountersAllEffect)

Example 2 with AddCountersAllEffect

use of mage.abilities.effects.common.counter.AddCountersAllEffect in project mage by magefree.

the class VraskaRegalGorgonEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    int count = player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game);
    return new AddCountersAllEffect(CounterType.P1P1.createInstance(count), StaticFilters.FILTER_CONTROLLED_CREATURE).apply(game, source);
}
Also used : Player(mage.players.Player) AddCountersAllEffect(mage.abilities.effects.common.counter.AddCountersAllEffect)

Aggregations

AddCountersAllEffect (mage.abilities.effects.common.counter.AddCountersAllEffect)2 Player (mage.players.Player)2 Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 ControllerIdPredicate (mage.filter.predicate.permanent.ControllerIdPredicate)1