use of mage.Mana in project mage by magefree.
the class EnergyTapEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
boolean applied = false;
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
if (targetCreature != null) {
applied = targetCreature.tap(source, game);
if (applied) {
player.getManaPool().addMana(new Mana(0, 0, 0, 0, 0, 0, 0, targetCreature.getManaValue()), game, source);
}
}
return applied;
}
use of mage.Mana in project mage by magefree.
the class FoodChainManaEffect method produceMana.
@Override
public Mana produceMana(Game game, Ability source) {
Mana mana = new Mana();
if (game == null) {
return mana;
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int manaCostExiled = 0;
for (Cost cost : source.getCosts()) {
if (cost.isPaid() && cost instanceof ExileTargetCost) {
for (Card card : ((ExileTargetCost) cost).getPermanents()) {
manaCostExiled += card.getManaValue();
}
}
}
ChoiceColor choice = new ChoiceColor();
if (!controller.choose(Outcome.PutManaInPool, choice, game)) {
return mana;
}
Mana chosen = choice.getMana(manaCostExiled + 1);
return manaBuilder.setMana(chosen, source, game).build();
}
return mana;
}
use of mage.Mana in project mage by magefree.
the class JeweledAmuletAddManaEffect method produceMana.
@Override
public Mana produceMana(Game game, Ability source) {
Mana mana = new Mana();
if (game == null) {
return mana;
}
Permanent jeweledAmulet = game.getPermanent(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (jeweledAmulet != null && controller != null) {
storedMana = (Mana) game.getState().getValue("JeweledAmulet" + source.getSourceId().toString());
if (storedMana != null) {
return storedMana.copy();
}
}
return mana;
}
use of mage.Mana in project mage by magefree.
the class JeganthaTheWellspringManaCondition method produceMana.
@Override
public Mana produceMana(Game game, Ability source) {
Mana mana = new Mana();
mana.add(new JeganthaTheWellspringConditionalMana("W"));
mana.add(new JeganthaTheWellspringConditionalMana("U"));
mana.add(new JeganthaTheWellspringConditionalMana("B"));
mana.add(new JeganthaTheWellspringConditionalMana("R"));
mana.add(new JeganthaTheWellspringConditionalMana("G"));
return mana;
}
use of mage.Mana in project mage by magefree.
the class MadScienceFairProjectEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(source.getFirstTarget());
if (controller == null || player == null) {
return false;
}
int amount = controller.rollDice(outcome, source, game, 6);
Mana mana = amount <= 3 ? Mana.ColorlessMana(1) : ManaChoice.chooseAnyColor(player, game, 1);
player.getManaPool().addMana(mana, game, source);
return true;
}
Aggregations