npctalk: add true/false responses and CONDITION trials to JSON #27707
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Infrastructure "npctalk: add true/false responses and CONDITION trials to JSON"
Purpose of change
Fixes #27637 - response snippets will now be logged in their final form
Fixes #27397 - CONDITION trials was the last remaining requested feature
Add two new options for PC responses to NPC dialogues in JSON:
Of course, both these options can be combined.
Also, clear a bug where snippets in a response line were logged in their original form instead of their expanded form.
Describe the solution
Add new fields to
talk_response
,truetext
,falsetext
, andtruefalse_condition
. Add code to the JSON parser to populate these fields if atruefalsetext
object is present. When creating an option line, set the text field to thetruetext
if thetruefalse_condition
is true and thefalsetext
otherwise.Log the final version of the response text after parsing, not the original form.
Add a new type of trial, CONDITION. A CONDITION trial takes a
condition
field instead of adifficulty
field, and sets the chance of the trial passing at 100 if thecondition
is true and at 0 otherwise.Update the test cases to use a helper function that calls
create_option_line()
so that thetruefalse_condition
will be evaluated.Additional context
Includes #27706