Search in sources :

Example 46 with ChoiceColor

use of mage.choices.ChoiceColor in project mage by magefree.

the class VedalkenEngineerEffect method produceMana.

@Override
public Mana produceMana(Game game, Ability source) {
    if (game != null) {
        Player controller = game.getPlayer(source.getControllerId());
        ChoiceColor choiceColor = new ChoiceColor(true);
        if (controller != null && controller.choose(Outcome.Benefit, choiceColor, game)) {
            return manaBuilder.setMana(choiceColor.getMana(amount), source, game).build();
        }
    }
    return new Mana();
}
Also used : Player(mage.players.Player) ConditionalMana(mage.ConditionalMana) Mana(mage.Mana) ChoiceColor(mage.choices.ChoiceColor)

Example 47 with ChoiceColor

use of mage.choices.ChoiceColor in project mage by magefree.

the class ChooseColorEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject mageObject = game.getPermanentEntering(source.getSourceId());
    if (mageObject == null) {
        mageObject = game.getObject(source.getSourceId());
    }
    ChoiceColor choice = new ChoiceColor();
    if (exceptColor != null) {
        choice.removeColorFromChoices(exceptColor);
    }
    if (controller == null || mageObject == null || !controller.choose(outcome, choice, game)) {
        return false;
    }
    game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
    game.getState().setValue(mageObject.getId() + "_color", choice.getColor());
    if (mageObject instanceof Permanent) {
        ((Permanent) mageObject).addInfo("chosen color", CardUtil.addToolTipMarkTags("Chosen color: " + choice.getChoice()), game);
    }
    return true;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) MageObject(mage.MageObject) ChoiceColor(mage.choices.ChoiceColor)

Example 48 with ChoiceColor

use of mage.choices.ChoiceColor in project mage by magefree.

the class GainProtectionFromColorSourceEffect method init.

@Override
public void init(Ability source, Game game) {
    super.init(source, game);
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        ChoiceColor colorChoice = new ChoiceColor(true);
        colorChoice.setMessage("Choose color for protection ability");
        if (controller.choose(outcome, colorChoice, game)) {
            game.informPlayers("Choosen color: " + colorChoice.getColor());
            protectionFilter.add(new ColorPredicate(colorChoice.getColor()));
            protectionFilter.setMessage(colorChoice.getChoice());
            ((ProtectionAbility) ability).setFilter(protectionFilter);
            return;
        }
    }
    discard();
}
Also used : ColorPredicate(mage.filter.predicate.mageobject.ColorPredicate) Player(mage.players.Player) ProtectionAbility(mage.abilities.keyword.ProtectionAbility) ChoiceColor(mage.choices.ChoiceColor)

Example 49 with ChoiceColor

use of mage.choices.ChoiceColor in project mage by magefree.

the class BecomesColorTargetEffect method init.

@Override
public void init(Ability source, Game game) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return;
    }
    if (setColor == null) {
        ChoiceColor choice = new ChoiceColor();
        if (!controller.choose(Outcome.PutManaInPool, choice, game)) {
            discard();
            return;
        }
        setColor = choice.getColor();
        if (!game.isSimulation()) {
            game.informPlayers(controller.getLogName() + " has chosen the color: " + setColor.toString());
        }
    }
    // To change body of generated methods, choose Tools | Templates.
    super.init(source, game);
}
Also used : Player(mage.players.Player) ChoiceColor(mage.choices.ChoiceColor)

Example 50 with ChoiceColor

use of mage.choices.ChoiceColor in project mage by magefree.

the class AddleEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    ChoiceColor choice = new ChoiceColor();
    if (controller != null && controller.choose(outcome, choice, game)) {
        ObjectColor color = choice.getColor();
        game.informPlayers(controller.getLogName() + " chooses " + color + '.');
        FilterCard filter = new FilterCard();
        filter.add(new ColorPredicate(color));
        Effect effect = new DiscardCardYouChooseTargetEffect(filter);
        return effect.apply(game, source);
    }
    return false;
}
Also used : FilterCard(mage.filter.FilterCard) ColorPredicate(mage.filter.predicate.mageobject.ColorPredicate) TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) ObjectColor(mage.ObjectColor) DiscardCardYouChooseTargetEffect(mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) DiscardCardYouChooseTargetEffect(mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect) ChoiceColor(mage.choices.ChoiceColor)

Aggregations

ChoiceColor (mage.choices.ChoiceColor)54 Player (mage.players.Player)52 Mana (mage.Mana)22 Permanent (mage.game.permanent.Permanent)17 ColorPredicate (mage.filter.predicate.mageobject.ColorPredicate)14 Choice (mage.choices.Choice)10 ObjectColor (mage.ObjectColor)8 FilterCard (mage.filter.FilterCard)7 MageObject (mage.MageObject)5 FilterPermanent (mage.filter.FilterPermanent)5 FixedTarget (mage.target.targetpointer.FixedTarget)5 ConditionalMana (mage.ConditionalMana)4 ContinuousEffect (mage.abilities.effects.ContinuousEffect)4 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)4 Ability (mage.abilities.Ability)3 ProtectionAbility (mage.abilities.keyword.ProtectionAbility)3 Card (mage.cards.Card)3 TargetPlayer (mage.target.TargetPlayer)3 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)3 ArrayList (java.util.ArrayList)2