use of mage.choices.ChoiceColor in project mage by magefree.
the class NarsetOfTheAncientWayDrawEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.gainLife(2, game, source);
ChoiceColor choice = new ChoiceColor();
choice.getChoices().remove("Green");
choice.getChoices().remove("Black");
player.choose(Outcome.PutManaInPool, choice, game);
ConditionalMana mana = new ConditionalMana(choice.getMana(1));
mana.addCondition(new NarsetOfTheAncientWayManaCondition());
player.getManaPool().addMana(mana, game, source);
return true;
}
use of mage.choices.ChoiceColor in project mage by magefree.
the class RealityTwistEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
TappedForManaEvent manaEvent = (TappedForManaEvent) event;
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = manaEvent.getPermanent();
if (controller == null || permanent == null) {
return false;
}
Choice choice = new ChoiceColor(true);
choice.getChoices().clear();
choice.setMessage("Pick a color to produce");
if (permanent.hasSubtype(SubType.PLAINS, game)) {
choice.getChoices().add("Red");
}
if (permanent.hasSubtype(SubType.SWAMP, game)) {
choice.getChoices().add("Green");
}
if (permanent.hasSubtype(SubType.MOUNTAIN, game)) {
choice.getChoices().add("White");
}
if (permanent.hasSubtype(SubType.FOREST, game)) {
choice.getChoices().add("Black");
}
String chosenColor;
if (choice.getChoices().size() == 1) {
chosenColor = choice.getChoices().iterator().next();
} else {
controller.choose(Outcome.PutManaInPool, choice, game);
chosenColor = choice.getChoice();
}
if (chosenColor == null) {
return false;
}
Mana mana = manaEvent.getMana();
int amount = mana.count();
switch(chosenColor) {
case "White":
mana.setToMana(Mana.WhiteMana(amount));
break;
case "Black":
mana.setToMana(Mana.BlackMana(amount));
break;
case "Red":
mana.setToMana(Mana.RedMana(amount));
break;
case "Green":
mana.setToMana(Mana.GreenMana(amount));
break;
}
return false;
}
use of mage.choices.ChoiceColor in project mage by magefree.
the class ScryingGlassEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetOpponent = game.getPlayer(source.getFirstTarget());
ChoiceColor color = new ChoiceColor();
int amount = 0;
if (controller != null && targetOpponent != null) {
amount = controller.getAmount(1, Integer.MAX_VALUE, "Choose a number", game);
controller.choose(Outcome.Discard, color, game);
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(color.getColor()));
targetOpponent.revealCards(source, targetOpponent.getHand(), game);
if (targetOpponent.getHand().count(filter, game) == amount) {
game.informPlayers(controller.getLogName() + " has chosen the exact number and color of the revealed cards from " + targetOpponent.getName() + "'s hand. They draw a card.");
controller.drawCards(1, source, game);
return true;
} else {
game.informPlayers(controller.getLogName() + " has chosen incorrectly and will not draw a card.");
}
}
return false;
}
use of mage.choices.ChoiceColor in project mage by magefree.
the class BecomesColorAllEffect 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 BecomesColorSourceEffect 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());
}
}
super.init(source, game);
}
Aggregations