Search in sources :

Example 21 with ChoiceColor

use of mage.choices.ChoiceColor in project mage by magefree.

the class NarsetOfTheAncientWayDrawEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    player.gainLife(2, game, source);
    ChoiceColor choice = new ChoiceColor();
    choice.getChoices().remove("Green");
    choice.getChoices().remove("Black");
    player.choose(Outcome.PutManaInPool, choice, game);
    ConditionalMana mana = new ConditionalMana(choice.getMana(1));
    mana.addCondition(new NarsetOfTheAncientWayManaCondition());
    player.getManaPool().addMana(mana, game, source);
    return true;
}
Also used : Player(mage.players.Player) ConditionalMana(mage.ConditionalMana) ChoiceColor(mage.choices.ChoiceColor)

Example 22 with ChoiceColor

use of mage.choices.ChoiceColor in project mage by magefree.

the class RealityTwistEffect method replaceEvent.

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    TappedForManaEvent manaEvent = (TappedForManaEvent) event;
    Player controller = game.getPlayer(source.getControllerId());
    Permanent permanent = manaEvent.getPermanent();
    if (controller == null || permanent == null) {
        return false;
    }
    Choice choice = new ChoiceColor(true);
    choice.getChoices().clear();
    choice.setMessage("Pick a color to produce");
    if (permanent.hasSubtype(SubType.PLAINS, game)) {
        choice.getChoices().add("Red");
    }
    if (permanent.hasSubtype(SubType.SWAMP, game)) {
        choice.getChoices().add("Green");
    }
    if (permanent.hasSubtype(SubType.MOUNTAIN, game)) {
        choice.getChoices().add("White");
    }
    if (permanent.hasSubtype(SubType.FOREST, game)) {
        choice.getChoices().add("Black");
    }
    String chosenColor;
    if (choice.getChoices().size() == 1) {
        chosenColor = choice.getChoices().iterator().next();
    } else {
        controller.choose(Outcome.PutManaInPool, choice, game);
        chosenColor = choice.getChoice();
    }
    if (chosenColor == null) {
        return false;
    }
    Mana mana = manaEvent.getMana();
    int amount = mana.count();
    switch(chosenColor) {
        case "White":
            mana.setToMana(Mana.WhiteMana(amount));
            break;
        case "Black":
            mana.setToMana(Mana.BlackMana(amount));
            break;
        case "Red":
            mana.setToMana(Mana.RedMana(amount));
            break;
        case "Green":
            mana.setToMana(Mana.GreenMana(amount));
            break;
    }
    return false;
}
Also used : Player(mage.players.Player) Choice(mage.choices.Choice) Mana(mage.Mana) Permanent(mage.game.permanent.Permanent) ChoiceColor(mage.choices.ChoiceColor) TappedForManaEvent(mage.game.events.TappedForManaEvent)

Example 23 with ChoiceColor

use of mage.choices.ChoiceColor in project mage by magefree.

the class ScryingGlassEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Player targetOpponent = game.getPlayer(source.getFirstTarget());
    ChoiceColor color = new ChoiceColor();
    int amount = 0;
    if (controller != null && targetOpponent != null) {
        amount = controller.getAmount(1, Integer.MAX_VALUE, "Choose a number", game);
        controller.choose(Outcome.Discard, color, game);
        FilterCard filter = new FilterCard();
        filter.add(new ColorPredicate(color.getColor()));
        targetOpponent.revealCards(source, targetOpponent.getHand(), game);
        if (targetOpponent.getHand().count(filter, game) == amount) {
            game.informPlayers(controller.getLogName() + " has chosen the exact number and color of the revealed cards from " + targetOpponent.getName() + "'s hand. They draw a card.");
            controller.drawCards(1, source, game);
            return true;
        } else {
            game.informPlayers(controller.getLogName() + " has chosen incorrectly and will not draw a card.");
        }
    }
    return false;
}
Also used : FilterCard(mage.filter.FilterCard) ColorPredicate(mage.filter.predicate.mageobject.ColorPredicate) Player(mage.players.Player) ChoiceColor(mage.choices.ChoiceColor)

Example 24 with ChoiceColor

use of mage.choices.ChoiceColor in project mage by magefree.

the class BecomesColorAllEffect method init.

@Override
public void init(Ability source, Game game) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return;
    }
    if (setColor == null) {
        ChoiceColor choice = new ChoiceColor();
        if (!controller.choose(Outcome.PutManaInPool, choice, game)) {
            discard();
            return;
        }
        setColor = choice.getColor();
        if (!game.isSimulation()) {
            game.informPlayers(controller.getLogName() + " has chosen the color: " + setColor.toString());
        }
    }
    // To change body of generated methods, choose Tools | Templates.
    super.init(source, game);
}
Also used : Player(mage.players.Player) ChoiceColor(mage.choices.ChoiceColor)

Example 25 with ChoiceColor

use of mage.choices.ChoiceColor in project mage by magefree.

the class BecomesColorSourceEffect method init.

@Override
public void init(Ability source, Game game) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return;
    }
    if (setColor == null) {
        ChoiceColor choice = new ChoiceColor();
        if (!controller.choose(Outcome.PutManaInPool, choice, game)) {
            discard();
            return;
        }
        setColor = choice.getColor();
        if (!game.isSimulation()) {
            game.informPlayers(controller.getLogName() + " has chosen the color: " + setColor.toString());
        }
    }
    super.init(source, game);
}
Also used : Player(mage.players.Player) ChoiceColor(mage.choices.ChoiceColor)

Aggregations

ChoiceColor (mage.choices.ChoiceColor)54 Player (mage.players.Player)52 Mana (mage.Mana)22 Permanent (mage.game.permanent.Permanent)17 ColorPredicate (mage.filter.predicate.mageobject.ColorPredicate)14 Choice (mage.choices.Choice)10 ObjectColor (mage.ObjectColor)8 FilterCard (mage.filter.FilterCard)7 MageObject (mage.MageObject)5 FilterPermanent (mage.filter.FilterPermanent)5 FixedTarget (mage.target.targetpointer.FixedTarget)5 ConditionalMana (mage.ConditionalMana)4 ContinuousEffect (mage.abilities.effects.ContinuousEffect)4 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)4 Ability (mage.abilities.Ability)3 ProtectionAbility (mage.abilities.keyword.ProtectionAbility)3 Card (mage.cards.Card)3 TargetPlayer (mage.target.TargetPlayer)3 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)3 ArrayList (java.util.ArrayList)2