Search in sources :

Example 21 with GenericManaCost

use of mage.abilities.costs.mana.GenericManaCost 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 22 with GenericManaCost

use of mage.abilities.costs.mana.GenericManaCost in project mage by magefree.

the class CyclingZeroCostEffect method apply.

@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null || !player.chooseUse(outcome, "Pay {0} to cycle this card?", source, game)) {
        return true;
    }
    abilityToModify.getManaCostsToPay().clear();
    abilityToModify.getCosts().removeIf(cost -> !CyclingDiscardCost.class.isInstance(cost));
    abilityToModify.getManaCostsToPay().add(new GenericManaCost(0));
    return true;
}
Also used : Player(mage.players.Player) GenericManaCost(mage.abilities.costs.mana.GenericManaCost)

Example 23 with GenericManaCost

use of mage.abilities.costs.mana.GenericManaCost in project mage by magefree.

the class OldGrowthTrollContinuousEffect method makeAbility.

private static final Ability makeAbility() {
    Ability activatedAbility = new SimpleActivatedAbility(new CreateTokenEffect(new TrollWarriorToken(), 1, true, false), new GenericManaCost(1));
    activatedAbility.addCost(new TapSourceCost());
    Cost cost = new SacrificeSourceCost();
    cost.setText("sacrifice this land");
    activatedAbility.addCost(cost);
    Ability ability = new SimpleStaticAbility(new GainAbilityAttachedEffect(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.GreenMana(2), new TapSourceCost()), AttachmentType.AURA).setText("enchanted Forest has \"{T}: Add {G}{G}\""));
    ability.addEffect(new GainAbilityAttachedEffect(activatedAbility, AttachmentType.AURA).setText("and \"{1}, {T}, Sacrifice this land: Create a tapped 4/4 green Troll Warrior creature token with trample.\""));
    return ability;
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) DiesSourceTriggeredAbility(mage.abilities.common.DiesSourceTriggeredAbility) EnchantAbility(mage.abilities.keyword.EnchantAbility) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) SpellAbility(mage.abilities.SpellAbility) ConditionalInterveningIfTriggeredAbility(mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility) TrampleAbility(mage.abilities.keyword.TrampleAbility) Ability(mage.abilities.Ability) TrollWarriorToken(mage.game.permanent.token.TrollWarriorToken) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) SacrificeSourceCost(mage.abilities.costs.common.SacrificeSourceCost) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) GainAbilityAttachedEffect(mage.abilities.effects.common.continuous.GainAbilityAttachedEffect) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) TapSourceCost(mage.abilities.costs.common.TapSourceCost) Cost(mage.abilities.costs.Cost) TapSourceCost(mage.abilities.costs.common.TapSourceCost) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) SacrificeSourceCost(mage.abilities.costs.common.SacrificeSourceCost)

Example 24 with GenericManaCost

use of mage.abilities.costs.mana.GenericManaCost in project mage by magefree.

the class RiseOfTheHobgoblinsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player you = game.getPlayer(source.getControllerId());
    ManaCosts<ManaCost> cost = new ManaCostsImpl<>("{X}");
    if (you != null && you.chooseUse(Outcome.Neutral, "Do you want to to pay {X}?", source, game)) {
        int costX = you.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source);
        cost.add(new GenericManaCost(costX));
        if (cost.pay(source, game, source, source.getControllerId(), false, null)) {
            Token token = new GoblinSoldierToken();
            return token.putOntoBattlefield(costX, game, source, source.getControllerId());
        }
    }
    return false;
}
Also used : GoblinSoldierToken(mage.game.permanent.token.GoblinSoldierToken) Player(mage.players.Player) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) ManaCost(mage.abilities.costs.mana.ManaCost) GoblinSoldierToken(mage.game.permanent.token.GoblinSoldierToken) Token(mage.game.permanent.token.Token) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Example 25 with GenericManaCost

use of mage.abilities.costs.mana.GenericManaCost in project mage by magefree.

the class SquealingDevilEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    ManaCosts cost = new ManaCostsImpl("{X}");
    if (player != null) {
        if (player.chooseUse(Outcome.BoostCreature, "Pay " + cost.getText() + "?", source, game)) {
            int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source);
            cost.add(new GenericManaCost(costX));
            if (cost.pay(source, game, source, source.getControllerId(), false, null)) {
                Permanent permanent = game.getPermanent(source.getFirstTarget());
                if (permanent != null && permanent.isCreature(game)) {
                    ContinuousEffect effect = new BoostTargetEffect(costX, 0, Duration.EndOfTurn);
                    effect.setTargetPointer(new FixedTarget(permanent, game));
                    game.addEffect(effect, source);
                    return true;
                }
                return false;
            }
        }
    }
    return false;
}
Also used : ManaCosts(mage.abilities.costs.mana.ManaCosts) FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) BoostTargetEffect(mage.abilities.effects.common.continuous.BoostTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl)

Aggregations

GenericManaCost (mage.abilities.costs.mana.GenericManaCost)31 Player (mage.players.Player)15 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)12 Permanent (mage.game.permanent.Permanent)10 ManaCosts (mage.abilities.costs.mana.ManaCosts)7 Ability (mage.abilities.Ability)6 CounterUnlessPaysEffect (mage.abilities.effects.common.CounterUnlessPaysEffect)6 FixedTarget (mage.target.targetpointer.FixedTarget)5 SpellAbility (mage.abilities.SpellAbility)4 PassAbility (mage.abilities.common.PassAbility)4 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)4 ReflexiveTriggeredAbility (mage.abilities.common.delayed.ReflexiveTriggeredAbility)4 ManaCost (mage.abilities.costs.mana.ManaCost)4 Effect (mage.abilities.effects.Effect)3 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)3 StackAbility (mage.game.stack.StackAbility)3 ActivatedAbility (mage.abilities.ActivatedAbility)2 RevealTargetFromHandCost (mage.abilities.costs.common.RevealTargetFromHandCost)2 TapSourceCost (mage.abilities.costs.common.TapSourceCost)2 AddCountersSourceEffect (mage.abilities.effects.common.counter.AddCountersSourceEffect)2