use of mage.choices.ChoiceColor in project mage by magefree.
the class AstralCornucopiaManaEffect method produceMana.
@Override
public Mana produceMana(Game game, Ability source) {
Mana mana = new Mana();
if (game == null) {
return mana;
}
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null) {
int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName());
if (counters > 0) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
ChoiceColor choice = new ChoiceColor();
choice.setMessage("Choose a color to add mana of that color");
if (controller.choose(outcome, choice, game)) {
if (choice.getChoice() != null) {
String color = choice.getChoice();
switch(color) {
case "Red":
mana.setRed(counters);
break;
case "Blue":
mana.setBlue(counters);
break;
case "White":
mana.setWhite(counters);
break;
case "Black":
mana.setBlack(counters);
break;
case "Green":
mana.setGreen(counters);
break;
}
}
}
}
}
}
return mana;
}
use of mage.choices.ChoiceColor in project mage by magefree.
the class CoalitionRelicEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
if (sourcePermanent != null && player != null) {
int chargeCounters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE);
sourcePermanent.removeCounters(CounterType.CHARGE.createInstance(chargeCounters), source, game);
Mana mana = new Mana();
ChoiceColor choice = new ChoiceColor();
for (int i = 0; i < chargeCounters; i++) {
if (!player.choose(outcome, choice, game)) {
return false;
}
choice.increaseMana(mana);
choice.clearChoice();
}
player.getManaPool().addMana(mana, game, source);
return true;
}
return false;
}
use of mage.choices.ChoiceColor in project mage by magefree.
the class CarpetOfFlowersEffect method produceMana.
@Override
public Mana produceMana(Game game, Ability source) {
Mana mana = new Mana();
if (game == null) {
return mana;
}
Player controller = game.getPlayer(source.getControllerId());
ChoiceColor choice = new ChoiceColor();
if (controller != null && controller.choose(Outcome.Benefit, choice, game)) {
int count = game.getBattlefield().count(filter, source.getSourceId(), source.getTargets().getFirstTarget(), game);
if (count > 0) {
switch(choice.getChoice()) {
case "Black":
mana.setBlack(count);
break;
case "Blue":
mana.setBlue(count);
break;
case "Red":
mana.setRed(count);
break;
case "Green":
mana.setGreen(count);
break;
case "White":
mana.setWhite(count);
break;
default:
break;
}
}
}
return mana;
}
use of mage.choices.ChoiceColor in project mage by magefree.
the class DarigaazTheIgniterEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
ChoiceColor choice = new ChoiceColor(true);
if (controller != null && controller.choose(outcome, choice, game)) {
game.informPlayers(controller.getLogName() + " chooses " + choice.getColor());
Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (damagedPlayer != null) {
damagedPlayer.revealCards("hand of " + damagedPlayer.getName(), damagedPlayer.getHand(), game);
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(choice.getColor()));
int damage = damagedPlayer.getHand().count(filter, source.getSourceId(), source.getControllerId(), game);
if (damage > 0) {
damagedPlayer.damage(damage, source.getSourceId(), source, game);
}
}
return true;
}
return false;
}
Aggregations