Search in sources :

Example 16 with Mana

use of mage.Mana in project mage by magefree.

the class MeteorCraterEffect method getNetMana.

@Override
public List<Mana> getNetMana(Game game, Ability source) {
    List<Mana> netManas = new ArrayList<>();
    Mana types = getManaTypes(game, source);
    if (types.getBlack() > 0) {
        netManas.add(new Mana(ColoredManaSymbol.B));
    }
    if (types.getRed() > 0) {
        netManas.add(new Mana(ColoredManaSymbol.R));
    }
    if (types.getBlue() > 0) {
        netManas.add(new Mana(ColoredManaSymbol.U));
    }
    if (types.getGreen() > 0) {
        netManas.add(new Mana(ColoredManaSymbol.G));
    }
    if (types.getWhite() > 0) {
        netManas.add(new Mana(ColoredManaSymbol.W));
    }
    return netManas;
}
Also used : Mana(mage.Mana) ArrayList(java.util.ArrayList)

Example 17 with Mana

use of mage.Mana in project mage by magefree.

the class MeteorCraterEffect method produceMana.

@Override
public Mana produceMana(Game game, Ability source) {
    Mana mana = new Mana();
    if (game == null) {
        return mana;
    }
    Mana types = getManaTypes(game, source);
    Choice choice = new ChoiceColor(true);
    choice.getChoices().clear();
    choice.setMessage("Pick a mana color");
    if (types.getAny() > 0) {
        choice.getChoices().add("Black");
        choice.getChoices().add("Red");
        choice.getChoices().add("Blue");
        choice.getChoices().add("Green");
        choice.getChoices().add("White");
    } else {
        if (types.getBlack() > 0) {
            choice.getChoices().add("Black");
        }
        if (types.getRed() > 0) {
            choice.getChoices().add("Red");
        }
        if (types.getBlue() > 0) {
            choice.getChoices().add("Blue");
        }
        if (types.getGreen() > 0) {
            choice.getChoices().add("Green");
        }
        if (types.getWhite() > 0) {
            choice.getChoices().add("White");
        }
    }
    if (!choice.getChoices().isEmpty()) {
        Player player = game.getPlayer(source.getControllerId());
        if (choice.getChoices().size() == 1) {
            choice.setChoice(choice.getChoices().iterator().next());
        } else {
            player.choose(outcome, choice, game);
        }
        if (choice.getChoice() != null) {
            switch(choice.getChoice()) {
                case "Black":
                    mana.setBlack(1);
                    break;
                case "Blue":
                    mana.setBlue(1);
                    break;
                case "Red":
                    mana.setRed(1);
                    break;
                case "Green":
                    mana.setGreen(1);
                    break;
                case "White":
                    mana.setWhite(1);
                    break;
            }
        }
    }
    return mana;
}
Also used : Player(mage.players.Player) Mana(mage.Mana) Choice(mage.choices.Choice) ChoiceColor(mage.choices.ChoiceColor)

Example 18 with Mana

use of mage.Mana in project mage by magefree.

the class NyxLotusDynamicManaEffect 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) {
        return mana;
    }
    ChoiceColor choice = new ChoiceColor();
    choice.setMessage("Choose a color for devotion of Nyx Lotus");
    if (!controller.choose(outcome, choice, game)) {
        return mana;
    }
    return computeMana(choice.getChoice(), game, source);
}
Also used : Player(mage.players.Player) Mana(mage.Mana) ChoiceColor(mage.choices.ChoiceColor)

Example 19 with Mana

use of mage.Mana in project mage by magefree.

the class NykthosDynamicManaEffect 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) {
        return mana;
    }
    ChoiceColor choice = new ChoiceColor();
    choice.setMessage("Choose a color for devotion of Nykthos");
    if (!controller.choose(outcome, choice, game)) {
        return mana;
    }
    return computeMana(choice.getChoice(), game, source);
}
Also used : Player(mage.players.Player) Mana(mage.Mana) ChoiceColor(mage.choices.ChoiceColor)

Example 20 with Mana

use of mage.Mana in project mage by magefree.

the class RadiantEpicureEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class);
    if (player == null || watcher == null) {
        return false;
    }
    Mana payment = watcher.getLastManaPayment(source.getSourceId());
    if (payment == null) {
        return false;
    }
    int xValue = payment.getDifferentColors();
    new DamagePlayersEffect(xValue, TargetController.OPPONENT).apply(game, source);
    player.gainLife(xValue, game, source);
    return true;
}
Also used : Player(mage.players.Player) Mana(mage.Mana) ManaSpentToCastWatcher(mage.watchers.common.ManaSpentToCastWatcher) DamagePlayersEffect(mage.abilities.effects.common.DamagePlayersEffect)

Aggregations

Mana (mage.Mana)147 Player (mage.players.Player)76 ConditionalMana (mage.ConditionalMana)33 Permanent (mage.game.permanent.Permanent)32 ArrayList (java.util.ArrayList)26 Choice (mage.choices.Choice)23 ChoiceColor (mage.choices.ChoiceColor)23 ChoiceImpl (mage.choices.ChoiceImpl)14 TappedForManaEvent (mage.game.events.TappedForManaEvent)14 Card (mage.cards.Card)13 ManaEvent (mage.game.events.ManaEvent)11 ObjectColor (mage.ObjectColor)8 ManaOptions (mage.abilities.mana.ManaOptions)8 FilterMana (mage.filter.FilterMana)8 LinkedHashSet (java.util.LinkedHashSet)7 UUID (java.util.UUID)7 FilterPermanent (mage.filter.FilterPermanent)6 MageObject (mage.MageObject)5 ActivatedManaAbilityImpl (mage.abilities.mana.ActivatedManaAbilityImpl)5 FilterCard (mage.filter.FilterCard)5