Unspk'd inventory lookup
[open-adventure.git] / actions.c
1 #include <stdlib.h>
2 #include <stdbool.h>
3 #include <string.h>
4 #include "advent.h"
5 #include "dungeon.h"
6
7 static int fill(token_t, token_t);
8
9 static void state_change(long obj, long state)
10 {
11     game.prop[obj] = state;
12     pspeak(obj, change, state, true);
13 }
14
15 static int attack(struct command_t *command)
16 /*  Attack.  Assume target if unambiguous.  "Throw" also links here.
17  *  Attackable objects fall into two categories: enemies (snake,
18  *  dwarf, etc.)  and others (bird, clam, machine).  Ambiguous if 2
19  *  enemies, or no enemies but 2 others. */
20 {
21     vocab_t verb = command->verb;
22     vocab_t obj = command->obj;
23
24     long spk = actions[verb].message;
25     if (obj == NO_OBJECT ||
26         obj == INTRANSITIVE) {
27         int changes = 0;
28         if (atdwrf(game.loc) > 0) {
29             obj = DWARF;
30             ++changes;
31         }
32         if (HERE(SNAKE)) {
33             obj = SNAKE;
34             ++changes;
35         }
36         if (AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS) {
37             obj = DRAGON;
38             ++changes;
39         }
40         if (AT(TROLL)) {
41             obj = TROLL;
42             ++changes;
43         }
44         if (AT(OGRE)) {
45             obj = OGRE;
46             ++changes;
47         }
48         if (HERE(BEAR) && game.prop[BEAR] == UNTAMED_BEAR) {
49             obj = BEAR;
50             ++changes;
51         }
52         /* check for low-priority targets */
53         if (obj == NO_OBJECT) {
54             /* Can't attack bird or machine by throwing axe. */
55             if (HERE(BIRD) && verb != THROW) {
56                 obj = BIRD;
57                 ++changes;
58             }
59             if (HERE(VEND) && verb != THROW) {
60                 obj = VEND;
61                 ++changes;
62             }
63             /* Clam and oyster both treated as clam for intransitive case;
64              * no harm done. */
65             if (HERE(CLAM) || HERE(OYSTER)) {
66                 obj = CLAM;
67                 ++changes;
68             }
69         }
70         if (changes >= 2)
71             return GO_UNKNOWN;
72
73     }
74     if (obj == BIRD) {
75         if (game.closed) {
76             rspeak(UNHAPPY_BIRD);
77             return GO_CLEAROBJ;
78         }
79         DESTROY(BIRD);
80         spk = BIRD_DEAD;
81     } else if (obj == VEND) {
82         state_change(VEND,
83                      game.prop[VEND] == VEND_BLOCKS ? VEND_UNBLOCKS : VEND_BLOCKS);
84         return GO_CLEAROBJ;
85     }
86
87     if (obj == NO_OBJECT)
88         spk = NO_TARGET;
89     if (obj == CLAM ||
90         obj == OYSTER)
91         spk = SHELL_IMPERVIOUS;
92     if (obj == SNAKE)
93         spk = SNAKE_WARNING;
94     if (obj == DWARF)
95         spk = BARE_HANDS_QUERY;
96     if (obj == DWARF && game.closed)
97         return GO_DWARFWAKE;
98     if (obj == DRAGON)
99         spk = ALREADY_DEAD;
100     if (obj == TROLL)
101         spk = ROCKY_TROLL;
102     if (obj == OGRE)
103         spk = OGRE_DODGE;
104     if (obj == OGRE && atdwrf(game.loc) > 0) {
105         rspeak(spk);
106         rspeak(KNIFE_THROWN);
107         DESTROY(OGRE);
108         int dwarves = 0;
109         for (int i = 1; i < PIRATE; i++) {
110             if (game.dloc[i] == game.loc) {
111                 ++dwarves;
112                 game.dloc[i] = LOC_LONGWEST;
113                 game.dseen[i] = false;
114             }
115         }
116         spk = (dwarves > 1) ?
117               OGRE_PANIC1 :
118               OGRE_PANIC2;
119     } else if (obj == BEAR) {
120         switch (game.prop[BEAR]) {
121         case UNTAMED_BEAR:
122             spk = BEAR_HANDS;
123             break;
124         case SITTING_BEAR:
125             spk = BEAR_CONFUSED;
126             break;
127         case CONTENTED_BEAR:
128             spk = BEAR_CONFUSED;
129             break;
130         case BEAR_DEAD:
131             spk = ALREADY_DEAD;
132             break;
133         }
134     } else if (obj == DRAGON && game.prop[DRAGON] == DRAGON_BARS) {
135         /*  Fun stuff for dragon.  If he insists on attacking it, win!
136          *  Set game.prop to dead, move dragon to central loc (still
137          *  fixed), move rug there (not fixed), and move him there,
138          *  too.  Then do a null motion to get new description. */
139         rspeak(BARE_HANDS_QUERY);
140         if (silent_yes()) {
141             // FIXME: setting wd1 is a workaround for broken logic
142             command->wd1 = token_to_packed("Y");
143         } else {
144             // FIXME: setting wd1 is a workaround for broken logic
145             command->wd1 = token_to_packed("N");
146             return GO_CHECKFOO;
147         }
148         state_change(DRAGON, DRAGON_DEAD);
149         game.prop[RUG] = RUG_FLOOR;
150         /* FIXME: Arithmetic on location values */
151         int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2;
152         move(DRAGON + NOBJECTS, -1);
153         move(RUG + NOBJECTS, 0);
154         move(DRAGON, k);
155         move(RUG, k);
156         drop(BLOOD, k);
157         for (obj = 1; obj <= NOBJECTS; obj++) {
158             if (game.place[obj] == objects[DRAGON].plac ||
159                 game.place[obj] == objects[DRAGON].fixd)
160                 move(obj, k);
161         }
162         game.loc = k;
163         return GO_MOVE;
164     }
165
166     rspeak(spk);
167     return GO_CLEAROBJ;
168 }
169
170 static int bigwords(token_t foo)
171 /*  FEE FIE FOE FOO (AND FUM).  Advance to next state if given in proper order.
172  *  Look up foo in special section of vocab to determine which word we've got.
173  *  Last word zips the eggs back to the giant room (unless already there). */
174 {
175     char word[TOKLEN + 1];
176     packed_to_token(foo, word);
177     int k = (int) get_special_vocab_id(word);
178     if (game.foobar != 1 - k) {
179         if (game.foobar != 0 && game.loc == LOC_GIANTROOM) {
180             rspeak( START_OVER);
181         } else {
182             rspeak(NOTHING_HAPPENS);
183         }
184         return GO_CLEAROBJ;
185     } else {
186         game.foobar = k;
187         if (k != 4) {
188             rspeak(OK_MAN);
189             return GO_CLEAROBJ;
190         }
191         game.foobar = 0;
192         if (game.place[EGGS] == objects[EGGS].plac ||
193             (TOTING(EGGS) && game.loc == objects[EGGS].plac)) {
194             rspeak(NOTHING_HAPPENS);
195             return GO_CLEAROBJ;
196         } else {
197             /*  Bring back troll if we steal the eggs back from him before
198              *  crossing. */
199             if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID)
200                 game.prop[TROLL] = TROLL_PAIDONCE;
201             k = EGGS_DONE;
202             if (HERE(EGGS))
203                 k = EGGS_VANISHED;
204             if (game.loc == objects[EGGS].plac)
205                 k = EGGS_HERE;
206             move(EGGS, objects[EGGS].plac);
207             pspeak(EGGS, look, k, true);
208             return GO_CLEAROBJ;
209         }
210     }
211 }
212
213 static int bivalve(token_t verb, token_t obj)
214 /* Clam/oyster actions */
215 {
216     bool is_oyster = (obj == OYSTER);
217     if (verb == LOCK) {
218         rspeak(HUH_MAN);
219         return GO_CLEAROBJ;
220     }
221     if (!TOTING(TRIDENT)) {
222         rspeak(is_oyster ?
223                OYSTER_OPENER :
224                CLAM_OPENER);
225         return GO_CLEAROBJ;
226     }
227     if (TOTING(obj)) {
228         rspeak( is_oyster ?
229                 DROP_OYSTER :
230                 DROP_CLAM);
231         return GO_CLEAROBJ;
232     }
233
234     if (!is_oyster) {
235         DESTROY(CLAM);
236         drop(OYSTER, game.loc);
237         drop(PEARL, LOC_CULDESAC);
238     }
239     rspeak(is_oyster ?
240            OYSTER_OPENS :
241            PEARL_FALLS);
242     return GO_CLEAROBJ;
243 }
244
245 static void blast(void)
246 /*  Blast.  No effect unless you've got dynamite, which is a neat trick! */
247 {
248     if (game.prop[ROD2] < 0 ||
249         !game.closed)
250         rspeak(REQUIRES_DYNAMITE);
251     else {
252         game.bonus = VICTORY_MESSAGE;
253         if (game.loc == LOC_NE)
254             game.bonus = DEFEAT_MESSAGE;
255         if (HERE(ROD2))
256             game.bonus = SPLATTER_MESSAGE;
257         rspeak(game.bonus);
258         terminate(endgame);
259     }
260 }
261
262 static int vbreak(token_t verb, token_t obj)
263 /*  Break.  Only works for mirror in repository and, of course, the vase. */
264 {
265     if (obj == MIRROR) {
266         if (game.closed) {
267             rspeak(BREAK_MIRROR);
268             return GO_DWARFWAKE;
269         } else {
270             rspeak(TOO_FAR);
271             return GO_CLEAROBJ;
272         }
273     }
274     if (obj == VASE && game.prop[VASE] == VASE_WHOLE) {
275         if (TOTING(VASE))
276             drop(VASE, game.loc);
277         state_change(VASE, VASE_BROKEN);
278         game.fixed[VASE] = -1;
279         return GO_CLEAROBJ;
280     }
281     rspeak(actions[verb].message);
282     return (GO_CLEAROBJ);
283 }
284
285 static int brief(void)
286 /*  Brief.  Intransitive only.  Suppress long descriptions after first time. */
287 {
288     game.abbnum = 10000;
289     game.detail = 3;
290     rspeak(BRIEF_CONFIRM);
291     return GO_CLEAROBJ;
292 }
293
294 static int vcarry(token_t verb, token_t obj)
295 /*  Carry an object.  Special cases for bird and cage (if bird in cage, can't
296  *  take one without the other).  Liquids also special, since they depend on
297  *  status of bottle.  Also various side effects, etc. */
298 {
299     int spk;
300     if (obj == INTRANSITIVE) {
301         /*  Carry, no object given yet.  OK if only one object present. */
302         if (game.atloc[game.loc] == 0 ||
303             game.link[game.atloc[game.loc]] != 0 ||
304             atdwrf(game.loc) > 0)
305             return GO_UNKNOWN;
306         obj = game.atloc[game.loc];
307     }
308
309     if (TOTING(obj)) {
310         rspeak(ALREADY_CARRYING);
311         return GO_CLEAROBJ;
312     }
313     spk = YOU_JOKING;
314     if (obj == PLANT && game.prop[PLANT] <= 0)
315         spk = DEEP_ROOTS;
316     if (obj == BEAR && game.prop[BEAR] == SITTING_BEAR)
317         spk = BEAR_CHAINED;
318     if (obj == CHAIN && game.prop[BEAR] != UNTAMED_BEAR)
319         spk = STILL_LOCKED;
320     if (obj == URN)
321         spk = URN_NOBUDGE;
322     if (obj == CAVITY)
323         spk = DOUGHNUT_HOLES;
324     if (obj == BLOOD)
325         spk = FEW_DROPS;
326     if (obj == RUG && game.prop[RUG] == RUG_HOVER)
327         spk = RUG_HOVERS;
328     if (obj == SIGN)
329         spk = HAND_PASSTHROUGH;
330     if (obj == MESSAG) {
331         rspeak(REMOVE_MESSAGE);
332         DESTROY(MESSAG);
333         return GO_CLEAROBJ;
334     }
335     if (game.fixed[obj] != 0) {
336         rspeak(spk);
337         return GO_CLEAROBJ;
338     }
339     if (obj == WATER ||
340         obj == OIL) {
341         if (!HERE(BOTTLE) ||
342             LIQUID() != obj) {
343             if (TOTING(BOTTLE) && game.prop[BOTTLE] == EMPTY_BOTTLE)
344                 return (fill(verb, BOTTLE));
345             else {
346                 if (game.prop[BOTTLE] != EMPTY_BOTTLE)
347                     spk = BOTTLE_FULL;
348                 if (!TOTING(BOTTLE))
349                     spk = NO_CONTAINER;
350                 rspeak(spk);
351                 return GO_CLEAROBJ;
352             }
353         }
354         obj = BOTTLE;
355     }
356
357     spk = CARRY_LIMIT;
358     if (game.holdng >= INVLIMIT) {
359         rspeak(spk);
360         return GO_CLEAROBJ;
361     } else if (obj == BIRD && game.prop[BIRD] != BIRD_CAGED && -1 - game.prop[BIRD] != BIRD_CAGED) {
362         if (game.prop[BIRD] == BIRD_FOREST_UNCAGED) {
363             DESTROY(BIRD);
364             rspeak(BIRD_CRAP);
365             return GO_CLEAROBJ;
366         }
367         if (!TOTING(CAGE))
368             spk = CANNOT_CARRY;
369         if (TOTING(ROD))
370             spk = BIRD_EVADES;
371         if (spk == CANNOT_CARRY ||
372             spk == BIRD_EVADES) {
373             rspeak(spk);
374             return GO_CLEAROBJ;
375         }
376         game.prop[BIRD] = BIRD_CAGED;
377     }
378     /* FIXME: Arithmetic on state numbers */
379     if ((obj == BIRD ||
380          obj == CAGE) &&
381         (game.prop[BIRD] == BIRD_CAGED ||
382          -1 - game.prop[BIRD] == 1))
383         carry(BIRD + CAGE - obj, game.loc);
384     carry(obj, game.loc);
385     if (obj == BOTTLE && LIQUID() != 0)
386         game.place[LIQUID()] = CARRIED;
387     if (GSTONE(obj) && game.prop[obj] != 0) {
388         game.prop[obj] = STATE_GROUND;
389         game.prop[CAVITY] = CAVITY_EMPTY;
390     }
391     rspeak(OK_MAN);
392     return GO_CLEAROBJ;
393 }
394
395 static int chain(token_t verb)
396 /* Do something to the bear's chain */
397 {
398     int spk;
399     if (verb != LOCK) {
400         spk = CHAIN_UNLOCKED;
401         if (game.prop[BEAR] == UNTAMED_BEAR)
402             spk = BEAR_BLOCKS;
403         if (game.prop[CHAIN] == CHAIN_HEAP)
404             spk = ALREADY_UNLOCKED;
405         if (spk != CHAIN_UNLOCKED) {
406             rspeak(spk);
407             return GO_CLEAROBJ;
408         }
409         game.prop[CHAIN] = CHAIN_HEAP;
410         game.fixed[CHAIN] = CHAIN_HEAP;
411         if (game.prop[BEAR] != BEAR_DEAD)
412             game.prop[BEAR] = CONTENTED_BEAR;
413         /* FIXME: Arithmetic on state numbers */
414         game.fixed[BEAR] = 2 - game.prop[BEAR];
415     } else {
416         spk = CHAIN_LOCKED;
417         if (game.prop[CHAIN] != CHAIN_HEAP)
418             spk = ALREADY_LOCKED;
419         if (game.loc != objects[CHAIN].plac)
420             spk = NO_LOCKSITE;
421         if (spk != CHAIN_LOCKED) {
422             rspeak(spk);
423             return GO_CLEAROBJ;
424         }
425         game.prop[CHAIN] = CHAIN_FIXED;
426         if (TOTING(CHAIN))
427             drop(CHAIN, game.loc);
428         game.fixed[CHAIN] = -1;
429     }
430     rspeak(spk);
431     return GO_CLEAROBJ;
432 }
433
434 static int discard(token_t verb, token_t obj, bool just_do_it)
435 /*  Discard object.  "Throw" also comes here for most objects.  Special cases for
436  *  bird (might attack snake or dragon) and cage (might contain bird) and vase.
437  *  Drop coins at vending machine for extra batteries. */
438 {
439     int spk = actions[verb].message;
440     if (!just_do_it) {
441         if (TOTING(ROD2) && obj == ROD && !TOTING(ROD))
442             obj = ROD2;
443         if (!TOTING(obj)) {
444             rspeak(spk);
445             return GO_CLEAROBJ;
446         }
447         if (obj == BIRD && HERE(SNAKE)) {
448             rspeak(BIRD_ATTACKS);
449             if (game.closed)
450                 return GO_DWARFWAKE;
451             DESTROY(SNAKE);
452             /* Set game.prop for use by travel options */
453             game.prop[SNAKE] = SNAKE_CHASED;
454
455         } else if ((GSTONE(obj) && AT(CAVITY) && game.prop[CAVITY] != CAVITY_FULL)) {
456             rspeak(GEM_FITS);
457             game.prop[obj] = 1;
458             game.prop[CAVITY] = CAVITY_FULL;
459             if (HERE(RUG) && ((obj == EMERALD && game.prop[RUG] != RUG_HOVER) ||
460                               (obj == RUBY && game.prop[RUG] == RUG_HOVER))) {
461                 spk = RUG_RISES;
462                 if (TOTING(RUG))
463                     spk = RUG_WIGGLES;
464                 if (obj == RUBY)
465                     spk = RUG_SETTLES;
466                 rspeak(spk);
467                 if (spk != RUG_WIGGLES) {
468                     /* FIXME: Arithmetic on state numbers */
469                     int k = 2 - game.prop[RUG];
470                     game.prop[RUG] = k;
471                     if (k == 2)
472                         k = objects[SAPPH].plac;
473                     move(RUG + NOBJECTS, k);
474                 }
475             }
476         } else if (obj == COINS && HERE(VEND)) {
477             DESTROY(COINS);
478             drop(BATTERY, game.loc);
479             pspeak(BATTERY, look, FRESH_BATTERIES, true);
480             return GO_CLEAROBJ;
481         } else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS) {
482             rspeak(BIRD_BURNT);
483             DESTROY(BIRD);
484             return GO_CLEAROBJ;
485         } else if (obj == BEAR && AT(TROLL)) {
486             state_change(TROLL, TROLL_GONE);
487             move(TROLL, LOC_NOWHERE);
488             move(TROLL + NOBJECTS, LOC_NOWHERE);
489             move(TROLL2, objects[TROLL].plac);
490             move(TROLL2 + NOBJECTS, objects[TROLL].fixd);
491             juggle(CHASM);
492         } else if (obj != VASE ||
493                    game.loc == objects[PILLOW].plac) {
494             rspeak(OK_MAN);
495         } else {
496             game.prop[VASE] = VASE_BROKEN;
497             if (AT(PILLOW))
498                 game.prop[VASE] = VASE_WHOLE;
499             pspeak(VASE, look, game.prop[VASE] + 1, true);
500             if (game.prop[VASE] != VASE_WHOLE)
501                 game.fixed[VASE] = -1;
502         }
503     }
504     int k = LIQUID();
505     if (k == obj)
506         obj = BOTTLE;
507     if (obj == BOTTLE && k != 0)
508         game.place[k] = LOC_NOWHERE;
509     if (obj == CAGE && game.prop[BIRD] == BIRD_CAGED)
510         drop(BIRD, game.loc);
511     drop(obj, game.loc);
512     if (obj != BIRD)
513         return GO_CLEAROBJ;
514     game.prop[BIRD] = BIRD_UNCAGED;
515     if (FOREST(game.loc))
516         game.prop[BIRD] = BIRD_FOREST_UNCAGED;
517     return GO_CLEAROBJ;
518 }
519
520 static int drink(token_t verb, token_t obj)
521 /*  Drink.  If no object, assume water and look for it here.  If water is in
522  *  the bottle, drink that, else must be at a water loc, so drink stream. */
523 {
524     if (obj == NO_OBJECT && LIQLOC(game.loc) != WATER && (LIQUID() != WATER ||
525             !HERE(BOTTLE)))
526         return GO_UNKNOWN;
527     if (obj != BLOOD) {
528         if (obj != NO_OBJECT && obj != WATER) {
529             rspeak(RIDICULOUS_ATTEMPT);
530         } else if (LIQUID() == WATER && HERE(BOTTLE)) {
531             game.prop[BOTTLE] = EMPTY_BOTTLE;
532             game.place[WATER] = LOC_NOWHERE;
533             rspeak(BOTTLE_EMPTY);
534         } else {
535             rspeak(actions[verb].message);
536         }
537     } else {
538         DESTROY(BLOOD);
539         state_change(DRAGON, DRAGON_BLOODLESS);
540         game.blooded = true;
541     }
542     return GO_CLEAROBJ;
543 }
544
545 static int eat(token_t verb, token_t obj)
546 /*  Eat.  Intransitive: assume food if present, else ask what.  Transitive: food
547  *  ok, some things lose appetite, rest are ridiculous. */
548 {
549     if (obj == INTRANSITIVE) {
550         if (!HERE(FOOD))
551             return GO_UNKNOWN;
552         DESTROY(FOOD);
553         rspeak(THANKS_DELICIOUS);
554         return GO_CLEAROBJ;
555     }
556     if (obj == FOOD) {
557         DESTROY(FOOD);
558         rspeak(THANKS_DELICIOUS);
559         return GO_CLEAROBJ;
560     }
561     if (obj == BIRD ||
562         obj == SNAKE ||
563         obj == CLAM ||
564         obj == OYSTER ||
565         obj == DWARF ||
566         obj == DRAGON ||
567         obj == TROLL ||
568         obj == BEAR ||
569         obj == OGRE) {
570         rspeak(LOST_APPETITE);
571         return GO_CLEAROBJ;
572     }
573     rspeak(actions[verb].message);
574     return GO_CLEAROBJ;
575 }
576
577 static int extinguish(token_t verb, int obj)
578 /* Extinguish.  Lamp, urn, dragon/volcano (nice try). */
579 {
580     if (obj == INTRANSITIVE) {
581         if (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT)
582             obj = LAMP;
583         if (HERE(URN) && game.prop[URN] == URN_LIT)
584             obj = URN;
585         if (obj == INTRANSITIVE ||
586             (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT &&
587              HERE(URN) && game.prop[URN] == URN_LIT))
588             return GO_UNKNOWN;
589     }
590
591     if (obj == URN) {
592         if (game.prop[URN] != URN_EMPTY) {
593             state_change(URN, URN_DARK);
594         } else {
595             pspeak(URN, change, URN_DARK, true);
596         }
597
598     } else if (obj == LAMP) {
599         state_change(LAMP, LAMP_DARK);
600         rspeak(DARK(game.loc) ?
601                PITCH_DARK :
602                NO_MESSAGE);
603
604     } else if (obj == DRAGON ||
605                obj == VOLCANO) {
606         rspeak(BEYOND_POWER);
607
608     } else {
609         rspeak(actions[verb].message);
610     }
611     return GO_CLEAROBJ;
612 }
613
614 static int feed(token_t verb, token_t obj)
615 /*  Feed.  If bird, no seed.  Snake, dragon, troll: quip.  If dwarf, make him
616  *  mad.  Bear, special. */
617 {
618     int spk = actions[verb].message;
619     if (obj == BIRD) {
620         rspeak(BIRD_PINING);
621         return GO_CLEAROBJ;
622     } else if (obj == SNAKE ||
623                obj == DRAGON ||
624                obj == TROLL) {
625         spk = NOTHING_EDIBLE;
626         if (obj == DRAGON && game.prop[DRAGON] != DRAGON_BARS)
627             spk = RIDICULOUS_ATTEMPT;
628         if (obj == TROLL)
629             spk = TROLL_VICES;
630         if (obj == SNAKE && !game.closed && HERE(BIRD)) {
631             DESTROY(BIRD);
632             spk = BIRD_DEVOURED;
633         }
634     } else if (obj == DWARF) {
635         if (HERE(FOOD)) {
636             game.dflag += 2;
637             spk = REALLY_MAD;
638         }
639     } else if (obj == BEAR) {
640         if (game.prop[BEAR] == UNTAMED_BEAR)
641             spk = NOTHING_EDIBLE;
642         if (game.prop[BEAR] == BEAR_DEAD)
643             spk = RIDICULOUS_ATTEMPT;
644         if (HERE(FOOD)) {
645             DESTROY(FOOD);
646             game.prop[BEAR] = SITTING_BEAR;
647             game.fixed[AXE] = 0;
648             game.prop[AXE] = 0;
649             spk = BEAR_TAMED;
650         }
651     } else if (obj == OGRE) {
652         if (HERE(FOOD))
653             spk = OGRE_FULL;
654     } else {
655         spk = AM_GAME;
656     }
657     rspeak(spk);
658     return GO_CLEAROBJ;
659 }
660
661 int fill(token_t verb, token_t obj)
662 /*  Fill.  Bottle or urn must be empty, and liquid available.  (Vase
663  *  is nasty.) */
664 {
665     int k;
666     int spk = actions[verb].message;
667     if (obj == VASE) {
668         spk = ARENT_CARRYING;
669         if (LIQLOC(game.loc) == 0)
670             spk = FILL_INVALID;
671         if (LIQLOC(game.loc) == 0 ||
672             !TOTING(VASE)) {
673             rspeak(spk);
674             return GO_CLEAROBJ;
675         }
676         rspeak(SHATTER_VASE);
677         game.prop[VASE] = VASE_BROKEN;
678         game.fixed[VASE] = -1;
679         return (discard(verb, obj, true));
680     } else if (obj == URN) {
681         spk = FULL_URN;
682         if (game.prop[URN] != URN_EMPTY) {
683             rspeak(spk);
684             return GO_CLEAROBJ;
685         }
686         spk = FILL_INVALID;
687         k = LIQUID();
688         if (k == 0 ||
689             !HERE(BOTTLE)) {
690             rspeak(spk);
691             return GO_CLEAROBJ;
692         }
693         game.place[k] = LOC_NOWHERE;
694         game.prop[BOTTLE] = EMPTY_BOTTLE;
695         if (k == OIL)
696             game.prop[URN] = URN_DARK;
697         spk = WATER_URN + game.prop[URN];
698         rspeak(spk);
699         return GO_CLEAROBJ;
700     } else if (obj != NO_OBJECT && obj != BOTTLE) {
701         rspeak(spk);
702         return GO_CLEAROBJ;
703     } else if (obj == NO_OBJECT && !HERE(BOTTLE))
704         return GO_UNKNOWN;
705     spk = BOTTLED_WATER;
706     if (LIQLOC(game.loc) == 0)
707         spk = NO_LIQUID;
708     if (HERE(URN) && game.prop[URN] != URN_EMPTY)
709         spk = URN_NOPOUR;
710     if (LIQUID() != 0)
711         spk = BOTTLE_FULL;
712     if (spk == BOTTLED_WATER) {
713         /* FIXME: Arithmetic on property values */
714         game.prop[BOTTLE] = MOD(conditions[game.loc], 4) / 2 * 2;
715         k = LIQUID();
716         if (TOTING(BOTTLE))
717             game.place[k] = CARRIED;
718         if (k == OIL)
719             spk = BOTTLED_OIL;
720     }
721     rspeak(spk);
722     return GO_CLEAROBJ;
723 }
724
725 static int find(token_t verb, token_t obj)
726 /* Find.  Might be carrying it, or it might be here.  Else give caveat. */
727 {
728     int spk = actions[verb].message;
729     if (AT(obj) ||
730         (LIQUID() == obj && AT(BOTTLE)) ||
731         obj == LIQLOC(game.loc) ||
732         (obj == DWARF && atdwrf(game.loc) > 0))
733         spk = YOU_HAVEIT;
734     if (game.closed)
735         spk = NEEDED_NEARBY;
736     if (TOTING(obj))
737         spk = ALREADY_CARRYING;
738     rspeak(spk);
739     return GO_CLEAROBJ;
740 }
741
742 static int fly(token_t verb, token_t obj)
743 /* Fly.  Snide remarks unless hovering rug is here. */
744 {
745     if (obj == INTRANSITIVE) {
746         if (!HERE(RUG)) {
747             rspeak(FLAP_ARMS);
748             return GO_CLEAROBJ;
749         }
750         if (game.prop[RUG] != RUG_HOVER) {
751             rspeak(RUG_NOTHING2);
752             return GO_CLEAROBJ;
753         }
754         obj = RUG;
755     }
756
757     if (obj != RUG) {
758         rspeak(actions[verb].message);
759         return GO_CLEAROBJ;
760     }
761     if (game.prop[RUG] != RUG_HOVER) {
762         rspeak(RUG_NOTHING1);
763         return GO_CLEAROBJ;
764     }
765     game.oldlc2 = game.oldloc;
766     game.oldloc = game.loc;
767     /* FIXME: Arithmetic on location values */
768     game.newloc = game.place[RUG] + game.fixed[RUG] - game.loc;
769
770     if (game.prop[SAPPH] >= 0) {
771         rspeak(RUG_RETURNS);
772     } else {
773         rspeak(RUG_GOES);
774     }
775     return GO_TERMINATE;
776 }
777
778 static int inven(void)
779 /* Inventory. If object, treat same as find.  Else report on current burden. */
780 {
781     bool empty = true;
782     for (int i = 1; i <= NOBJECTS; i++) {
783         if (i == BEAR ||
784             !TOTING(i))
785             continue;
786         if (empty) {
787             rspeak(NOW_HOLDING);
788             empty = false;
789         }
790         pspeak(i, touch, -1, false);
791     }
792     if (TOTING(BEAR))
793         rspeak(TAME_BEAR);
794     if (empty)
795         rspeak(NO_CARRY);
796     return GO_CLEAROBJ;
797 }
798
799 static int light(token_t verb, token_t obj)
800 /*  Light.  Applicable only to lamp and urn. */
801 {
802     if (obj == INTRANSITIVE) {
803         if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0)
804             obj = LAMP;
805         if (HERE(URN) && game.prop[URN] == URN_DARK)
806             obj =  URN;
807         if (obj == INTRANSITIVE ||
808             (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0 &&
809              HERE(URN) && game.prop[URN] == URN_DARK))
810             return GO_UNKNOWN;
811     }
812
813     if (obj == URN) {
814         state_change(URN, game.prop[URN] == URN_EMPTY ?
815                      URN_EMPTY :
816                      URN_LIT);
817         return GO_CLEAROBJ;
818     } else {
819         if (obj != LAMP) {
820             rspeak(actions[verb].message);
821             return GO_CLEAROBJ;
822         }
823         if (game.limit < 0) {
824             rspeak(LAMP_OUT);
825             return GO_CLEAROBJ;
826         }
827         state_change(LAMP, LAMP_BRIGHT);
828         if (game.wzdark)
829             return GO_TOP;
830         else
831             return GO_CLEAROBJ;
832     }
833 }
834
835 static int listen(void)
836 /*  Listen.  Intransitive only.  Print stuff based on objsnd/locsnd. */
837 {
838     long sound = locations[game.loc].sound;
839     if (sound != SILENT) {
840         rspeak(sound);
841         if (!locations[game.loc].loud)
842             rspeak(NO_MESSAGE);
843         return GO_CLEAROBJ;
844     }
845     for (int i = 1; i <= NOBJECTS; i++) {
846         if (!HERE(i) ||
847             objects[i].sounds[0] == NULL ||
848             game.prop[i] < 0)
849             continue;
850         int mi =  game.prop[i];
851         if (i == BIRD)
852             mi += 3 * game.blooded;
853         long packed_zzword = token_to_packed(game.zzword);
854         pspeak(i, hear, mi, true, packed_zzword);
855         rspeak(NO_MESSAGE);
856         /* FIXME: Magic number, sensitive to bird state logic */
857         if (i == BIRD && game.prop[i] == 5)
858             DESTROY(BIRD);
859         return GO_CLEAROBJ;
860     }
861     rspeak(ALL_SILENT);
862     return GO_CLEAROBJ;
863 }
864
865 static int lock(token_t verb, token_t obj)
866 /* Lock, unlock, no object given.  Assume various things if present. */
867 {
868     if (obj == INTRANSITIVE) {
869         if (HERE(CLAM))
870             obj = CLAM;
871         if (HERE(OYSTER))
872             obj = OYSTER;
873         if (AT(DOOR))
874             obj = DOOR;
875         if (AT(GRATE))
876             obj = GRATE;
877         if (HERE(CHAIN))
878             obj = CHAIN;
879         if (obj == INTRANSITIVE) {
880             rspeak(NOTHING_LOCKED);
881             return GO_CLEAROBJ;
882         }
883     }
884
885     /*  Lock, unlock object.  Special stuff for opening clam/oyster
886      *  and for chain. */
887     if (obj == GRATE ||
888         obj == CHAIN) {
889         if (HERE(KEYS)) {
890             if (obj == CHAIN)
891                 return chain(verb);
892             if (game.closng) {
893                 rspeak(EXIT_CLOSED);
894                 if (!game.panic)
895                     game.clock2 = PANICTIME;
896                 game.panic = true;
897                 return GO_CLEAROBJ ;
898             } else {
899                 state_change(GRATE, (verb == LOCK) ?
900                              GRATE_CLOSED :
901                              GRATE_OPEN);
902                 return GO_CLEAROBJ;
903             }
904         }
905         rspeak(NO_KEYS);
906         return GO_CLEAROBJ;
907     }
908
909     switch (obj) {
910     case CLAM:
911     case OYSTER:
912         return bivalve(verb, obj);
913     case DOOR:
914         rspeak((game.prop[DOOR] == DOOR_UNRUSTED) ? OK_MAN : RUSTY_DOOR);
915         break;
916     case CAGE:
917         rspeak( NO_LOCK);
918         break;
919     case KEYS:
920         rspeak(CANNOT_UNLOCK);
921         break;
922     default:
923         rspeak(actions[verb].message);
924     }
925
926     return GO_CLEAROBJ;
927 }
928
929 static int pour(token_t verb, token_t obj)
930 /*  Pour.  If no object, or object is bottle, assume contents of bottle.
931  *  special tests for pouring water or oil on plant or rusty door. */
932 {
933     if (obj == BOTTLE ||
934         obj == NO_OBJECT)
935         obj = LIQUID();
936     if (obj == NO_OBJECT)
937         return GO_UNKNOWN;
938     if (!TOTING(obj)) {
939         rspeak(actions[verb].message);
940         return GO_CLEAROBJ;
941     }
942
943     if (obj != OIL && obj != WATER) {
944         rspeak(CANT_POUR);
945         return GO_CLEAROBJ;
946     }
947     if (HERE(URN) && game.prop[URN] == URN_EMPTY)
948         return fill(verb, URN);
949     game.prop[BOTTLE] = EMPTY_BOTTLE;
950     game.place[obj] = LOC_NOWHERE;
951     if (!(AT(PLANT) ||
952           AT(DOOR))) {
953         rspeak(GROUND_WET);
954         return GO_CLEAROBJ;
955     }
956     if (!AT(DOOR)) {
957         if (obj == WATER) {
958             /* cycle through the three plant states */
959             state_change(PLANT, MOD(game.prop[PLANT] + 1, 3));
960             game.prop[PLANT2] = game.prop[PLANT];
961             return GO_MOVE;
962         } else {
963             rspeak(SHAKING_LEAVES);
964             return GO_CLEAROBJ;
965         }
966     } else {
967         state_change(DOOR, (obj == OIL) ?
968                      DOOR_UNRUSTED :
969                      DOOR_RUSTED);
970         return GO_CLEAROBJ;
971     }
972 }
973
974 static int quit(void)
975 /*  Quit.  Intransitive only.  Verify intent and exit if that's what he wants. */
976 {
977     if (yes(arbitrary_messages[REALLY_QUIT], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
978         terminate(quitgame);
979     return GO_CLEAROBJ;
980 }
981
982 static int read(struct command_t command)
983 /*  Read.  Print stuff based on objtxt.  Oyster (?) is special case. */
984 {
985     if (command.obj == INTRANSITIVE) {
986         command.obj = 0;
987         for (int i = 1; i <= NOBJECTS; i++) {
988             if (HERE(i) && objects[i].texts[0] != NULL && game.prop[i] >= 0)
989                 command.obj = command.obj * NOBJECTS + i;
990         }
991         if (command.obj > NOBJECTS ||
992             command.obj == 0 ||
993             DARK(game.loc))
994             return GO_UNKNOWN;
995     }
996
997     if (DARK(game.loc)) {
998         sspeak(NO_SEE, command.raw1);
999     } else if (command.obj == OYSTER && !game.clshnt && game.closed) {
1000         game.clshnt = yes(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
1001     } else if (objects[command.obj].texts[0] == NULL ||
1002                game.prop[command.obj] < 0) {
1003         rspeak(actions[command.verb].message);
1004     } else
1005         pspeak(command.obj, study, game.prop[command.obj], true);
1006     return GO_CLEAROBJ;
1007 }
1008
1009 static int reservoir(void)
1010 /*  Z'ZZZ (word gets recomputed at startup; different each game). */
1011 {
1012     /* FIXME: Arithmetic on state numbers */
1013     if (!AT(RESER) && game.loc != game.fixed[RESER] - 1) {
1014         rspeak(NOTHING_HAPPENS);
1015         return GO_CLEAROBJ;
1016     } else {
1017         /* FIXME: Arithmetic on state numbers */
1018         pspeak(RESER, look, game.prop[RESER] + 1, true);
1019         game.prop[RESER] = 1 - game.prop[RESER];
1020         if (AT(RESER))
1021             return GO_CLEAROBJ;
1022         else {
1023             game.oldlc2 = game.loc;
1024             game.newloc = LOC_NOWHERE;
1025             rspeak(NOT_BRIGHT);
1026             return GO_TERMINATE;
1027         }
1028     }
1029 }
1030
1031 static int rub(token_t verb, token_t obj)
1032 /* Rub.  Yields various snide remarks except for lit urn. */
1033 {
1034     if (obj == URN && game.prop[URN] == URN_LIT) {
1035         DESTROY(URN);
1036         drop(AMBER, game.loc);
1037         game.prop[AMBER] = AMBER_IN_ROCK;
1038         --game.tally;
1039         drop(CAVITY, game.loc);
1040         rspeak(URN_GENIES);
1041     } else if (obj != LAMP) {
1042         rspeak(PECULIAR_NOTHING);
1043     } else {
1044         rspeak(actions[verb].message);
1045     }
1046     return GO_CLEAROBJ;
1047 }
1048
1049 static int say(struct command_t *command)
1050 /* Say.  Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).)  Magic words override. */
1051 {
1052     if (command->wd2 > 0) {
1053         command->wd1 = command->wd2;
1054         strcpy(command->raw1, command->raw2);
1055     }
1056     char word1[TOKLEN + 1];
1057     packed_to_token(command->wd1, word1);
1058     int wd = (int) get_vocab_id(word1);
1059     /* FIXME: magic numbers */
1060     if (wd == MOTION_WORD(XYZZY) ||
1061         wd == MOTION_WORD(PLUGH) ||
1062         wd == MOTION_WORD(PLOVER) ||
1063         wd == ACTION_WORD(GIANTWORDS) ||
1064         wd == ACTION_WORD(PART)) {
1065         /* FIXME: scribbles on the interpreter's command block */
1066         wordclear(&command->wd2);
1067         return GO_LOOKUP;
1068     }
1069     sspeak(OKEY_DOKEY, command->raw1);
1070     return GO_CLEAROBJ;
1071 }
1072
1073 static int throw_support(long spk)
1074 {
1075     rspeak(spk);
1076     drop(AXE, game.loc);
1077     return GO_MOVE;
1078 }
1079
1080 static int throw (struct command_t *command)
1081 /*  Throw.  Same as discard unless axe.  Then same as attack except
1082  *  ignore bird, and if dwarf is present then one might be killed.
1083  *  (Only way to do so!)  Axe also special for dragon, bear, and
1084  *  troll.  Treasures special for troll. */
1085 {
1086     if (TOTING(ROD2) && command->obj == ROD && !TOTING(ROD))
1087         command->obj = ROD2;
1088     if (!TOTING(command->obj)) {
1089         rspeak(actions[command->verb].message);
1090         return GO_CLEAROBJ;
1091     }
1092     if (objects[command->obj].is_treasure && AT(TROLL)) {
1093         /*  Snarf a treasure for the troll. */
1094         drop(command->obj, LOC_NOWHERE);
1095         move(TROLL, LOC_NOWHERE);
1096         move(TROLL + NOBJECTS, LOC_NOWHERE);
1097         drop(TROLL2, objects[TROLL].plac);
1098         drop(TROLL2 + NOBJECTS, objects[TROLL].fixd);
1099         juggle(CHASM);
1100         rspeak(TROLL_SATISFIED);
1101         return GO_CLEAROBJ;
1102     }
1103     if (command->obj == FOOD && HERE(BEAR)) {
1104         /* But throwing food is another story. */
1105         command->obj = BEAR;
1106         return (feed(command->verb, command->obj));
1107     }
1108     if (command->obj != AXE)
1109         return (discard(command->verb, command->obj, false));
1110     else {
1111         if (atdwrf(game.loc) <= 0) {
1112             if (AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS)
1113                 return throw_support(DRAGON_SCALES);
1114             if (AT(TROLL))
1115                 return throw_support(TROLL_RETURNS);
1116             else if (AT(OGRE))
1117                 return throw_support(OGRE_DODGE);
1118             else if (HERE(BEAR) && game.prop[BEAR] == UNTAMED_BEAR) {
1119                 /* This'll teach him to throw the axe at the bear! */
1120                 drop(AXE, game.loc);
1121                 game.fixed[AXE] = -1;
1122                 juggle(BEAR);
1123                 state_change(AXE, AXE_LOST);
1124                 return GO_CLEAROBJ;
1125             }
1126             command->obj = NO_OBJECT;
1127             return (attack(command));
1128         }
1129
1130         if (randrange(NDWARVES + 1) < game.dflag) {
1131             return throw_support(DWARF_DODGES);
1132         } else {
1133             long i = atdwrf(game.loc);
1134             game.dseen[i] = false;
1135             game.dloc[i] = LOC_NOWHERE;
1136             return throw_support((++game.dkill == 1) ?
1137                                  DWARF_SMOKE :
1138                                  KILLED_DWARF);
1139         }
1140     }
1141 }
1142
1143 static int wake(token_t verb, token_t obj)
1144 /* Wake.  Only use is to disturb the dwarves. */
1145 {
1146     if (obj != DWARF ||
1147         !game.closed) {
1148         rspeak(actions[verb].message);
1149         return GO_CLEAROBJ;
1150     } else {
1151         rspeak(PROD_DWARF);
1152         return GO_DWARFWAKE;
1153     }
1154 }
1155
1156 static int wave(token_t verb, token_t obj)
1157 /* Wave.  No effect unless waving rod at fissure or at bird. */
1158 {
1159     if (obj != ROD ||
1160         !TOTING(obj) ||
1161         (!HERE(BIRD) &&
1162          (game.closng ||
1163           !AT(FISSURE)))) {
1164         rspeak(((!TOTING(obj)) && (obj != ROD ||
1165                                    !TOTING(ROD2))) ?
1166                ARENT_CARRYING :
1167                actions[verb].message);
1168         return GO_CLEAROBJ;
1169     }
1170
1171     if (game.prop[BIRD] == BIRD_UNCAGED && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
1172         drop(JADE, game.loc);
1173         game.prop[JADE] = 0;
1174         --game.tally;
1175         rspeak(NECKLACE_FLY);
1176         return GO_CLEAROBJ;
1177     } else {
1178         if (game.closed) {
1179             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1180                    CAGE_FLY :
1181                    FREE_FLY);
1182             return GO_DWARFWAKE;
1183         }
1184         if (game.closng ||
1185             !AT(FISSURE)) {
1186             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1187                    CAGE_FLY :
1188                    FREE_FLY);
1189             return GO_CLEAROBJ;
1190         }
1191         if (HERE(BIRD))
1192             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1193                    CAGE_FLY :
1194                    FREE_FLY);
1195
1196         /* FIXME: Arithemetic on property values */
1197         game.prop[FISSURE] = 1 - game.prop[FISSURE];
1198         pspeak(FISSURE, look, 2 - game.prop[FISSURE], true);
1199         return GO_CLEAROBJ;
1200     }
1201 }
1202
1203 int action(struct command_t *command)
1204 /*  Analyse a verb.  Remember what it was, go back for object if second word
1205  *  unless verb is "say", which snarfs arbitrary second word.
1206  */
1207 {
1208     if (command->part == unknown) {
1209         /*  Analyse an object word.  See if the thing is here, whether
1210          *  we've got a verb yet, and so on.  Object must be here
1211          *  unless verb is "find" or "invent(ory)" (and no new verb
1212          *  yet to be analysed).  Water and oil are also funny, since
1213          *  they are never actually dropped at any location, but might
1214          *  be here inside the bottle or urn or as a feature of the
1215          *  location. */
1216         if (HERE(command->obj))
1217             /* FALL THROUGH */;
1218         else if (command->obj == GRATE) {
1219             if (game.loc == LOC_START ||
1220                 game.loc == LOC_VALLEY ||
1221                 game.loc == LOC_SLIT) {
1222                 command->obj = DPRSSN;
1223             }
1224             if (game.loc == LOC_COBBLE ||
1225                 game.loc == LOC_DEBRIS ||
1226                 game.loc == LOC_AWKWARD ||
1227                 game.loc == LOC_BIRD ||
1228                 game.loc == LOC_PITTOP) {
1229                 command->obj = ENTRNC;
1230             }
1231         } else if (command->obj == DWARF && atdwrf(game.loc) > 0)
1232             /* FALL THROUGH */;
1233         else if ((LIQUID() == command->obj && HERE(BOTTLE)) ||
1234                  command->obj == LIQLOC(game.loc))
1235             /* FALL THROUGH */;
1236         else if (command->obj == OIL && HERE(URN) && game.prop[URN] != 0) {
1237             command->obj = URN;
1238             /* FALL THROUGH */;
1239         } else if (command->obj == PLANT && AT(PLANT2) && game.prop[PLANT2] != 0) {
1240             command->obj = PLANT2;
1241             /* FALL THROUGH */;
1242         } else if (command->obj == KNIFE && game.knfloc == game.loc) {
1243             game.knfloc = -1;
1244             rspeak(KNIVES_VANISH);
1245             return GO_CLEAROBJ;
1246         } else if (command->obj == ROD && HERE(ROD2)) {
1247             command->obj = ROD2;
1248             /* FALL THROUGH */;
1249         } else if ((command->verb == FIND ||
1250                     command->verb == INVENTORY) && command->wd2 <= 0)
1251             /* FALL THROUGH */;
1252         else {
1253             sspeak(NO_SEE, command->raw1);
1254             return GO_CLEAROBJ;
1255         }
1256
1257         if (command->wd2 > 0)
1258             return GO_WORD2;
1259         if (command->verb != 0)
1260             command->part = transitive;
1261     }
1262
1263     switch (command->part) {
1264     case intransitive:
1265         if (command->wd2 > 0 && command->verb != SAY)
1266             return GO_WORD2;
1267         if (command->verb == SAY)
1268             command->obj = command->wd2;
1269         if (command->obj == 0 ||
1270             command->obj == INTRANSITIVE) {
1271             /*  Analyse an intransitive verb (ie, no object given yet). */
1272             switch (command->verb) {
1273             case CARRY:
1274                 return vcarry(command->verb, INTRANSITIVE);
1275             case  DROP:
1276                 return GO_UNKNOWN;
1277             case  SAY:
1278                 return GO_UNKNOWN;
1279             case  UNLOCK:
1280                 return lock(command->verb, INTRANSITIVE);
1281             case  NOTHING: {
1282                 rspeak(OK_MAN);
1283                 return (GO_CLEAROBJ);
1284             }
1285             case  LOCK:
1286                 return lock(command->verb, INTRANSITIVE);
1287             case  LIGHT:
1288                 return light(command->verb, INTRANSITIVE);
1289             case  EXTINGUISH:
1290                 return extinguish(command->verb, INTRANSITIVE);
1291             case  WAVE:
1292                 return GO_UNKNOWN;
1293             case  TAME:
1294                 return GO_UNKNOWN;
1295             case GO: {
1296                 rspeak(actions[command->verb].message);
1297                 return GO_CLEAROBJ;
1298             }
1299             case ATTACK:
1300                 return attack(command);
1301             case POUR:
1302                 return pour(command->verb, command->obj);
1303             case EAT:
1304                 return eat(command->verb, INTRANSITIVE);
1305             case DRINK:
1306                 return drink(command->verb, command->obj);
1307             case RUB:
1308                 return GO_UNKNOWN;
1309             case THROW:
1310                 return GO_UNKNOWN;
1311             case QUIT:
1312                 return quit();
1313             case FIND:
1314                 return GO_UNKNOWN;
1315             case INVENTORY:
1316                 return inven();
1317             case FEED:
1318                 return GO_UNKNOWN;
1319             case FILL:
1320                 return fill(command->verb, command->obj);
1321             case BLAST:
1322                 blast();
1323                 return GO_CLEAROBJ;
1324             case SCORE:
1325                 score(scoregame);
1326                 return GO_CLEAROBJ;
1327             case GIANTWORDS:
1328                 return bigwords(command->wd1);
1329             case BRIEF:
1330                 return brief();
1331             case READ:
1332                 command->obj = INTRANSITIVE;
1333                 return read(*command);
1334             case BREAK:
1335                 return GO_UNKNOWN;
1336             case WAKE:
1337                 return GO_UNKNOWN;
1338             case SAVE:
1339                 return suspend();
1340             case RESUME:
1341                 return resume();
1342             case FLY:
1343                 return fly(command->verb, INTRANSITIVE);
1344             case LISTEN:
1345                 return listen();
1346             case PART:
1347                 return reservoir();
1348             default:
1349                 BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
1350             }
1351         }
1352     /* FALLTHRU */
1353     case transitive:
1354         /*  Analyse a transitive verb. */
1355         switch (command->verb) {
1356         case  CARRY:
1357             return vcarry(command->verb, command->obj);
1358         case  DROP:
1359             return discard(command->verb, command->obj, false);
1360         case  SAY:
1361             return say(command);
1362         case  UNLOCK:
1363             return lock(command->verb, command->obj);
1364         case  NOTHING: {
1365             rspeak(OK_MAN);
1366             return (GO_CLEAROBJ);
1367         }
1368         case  LOCK:
1369             return lock(command->verb, command->obj);
1370         case LIGHT:
1371             return light(command->verb, command->obj);
1372         case EXTINGUISH:
1373             return extinguish(command->verb, command->obj);
1374         case WAVE:
1375             return wave(command->verb, command->obj);
1376         case TAME: {
1377             rspeak(actions[command->verb].message);
1378             return GO_CLEAROBJ;
1379         }
1380         case GO: {
1381             rspeak(actions[command->verb].message);
1382             return GO_CLEAROBJ;
1383         }
1384         case ATTACK:
1385             return attack(command);
1386         case POUR:
1387             return pour(command->verb, command->obj);
1388         case EAT:
1389             return eat(command->verb, command->obj);
1390         case DRINK:
1391             return drink(command->verb, command->obj);
1392         case RUB:
1393             return rub(command->verb, command->obj);
1394         case THROW:
1395             return throw (command);
1396         case QUIT: {
1397             rspeak(actions[command->verb].message);
1398             return GO_CLEAROBJ;
1399         }
1400         case FIND:
1401             return find(command->verb, command->obj);
1402         case INVENTORY:
1403             return find(command->verb, command->obj);
1404         case FEED:
1405             return feed(command->verb, command->obj);
1406         case FILL:
1407             return fill(command->verb, command->obj);
1408         case BLAST:
1409             blast();
1410             return GO_CLEAROBJ;
1411         case SCORE: {
1412             rspeak(actions[command->verb].message);
1413             return GO_CLEAROBJ;
1414         }
1415         case GIANTWORDS: {
1416             rspeak(actions[command->verb].message);
1417             return GO_CLEAROBJ;
1418         }
1419         case BRIEF: {
1420             rspeak(actions[command->verb].message);
1421             return GO_CLEAROBJ;
1422         }
1423         case READ:
1424             return read(*command);
1425         case BREAK:
1426             return vbreak(command->verb, command->obj);
1427         case WAKE:
1428             return wake(command->verb, command->obj);
1429         case SAVE: {
1430             rspeak(actions[command->verb].message);
1431             return GO_CLEAROBJ;
1432         }
1433         case RESUME: {
1434             rspeak(actions[command->verb].message);
1435             return GO_CLEAROBJ;
1436         }
1437         case FLY:
1438             return fly(command->verb, command->obj);
1439         case LISTEN: {
1440             rspeak(actions[command->verb].message);
1441             return GO_CLEAROBJ;
1442         }
1443         case PART:
1444             return reservoir();
1445         default:
1446             BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
1447         }
1448     case unknown:
1449         /* Unknown verb, couldn't deduce object - might need hint */
1450         sspeak(WHAT_DO, command->raw1);
1451         return GO_CHECKHINT;
1452     default:
1453         BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN); // LCOV_EXCL_LINE
1454     }
1455 }