Search in sources :

Example 6 with CounterUnlessPaysEffect

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

the class InvokePrejudiceEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    boolean result = true;
    Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
    if (spell != null) {
        CounterUnlessPaysEffect effect = new CounterUnlessPaysEffect(new GenericManaCost(spell.getManaValue()));
        effect.setTargetPointer(getTargetPointer());
        result = effect.apply(game, source);
    }
    return result;
}
Also used : CounterUnlessPaysEffect(mage.abilities.effects.common.CounterUnlessPaysEffect) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) Spell(mage.game.stack.Spell)

Example 7 with CounterUnlessPaysEffect

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

the class RitesOfRefusalEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    int count = controller.discard(0, Integer.MAX_VALUE, false, source, game).size();
    return new CounterUnlessPaysEffect(new GenericManaCost(3 * count)).apply(game, source);
}
Also used : CounterUnlessPaysEffect(mage.abilities.effects.common.CounterUnlessPaysEffect) Player(mage.players.Player) GenericManaCost(mage.abilities.costs.mana.GenericManaCost)

Example 8 with CounterUnlessPaysEffect

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

the class UnsettledMarinerTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    if (!game.getOpponents(getControllerId()).contains(event.getPlayerId())) {
        return false;
    }
    Permanent permanent = game.getPermanent(event.getTargetId());
    if ((permanent == null || !permanent.getControllerId().equals(getControllerId())) && !event.getTargetId().equals(getControllerId())) {
        return false;
    }
    Effect effect = new CounterUnlessPaysEffect(new GenericManaCost(1));
    effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
    this.getEffects().clear();
    this.addEffect(effect);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) CounterUnlessPaysEffect(mage.abilities.effects.common.CounterUnlessPaysEffect) Permanent(mage.game.permanent.Permanent) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) Effect(mage.abilities.effects.Effect) CounterUnlessPaysEffect(mage.abilities.effects.common.CounterUnlessPaysEffect)

Aggregations

CounterUnlessPaysEffect (mage.abilities.effects.common.CounterUnlessPaysEffect)8 GenericManaCost (mage.abilities.costs.mana.GenericManaCost)6 Ability (mage.abilities.Ability)2 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)2 RevealTargetFromHandCost (mage.abilities.costs.common.RevealTargetFromHandCost)2 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)2 Effect (mage.abilities.effects.Effect)2 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)2 SimpleManaAbility (mage.abilities.mana.SimpleManaAbility)2 Permanent (mage.game.permanent.Permanent)2 TargetSpell (mage.target.TargetSpell)2 TargetAnyTarget (mage.target.common.TargetAnyTarget)2 TargetCardInHand (mage.target.common.TargetCardInHand)2 FixedTarget (mage.target.targetpointer.FixedTarget)2 Test (org.junit.Test)2 AddConditionalManaEffect (mage.abilities.effects.mana.AddConditionalManaEffect)1 SimpleActivatedAbilityManaBuilder (mage.abilities.mana.builder.common.SimpleActivatedAbilityManaBuilder)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)1 Spell (mage.game.stack.Spell)1