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);
}
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;
}
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;
}
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;
}
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;
}
Aggregations