Package mage.choices

Examples of mage.choices.ChoiceImpl


    @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


    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);
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.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.