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