Fixed RPG
This commit is contained in:
+19
-1
@@ -27,7 +27,7 @@ Return ONLY valid JSON (no markdown):
|
||||
"cast": [{"name":"NPC name","role":"helper|antagonist|bystander","motivation":"..."}],
|
||||
"secrets": ["hidden truths not revealed yet"],
|
||||
"beats": [
|
||||
{"id":"b1","trigger":"event_driven:rest|event_driven:travel|event_driven:help_request|event_driven:after_fail|event_driven:after_success",
|
||||
{"id":"b1","title":"short quest title (3-6 words)","trigger":"event_driven:rest|event_driven:travel|event_driven:help_request|event_driven:after_fail|event_driven:after_success",
|
||||
"injection":"1-3 sentences to introduce the beat WITHOUT breaking current scene",
|
||||
"choices":[{"id":"a","label":"..."},{"id":"b","label":"..."}]}
|
||||
],
|
||||
@@ -90,6 +90,24 @@ def should_advance_arc(user_text: str) -> str | None:
|
||||
return None
|
||||
|
||||
|
||||
PHASE_ORDER = ["opening", "hook", "complication", "reveal", "climax", "aftermath"]
|
||||
|
||||
|
||||
def advance_phase(arc: dict) -> bool:
|
||||
"""Advance arc to next phase if beats are exhausted. Returns True if phase changed."""
|
||||
current = arc.get("phase", "opening")
|
||||
if arc.get("beats"):
|
||||
return False
|
||||
try:
|
||||
idx = PHASE_ORDER.index(current)
|
||||
except ValueError:
|
||||
return False
|
||||
if idx + 1 >= len(PHASE_ORDER):
|
||||
return False
|
||||
arc["phase"] = PHASE_ORDER[idx + 1]
|
||||
return True
|
||||
|
||||
|
||||
def pop_matching_beats(arc: dict, trigger: str, max_beats: int = 1) -> tuple[dict, list[dict]]:
|
||||
beats = arc.get("beats", [])
|
||||
if not isinstance(beats, list):
|
||||
|
||||
Reference in New Issue
Block a user