Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card commander = game.getCard(controller.getCommanderId());
if (commander != null) {
Mana commanderMana = commander.getManaCost().getMana();
Choice choice = new ChoiceImpl(true);
choice.setMessage("Pick a mana color");
if (commanderMana.getBlack() > 0) {
choice.getChoices().add("Black");
}
if (commanderMana.getRed() > 0) {
choice.getChoices().add("Red");
}
if (commanderMana.getBlue() > 0) {
choice.getChoices().add("Blue");
}
if (commanderMana.getGreen() > 0) {
choice.getChoices().add("Green");
}
if (commanderMana.getWhite() > 0) {
choice.getChoices().add("White");
}
if (choice.getChoices().size() > 0) {
Mana mana = new Mana();
if (choice.getChoices().size() == 1) {
choice.setChoice(choice.getChoices().iterator().next());
} else {
controller.choose(outcome, choice, game);
}
if (choice.getChoice().equals("Black")) {
mana.addBlack();
} else if (choice.getChoice().equals("Blue")) {
mana.addBlue();
} else if (choice.getChoice().equals("Red")) {
mana.addRed();
} else if (choice.getChoice().equals("Green")) {
mana.addGreen();
} else if (choice.getChoice().equals("White")) {
mana.addWhite();
}
// set to indicate, that the mana can boost the commander
mana.setFlag(true);
controller.getManaPool().addMana(mana, game, source);