Package mage.choices

Examples of mage.choices.Choice


            if (game.getTurnNum() != turn) {
                turn = game.getTurnNum();
                applies = false;
                Permanent storageMatrix = game.getPermanent(source.getSourceId());
                if (storageMatrix != null && !storageMatrix.isTapped()) {
                    Choice choiceImpl = new ChoiceImpl();
                    choiceImpl.setMessage("Untap which kind of permanent?");
                    choiceImpl.setChoices(choice);
                    Player player = game.getPlayer(game.getActivePlayerId());
                    if(player != null){
                        while(!player.choose(outcome, choiceImpl, game)) {
                            // player has to choose
                        }
                        String choosenType = choiceImpl.getChoice();
                        game.informPlayers(new StringBuilder(storageMatrix.getName()).append(": ").append(player.getName()).append(" chose to untap ").append(choosenType).toString());

                        if(choosenType.equals(CardType.ARTIFACT.toString())){
                            type = CardType.ARTIFACT;
                        }else if(choosenType.equals(CardType.LAND.toString())){
View Full Code Here


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

    @Override
    public void adjustTargets(Ability ability, Game game) {
        if (ability instanceof SpellAbility) {
            for(Effect effect :ability.getEffects()) {
                if (effect instanceof FuryCharmRemoveCounterEffect) {
                    Choice targetChoice = ability.getChoices().get(0);
                    if (targetChoice.getChoice().equals("Permanent")) {
                        ability.addTarget(new TargetCreaturePermanent());
                    }
                    if (targetChoice.getChoice().equals("Suspended Card")) {
                        Target target = new TargetCardInExile(1,1, filter, null, true);
                        ability.addTarget(target);
                    }
                }
            }
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

        super(effect);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Choice abilityChoice = source.getChoices().get(0);
        Player controller = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanent(source.getSourceId());
        if (controller != null && sourcePermanent != null && abilityChoice != null && abilityChoice.isChosen()) {
            Ability ability = null;
            if (abilityChoice.getChoice().equals("First strike")) {
                ability = FirstStrikeAbility.getInstance();
            } else if (abilityChoice.getChoice().equals("Vigilance")) {
                ability = VigilanceAbility.getInstance();
            } else if (abilityChoice.getChoice().equals("Lifelink")) {
                ability = LifelinkAbility.getInstance();
            }
            if (ability != null) {
                GainAbilityControlledEffect effect = new GainAbilityControlledEffect(ability, Duration.EndOfTurn, new FilterControlledCreaturePermanent());
                game.addEffect(effect, source);
                game.informPlayers(new StringBuilder(sourcePermanent.getName())
                        .append(": ")
                        .append(controller.getName())
                        .append(" has chosen ")
                        .append(abilityChoice.getChoice().toLowerCase()).toString());
                return true;
            }
        }
        return false;
    }
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

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.