Blame


1 cc9bbf61 2020-04-01 op #include <stdio.h>
2 cc9bbf61 2020-04-01 op
3 cc9bbf61 2020-04-01 op struct object {
4 cc9bbf61 2020-04-01 op int (*condition)(struct object*);
5 cc9bbf61 2020-04-01 op const char *description;
6 cc9bbf61 2020-04-01 op const char **tags;
7 cc9bbf61 2020-04-01 op struct object *location;
8 cc9bbf61 2020-04-01 op struct object *destination;
9 cc9bbf61 2020-04-01 op struct object *prospect;
10 cc9bbf61 2020-04-01 op const char *details;
11 cc9bbf61 2020-04-01 op const char *contents;
12 cc9bbf61 2020-04-01 op const char *text_go;
13 cc9bbf61 2020-04-01 op int weight;
14 cc9bbf61 2020-04-01 op int capacity;
15 cc9bbf61 2020-04-01 op int health;
16 cc9bbf61 2020-04-01 op const char *(*open)(struct object*);
17 cc9bbf61 2020-04-01 op const char *(*close)(struct object*);
18 cc9bbf61 2020-04-01 op const char *(*lock)(struct object*);
19 cc9bbf61 2020-04-01 op const char *(*unlock)(struct object*);
20 cc9bbf61 2020-04-01 op };
21 cc9bbf61 2020-04-01 op
22 cc9bbf61 2020-04-01 op extern struct object objs[];
23 cc9bbf61 2020-04-01 op
24 cc9bbf61 2020-04-01 op - field
25 cc9bbf61 2020-04-01 op description "an open field"
26 cc9bbf61 2020-04-01 op tags "field"
27 cc9bbf61 2020-04-01 op details "The filed is a nice and quiet place under a clear blue sky."
28 cc9bbf61 2020-04-01 op
29 cc9bbf61 2020-04-01 op - cave
30 cc9bbf61 2020-04-01 op description "a little cave"
31 cc9bbf61 2020-04-01 op tags "cave"
32 cc9bbf61 2020-04-01 op details "The cave is just a cold, damp, rocky chamber."
33 cc9bbf61 2020-04-01 op
34 cc9bbf61 2020-04-01 op - silver
35 cc9bbf61 2020-04-01 op description "a silver coin"
36 cc9bbf61 2020-04-01 op tags "silver", "coin", "sirver coin"
37 cc9bbf61 2020-04-01 op location field
38 cc9bbf61 2020-04-01 op details "The coin has an eagle on the obverse."
39 cc9bbf61 2020-04-01 op weight 1
40 cc9bbf61 2020-04-01 op
41 cc9bbf61 2020-04-01 op - gold
42 cc9bbf61 2020-04-01 op description "a gold coin"
43 cc9bbf61 2020-04-01 op tags "gold", "coin", "gold coin"
44 cc9bbf61 2020-04-01 op location cave
45 cc9bbf61 2020-04-01 op details "The shiny coin seems to be a rare and priceless artefact."
46 cc9bbf61 2020-04-01 op weight 1
47 cc9bbf61 2020-04-01 op
48 cc9bbf61 2020-04-01 op - guard
49 cc9bbf61 2020-04-01 op description "a burly guard"
50 cc9bbf61 2020-04-01 op tags "guard", "burly guard"
51 cc9bbf61 2020-04-01 op location field
52 cc9bbf61 2020-04-01 op details "The guard is a really big fellow."
53 cc9bbf61 2020-04-01 op contents "He has"
54 cc9bbf61 2020-04-01 op health 100
55 cc9bbf61 2020-04-01 op capacity 20
56 cc9bbf61 2020-04-01 op
57 cc9bbf61 2020-04-01 op - player
58 cc9bbf61 2020-04-01 op description "yourself"
59 cc9bbf61 2020-04-01 op tags "me"
60 cc9bbf61 2020-04-01 op location field
61 cc9bbf61 2020-04-01 op details "You would need a mirror to look at yourself."
62 cc9bbf61 2020-04-01 op contents "You have"
63 cc9bbf61 2020-04-01 op health 100
64 cc9bbf61 2020-04-01 op capacity 20
65 cc9bbf61 2020-04-01 op
66 cc9bbf61 2020-04-01 op - into_cave
67 cc9bbf61 2020-04-01 op condition { return guard->health == 0 || silver->location == guard; }
68 cc9bbf61 2020-04-01 op description "a cave entrance to the east"
69 cc9bbf61 2020-04-01 op tags "east", "entrance"
70 cc9bbf61 2020-04-01 op location field
71 cc9bbf61 2020-04-01 op destination cave
72 cc9bbf61 2020-04-01 op details "The entrance is just a narrow opening in a small outcrop."
73 cc9bbf61 2020-04-01 op text_go "You walk into the cave."
74 cc9bbf61 2020-04-01 op open is_already_open
75 cc9bbf61 2020-04-01 op
76 cc9bbf61 2020-04-01 op - into_cave_blocked
77 cc9bbf61 2020-04-01 op condition { return guard->health > 0 && silver->location != guard; }
78 cc9bbf61 2020-04-01 op description "a cave entrance to the east"
79 cc9bbf61 2020-04-01 op tags "east", "entrance"
80 cc9bbf61 2020-04-01 op location field
81 cc9bbf61 2020-04-01 op prospect cave
82 cc9bbf61 2020-04-01 op details "The entrance is just a narrow opening in a small outcrop."
83 cc9bbf61 2020-04-01 op text_go "The guard stops you from walking into the cave."
84 cc9bbf61 2020-04-01 op open is_already_open
85 cc9bbf61 2020-04-01 op
86 cc9bbf61 2020-04-01 op - exit_cave
87 cc9bbf61 2020-04-01 op description "a way out to the west"
88 cc9bbf61 2020-04-01 op tags "west", "out"
89 cc9bbf61 2020-04-01 op location cave
90 cc9bbf61 2020-04-01 op destination field
91 cc9bbf61 2020-04-01 op details "Sunlight pours in through an opening in the cave's wall."
92 cc9bbf61 2020-04-01 op text_go "You walk out of the cave."
93 cc9bbf61 2020-04-01 op open is_already_open
94 cc9bbf61 2020-04-01 op
95 cc9bbf61 2020-04-01 op - wall_field
96 cc9bbf61 2020-04-01 op description "dense forest all around"
97 cc9bbf61 2020-04-01 op tags "west", "north", "south", "forest"
98 cc9bbf61 2020-04-01 op location field
99 cc9bbf61 2020-04-01 op details "The field is surrounded by trees and undergrowth."
100 cc9bbf61 2020-04-01 op text_go "Dense forest is blocking the way."
101 cc9bbf61 2020-04-01 op
102 cc9bbf61 2020-04-01 op - wall_cave
103 cc9bbf61 2020-04-01 op description "solid rock all around"
104 cc9bbf61 2020-04-01 op tags "east", "north", "rock"
105 cc9bbf61 2020-04-01 op location cave
106 cc9bbf61 2020-04-01 op details "carved in stone is a secret password 'abccb'."
107 cc9bbf61 2020-04-01 op text_go "Solid rock is blocking the way."
108 cc9bbf61 2020-04-01 op
109 cc9bbf61 2020-04-01 op - backroom
110 cc9bbf61 2020-04-01 op description "a backroom"
111 cc9bbf61 2020-04-01 op tags "backroom"
112 cc9bbf61 2020-04-01 op details "The room is dusty and messy."
113 cc9bbf61 2020-04-01 op
114 cc9bbf61 2020-04-01 op - wall_backroom
115 cc9bbf61 2020-04-01 op description "solid rock all around"
116 cc9bbf61 2020-04-01 op tags "east", "west", "south", "rock"
117 cc9bbf61 2020-04-01 op location backroom
118 cc9bbf61 2020-04-01 op details "Trendy wallpaper covers the rock walls."
119 cc9bbf61 2020-04-01 op text_go "Solid rock is blocking the way."
120 cc9bbf61 2020-04-01 op
121 cc9bbf61 2020-04-01 op - open_door_to_backroom
122 cc9bbf61 2020-04-01 op description "an open door to the south"
123 cc9bbf61 2020-04-01 op tags "south", "door", "doorway"
124 cc9bbf61 2020-04-01 op destination backroom
125 cc9bbf61 2020-04-01 op details "The door is open."
126 cc9bbf61 2020-04-01 op text_go "You walk through the door into the backroom."
127 cc9bbf61 2020-04-01 op open is_already_open
128 cc9bbf61 2020-04-01 op close toggle_backdoor
129 cc9bbf61 2020-04-01 op
130 cc9bbf61 2020-04-01 op - closed_door_to_backroom
131 cc9bbf61 2020-04-01 op description "a closed door to the south"
132 cc9bbf61 2020-04-01 op tags "south", "door", "doorway"
133 cc9bbf61 2020-04-01 op location cave
134 cc9bbf61 2020-04-01 op prospect backroom
135 cc9bbf61 2020-04-01 op details "The door is closed."
136 cc9bbf61 2020-04-01 op text_go "The door is closed."
137 cc9bbf61 2020-04-01 op open toggle_backdoor
138 cc9bbf61 2020-04-01 op close is_already_closed
139 cc9bbf61 2020-04-01 op
140 cc9bbf61 2020-04-01 op - open_door_to_cave
141 cc9bbf61 2020-04-01 op description "an open door to the north"
142 cc9bbf61 2020-04-01 op tags "north", "door", "doorway"
143 cc9bbf61 2020-04-01 op destination cave
144 cc9bbf61 2020-04-01 op details "The door is open"
145 cc9bbf61 2020-04-01 op text_go "You walk through the door into the cave."
146 cc9bbf61 2020-04-01 op open is_already_open
147 cc9bbf61 2020-04-01 op close toggle_backdoor
148 cc9bbf61 2020-04-01 op
149 cc9bbf61 2020-04-01 op - closed_door_to_cave
150 cc9bbf61 2020-04-01 op description "a closed door to the north"
151 cc9bbf61 2020-04-01 op tags "north", "door", "doorway"
152 cc9bbf61 2020-04-01 op location backroom
153 cc9bbf61 2020-04-01 op prospect cave
154 cc9bbf61 2020-04-01 op details "The door is closed."
155 cc9bbf61 2020-04-01 op text_go "The door is closed."
156 cc9bbf61 2020-04-01 op open toggle_backdoor
157 cc9bbf61 2020-04-01 op close is_already_closed
158 cc9bbf61 2020-04-01 op
159 cc9bbf61 2020-04-01 op - open_box
160 cc9bbf61 2020-04-01 op description "a wooden box"
161 cc9bbf61 2020-04-01 op tags "box", "wooden box"
162 cc9bbf61 2020-04-01 op details "The box is open."
163 cc9bbf61 2020-04-01 op weight 5
164 cc9bbf61 2020-04-01 op capacity 10
165 cc9bbf61 2020-04-01 op open is_already_open
166 cc9bbf61 2020-04-01 op close toggle_box
167 cc9bbf61 2020-04-01 op lock is_still_open
168 cc9bbf61 2020-04-01 op unlock is_already_open
169 cc9bbf61 2020-04-01 op
170 cc9bbf61 2020-04-01 op - closed_box
171 cc9bbf61 2020-04-01 op description "a wooden box"
172 cc9bbf61 2020-04-01 op tags "box", "wooden box"
173 cc9bbf61 2020-04-01 op details "The box is closed."
174 cc9bbf61 2020-04-01 op weight 5
175 cc9bbf61 2020-04-01 op open toggle_box
176 cc9bbf61 2020-04-01 op close is_already_closed
177 cc9bbf61 2020-04-01 op lock toggle_box_lock
178 cc9bbf61 2020-04-01 op unlock is_already_unlocked
179 cc9bbf61 2020-04-01 op
180 cc9bbf61 2020-04-01 op - locked_box
181 cc9bbf61 2020-04-01 op description "a wooden box"
182 cc9bbf61 2020-04-01 op tags "box", "wooden box"
183 cc9bbf61 2020-04-01 op location backroom
184 cc9bbf61 2020-04-01 op details "The box is closed."
185 cc9bbf61 2020-04-01 op weight 5
186 cc9bbf61 2020-04-01 op open is_still_locked
187 cc9bbf61 2020-04-01 op close is_already_closed
188 cc9bbf61 2020-04-01 op lock is_already_locked
189 cc9bbf61 2020-04-01 op unlock toggle_box_lock
190 cc9bbf61 2020-04-01 op
191 cc9bbf61 2020-04-01 op - key_for_box
192 cc9bbf61 2020-04-01 op description "a tiny key"
193 cc9bbf61 2020-04-01 op tags "key", "tiny key"
194 cc9bbf61 2020-04-01 op location cave
195 cc9bbf61 2020-04-01 op details "The key is really small and shiny."
196 cc9bbf61 2020-04-01 op weight 1
197 cc9bbf61 2020-04-01 op
198 cc9bbf61 2020-04-01 op - knife
199 cc9bbf61 2020-04-01 op description "a small, rusty knife"
200 cc9bbf61 2020-04-01 op tags "knife", "rusty knife", "small knife"
201 cc9bbf61 2020-04-01 op location open_box
202 cc9bbf61 2020-04-01 op details "This knife has surely seen better times."
203 cc9bbf61 2020-04-01 op weight 1