Blob


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