mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Avoid prompting user to choose which replacement effect to apply first if all options are the same
This commit is contained in:
@@ -97,7 +97,6 @@ public class ReplacementHandler {
|
|||||||
* @return true if the event was replaced.
|
* @return true if the event was replaced.
|
||||||
*/
|
*/
|
||||||
public ReplacementResult run(final HashMap<String, Object> runParams, final ReplacementLayer layer, final Player decider, final Game game) {
|
public ReplacementResult run(final HashMap<String, Object> runParams, final ReplacementLayer layer, final Player decider, final Game game) {
|
||||||
|
|
||||||
final List<ReplacementEffect> possibleReplacers = new ArrayList<ReplacementEffect>();
|
final List<ReplacementEffect> possibleReplacers = new ArrayList<ReplacementEffect>();
|
||||||
// Round up Non-static replacement effects ("Until EOT," or
|
// Round up Non-static replacement effects ("Until EOT," or
|
||||||
// "The next time you would..." etc)
|
// "The next time you would..." etc)
|
||||||
|
|||||||
@@ -1118,10 +1118,17 @@ public class PlayerControllerHuman
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers, HashMap<String, Object> runParams) {
|
public ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers, HashMap<String, Object> runParams) {
|
||||||
|
ReplacementEffect first = possibleReplacers.get(0);
|
||||||
if (possibleReplacers.size() == 1) {
|
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
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user