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();
}
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;
}
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();
}
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);
}
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;
}
Aggregations