AI: shortcut for chooseCounterType if there is only one

This commit is contained in:
Hans Mackowiak
2022-03-12 12:43:30 +01:00
parent 38787b1539
commit 917493b2af

View File

@@ -918,6 +918,10 @@ public class PlayerControllerAi extends PlayerController {
@Override
public CounterType chooseCounterType(List<CounterType> options, SpellAbility sa, String prompt,
Map<String, Object> params) {
// short cut if there is no options to choose
if (options.size() <= 1) {
return Iterables.getFirst(options, null);
}
ApiType api = sa.getApi();
if (null == api) {
throw new InvalidParameterException("SA is not api-based, this is not supported yet");