Avoid prompting user to choose which replacement effect to apply first if all options are the same

This commit is contained in:
drdev
2015-04-06 20:11:53 +00:00
parent 70456827be
commit 14ca6da9cf
2 changed files with 9 additions and 3 deletions

View File

@@ -97,7 +97,6 @@ public class ReplacementHandler {
* @return true if the event was replaced.
*/
public ReplacementResult run(final HashMap<String, Object> runParams, final ReplacementLayer layer, final Player decider, final Game game) {
final List<ReplacementEffect> possibleReplacers = new ArrayList<ReplacementEffect>();
// Round up Non-static replacement effects ("Until EOT," or
// "The next time you would..." etc)

View File

@@ -1118,10 +1118,17 @@ public class PlayerControllerHuman
@Override
public ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers, HashMap<String, Object> runParams) {
ReplacementEffect first = possibleReplacers.get(0);
if (possibleReplacers.size() == 1) {
return possibleReplacers.get(0);
return first;
}
return getGui().one(prompt, possibleReplacers);
String firstStr = first.toString();
for (int i = 1; i < possibleReplacers.size(); i++) {
if (!possibleReplacers.get(i).toString().equals(firstStr)) {
return getGui().one(prompt, possibleReplacers); //prompt user if there are multiple different options
}
}
return first; //return first option without prompting if all options are the same
}
@Override