We have the technology for this. Consider Papaya War in The Palindome.
In ChoiceAdventures.java:
Code:
// No sir, away! A papaya war is on!
new ChoiceSpoiler(
127,
"Plains",
"Palindome",
// Option...
new Option("3 papayas", "papaya"),
new Option("trade 3 papayas for stats"),
new Option("stats"));
// No sir, away! A papaya war is on!
new ChoiceCost(127, new Cost(2, ItemPool.get(ItemPool.PAPAYA, -3)));
Notice that is a ChoiceSpoiler, rather than a ChoiceAdventure. That means that we will display spoilers in the Relay Browser, but do not automatically generate this choice in the GUI. Which does not mean that we don't provide GUI configuration.
In ChoiceOptionsPanel.java:
Code:
private final JComboBox<String> palindomePapayaSelect;
...
this.palindomePapayaSelect = new JComboBox<>();
this.palindomePapayaSelect.addItem("3 papayas");
this.palindomePapayaSelect.addItem("Trade papayas for stats");
this.palindomePapayaSelect.addItem("Fewer stats");
this.palindomePapayaSelect.addItem("Stats until out of papayas then papayas");
this.palindomePapayaSelect.addItem("Stats until out of papayas then fewer stats");
...
this.addChoiceSelect("Plains", "Papaya War", this.palindomePapayaSelect);
...
Preferences.setString(
"choiceAdventure127", String.valueOf(this.palindomePapayaSelect.getSelectedIndex() + 1));
...
this.palindomePapayaSelect.setSelectedIndex(
Math.max(0, Preferences.getInteger("choiceAdventure127") - 1));
Notice that there are three options provided by KoL and two more that require run-time condition checking.
In defaults.txt:
Code:
user choiceAdventure127 3
In ChoiceManager.specialChoiceDecision2()
Code:
// No sir, away! A papaya war is on!
case 127:
switch (StringUtilities.parseInt(decision)) {
case 1:
case 2:
case 3:
return decision;
case 4:
return ChoiceManager.PAPAYA.getCount(KoLConstants.inventory) >= 3 ? "2" : "1";
case 5:
return ChoiceManager.PAPAYA.getCount(KoLConstants.inventory) >= 3 ? "2" : "3";
}
return decision;
And that's it.
I've been meaning to write a document to put in the "devdoc" directory in the repository on just how to add a new choice adventure.
- ChoiceAdventure vs. ChoiceSpoiler
- ChoiceAdventure.dynamicChoiceSpoilers, dynamicChoiceOptions
- ChoiceManager.specialChoiceHandling , specialChoiceDecision1, pickGoalChoice, specialChoiceDecision2
- ChoiceControl.preChoice, visitChoice, postChoice0, postChoice1, postChoice2, registerRequest
Not every choice needs every one of those, by a long shot.
Some things you should probably just put in your own script, but choices that might be of general interest to supply pseudo-choices for - like June Cleaver choices, as you point out - can be customized using existing code.