Package mage.choices

Examples of mage.choices.ChoiceColor


    @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) {
            ChoiceColor colorChoice = new ChoiceColor();
            colorChoice.setMessage("Choose color");
            while (!player.choose(Outcome.BoostCreature, colorChoice, game)) {
                if (!player.isInGame()) {
                    return false;
                }
            }
            if (colorChoice.getChoice() != null) {
                game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice());
                game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor());
                permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>");
            }
        }
        return false;
    }
View Full Code Here


        this.addAbility(VigilanceAbility.getInstance());
        // {1}{W}: Prevent all damage that would be dealt to another target creature this turn by sources of the color of your choice.
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
                new AvacynGuardianAngelPreventToCreatureEffect(Duration.EndOfTurn, Integer.MAX_VALUE, false),
                new ManaCostsImpl("{1}{W}"));
        ability.addChoice(new ChoiceColor());
        ability.addTarget(new TargetCreaturePermanent(filter));       
        this.addAbility(ability);
       
        // {5}{W}{W}: Prevent all damage that would be dealt to target player this turn by sources of the color of your choice.
        ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
                new AvacynGuardianAngelPreventToPlayerEffect(Duration.EndOfTurn, Integer.MAX_VALUE, false),
                new ManaCostsImpl("{5}{W}{W}"));
        ability.addChoice(new ChoiceColor());
        ability.addTarget(new TargetPlayer());   
        this.addAbility(ability);
    }
View Full Code Here

    @Override
    public boolean applies(GameEvent event, Ability source, Game game) {
        if (super.applies(event, source, game)) {
            if (event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)
                    && event.getTargetId().equals(getTargetPointer().getFirst(game, source))) {
                ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
                MageObject sourceObject = game.getObject(event.getSourceId());
                if (sourceObject != null && choice != null && sourceObject.getColor().shares(choice.getColor())) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here

    @Override
    public boolean applies(GameEvent event, Ability source, Game game) {
        if (super.applies(event, source, game)) {
            if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)
                    && event.getTargetId().equals(getTargetPointer().getFirst(game, source))) {
                ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
                MageObject sourceObject = game.getObject(event.getSourceId());
                if (sourceObject != null && choice != null && sourceObject.getColor().shares(choice.getColor())) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        StackObject sourceStackObject = game.getStack().getStackObject(source.getSourceId());
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (player != null && sourceStackObject != null && permanent != null) {
            ChoiceColor colorChoice = new ChoiceColor();
            if (player.choose(Outcome.BoostCreature, colorChoice, game)) {
                game.informPlayers(sourceStackObject.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice());
                game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor());
                permanent.addInfo("chosen color", new StringBuilder("<font color='blue'>Chosen color: ").append(colorChoice.getColor().getDescription()).append("</font>").toString());
            }
        }
        return false;
    }
View Full Code Here

        Player controller = game.getPlayer(source.getControllerId());
        Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
        if (controller == null || opponent == null) {
            return false;
        }
        ChoiceColor choice = new ChoiceColor();
        controller.choose(outcome, choice, game);
        if (choice.getColor() != null) {
            int cardsWithColor = 0;
            int cardsToExile = Math.min(opponent.getLibrary().size(), source.getManaCostsToPay().getX());
            for(int i = 0; i < cardsToExile; i++) {
                Card card = opponent.getLibrary().removeFromTop(game);
                if (card != null) {
                    if (card.getColor().contains(choice.getColor())) {
                        cardsWithColor++;
                    }
                    card.moveToExile(null, null, source.getSourceId(), game);
                }
            }
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

    public Mana computeMana(Game game, Ability source){
        this.computedMana.clear();
        if (!source.getChoices().isEmpty()) {
            Permanent sourcePermanent = game.getPermanent(source.getSourceId());
            ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
            if (choice != null && choice instanceof ChoiceColor && choice.getChoice() != null) {
                String color = choice.getChoice();
                int counters = sourcePermanent.getCounters().getCount(CounterType.CHARGE.getName());
                if (color.equals("Red")) {
                    computedMana.setRed(counters);
                } else if (color.equals("Blue")) {
                    computedMana.setBlue(counters);
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) {
            ChoiceColor colorChoice = new ChoiceColor();
            if (player.choose(Outcome.Neutral, colorChoice, game)) {
                game.informPlayers(new StringBuilder(permanent.getName()).append(": ").append(player.getName()).append(" has chosen ").append(colorChoice.getChoice()).toString());
                game.getState().setValue(source.getSourceId() + "_color", colorChoice.getColor());
                permanent.addInfo("chosen color", "<font color = 'blue'>Chosen color: " + colorChoice.getColor().getDescription() + "</font>");
            }
        }
        return false;
    }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Permanent targetCreature = game.getPermanent(source.getFirstTarget());
        if (targetCreature != null) {
            Player player = game.getPlayer(targetCreature.getControllerId());
            if (player != null) {
                ChoiceColor colorChoice = new ChoiceColor();
                if (player.choose(Outcome.Neutral, colorChoice, game)) {
                    game.informPlayers(targetCreature.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice());
                    game.getState().setValue(targetCreature.getId() + "_color", colorChoice.getColor());
                }
            }
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of mage.choices.ChoiceColor

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.