Package mage.choices

Examples of mage.choices.ChoiceImpl


        if (permanent != null && player != null) {
            List<UUID> imprinted = permanent.getImprinted();
            if (imprinted.size() > 0) {
                Card imprintedCard = game.getCard(imprinted.get(0));
                if (imprintedCard != null) {
                    Choice choice = new ChoiceImpl(true);
                    choice.setMessage("Pick a mana color");
                    ObjectColor color = imprintedCard.getColor();
                    if (color.isBlack()) {
                        choice.getChoices().add("Black");
                    }
                    if (color.isRed()) {
                        choice.getChoices().add("Red");
                    }
                    if (color.isBlue()) {
                        choice.getChoices().add("Blue");
                    }
                    if (color.isGreen()) {
                        choice.getChoices().add("Green");
                    }
                    if (color.isWhite()) {
                        choice.getChoices().add("White");
                    }
                 
                    if (choice.getChoices().size() > 0) {
                        if (choice.getChoices().size() == 1) {
                            choice.setChoice(choice.getChoices().iterator().next());
                        } else {
                            player.choose(outcome, choice, game);
                        }
                        if (choice.getChoice().equals("Black")) {
                            player.getManaPool().addMana(Mana.BlackMana, game, source);
                        } else if (choice.getChoice().equals("Blue")) {
                            player.getManaPool().addMana(Mana.BlueMana, game, source);
                        } else if (choice.getChoice().equals("Red")) {
                            player.getManaPool().addMana(Mana.RedMana, game, source);
                        } else if (choice.getChoice().equals("Green")) {
                            player.getManaPool().addMana(Mana.GreenMana, game, source);
                        } else if (choice.getChoice().equals("White")) {
                            player.getManaPool().addMana(Mana.WhiteMana, game, source);
                        } else if (choice.getChoice().equals("Colorless")) {
                            player.getManaPool().addMana(Mana.ColorlessMana, game, source);
                        }
                    }
                }
View Full Code Here


        if (fromPermanent == null
                || toPermanent == null
                || you == null) {
            return false;
        }
        Choice choice = new ChoiceImpl();
        Set<String> possibleChoices = new HashSet<String>();
        for (String counterName : fromPermanent.getCounters().keySet()) {
            possibleChoices.add(counterName);
        }
        choice.setChoices(possibleChoices);
        you.choose(Outcome.Neutral, choice, game);
        String chosen = choice.getChoice();
        if (fromPermanent.getCounters().containsKey(chosen)) {
            fromPermanent.removeCounters(chosen, 1, game);
            toPermanent.addCounters(chosen, 1, game);
        }
        return true;
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (player != null && permanent != null) {
            Choice typeChoice = new ChoiceImpl(true);
            typeChoice.setMessage("Choose creature type");
            typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
            while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
                if (!player.isInGame()) {
                    return false;
                }
            }
            if (typeChoice.getChoice() != null) {
                game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
                game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
                permanent.addInfo("chosen type", "<i>Chosen type: " + typeChoice.getChoice().toString() + "</i>");
            }
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (controller != null && permanent != null) {
            Choice cardChoice = new ChoiceImpl();
            cardChoice.setChoices(CardRepository.instance.getNonLandNames());
            cardChoice.clearChoice();
            while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
                if (!controller.isInGame()) {
                    return false;
                }
            }
            String cardName = cardChoice.getChoice();
            game.informPlayers(permanent.getLogName() + ", named card: [" + cardName + "]");
            game.getState().setValue(source.getSourceId().toString(), cardName);
            permanent.addInfo("named card", CardUtil.addToolTipMarkTags("Named card: [" + cardName +"]"));
            return true;
        }       
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            ChoiceImpl choices = new ChoiceImpl(true);
            Set choicesSet = choices.getChoices();
            choicesSet.add("Forest");
            choicesSet.add("Plains");
            choicesSet.add("Mountain");
            choicesSet.add("Island");
            choicesSet.add("Swamp");
            if (player.choose(Outcome.Neutral, choices, game)) {
                game.getState().setValue(source.getSourceId().toString() + "_ElsewhereFlask", choices.getChoice());
            }
            game.addEffect(new ElsewhereFlaskContinuousEffect(), source);
            return true;
        }
        return false;
View Full Code Here

        choices.add("Artifacts");
        choices.add("Creatures");
        choices.add("Lands");

        LinkedList<CardType> order = new LinkedList<>();
        ChoiceImpl choice = new ChoiceImpl(true);
        choice.setChoices(choices);
        while (controller.isInGame() && controller.choose(Outcome.Sacrifice, choice, game) && choices.size() > 1) {
            order.add(getCardType(choice.getChoice()));
            choices.remove(choice.getChoice());
            choice.clearChoice();
        }
        order.add(getCardType(choices.iterator().next()));

        LinkedList<UUID> sacrifices = new LinkedList<>();
        int count = 1;
View Full Code Here

        Abilities<ManaAbility> mana = land.getAbilities().getManaAbilities(Zone.BATTLEFIELD);
        Mana types = new Mana();
        for (ManaAbility ability: mana) {
            types.add(ability.getNetMana(game));
        }
        Choice choice = new ChoiceImpl(true);
        choice.setMessage("Pick a mana color");
        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 (types.getColorless() > 0) {
            choice.getChoices().add("Colorless");
        }
        if (choice.getChoices().size() > 0) {
            Player player = game.getPlayer(source.getControllerId());
            if (choice.getChoices().size() == 1) {
                choice.setChoice(choice.getChoices().iterator().next());
            } else {
                player.choose(outcome, choice, game);
            }
            switch (choice.getChoice()) {
                case "Black":
                    player.getManaPool().addMana(Mana.BlackMana, game, source);
                    return true;
                case "Blue":
                    player.getManaPool().addMana(Mana.BlueMana, game, source);
View Full Code Here

        this.color.setRed(true);
        this.power = new MageInt(1);
        this.toughness = new MageInt(1);

        // {1}{R}, Remove a time counter from a permanent you control or suspended card you own: Rift Elemental gets +2/+0 until end of turn.
        Choice targetChoice = new ChoiceImpl();
        targetChoice.setMessage("Choose what to target");
        targetChoice.getChoices().add("Permanent");
        targetChoice.getChoices().add("Suspended Card");
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2,0,Duration.EndOfTurn), new ManaCostsImpl("{1}{R}"));
        ability.addChoice(targetChoice);
        ability.addCost(new RemoveCounterFromCardCost(new TargetCardInExile(1,1,filter, null, true), CounterType.TIME));
        this.addAbility(ability);
    }
View Full Code Here

            if (game.getTurnNum() != turn) {
                turn = game.getTurnNum();
                applies = false;
                Permanent storageMatrix = game.getPermanent(source.getSourceId());
                if (storageMatrix != null && !storageMatrix.isTapped()) {
                    Choice choiceImpl = new ChoiceImpl();
                    choiceImpl.setMessage("Untap which kind of permanent?");
                    choiceImpl.setChoices(choice);
                    Player player = game.getPlayer(game.getActivePlayerId());
                    if(player != null){
                        while(!player.choose(outcome, choiceImpl, game)) {
                            // player has to choose
                        }
                        String choosenType = choiceImpl.getChoice();
                        game.informPlayers(new StringBuilder(storageMatrix.getName()).append(": ").append(player.getName()).append(" chose to untap ").append(choosenType).toString());

                        if(choosenType.equals(CardType.ARTIFACT.toString())){
                            type = CardType.ARTIFACT;
                        }else if(choosenType.equals(CardType.LAND.toString())){
View Full Code Here

                        String counterName = null;
                        if (counterTypeToRemove != null) {
                            counterName = counterTypeToRemove.getName();
                        } else {
                            if (card.getCounters().size() > 1 && counterTypeToRemove == null) {
                                Choice choice = new ChoiceImpl(true);
                                Set<String> choices = new HashSet<String>();
                                for (Counter counter : card.getCounters().values()) {
                                    if (card.getCounters().getCount(counter.getName()) > 0) {
                                        choices.add(counter.getName());
                                    }
                                }
                                choice.setChoices(choices);
                                choice.setMessage("Choose a counter to remove from " + card.getName());
                                controller.choose(Outcome.UnboostCreature, choice, game);
                                counterName = choice.getChoice();
                            } else {
                                for (Counter counter : card.getCounters().values()) {
                                    if (counter.getCount() > 0) {
                                        counterName = counter.getName();
                                    }
View Full Code Here

TOP

Related Classes of mage.choices.ChoiceImpl

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.