Package mage.choices

Examples of mage.choices.ChoiceColor


    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());       
        if (controller == null) {
            return false;
        }
        ChoiceColor choice = new ChoiceColor();
        controller.choose(outcome, choice, game);
        if (choice.getColor() != null) {
            game.informPlayers(new StringBuilder(controller.getName()).append(" chooses ").append(choice.getColor()).toString());
            FilterPermanent filter = new FilterPermanent();
            filter.add(new ColorPredicate(choice.getColor()));
            int cardsWithColor = game.getBattlefield().count(filter, source.getSourceId(), controller.getId(), game);
            if (cardsWithColor > 0) {
                new CreateTokenEffect(new SaprolingToken(), cardsWithColor).apply(game, source);
            }
            return true;
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        Permanent creature = game.getPermanent(source.getSourceId());
        if (creature != null) {
            ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
            protectionFilter.add(new ColorPredicate(choice.getColor()));
            protectionFilter.setMessage(choice.getChoice());
            ProtectionAbility ability = new ProtectionAbility(protectionFilter);
            creature.addAbility(ability, source.getSourceId(), game);
            return true;
        }
        return false;
View Full Code Here

        Player player = game.getPlayer(source.getControllerId());
        if (sourcePermanent != null && player != null) {
            int chargeCounters = sourcePermanent.getCounters().getCount(CounterType.CHARGE);
            sourcePermanent.removeCounters(CounterType.CHARGE.createInstance(chargeCounters), game);
            Mana mana = new Mana();
            ChoiceColor choice = new ChoiceColor();
            for (int i = 0; i < chargeCounters; i++) {
                while (!choice.isChosen()) {
                    if (!player.isInGame()) {
                        return false;
                    }
                    player.choose(outcome, choice, game);
                }
                if (choice.getColor().isBlack()) {
                    mana.addBlack();
                } else if (choice.getColor().isBlue()) {
                    mana.addBlue();
                } else if (choice.getColor().isRed()) {
                    mana.addRed();
                } else if (choice.getColor().isGreen()) {
                    mana.addGreen();
                } else if (choice.getColor().isWhite()) {
                    mana.addWhite();
                }
                choice.clearChoice();
            }
            player.getManaPool().addMana(mana, game, source);
            return true;
        }
        return false;
View Full Code Here

class VedalkenEngineerAbility extends ManaAbility {

    public VedalkenEngineerAbility(Cost cost, int amount, ConditionalManaBuilder manaBuilder) {
        super(Zone.BATTLEFIELD, new VedalkenEngineerEffect(amount, manaBuilder), cost);
        this.addChoice(new ChoiceColor());
        this.netMana.setAny(amount);
    }
View Full Code Here

            return false;
        }

        boolean result = false;
        for (int i = 0; i < amount; i++) {
            ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
            Mana mana = null;
            if (choice.getColor().isBlack()) {
                mana = manaBuilder.setMana(Mana.BlackMana(1), source, game).build();
            } else if (choice.getColor().isBlue()) {
                mana = manaBuilder.setMana(Mana.BlueMana(1), source, game).build();
            } else if (choice.getColor().isRed()) {
                mana = manaBuilder.setMana(Mana.RedMana(1), source, game).build();
            } else if (choice.getColor().isGreen()) {
                mana = manaBuilder.setMana(Mana.GreenMana(1), source, game).build();
            } else if (choice.getColor().isWhite()) {
                mana = manaBuilder.setMana(Mana.WhiteMana(1), source, game).build();
            }
            if (mana != null) {
                player.getManaPool().addMana(mana, game, source);
                result = true;
View Full Code Here

        this.color.setBlack(true);

        // Choose a color. Target player reveals his or her hand and discards all cards of that color.
        this.getSpellAbility().addEffect(new PersecuteEffect());
        this.getSpellAbility().addChoice(new ChoiceColor());
        this.getSpellAbility().addTarget(new TargetPlayer());

    }
View Full Code Here

        this.power = new MageInt(3);
        this.toughness = new MageInt(3);

        // Whenever you cast a Spirit or Arcane spell, Kami of the Painted Road gains protection from the color of your choice until end of turn.
        Ability ability = new SpellCastControllerTriggeredAbility(new GainProtectionFromColorSourceEffect(Duration.EndOfTurn), filter, true);
        Choice colorChoice = new ChoiceColor();
        colorChoice.setMessage("Choose color (Kami of the Painted Road)");
        ability.addChoice(colorChoice);
        this.addAbility(ability);

    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Permanent creature = game.getPermanent(source.getSourceId());
        if (creature != null) {
            ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
            protectionFilter.add(new ColorPredicate(choice.getColor()));
            protectionFilter.setMessage(choice.getChoice());
            ((ProtectionAbility)ability).setFilter(protectionFilter);
            creature.addAbility(ability, source.getSourceId(), game);
            return true;
        }
        return false;
View Full Code Here

        if (enchantment != null) {
            Permanent land = game.getPermanent(enchantment.getAttachedTo());
            if (land != null) {
                Player player = game.getPlayer(land.getControllerId());
                if (player != null) {
                    ChoiceColor choice = new ChoiceColor();
                    while (!player.choose(outcome, choice, game)) {
                        if (!player.isInGame()) {
                            return false;
                        }
                    }
                    int amount = 1;
                    Mana mana = null;
                    if (choice.getColor().isBlack()) {
                        mana = Mana.BlackMana(amount);
                    } else if (choice.getColor().isBlue()) {
                        mana = Mana.BlueMana(amount);
                    } else if (choice.getColor().isRed()) {
                        mana = Mana.RedMana(amount);
                    } else if (choice.getColor().isGreen()) {
                        mana = Mana.GreenMana(amount);
                    } else if (choice.getColor().isWhite()) {
                        mana = Mana.WhiteMana(amount);
                    }
                    if (player != null && mana != null) {
                        player.getManaPool().addMana(mana, game, source);
                        return true;
View Full Code Here

        this.addAbility(new EntersBattlefieldTappedAbility());
        // {2}, {tap}, Sacrifice Terrarion: Add two mana in any combination of colors to your mana pool.
        Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new TerrarionManaEffect(), new GenericManaCost(2));
        ability.addCost(new TapSourceCost());
        ability.addCost(new SacrificeSourceCost());
        ability.addChoice(new ChoiceColor());
        ability.addChoice(new ChoiceColor());
        this.addAbility(ability);
        // When Terrarion is put into a graveyard from the battlefield, draw a card.
        this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)));
    }
View Full Code Here

TOP

Related Classes of mage.choices.ChoiceColor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.