1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
export const scenes = {
start: {
description: "You are standing in a dark cave. There's a faint glimmer in the distance, and a torch on the ground.",
choices: [
{ text: "Explore further", nextScene: "deepCave" },
{ text: "Pick up the torch", action: (state) => state.inventory.add("torch") },
{
text: "Use a torch to illuminate the cave",
nextScene: "litCave",
condition: (state) => state.inventory.has("torch"),
consume: ["torch"]
},
],
},
deepCave: {
description: "The darkness becomes overwhelming. You can't proceed further.",
choices: [
{ text: "Go back", nextScene: "start" },
],
},
litCave: {
description: "With the torchlight, you see glittering gemstones embedded in the walls.",
choices: [
{ text: "Pick up the key", action: (state) => state.inventory.add("key") },
{ text: "Collect a gemstone", action: (state) => state.inventory.add("gemstone") },
{ text: "Go back", nextScene: "start" },
{ text: "Go deeper into the cave", nextScene: "treasureRoom", condition: (state) => state.inventory.has("key") },
],
},
treasureRoom: {
description: "You find a room filled with treasure. You are rich beyond your wildest dreams.",
choices: [
{ text: "Swim in the treasure", nextScene: "treasureRoom" },
],
},
};
|