initial
[lifp.git] / EXAMPLES / cloak.lisp
1 (if-lib::load-libs :cloak-of-darkness)\r
2 \r
3 (in-package :cloak-of-darkness)\r
4 \r
5 (ref cloak message)\r
6                                         \r
7 (object foyer (room) "Foyer of the Opera House"\r
8         (description "You are standing in a spacious hall, splendidly\r
9  decorated in red and gold, with glittering chandeliers overhead.\r
10  The entrance from the street is to the north, and there are doorways\r
11  south and west.")\r
12         (s-to 'bar)\r
13         (w-to 'cloakroom)\r
14         (n-to "You've only just arrived, and besides, the weather outside\r
15  seems to be getting worse."))\r
16 \r
17 (object cloakroom (room) "Cloakroom"\r
18         (description "The walls of this small room were clearly once lined\r
19  with hooks, though now only one remains. The exit is a door to the east.")\r
20         (e-to 'foyer))\r
21 \r
22 (object hook (supporter) "small brass hook" cloakroom\r
23         (name "small" "brass" "hook" "peg")\r
24         (description (lambda () (format nil "It's just a small brass hook, ~a"\r
25                                         (if (in cloak *player*)\r
26                                             "screwed to the wall."\r
27                                             "with a cloak hanging on it."))))\r
28         (has :scenery))\r
29 \r
30 (object bar (room) "Foyer bar"\r
31         (description "The bar, much rougher than you'd have guessed after\r
32  the opulence of the foyer to the north, is completely empty. There seems\r
33  to be some sort of message scrawled in the sawdust on the floor.")\r
34         (n-to 'foyer)\r
35         (before\r
36          (go-to (when (and (hasnt self :light) \r
37                            (not (eql *noun* dir-n)))\r
38                   (incf (num message) 2)\r
39                   "Blundering around in the dark isn't a good idea!"))\r
40          (t (when (hasnt self :light)\r
41               (incf (num message) 1)\r
42               "In the dark? You could easily disturb something!")))\r
43         (has :~light))\r
44 \r
45 (object cloak (clothing) "velvet cloak" *player*\r
46         (name "handsome" "dark" "black" "velvet" "satin" "cloak")\r
47         (description "A handsome cloak, of velvet trimmed with satin, and\r
48  slightly spattered with raindrops. Its blackness is so deep that it almost\r
49  seems to suck light from the room.")\r
50         (before\r
51          ((drop put-on)\r
52           (if (eql *location* cloakroom)\r
53             (progn (give bar :light)\r
54                    (when (and (eql *action* 'put-on) (has self :general))\r
55                      (give self :~general)\r
56                      (incf *score*) nil))\r
57             "This isn't the best place to leave a smart cloak lying around.")))\r
58         (after (take (give bar :~light) nil))\r
59         (has :general :worn))\r
60 \r
61 (object message () "scrawled message" bar\r
62         (name "message" "sawdust" "floor")\r
63         (description (lambda ()\r
64                        (if (< (num message) 2)\r
65                            (progn (incf *score*) \r
66                                   (setf *gamestate* 2)\r
67                                   (sprint "The message, neatly marked in the\r
68  sawdust, reads..."))\r
69                            (progn (setf *gamestate* 3)\r
70                                   (sprint "The message has been carelessly\r
71  trampled, making it difficult to read. You can just distinguish\r
72  the words...")))))\r
73         (num integer 0)\r
74         (has :scenery))\r
75                                   \r
76 (supply init ()\r
77   (setf *location* foyer)\r
78   "~%~%Hurrying through the rainswept November night, you're glad to see\r
79  the bright lights of the Opera House. It's surprising that there aren't\r
80  more people about but, hey, what do you expect in a cheap demo game...?~%~%")\r
81 \r
82 (supply print-gamestate () "You have lost")\r
83 \r
84 (verb "hang" '(:held "on" :noun -> put-on))