Package mage.choices

Examples of mage.choices.Choice


                    if (gameCard.getOwnerId().equals(targetPlayer.getId())) {
                        choices.add(gameCard.getName());
                    }
                }

                Choice cardChoice = new ChoiceImpl();
                cardChoice.setChoices(choices);
                cardChoice.clearChoice();
                while (!targetPlayer.choose(Outcome.Benefit, cardChoice, game)) {
                    if (!targetPlayer.isInGame()) {
                        return false;
                    }
                }
                String cardName = cardChoice.getChoice();

                game.informPlayers(new StringBuilder(sourcePermanent.getName()).append(", named card: [").append(cardName).append("]").toString());
                if (!card.getName().equals(cardName) && card.getCardType().contains(CardType.CREATURE)) {
                    if (player.chooseUse(outcome, new StringBuilder("Put ").append(card.getName()).append(" onto the battlefield?").toString(), game)) {
                        player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            // Name a card.
            Choice choice = new ChoiceImpl();
            choice.setChoices(CardRepository.instance.getNames());
            while (!player.choose(Outcome.Benefit, choice, game)) {
                if (!player.isInGame()) {
                    return false;
                }
            }
            String name = choice.getChoice();
            game.informPlayers("Card named: " + name);
           
            // Exile the top six cards of your library,
            int num = Math.min(6, player.getLibrary().size());
            for (int i = 0; i < num; i++) {
View Full Code Here

        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            Card commander = game.getCard(controller.getCommanderId());
            if (commander != null) {
                Mana commanderMana = commander.getManaCost().getMana();
                Choice choice = new ChoiceImpl(true);
                choice.setMessage("Pick a mana color");
                if (commanderMana.getBlack() > 0) {
                    choice.getChoices().add("Black");
                }
                if (commanderMana.getRed() > 0) {
                    choice.getChoices().add("Red");
                }
                if (commanderMana.getBlue() > 0) {
                    choice.getChoices().add("Blue");
                }
                if (commanderMana.getGreen() > 0) {
                    choice.getChoices().add("Green");
                }
                if (commanderMana.getWhite() > 0) {
                    choice.getChoices().add("White");
                }
                if (choice.getChoices().size() > 0) {
                    Mana mana = new Mana();
                    if (choice.getChoices().size() == 1) {
                        choice.setChoice(choice.getChoices().iterator().next());
                    } else {
                        controller.choose(outcome, choice, game);
                    }
                    if (choice.getChoice().equals("Black")) {
                        mana.addBlack();
                    } else if (choice.getChoice().equals("Blue")) {
                        mana.addBlue();
                    } else if (choice.getChoice().equals("Red")) {
                        mana.addRed();
                    } else if (choice.getChoice().equals("Green")) {
                        mana.addGreen();
                    } else if (choice.getChoice().equals("White")) {
                        mana.addWhite();
                    }
                    // set to indicate, that the mana can boost the commander
                    mana.setFlag(true);
                    controller.getManaPool().addMana(mana, game, source);
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(land.getControllerId());
            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);
                return true;
            } else if (choice.getChoice().equals("Blue")) {
                player.getManaPool().addMana(Mana.BlueMana, game, source);
                return true;
            } else if (choice.getChoice().equals("Red")) {
                player.getManaPool().addMana(Mana.RedMana, game, source);
                return true;
            } else if (choice.getChoice().equals("Green")) {
                player.getManaPool().addMana(Mana.GreenMana, game, source);
                return true;
            } else if (choice.getChoice().equals("White")) {
                player.getManaPool().addMana(Mana.WhiteMana, game, source);
                return true;
            } else if (choice.getChoice().equals("Colorless")) {
                player.getManaPool().addMana(Mana.ColorlessMana, game, source);
                return true;
            }
        }
        return true;
View Full Code Here

            Abilities<ManaAbility> mana = land.getAbilities().getManaAbilities(Zone.BATTLEFIELD);
            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.getAny() > 0) {
            choice.getChoices().add("Black");
            choice.getChoices().add("Red");
            choice.getChoices().add("Blue");
            choice.getChoices().add("Green");
            choice.getChoices().add("White");
        }
        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);
            }
            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);
            }
        }
        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;
                }
            }
            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

            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(land.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

        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            Card commander = game.getCard(controller.getCommanderId());
            if (commander != null) {
                Mana commanderMana = commander.getManaCost().getMana();
                Choice choice = new ChoiceImpl(true);
                choice.setMessage("Pick a mana color");
                if (commanderMana.getBlack() > 0) {
                    choice.getChoices().add("Black");
                }
                if (commanderMana.getRed() > 0) {
                    choice.getChoices().add("Red");
                }
                if (commanderMana.getBlue() > 0) {
                    choice.getChoices().add("Blue");
                }
                if (commanderMana.getGreen() > 0) {
                    choice.getChoices().add("Green");
                }
                if (commanderMana.getWhite() > 0) {
                    choice.getChoices().add("White");
                }
                if (choice.getChoices().size() > 0) {
                    if (choice.getChoices().size() == 1) {
                        choice.setChoice(choice.getChoices().iterator().next());
                    } else {
                        controller.choose(outcome, choice, game);
                    }
                    if (choice.getChoice().equals("Black")) {
                        controller.getManaPool().addMana(Mana.BlackMana, game, source);
                    } else if (choice.getChoice().equals("Blue")) {
                        controller.getManaPool().addMana(Mana.BlueMana, game, source);
                    } else if (choice.getChoice().equals("Red")) {
                        controller.getManaPool().addMana(Mana.RedMana, game, source);
                    } else if (choice.getChoice().equals("Green")) {
                        controller.getManaPool().addMana(Mana.GreenMana, game, source);
                    } else if (choice.getChoice().equals("White")) {
                        controller.getManaPool().addMana(Mana.WhiteMana, game, source);
                    }
                }
                return true;
            }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        Player controller = game.getPlayer(source.getControllerId());
        if (player != null && controller != null) {
            Choice cardChoice = new ChoiceImpl();
            cardChoice.setChoices(CardRepository.instance.getNonLandNames());
            cardChoice.clearChoice();

            while (!controller.choose(Outcome.Exile, cardChoice, game)) {
                if (!controller.isInGame()) {
                    return false;
                }
            }

            String cardName = cardChoice.getChoice();
            game.informPlayers("Memoricide, named card: [" + cardName + "]");
            for (Card card: player.getGraveyard().getCards(game)) {
                if (card.getName().equals(cardName)) {
                    card.moveToExile(null, "", source.getSourceId(), game);                   
                }
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

TOP

Related Classes of mage.choices.Choice

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.