mirror of
https://github.com/correl/mage.git
synced 2024-11-14 11:09:31 +00:00
Fix Nesting Grounds unnecessarily prompting user to select a counter when only one option present
This commit is contained in:
parent
4345fe8f3c
commit
4575bd6fda
1 changed files with 10 additions and 4 deletions
|
@ -90,17 +90,23 @@ class NestingGroundsEffect extends OneShotEffect {
|
|||
Permanent toPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (fromPermanent == null
|
||||
|| toPermanent == null
|
||||
|| controller == null) {
|
||||
|| controller == null
|
||||
|| fromPermanent.getCounters(game).size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Set<String> possibleChoices = new LinkedHashSet<>(fromPermanent.getCounters(game).keySet());
|
||||
if (possibleChoices.size() == 0) {
|
||||
return false;
|
||||
if (fromPermanent.getCounters(game).size() == 1) {
|
||||
for (Counter counter : fromPermanent.getCounters(game).values()) {
|
||||
fromPermanent.removeCounters(counter.getName(), 1, source, game);
|
||||
toPermanent.addCounters(new Counter(counter.getName()), source.getControllerId(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Choice choice = new ChoiceImpl();
|
||||
Set<String> possibleChoices = new LinkedHashSet<>(fromPermanent.getCounters(game).keySet());
|
||||
choice.setChoices(possibleChoices);
|
||||
choice.setMessage("Choose a counter");
|
||||
if (controller.choose(outcome, choice, game)) {
|
||||
String chosen = choice.getChoice();
|
||||
if (fromPermanent.getCounters(game).containsKey(chosen)) {
|
||||
|
|
Loading…
Reference in a new issue