if (permanent.getCounters().size() == 1) {
for (Counter counter : permanent.getCounters().values()) {
permanent.addCounters(counter.getName(), 1, game);
}
} else {
Choice choice = new ChoiceImpl(true);
Set<String> choices = new HashSet<>();
for (Counter counter : permanent.getCounters().values()) {
choices.add(counter.getName());
}
choice.setChoices(choices);
choice.setMessage("Choose a counter to proliferate (" + permanent.getName() + ")");
controller.choose(Outcome.Benefit, choice, game);
for (Counter counter : permanent.getCounters().values()) {
if (counter.getName().equals(choice.getChoice())) {
permanent.addCounters(counter.getName(), 1, game);
break;
}
}
}
}
} else {
Player player = game.getPlayer(chosen);
if (player != null) {
if (player.getCounters().size() > 0) {
if (player.getCounters().size() == 1) {
for (Counter counter : player.getCounters().values()) {
Counter newCounter = new Counter(counter.getName());
player.addCounters(newCounter, game);
}
} else {
Choice choice = new ChoiceImpl(true);
Set<String> choices = new HashSet<>();
for (Counter counter : player.getCounters().values()) {
choices.add(counter.getName());
}
choice.setChoices(choices);
choice.setMessage("Choose a counter to proliferate (" + player.getName() + ")");
controller.choose(Outcome.Benefit, choice, game);
for (Counter counter : player.getCounters().values()) {
if (counter.getName().equals(choice.getChoice())) {
Counter newCounter = new Counter(counter.getName());
player.addCounters(newCounter, game);
break;
}
}