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