{
  "version": "1.1",
  "name": "Branching Finale Atmosphere Based on Player Choices",
  "startRoom": "lesson_room",
  "author": "TAGMaker",
  "description": "The finale remembers whether you recruited a companion, spared a defeated rival and recovered a keepsake. Three separate passages reflect those choices before the named ending.",
  "playerAppearance": {
    "version": 1,
    "layout": "modern",
    "font": "sans",
    "colorScheme": "light",
    "textSize": 18,
    "lineHeight": 1.6,
    "readingWidth": 80,
    "quietReading": false,
    "mapMode": "discovered",
    "panels": {
      "inventory": true,
      "map": true,
      "objectives": true,
      "status": true,
      "words": true
    },
    "picture": {
      "visible": true,
      "fit": "contain",
      "focalX": 50,
      "focalY": 50
    },
    "commands": {
      "visible": true,
      "standard": [
        "look",
        "search",
        "inventory",
        "help"
      ],
      "custom": []
    },
    "words": []
  },
  "created": "2026-11-01T00:00:00.000Z",
  "modified": "2026-11-01T00:00:00.000Z",
  "files": [
    {
      "path": "rooms/lesson_room.taml",
      "content": "room lesson_room\n  exit north: lesson_finale\n  name: \"Last Camp\"\n  description: \"Talk to the companion, talk to the rival, and take the pocket watch if you wish. Going north reaches the finale and ends the game.\"\n  dark: false\nend"
    },
    {
      "path": "rooms/lesson_finale.taml",
      "content": "room lesson_finale\n  name: \"Homecoming Bridge\"\n  description: \"The road home lies beyond this bridge.\"\n  smart_narrative: \"{\\\"version\\\":1,\\\"parts\\\":[{\\\"type\\\":\\\"conditional\\\",\\\"id\\\":\\\"lesson_ally_prose\\\",\\\"when\\\":{\\\"kind\\\":\\\"flag_equals\\\",\\\"flag\\\":\\\"lesson_ally_chosen\\\",\\\"value\\\":true},\\\"then\\\":\\\"Your companion walks beside you.\\\",\\\"otherwise\\\":\\\"You walk the bridge alone.\\\"},{\\\"type\\\":\\\"conditional\\\",\\\"id\\\":\\\"lesson_spared_prose\\\",\\\"when\\\":{\\\"kind\\\":\\\"flag_equals\\\",\\\"flag\\\":\\\"lesson_spared_chosen\\\",\\\"value\\\":true},\\\"then\\\":\\\"You remember the mercy you offered your rival.\\\",\\\"otherwise\\\":\\\"The old conflict remains unresolved.\\\"},{\\\"type\\\":\\\"conditional\\\",\\\"id\\\":\\\"lesson_watch_prose\\\",\\\"when\\\":{\\\"kind\\\":\\\"flag_equals\\\",\\\"flag\\\":\\\"lesson_watch_chosen\\\",\\\"value\\\":true},\\\"then\\\":\\\"The recovered watch brings back a memory of home.\\\",\\\"otherwise\\\":\\\"The lost keepsake remains only a memory.\\\"}]}\"\n  dark: false\nend"
    },
    {
      "path": "npcs/lesson_ally.taml",
      "content": "npc lesson_ally\n  name: \"companion\"\n  description: \"A companion is ready to follow if asked.\"\n  location: lesson_room\n  mobile: true\n  follow: false\n  health: 100\n  combat_side: neutral\n  auto_fight: false\n  attack_power: 10\n  defense: 0\n  trust: 50\n  dialogue default:\n    print \"lesson ally looks at you in silence.\"\n  end\nend"
    },
    {
      "path": "npcs/lesson_rival.taml",
      "content": "npc lesson_rival\n  name: \"defeated rival\"\n  description: \"The defeated rival asks for mercy.\"\n  location: lesson_room\n  mobile: false\n  follow: false\n  health: 100\n  combat_side: neutral\n  auto_fight: false\n  attack_power: 10\n  defense: 0\n  trust: 50\nend"
    },
    {
      "path": "objects/lesson_watch.taml",
      "content": "object lesson_watch\n  name: \"pocket watch\"\n  description: \"A keepsake from home.\"\n  location: lesson_room\n  takeable: true\n  use_give: true\n  weight: 0.1\nend"
    }
  ],
  "story": {
    "version": 1,
    "states": [
      {
        "id": "lesson_ally_chosen",
        "name": "ally chosen",
        "description": "Progress remembered by this recipe.",
        "type": "boolean",
        "initial": false
      },
      {
        "id": "lesson_spared_chosen",
        "name": "spared chosen",
        "description": "Progress remembered by this recipe.",
        "type": "boolean",
        "initial": false
      },
      {
        "id": "lesson_watch_chosen",
        "name": "watch chosen",
        "description": "Progress remembered by this recipe.",
        "type": "boolean",
        "initial": false
      },
      {
        "id": "lesson_decided",
        "name": "decided",
        "description": "Progress remembered by this recipe.",
        "type": "boolean",
        "initial": false
      },
      {
        "id": "lesson_finished",
        "name": "finished",
        "description": "Progress remembered by this recipe.",
        "type": "boolean",
        "initial": false
      }
    ],
    "rules": [
      {
        "id": "lesson_recruit",
        "name": "recruit",
        "enabled": true,
        "trigger": {
          "kind": "npc",
          "target": "lesson_ally",
          "event": "talk"
        },
        "match": "all",
        "conditions": [],
        "actions": [
          {
            "kind": "npc_control",
            "target": "lesson_ally",
            "operation": "recruit"
          },
          {
            "kind": "state",
            "target": "lesson_ally_chosen",
            "value": true
          },
          {
            "kind": "message",
            "value": "The companion joins you."
          }
        ],
        "otherwise": "",
        "once": true,
        "repeatText": "The companion is ready."
      },
      {
        "id": "lesson_mercy",
        "name": "mercy",
        "enabled": true,
        "trigger": {
          "kind": "npc",
          "target": "lesson_rival",
          "event": "talk"
        },
        "match": "all",
        "conditions": [],
        "actions": [
          {
            "kind": "prompt",
            "target": "lesson_mercy"
          }
        ],
        "otherwise": "",
        "once": false
      },
      {
        "id": "lesson_watch",
        "name": "watch",
        "enabled": true,
        "trigger": {
          "kind": "object",
          "target": "lesson_watch",
          "event": "take"
        },
        "match": "all",
        "conditions": [],
        "actions": [
          {
            "kind": "state",
            "target": "lesson_watch_chosen",
            "value": true
          }
        ],
        "otherwise": "",
        "once": true
      },
      {
        "id": "lesson_finish",
        "name": "finish",
        "enabled": true,
        "trigger": {
          "kind": "room",
          "target": "lesson_finale",
          "event": "after_enter"
        },
        "match": "all",
        "conditions": [],
        "actions": [
          {
            "kind": "ending",
            "target": "lesson_homecoming"
          }
        ],
        "otherwise": "",
        "once": false
      }
    ],
    "features": {
      "version": 1,
      "npcProfiles": [
        {
          "version": 1,
          "id": "lesson_ally_profile",
          "name": "companion abilities",
          "npcId": "lesson_ally",
          "enabled": true,
          "memory": [],
          "traits": {
            "loyalty": 50,
            "fear": 0,
            "suspicion": 0
          },
          "life": {
            "maxHealth": 100,
            "initial": "active",
            "essential": false,
            "defeat": "dead",
            "retreatAtHealth": 0
          },
          "inventory": {
            "objects": [],
            "equipped": [],
            "equipment": [],
            "money": 0,
            "dropOnDeath": false
          },
          "combat": {
            "assist": "off",
            "target": "first_enemy",
            "interceptPercent": 50,
            "interval": 1
          },
          "perception": {
            "enabled": false,
            "sightRange": 0,
            "hearingRange": 0,
            "suspicionPerSight": 10,
            "suspicionPerNoise": 10,
            "threshold": 50,
            "investigate": false,
            "returnHome": false,
            "allowedRoomIds": []
          },
          "abilities": []
        }
      ],
      "prompts": [
        {
          "id": "lesson_mercy",
          "name": "Will you spare the defeated rival?",
          "enabled": true,
          "text": "Will you spare the defeated rival?",
          "cancelLabel": "Leave the choice for later",
          "cancelable": true,
          "owner": {
            "kind": "npc",
            "id": "lesson_rival"
          },
          "options": [
            {
              "id": "spare",
              "label": "Offer mercy",
              "match": "all",
              "conditions": [
                {
                  "kind": "state",
                  "target": "lesson_decided",
                  "operator": "==",
                  "value": false
                }
              ],
              "actions": [
                {
                  "kind": "state",
                  "target": "lesson_decided",
                  "value": true
                },
                {
                  "kind": "state",
                  "target": "lesson_spared_chosen",
                  "value": true
                },
                {
                  "kind": "message",
                  "value": "You offer mercy. The rival accepts it."
                }
              ],
              "once": false,
              "unavailable": "disable"
            },
            {
              "id": "leave",
              "label": "Leave the conflict unresolved",
              "match": "all",
              "conditions": [
                {
                  "kind": "state",
                  "target": "lesson_decided",
                  "operator": "==",
                  "value": false
                }
              ],
              "actions": [
                {
                  "kind": "state",
                  "target": "lesson_decided",
                  "value": true
                },
                {
                  "kind": "message",
                  "value": "You leave without offering mercy."
                }
              ],
              "once": false,
              "unavailable": "disable"
            }
          ]
        }
      ],
      "endings": [
        {
          "id": "lesson_homecoming",
          "name": "Homecoming",
          "enabled": true,
          "automatic": false,
          "priority": 0,
          "conditions": [],
          "match": "all",
          "text": "Beyond the bridge, a new chapter begins.",
          "actions": [
            {
              "kind": "state",
              "target": "lesson_finished",
              "value": true
            }
          ]
        }
      ]
    }
  },
  "cookbookRecipes": [
    {
      "version": 1,
      "settings": {
        "instance": "lesson",
        "recipeId": "branching-finale-atmosphere",
        "choices": {
          "room": {
            "existing": "",
            "name": "Last Camp",
            "description": "Talk to the companion, talk to the rival, and take the pocket watch if you wish. Going north reaches the finale and ends the game."
          },
          "finale": {
            "existing": "",
            "name": "Homecoming Bridge",
            "description": "The road home lies beyond this bridge."
          },
          "ally": {
            "existing": "",
            "name": "companion",
            "description": "A companion is ready to follow if asked."
          },
          "rival": {
            "existing": "",
            "name": "defeated rival",
            "description": "The defeated rival asks for mercy."
          },
          "watch": {
            "existing": "",
            "name": "pocket watch",
            "description": "A keepsake from home."
          }
        },
        "values": {
          "ally_yes": "Your companion walks beside you.",
          "ally_no": "You walk the bridge alone.",
          "spared_yes": "You remember the mercy you offered your rival.",
          "spared_no": "The old conflict remains unresolved.",
          "watch_yes": "The recovered watch brings back a memory of home.",
          "watch_no": "The lost keepsake remains only a memory.",
          "ending": "Beyond the bridge, a new chapter begins."
        },
        "reuseRoutes": {}
      },
      "owned": [
        {
          "path": "files",
          "key": "rooms/lesson_room.taml",
          "after": {
            "path": "rooms/lesson_room.taml",
            "name": "lesson_room.taml",
            "content": "room lesson_room\n  exit north: lesson_finale\n  name: \"Last Camp\"\n  description: \"Talk to the companion, talk to the rival, and take the pocket watch if you wish. Going north reaches the finale and ends the game.\"\n  dark: false\nend",
            "isDirty": true
          }
        },
        {
          "path": "files",
          "key": "rooms/lesson_finale.taml",
          "after": {
            "path": "rooms/lesson_finale.taml",
            "name": "lesson_finale.taml",
            "content": "room lesson_finale\n  name: \"Homecoming Bridge\"\n  description: \"The road home lies beyond this bridge.\"\n  smart_narrative: \"{\\\"version\\\":1,\\\"parts\\\":[{\\\"type\\\":\\\"conditional\\\",\\\"id\\\":\\\"lesson_ally_prose\\\",\\\"when\\\":{\\\"kind\\\":\\\"flag_equals\\\",\\\"flag\\\":\\\"lesson_ally_chosen\\\",\\\"value\\\":true},\\\"then\\\":\\\"Your companion walks beside you.\\\",\\\"otherwise\\\":\\\"You walk the bridge alone.\\\"},{\\\"type\\\":\\\"conditional\\\",\\\"id\\\":\\\"lesson_spared_prose\\\",\\\"when\\\":{\\\"kind\\\":\\\"flag_equals\\\",\\\"flag\\\":\\\"lesson_spared_chosen\\\",\\\"value\\\":true},\\\"then\\\":\\\"You remember the mercy you offered your rival.\\\",\\\"otherwise\\\":\\\"The old conflict remains unresolved.\\\"},{\\\"type\\\":\\\"conditional\\\",\\\"id\\\":\\\"lesson_watch_prose\\\",\\\"when\\\":{\\\"kind\\\":\\\"flag_equals\\\",\\\"flag\\\":\\\"lesson_watch_chosen\\\",\\\"value\\\":true},\\\"then\\\":\\\"The recovered watch brings back a memory of home.\\\",\\\"otherwise\\\":\\\"The lost keepsake remains only a memory.\\\"}]}\"\n  dark: false\nend",
            "isDirty": true
          }
        },
        {
          "path": "files",
          "key": "npcs/lesson_ally.taml",
          "after": {
            "path": "npcs/lesson_ally.taml",
            "name": "lesson_ally.taml",
            "content": "npc lesson_ally\n  name: \"companion\"\n  description: \"A companion is ready to follow if asked.\"\n  location: lesson_room\n  mobile: true\n  follow: false\n  health: 100\n  combat_side: neutral\n  auto_fight: false\n  attack_power: 10\n  defense: 0\n  trust: 50\n  dialogue default:\n    print \"lesson ally looks at you in silence.\"\n  end\nend",
            "isDirty": true
          }
        },
        {
          "path": "files",
          "key": "npcs/lesson_rival.taml",
          "after": {
            "path": "npcs/lesson_rival.taml",
            "name": "lesson_rival.taml",
            "content": "npc lesson_rival\n  name: \"defeated rival\"\n  description: \"The defeated rival asks for mercy.\"\n  location: lesson_room\n  mobile: false\n  follow: false\n  health: 100\n  combat_side: neutral\n  auto_fight: false\n  attack_power: 10\n  defense: 0\n  trust: 50\nend",
            "isDirty": true
          }
        },
        {
          "path": "files",
          "key": "objects/lesson_watch.taml",
          "after": {
            "path": "objects/lesson_watch.taml",
            "name": "lesson_watch.taml",
            "content": "object lesson_watch\n  name: \"pocket watch\"\n  description: \"A keepsake from home.\"\n  location: lesson_room\n  takeable: true\n  use_give: true\n  weight: 0.1\nend",
            "isDirty": true
          }
        },
        {
          "path": "objects",
          "key": "lesson_watch",
          "after": {
            "id": "lesson_watch",
            "name": "pocket watch",
            "description": "A keepsake from home.",
            "article": "",
            "location": "lesson_room",
            "aliases": [],
            "visible": true,
            "takeable": true,
            "droppable": true,
            "useGive": true,
            "container": false,
            "switchable": false,
            "edible": false,
            "drinkable": false,
            "wearable": false,
            "weapon": false,
            "weight": 0.1,
            "locked": false,
            "lockKey": "",
            "events": []
          }
        },
        {
          "path": "npcs",
          "key": "lesson_ally",
          "after": {
            "id": "lesson_ally",
            "name": "companion",
            "description": "A companion is ready to follow if asked.",
            "location": "lesson_room",
            "mobile": true,
            "aliases": [],
            "onEnter": "",
            "onExamine": "",
            "onTalk": "",
            "onAttack": "",
            "onDeath": "",
            "onFollow": "",
            "onAutoAttack": "",
            "onTrustChange": "",
            "onGive": "",
            "onBeforeTalk": "",
            "onAfterTalk": "",
            "onBeforeAttack": "",
            "onAfterAttack": "",
            "onDamage": "",
            "onHeal": "",
            "onMove": "",
            "onLeave": "",
            "followPlayer": false,
            "health": 100,
            "combatSide": "neutral",
            "autoFight": false,
            "attackPower": 10,
            "defense": 0,
            "trustLevel": 50,
            "conversationEnabled": false,
            "convGreeting": "",
            "convFarewell": "",
            "convTopics": [],
            "dialogues": [
              {
                "id": "default",
                "trigger": "default",
                "body": "print \"lesson ally looks at you in silence.\""
              }
            ]
          }
        },
        {
          "path": "npcs",
          "key": "lesson_rival",
          "after": {
            "id": "lesson_rival",
            "name": "defeated rival",
            "description": "The defeated rival asks for mercy.",
            "location": "lesson_room",
            "mobile": false,
            "aliases": [],
            "onEnter": "",
            "onExamine": "",
            "onTalk": "",
            "onAttack": "",
            "onDeath": "",
            "onFollow": "",
            "onAutoAttack": "",
            "onTrustChange": "",
            "onGive": "",
            "onBeforeTalk": "",
            "onAfterTalk": "",
            "onBeforeAttack": "",
            "onAfterAttack": "",
            "onDamage": "",
            "onHeal": "",
            "onMove": "",
            "onLeave": "",
            "followPlayer": false,
            "health": 100,
            "combatSide": "neutral",
            "autoFight": false,
            "attackPower": 10,
            "defense": 0,
            "trustLevel": 50,
            "conversationEnabled": false,
            "convGreeting": "",
            "convFarewell": "",
            "convTopics": [],
            "dialogues": []
          }
        },
        {
          "path": "mapRooms",
          "key": "lesson_room",
          "after": {
            "id": "lesson_room",
            "name": "Last Camp",
            "description": "Talk to the companion, talk to the rival, and take the pocket watch if you wish. Going north reaches the finale and ends the game.",
            "reentryEnabled": false,
            "reentryDesc": "",
            "hint": "",
            "dark": false,
            "roomType": "regular",
            "x": 100,
            "y": 100,
            "width": 160,
            "height": 64,
            "color": "#000000",
            "blockedDescriptions": {}
          }
        },
        {
          "path": "mapRooms",
          "key": "lesson_finale",
          "after": {
            "id": "lesson_finale",
            "name": "Homecoming Bridge",
            "description": "The road home lies beyond this bridge.",
            "reentryEnabled": false,
            "reentryDesc": "",
            "hint": "",
            "dark": false,
            "roomType": "regular",
            "x": 320,
            "y": 100,
            "width": 160,
            "height": 64,
            "color": "#000000",
            "smartProse": {
              "narrative": {
                "version": 1,
                "parts": [
                  {
                    "type": "conditional",
                    "id": "lesson_ally_prose",
                    "when": {
                      "kind": "flag_equals",
                      "flag": "lesson_ally_chosen",
                      "value": true
                    },
                    "then": "Your companion walks beside you.",
                    "otherwise": "You walk the bridge alone."
                  },
                  {
                    "type": "conditional",
                    "id": "lesson_spared_prose",
                    "when": {
                      "kind": "flag_equals",
                      "flag": "lesson_spared_chosen",
                      "value": true
                    },
                    "then": "You remember the mercy you offered your rival.",
                    "otherwise": "The old conflict remains unresolved."
                  },
                  {
                    "type": "conditional",
                    "id": "lesson_watch_prose",
                    "when": {
                      "kind": "flag_equals",
                      "flag": "lesson_watch_chosen",
                      "value": true
                    },
                    "then": "The recovered watch brings back a memory of home.",
                    "otherwise": "The lost keepsake remains only a memory."
                  }
                ]
              }
            }
          }
        },
        {
          "path": "mapExits",
          "key": "lesson_route_finale",
          "after": {
            "id": "lesson_route_finale",
            "fromRoom": "lesson_room",
            "toRoom": "lesson_finale",
            "direction": "north",
            "locked": false
          }
        },
        {
          "path": "manifest.story.states",
          "key": "lesson_ally_chosen",
          "after": {
            "id": "lesson_ally_chosen",
            "name": "ally chosen",
            "description": "Progress remembered by this recipe.",
            "type": "boolean",
            "initial": false
          }
        },
        {
          "path": "manifest.story.states",
          "key": "lesson_spared_chosen",
          "after": {
            "id": "lesson_spared_chosen",
            "name": "spared chosen",
            "description": "Progress remembered by this recipe.",
            "type": "boolean",
            "initial": false
          }
        },
        {
          "path": "manifest.story.states",
          "key": "lesson_watch_chosen",
          "after": {
            "id": "lesson_watch_chosen",
            "name": "watch chosen",
            "description": "Progress remembered by this recipe.",
            "type": "boolean",
            "initial": false
          }
        },
        {
          "path": "manifest.story.states",
          "key": "lesson_decided",
          "after": {
            "id": "lesson_decided",
            "name": "decided",
            "description": "Progress remembered by this recipe.",
            "type": "boolean",
            "initial": false
          }
        },
        {
          "path": "manifest.story.states",
          "key": "lesson_finished",
          "after": {
            "id": "lesson_finished",
            "name": "finished",
            "description": "Progress remembered by this recipe.",
            "type": "boolean",
            "initial": false
          }
        },
        {
          "path": "manifest.story.rules",
          "key": "lesson_recruit",
          "after": {
            "id": "lesson_recruit",
            "name": "recruit",
            "enabled": true,
            "trigger": {
              "kind": "npc",
              "target": "lesson_ally",
              "event": "talk"
            },
            "match": "all",
            "conditions": [],
            "actions": [
              {
                "kind": "npc_control",
                "target": "lesson_ally",
                "operation": "recruit"
              },
              {
                "kind": "state",
                "target": "lesson_ally_chosen",
                "value": true
              },
              {
                "kind": "message",
                "value": "The companion joins you."
              }
            ],
            "otherwise": "",
            "once": true,
            "repeatText": "The companion is ready."
          }
        },
        {
          "path": "manifest.story.rules",
          "key": "lesson_mercy",
          "after": {
            "id": "lesson_mercy",
            "name": "mercy",
            "enabled": true,
            "trigger": {
              "kind": "npc",
              "target": "lesson_rival",
              "event": "talk"
            },
            "match": "all",
            "conditions": [],
            "actions": [
              {
                "kind": "prompt",
                "target": "lesson_mercy"
              }
            ],
            "otherwise": "",
            "once": false
          }
        },
        {
          "path": "manifest.story.rules",
          "key": "lesson_watch",
          "after": {
            "id": "lesson_watch",
            "name": "watch",
            "enabled": true,
            "trigger": {
              "kind": "object",
              "target": "lesson_watch",
              "event": "take"
            },
            "match": "all",
            "conditions": [],
            "actions": [
              {
                "kind": "state",
                "target": "lesson_watch_chosen",
                "value": true
              }
            ],
            "otherwise": "",
            "once": true
          }
        },
        {
          "path": "manifest.story.rules",
          "key": "lesson_finish",
          "after": {
            "id": "lesson_finish",
            "name": "finish",
            "enabled": true,
            "trigger": {
              "kind": "room",
              "target": "lesson_finale",
              "event": "after_enter"
            },
            "match": "all",
            "conditions": [],
            "actions": [
              {
                "kind": "ending",
                "target": "lesson_homecoming"
              }
            ],
            "otherwise": "",
            "once": false
          }
        },
        {
          "path": "manifest.story.features.npcProfiles",
          "key": "lesson_ally_profile",
          "after": {
            "version": 1,
            "id": "lesson_ally_profile",
            "name": "companion abilities",
            "npcId": "lesson_ally",
            "enabled": true,
            "memory": [],
            "traits": {
              "loyalty": 50,
              "fear": 0,
              "suspicion": 0
            },
            "life": {
              "maxHealth": 100,
              "initial": "active",
              "essential": false,
              "defeat": "dead",
              "retreatAtHealth": 0
            },
            "inventory": {
              "objects": [],
              "equipped": [],
              "equipment": [],
              "money": 0,
              "dropOnDeath": false
            },
            "combat": {
              "assist": "off",
              "target": "first_enemy",
              "interceptPercent": 50,
              "interval": 1
            },
            "perception": {
              "enabled": false,
              "sightRange": 0,
              "hearingRange": 0,
              "suspicionPerSight": 10,
              "suspicionPerNoise": 10,
              "threshold": 50,
              "investigate": false,
              "returnHome": false,
              "allowedRoomIds": []
            },
            "abilities": []
          }
        },
        {
          "path": "manifest.story.features.prompts",
          "key": "lesson_mercy",
          "after": {
            "id": "lesson_mercy",
            "name": "Will you spare the defeated rival?",
            "enabled": true,
            "text": "Will you spare the defeated rival?",
            "cancelLabel": "Leave the choice for later",
            "cancelable": true,
            "owner": {
              "kind": "npc",
              "id": "lesson_rival"
            },
            "options": [
              {
                "id": "spare",
                "label": "Offer mercy",
                "match": "all",
                "conditions": [
                  {
                    "kind": "state",
                    "target": "lesson_decided",
                    "operator": "==",
                    "value": false
                  }
                ],
                "actions": [
                  {
                    "kind": "state",
                    "target": "lesson_decided",
                    "value": true
                  },
                  {
                    "kind": "state",
                    "target": "lesson_spared_chosen",
                    "value": true
                  },
                  {
                    "kind": "message",
                    "value": "You offer mercy. The rival accepts it."
                  }
                ],
                "once": false,
                "unavailable": "disable"
              },
              {
                "id": "leave",
                "label": "Leave the conflict unresolved",
                "match": "all",
                "conditions": [
                  {
                    "kind": "state",
                    "target": "lesson_decided",
                    "operator": "==",
                    "value": false
                  }
                ],
                "actions": [
                  {
                    "kind": "state",
                    "target": "lesson_decided",
                    "value": true
                  },
                  {
                    "kind": "message",
                    "value": "You leave without offering mercy."
                  }
                ],
                "once": false,
                "unavailable": "disable"
              }
            ]
          }
        },
        {
          "path": "manifest.story.features.endings",
          "key": "lesson_homecoming",
          "after": {
            "id": "lesson_homecoming",
            "name": "Homecoming",
            "enabled": true,
            "automatic": false,
            "priority": 0,
            "conditions": [],
            "match": "all",
            "text": "Beyond the bridge, a new chapter begins.",
            "actions": [
              {
                "kind": "state",
                "target": "lesson_finished",
                "value": true
              }
            ]
          }
        }
      ]
    }
  ],
  "creatorNotes": "The finale remembers whether you recruited a companion, spared a defeated rival and recovered a keepsake. Three separate passages reflect those choices before the named ending. Open this recipe in Help to inspect its saved settings.",
  "mapRooms": [
    {
      "id": "lesson_room",
      "name": "Last Camp",
      "description": "Talk to the companion, talk to the rival, and take the pocket watch if you wish. Going north reaches the finale and ends the game.",
      "reentryEnabled": false,
      "reentryDesc": "",
      "hint": "",
      "dark": false,
      "roomType": "regular",
      "x": 100,
      "y": 100,
      "width": 160,
      "height": 64,
      "color": "#000000",
      "blockedDescriptions": {}
    },
    {
      "id": "lesson_finale",
      "name": "Homecoming Bridge",
      "description": "The road home lies beyond this bridge.",
      "reentryEnabled": false,
      "reentryDesc": "",
      "hint": "",
      "dark": false,
      "roomType": "regular",
      "x": 320,
      "y": 100,
      "width": 160,
      "height": 64,
      "color": "#000000",
      "smartProse": {
        "narrative": {
          "version": 1,
          "parts": [
            {
              "type": "conditional",
              "id": "lesson_ally_prose",
              "when": {
                "kind": "flag_equals",
                "flag": "lesson_ally_chosen",
                "value": true
              },
              "then": "Your companion walks beside you.",
              "otherwise": "You walk the bridge alone."
            },
            {
              "type": "conditional",
              "id": "lesson_spared_prose",
              "when": {
                "kind": "flag_equals",
                "flag": "lesson_spared_chosen",
                "value": true
              },
              "then": "You remember the mercy you offered your rival.",
              "otherwise": "The old conflict remains unresolved."
            },
            {
              "type": "conditional",
              "id": "lesson_watch_prose",
              "when": {
                "kind": "flag_equals",
                "flag": "lesson_watch_chosen",
                "value": true
              },
              "then": "The recovered watch brings back a memory of home.",
              "otherwise": "The lost keepsake remains only a memory."
            }
          ]
        }
      }
    }
  ],
  "mapExits": [
    {
      "id": "lesson_route_finale",
      "fromRoom": "lesson_room",
      "toRoom": "lesson_finale",
      "direction": "north",
      "locked": false
    }
  ],
  "objects": [
    {
      "id": "lesson_watch",
      "name": "pocket watch",
      "description": "A keepsake from home.",
      "article": "",
      "location": "lesson_room",
      "aliases": [],
      "visible": true,
      "takeable": true,
      "droppable": true,
      "useGive": true,
      "container": false,
      "switchable": false,
      "edible": false,
      "drinkable": false,
      "wearable": false,
      "weapon": false,
      "weight": 0.1,
      "locked": false,
      "lockKey": "",
      "events": []
    }
  ],
  "npcs": [
    {
      "id": "lesson_ally",
      "name": "companion",
      "description": "A companion is ready to follow if asked.",
      "location": "lesson_room",
      "mobile": true,
      "aliases": [],
      "onEnter": "",
      "onExamine": "",
      "onTalk": "",
      "onAttack": "",
      "onDeath": "",
      "onFollow": "",
      "onAutoAttack": "",
      "onTrustChange": "",
      "onGive": "",
      "onBeforeTalk": "",
      "onAfterTalk": "",
      "onBeforeAttack": "",
      "onAfterAttack": "",
      "onDamage": "",
      "onHeal": "",
      "onMove": "",
      "onLeave": "",
      "followPlayer": false,
      "health": 100,
      "combatSide": "neutral",
      "autoFight": false,
      "attackPower": 10,
      "defense": 0,
      "trustLevel": 50,
      "conversationEnabled": false,
      "convGreeting": "",
      "convFarewell": "",
      "convTopics": [],
      "dialogues": [
        {
          "id": "default",
          "trigger": "default",
          "body": "print \"lesson ally looks at you in silence.\""
        }
      ]
    },
    {
      "id": "lesson_rival",
      "name": "defeated rival",
      "description": "The defeated rival asks for mercy.",
      "location": "lesson_room",
      "mobile": false,
      "aliases": [],
      "onEnter": "",
      "onExamine": "",
      "onTalk": "",
      "onAttack": "",
      "onDeath": "",
      "onFollow": "",
      "onAutoAttack": "",
      "onTrustChange": "",
      "onGive": "",
      "onBeforeTalk": "",
      "onAfterTalk": "",
      "onBeforeAttack": "",
      "onAfterAttack": "",
      "onDamage": "",
      "onHeal": "",
      "onMove": "",
      "onLeave": "",
      "followPlayer": false,
      "health": 100,
      "combatSide": "neutral",
      "autoFight": false,
      "attackPower": 10,
      "defense": 0,
      "trustLevel": 50,
      "conversationEnabled": false,
      "convGreeting": "",
      "convFarewell": "",
      "convTopics": [],
      "dialogues": []
    }
  ],
  "activeMechanics": [],
  "verbAliases": [],
  "scripts": [],
  "worldEvents": [],
  "customMechanicDefs": [],
  "savedMechanicTemplates": [],
  "objectiveSets": [],
  "gameOutliner": {},
  "customRoomTemplates": [],
  "customObjectTemplates": [],
  "customNpcTemplates": [],
  "customSavedScripts": [],
  "requiredCapabilities": [
    "npc-capabilities-v1",
    "smart-prose-v1",
    "story-rules-v1",
    "creator-features-v1"
  ]
}
