use of mage.abilities.costs.common.ExileTargetCost 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;
}
Aggregations