Merge pull request #5671 from ketsuban/proliferate

Proliferate now doesn't choose a type of counter
This commit is contained in:
Evan Kranzler 2019-04-02 08:14:33 -04:00 committed by GitHub
commit 25627183a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,7 +26,7 @@ public class ProliferateEffect extends OneShotEffect {
public ProliferateEffect() {
super(Outcome.Benefit);
staticText = "Proliferate. <i>(You choose any number of permanents and/or players with counters on them, then give each another counter of a kind already there.)</i>";
staticText = "Proliferate. <i>(You choose any number of permanents and/or players with counters on them, then give each another counter of each kind already there.)</i>";
}
public ProliferateEffect(ProliferateEffect effect) {
@ -48,60 +48,18 @@ public class ProliferateEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(chosen);
if (permanent != null) {
if (!permanent.getCounters(game).isEmpty()) {
if (permanent.getCounters(game).size() == 1) {
for (Counter counter : permanent.getCounters(game).values()) {
Counter newCounter = new Counter(counter.getName());
permanent.addCounters(newCounter, source, game);
}
} else {
Choice choice = new ChoiceImpl(true);
Set<String> choices = new HashSet<>();
for (Counter counter : permanent.getCounters(game).values()) {
choices.add(counter.getName());
}
choice.setChoices(choices);
choice.setMessage("Choose a counter to proliferate (" + permanent.getIdName() + ')');
if (controller.choose(Outcome.Benefit, choice, game)) {
for (Counter counter : permanent.getCounters(game).values()) {
if (counter.getName().equals(choice.getChoice())) {
Counter newCounter = new Counter(counter.getName());
permanent.addCounters(newCounter, source, game);
break;
}
}
} else {
return false;
}
for (Counter counter : permanent.getCounters(game).values()) {
Counter newCounter = new Counter(counter.getName());
permanent.addCounters(newCounter, source, game);
}
}
} else {
Player player = game.getPlayer(chosen);
if (player != null) {
if (!player.getCounters().isEmpty()) {
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.getLogName() + ')');
if (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;
}
}
} else {
return false;
}
for (Counter counter : player.getCounters().values()) {
Counter newCounter = new Counter(counter.getName());
player.addCounters(newCounter, game);
}
}
}