Package mage.choices

Examples of mage.choices.Choice


    @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.Discard, cardChoice, game)) {
                if (!controller.isInGame()) {
                    return false;
                }
            }

            String cardName = cardChoice.getChoice();
            game.informPlayers("Cabal Therapy, named card: [" + cardName + "]");
            for (Card card : player.getHand().getCards(game)) {
                if (card.getName().equals(cardName)) {
                    player.discard(card, source, game);
                }
View Full Code Here


   
    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            Choice typeChoice = new ChoiceImpl(true);
            typeChoice.setMessage("Choose a creature type:");
            typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
            while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
                if (!player.isInGame()) {
                    return false;
                }
            }
            FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
            filter.add(new SubtypePredicate(typeChoice.getChoice()));
            return new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)).apply(game, source);
        }
        return false;
    }
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 a 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() + "</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(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

        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

        // Astral Cornucopia enters the battlefield with X charge counters on it.
        this.addAbility(new EntersBattlefieldAbility(new AstralCornucopiaEffect(), "with X charge counters on it"));

        // {T}: Choose a color. Add one mana of that color to your mana pool for each charge counter on Astral Cornucopia.
        Ability ability = new AstralCornucopiaManaAbility();
        Choice choice = new ChoiceColor();
        choice.setMessage("Choose a color to add mana of that color");
        ability.addChoice(choice);
        this.addAbility(ability);
    }
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

        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

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.