Package mage.choices

Examples of mage.choices.Choice


        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) {
            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


    @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.Benefit, 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", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()));
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        UUID target = source.getFirstTarget();
        if(player != null && target != null){
            Choice choiceImpl = new ChoiceImpl();
            choiceImpl.setChoices(choice);
            while(!player.choose(outcome.Neutral, choiceImpl, game));
            CardType type;
            String choosenType = choiceImpl.getChoice();
           
            if(choosenType.equals(CardType.ARTIFACT.toString())){
                type = CardType.ARTIFACT;
            }else if(choosenType.equals(CardType.LAND.toString())){
                type = CardType.LAND;
            }else{
                type = CardType.CREATURE;               
            }
           
            choiceImpl = new ChoiceImpl();
            choiceImpl.setChoices(choice2);
            while(!player.choose(outcome.Neutral, choiceImpl, game));
           
            FilterPermanent filter = new FilterPermanent();
            filter.add(new CardTypePredicate(type));
           
           
            if(choiceImpl.getChoice().equals("Untap")){
                filter.add(new TappedPredicate());
                for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
                    if(permanent.getControllerId().equals(target)){
                        permanent.untap(game);
                    }
View Full Code Here

            }

            player.revealCards("Pile 1 (Fact or Fiction)", pile1, game);
            player.revealCards("Pile 2 (Fact or Fiction)", cards, game);

            Choice choice = new ChoiceImpl(true);
            choice.setMessage("Select a pile of cards to put into your hand:");

            StringBuilder sb = new StringBuilder("Pile 1: ");
            for (UUID cardId : pile1) {
                Card card = pile1.get(cardId, game);
                if (card != null) {
                    sb.append(card.getName()).append("; ");
                }
            }
            sb.delete(sb.length() - 2, sb.length());
            choice.getChoices().add(sb.toString());

            sb = new StringBuilder("Pile 2: ");
            for (UUID cardId : cards) {
                Card card = cards.get(cardId, game);
                if (card != null) {
                    sb.append(card.getName()).append("; ");
                }
            }
            sb.delete(sb.length() - 2, sb.length());
            choice.getChoices().add(sb.toString());

            Zone pile1Zone = Zone.GRAVEYARD;
            Zone pile2Zone = Zone.HAND;
            if (player.choose(Outcome.Neutral, choice, game)) {
                if (choice.getChoice().startsWith("Pile 1")) {
                    pile1Zone = Zone.HAND;
                    pile2Zone = Zone.GRAVEYARD;
                }
            }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            if (typeChosen.isEmpty()) {
                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;
                    }
                }
                typeChosen = typeChoice.getChoice();
                game.informPlayers(player.getName() + " has chosen " + typeChosen);
            }
            for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
                if (perm.hasSubtype(typeChosen)) {
                    perm.addPower(3);
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.