Package mage.choices

Examples of mage.choices.ChoiceImpl


    @Override
    public boolean apply(Game game, Ability source) {
        Player you = game.getPlayer(source.getControllerId());
        if (you != null) {
            ChoiceImpl choices = new ChoiceImpl(true);
            choices.setMessage("Choose basic land type");
            choices.isRequired();
            choices.getChoices().add("Forest");
            choices.getChoices().add("Plains");
            choices.getChoices().add("Mountain");
            choices.getChoices().add("Island");
            choices.getChoices().add("Swamp");
            if (you.choose(Outcome.Neutral, choices, game)) {
                game.informPlayers(new StringBuilder("Realmwright: ").append(" Chosen basic land type is ").append(choices.getChoice()).toString());
                game.getState().setValue(source.getSourceId().toString() + "_Realmwright", choices.getChoice());
                return true;
            }
        }
        return false;
    }
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        MageObject sourceObject = game.getObject(source.getSourceId());
        if (sourceObject != null && controller != null) {
            Choice abilityChoice = new ChoiceImpl();
            abilityChoice.setMessage("Choose an ability to add");

            Set<String> abilities = new HashSet<>();
            abilities.add(VigilanceAbility.getInstance().getRule());
            abilities.add(LifelinkAbility.getInstance().getRule());
            abilities.add(HasteAbility.getInstance().getRule());
            abilityChoice.setChoices(abilities);
            while (!abilityChoice.isChosen()) {
                controller.choose(Outcome.AddAbility, abilityChoice, game);
                if (!controller.isInGame()) {
                    return false;
                }
            }

            String chosen = abilityChoice.getChoice();
            Ability ability = null;
            if (VigilanceAbility.getInstance().getRule().equals(chosen)) {
                ability = VigilanceAbility.getInstance();
            } else if (LifelinkAbility.getInstance().getRule().equals(chosen)) {
                ability = LifelinkAbility.getInstance();
View Full Code Here

   
    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            Choice choice = new ChoiceImpl(true);
            choice.setMessage("Choose a creature type:");
            choice.setChoices(CardRepository.instance.getCreatureTypes());
            while (!player.choose(Outcome.BoostCreature, choice, game)) {
                if (!player.isInGame()) {
                    return false;
                }
            }
            Cards revealedCards = new CardsImpl();
            while (player.getLibrary().size() > 0) {
                Card card = player.getLibrary().removeFromTop(game);
                if (card.getCardType().contains(CardType.CREATURE) && card.getSubtype().contains(choice.getChoice())) {
                    player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
                    break;
                }
                revealedCards.add(card);
            }
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);
            choices.setMessage("Choose basic land type");
            choices.isRequired();
            choices.getChoices().add("Forest");
            choices.getChoices().add("Plains");
            choices.getChoices().add("Mountain");
            choices.getChoices().add("Island");
            choices.getChoices().add("Swamp");
            if (player.choose(Outcome.Neutral, choices, game)) {
                game.informPlayers(new StringBuilder("Phantasmal Terrain: ").append(" chosen basic land type is ").append(choices.getChoice()).toString());
                game.getState().setValue(source.getSourceId().toString() + "_PhantasmalTerrain", choices.getChoice());
                return true;
            }
        }
        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

        mode.getEffects().add(effect);
        mode.getTargets().add(new TargetCreaturePermanent());
        this.getSpellAbility().getModes().addMode(mode);
        // or remove two time counters from target permanent or suspended card.
        mode = new Mode();
        Choice targetChoice = new ChoiceImpl();
        targetChoice.setMessage("Choose what to target");
        targetChoice.getChoices().add("Permanent");
        targetChoice.getChoices().add("Suspended Card");
        mode.getChoices().add(targetChoice);
        mode.getEffects().add(new FuryCharmRemoveCounterEffect());
        this.getSpellAbility().getModes().addMode(mode);

View Full Code Here

        this.color.setRed(true);
        this.color.setBlack(true);

        // Choose a number. Destroy all artifacts and creatures with converted mana cost equal to that number. Then target player reveals his or her hand and discards all nonland cards with converted mana cost equal to the number.
        Choice numberChoice = new ChoiceImpl();
        HashSet<String> numbers = new HashSet<String>();
        for (int i = 0; i <= 30; i++) {
            numbers.add(Integer.toString(i));
        }
        numberChoice.setChoices(numbers);
        numberChoice.setMessage("Choose a number");
        this.getSpellAbility().addChoice(numberChoice);
        this.getSpellAbility().addTarget(new TargetPlayer());
        this.getSpellAbility().addEffect(new VoidEffect());

    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if(player != null){
            Choice manaChoice = new ChoiceImpl();
            Set<String> choices = new LinkedHashSet<>();
            choices.add("Red");
            choices.add("Green");
            manaChoice.setChoices(choices);
            manaChoice.setMessage("Select color of mana to add");

            for(int i = 0; i < 3; i++){
                Mana mana = new Mana();
                while (!player.choose(Outcome.Benefit, manaChoice, game)) {
                    if (!player.isInGame()) {
                        return false;
                    }
                }
                switch (manaChoice.getChoice()) {
                    case "Green":
                        mana.addGreen();
                        break;
                    case "Red":
                        mana.addRed();
View Full Code Here

                    String counterName = null;
                    if (counterTypeToRemove != null) {
                        counterName = counterTypeToRemove.getName();
                    } else {
                        if (permanent.getCounters().size() > 1 && counterTypeToRemove == null) {
                            Choice choice = new ChoiceImpl(true);
                            Set<String> choices = new HashSet<String>();
                            for (Counter counter : permanent.getCounters().values()) {
                                if (permanent.getCounters().getCount(counter.getName()) > 0) {
                                   choices.add(counter.getName());
                                }
                            }
                            choice.setChoices(choices);
                            choice.setMessage("Choose a counter type to remove from " + permanent.getName());
                            controller.choose(Outcome.Detriment, choice, game);
                            counterName = choice.getChoice();
                         } else {
                            for (Counter counter : permanent.getCounters().values()) {
                                if (counter.getCount() > 0) {
                                    counterName = counter.getName();
                                }
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();
            cardChoice.setMessage("Name a nonland card");

            while (!controller.choose(Outcome.Exile, cardChoice, game)) {
                if (!controller.isInGame()) {
                    return false;
                }
            }
            String cardName;
            cardName = cardChoice.getChoice();
            Card card = game.getCard(source.getSourceId());
            if (card != null) {
                game.informPlayers(card.getName()+"named card: [" + cardName + "]");
            }
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.