Update PlayerControllerHuman.java

show more info on choice list on non network game
This commit is contained in:
kevlahnota
2024-09-16 19:38:30 +08:00
committed by GitHub
parent 7b9e2a6735
commit 79b1c3c9fd

View File

@@ -1859,12 +1859,14 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
} }
final List<String> res = Lists.newArrayListWithCapacity(possibleReplacers.size()); final List<String> res = Lists.newArrayListWithCapacity(possibleReplacers.size());
for (ReplacementEffect r : possibleReplacers) for (ReplacementEffect r : possibleReplacers)
res.add(r.toString()); res.add(r.getDescription());
String prompt = localizer.getMessage("lblChooseFirstApplyReplacementEffect"); String prompt = localizer.getMessage("lblChooseFirstApplyReplacementEffect");
final String firstStr = first.toString(); final String firstStr = res.get(0);
for (int i = 1; i < possibleReplacers.size(); i++) { for (int i = 1; i < res.size(); i++) {
// prompt user if there are multiple different options // prompt user if there are multiple different options
if (!possibleReplacers.get(i).toString().equals(firstStr)) { if (!res.get(i).equals(firstStr)) {
if (!GuiBase.isNetworkplay()) //non network game show more info since they don't need serialization
return getGui().one(prompt, possibleReplacers);
int index = res.indexOf(getGui().one(prompt, res)); int index = res.indexOf(getGui().one(prompt, res));
if (index > -1) if (index > -1)
return possibleReplacers.get(index); return possibleReplacers.get(index);
@@ -1883,10 +1885,12 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
final List<String> sts = Lists.newArrayListWithCapacity(possibleStatics.size()); final List<String> sts = Lists.newArrayListWithCapacity(possibleStatics.size());
for (StaticAbility s : possibleStatics) for (StaticAbility s : possibleStatics)
sts.add(s.toString()); sts.add(s.toString());
final String firstStr = first.toString(); final String firstStr = sts.get(0);
for (int i = 1; i < possibleStatics.size(); i++) { for (int i = 1; i < sts.size(); i++) {
// prompt user if there are multiple different options // prompt user if there are multiple different options
if (!possibleStatics.get(i).toString().equals(firstStr)) { if (!sts.get(i).equals(firstStr)) {
if (!GuiBase.isNetworkplay()) //non network game show more info since they don't need serialization
return getGui().one(prompt, possibleStatics);
int index = sts.indexOf(getGui().one(prompt, sts)); int index = sts.indexOf(getGui().one(prompt, sts));
if (index > -1) if (index > -1)
return possibleStatics.get(index); return possibleStatics.get(index);