Package mage.choices

Examples of mage.choices.ChoiceColor


            super(effect);
        }

        @Override
        public boolean apply(Game game, Ability source) {
            ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
            Player player = game.getPlayer(source.getControllerId());

            if (player != null && choice != null) {
                int numberOfMana = 0;
                for (Cost cost : source.getCosts()) {
                    if (cost instanceof RemoveVariableCountersSourceCost) {
                        numberOfMana = ((RemoveVariableCountersSourceCost)cost).getAmount();
                    }
                }               
                if (choice.getColor().isBlack()) {
                    player.getManaPool().addMana(new Mana(0, 0, 0, 0, numberOfMana, 0, 0), game, source);
                    return true;
                } else if (choice.getColor().isBlue()) {
                    player.getManaPool().addMana(new Mana(0, 0, numberOfMana, 0, 0, 0, 0), game, source);
                    return true;
                } else if (choice.getColor().isRed()) {
                    player.getManaPool().addMana(new Mana(numberOfMana, 0, 0, 0, 0, 0, 0), game, source);
                    return true;
                } else if (choice.getColor().isGreen()) {
                    player.getManaPool().addMana(new Mana(0, numberOfMana, 0, 0, 0, 0, 0), game, source);
                    return true;
                } else if (choice.getColor().isWhite()) {
                    player.getManaPool().addMana(new Mana(0, 0, 0, numberOfMana, 0, 0, 0), game, source);
                    return true;
                }
            }
            return false;
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getFirstTarget());
        if (player != null) {
            ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
            if(choice == null || choice.getColor() == null) {
                return false;
            }
            Cards hand = player.getHand();
            player.revealCards("Persecute", hand, game);
            Set<Card> cards = hand.getCards(game);
            for (Card card : cards) {
                if (card != null && card.getColor().shares(choice.getColor())) {
                    player.discard(card, source, game);
                }
            }
            return true;
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        Permanent wildMongrel = game.getPermanent(source.getSourceId());
        if (player != null && wildMongrel != null) {
            ChoiceColor colorChoice = new ChoiceColor();
            if (player.choose(Outcome.Neutral, colorChoice, game)) {
                game.informPlayers(wildMongrel.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice());
                ContinuousEffect effect = new SetCardColorTargetEffect(colorChoice.getColor(), Duration.EndOfTurn, "is " + colorChoice.getChoice());
                effect.setTargetPointer(new FixedTarget(source.getSourceId()));
                game.addEffect(effect, source);
                return true;
            }
        }
View Full Code Here

class CarpetOfFlowersTriggeredAbility extends TriggeredAbilityImpl {


    public CarpetOfFlowersTriggeredAbility() {
        super(Zone.BATTLEFIELD, new CarpetOfFlowersEffect(), true);
        this.addChoice(new ChoiceColor());
        this.addTarget(new TargetOpponent());
       
    }
View Full Code Here

        super(effect);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
        Player player = game.getPlayer(source.getControllerId());
        if(player != null){
            int countMax = game.getBattlefield().count(filter, source.getSourceId(), source.getTargets().getFirstTarget(), game);
            ChoiceImpl choiceCount = new ChoiceImpl(true);
            LinkedHashSet<String> set = new LinkedHashSet<>();
            for(int i = 0; i <= countMax; i++)
            {
                set.add(Integer.toString(i));
            }
            choiceCount.setChoices(set);
            choiceCount.setMessage("Choose number of mana");
            player.choose(Outcome.PutManaInPool, choiceCount, game);
            int count = Integer.parseInt(choiceCount.getChoice());
            if (choice.getColor().isBlack()) {
                player.getManaPool().addMana(new Mana(0, 0, 0, 0, count, 0, 0), game, source);
                return true;
            } else if (choice.getColor().isBlue()) {
                player.getManaPool().addMana(new Mana(0, 0, count, 0, 0, 0, 0), game, source);
                return true;
            } else if (choice.getColor().isRed()) {
                player.getManaPool().addMana(new Mana(count, 0, 0, 0, 0, 0, 0), game, source);
                return true;
            } else if (choice.getColor().isGreen()) {
                player.getManaPool().addMana(new Mana(0, count, 0, 0, 0, 0, 0), game, source);
                return true;
            } else if (choice.getColor().isWhite()) {
                player.getManaPool().addMana(new Mana(0, 0, 0, count, 0, 0, 0), game, source);
                return true;
            }
        }
        return false;
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            ChoiceColor choice = new ChoiceColor();
            choice.setMessage("Choose a color for devotion of Nykthos");
            if (controller.choose(outcome, choice, game)) {
                computeMana(choice.getChoice(), game, source);
                game.getPlayer(source.getControllerId()).getManaPool().addMana(computedMana, game, source);
                return true;
            }
        }
        return false;
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (player != null && permanent != null) {
            String colors;
            ChoiceColor colorChoice = new ChoiceColor();
            colorChoice.setMessage("Choose the first color");
            while (!player.choose(Outcome.GainLife, colorChoice, game)) {
                if (!player.isInGame()) {
                    return false;
                }
            }
            game.getState().setValue(permanent.getId() + "_color1", colorChoice.getColor().toString());
            colors = colorChoice.getChoice().toLowerCase() + " and ";

            colorChoice.getChoices().remove(colorChoice.getChoice());
            colorChoice.setMessage("Choose the second color");
            while (!player.choose(Outcome.GainLife, colorChoice, game&& player.isInGame()) {
                game.debugMessage("player canceled choosing type. retrying.");
            }
            game.getState().setValue(permanent.getId() + "_color2", colorChoice.getColor().toString());
            colors = colors + colorChoice.getChoice().toLowerCase();
            game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + colors);
        }
        return false;
    }
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.