5ead1f22d234ed0e259a3d5981c09af74829ff8d
[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     switch (obj) {
628     case BIRD:
629         rspeak(BIRD_PINING);
630         break;
631
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             rspeak(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         }
669         break;
670     case OGRE:
671         if (HERE(FOOD))
672             rspeak(OGRE_FULL);
673         else
674             rspeak(actions[verb].message);
675         break;
676     default:
677         rspeak(AM_GAME);
678     }
679     return GO_CLEAROBJ;
680 }
681
682 int fill(token_t verb, token_t obj)
683 /*  Fill.  Bottle or urn must be empty, and liquid available.  (Vase
684  *  is nasty.) */
685 {
686     if (obj == VASE) {
687         if (LIQLOC(game.loc) == NO_OBJECT) {
688             rspeak(FILL_INVALID);
689             return GO_CLEAROBJ;
690         }
691         if (!TOTING(VASE)) {
692             rspeak(ARENT_CARRYING);
693             return GO_CLEAROBJ;
694         }
695         rspeak(SHATTER_VASE);
696         game.prop[VASE] = VASE_BROKEN;
697         game.fixed[VASE] = IS_FIXED;
698         return (discard(verb, VASE, true));
699     }
700
701     if (obj == URN) {
702         if (game.prop[URN] != URN_EMPTY) {
703             rspeak(FULL_URN);
704             return GO_CLEAROBJ;
705         }
706         if (!HERE(BOTTLE)) {
707             rspeak(FILL_INVALID);
708             return GO_CLEAROBJ;
709         }
710         int k = LIQUID();
711         switch (k) {
712         case WATER:
713             game.prop[BOTTLE] = EMPTY_BOTTLE;
714             rspeak(WATER_URN);
715             break;
716         case OIL:
717             game.prop[URN] = URN_DARK;
718             game.prop[BOTTLE] = EMPTY_BOTTLE;
719             rspeak(OIL_URN);
720             break;
721         case NO_OBJECT:
722         default:
723             rspeak(FILL_INVALID);
724             return GO_CLEAROBJ;
725         }
726         game.place[k] = LOC_NOWHERE;
727         return GO_CLEAROBJ;
728     }
729     if (obj != NO_OBJECT && obj != BOTTLE) {
730         rspeak(actions[verb].message);
731         return GO_CLEAROBJ;
732     }
733     if (obj == NO_OBJECT && !HERE(BOTTLE))
734         return GO_UNKNOWN;
735
736     if (HERE(URN) && game.prop[URN] != URN_EMPTY) {
737         rspeak(URN_NOPOUR);
738         return GO_CLEAROBJ;
739     }
740     if (LIQUID() != NO_OBJECT) {
741         rspeak(BOTTLE_FULL);
742         return GO_CLEAROBJ;
743     }
744     if (LIQLOC(game.loc) == NO_OBJECT) {
745         rspeak(NO_LIQUID);
746         return GO_CLEAROBJ;
747     }
748
749     state_change(BOTTLE, (LIQLOC(game.loc) == OIL)
750                  ? OIL_BOTTLE
751                  : WATER_BOTTLE);
752     if (TOTING(BOTTLE))
753         game.place[LIQUID()] = CARRIED;
754     return GO_CLEAROBJ;
755 }
756
757 static int find(token_t verb, token_t obj)
758 /* Find.  Might be carrying it, or it might be here.  Else give caveat. */
759 {
760     if (TOTING(obj)) {
761         rspeak(ALREADY_CARRYING);
762         return GO_CLEAROBJ;
763     }
764
765     if (game.closed) {
766         rspeak(NEEDED_NEARBY);
767         return GO_CLEAROBJ;
768     }
769
770     if (AT(obj) ||
771         (LIQUID() == obj && AT(BOTTLE)) ||
772         obj == LIQLOC(game.loc) ||
773         (obj == DWARF && atdwrf(game.loc) > 0)) {
774         rspeak(YOU_HAVEIT);
775         return GO_CLEAROBJ;
776     }
777
778
779     rspeak(actions[verb].message);
780     return GO_CLEAROBJ;
781 }
782
783 static int fly(token_t verb, token_t obj)
784 /* Fly.  Snide remarks unless hovering rug is here. */
785 {
786     if (obj == INTRANSITIVE) {
787         if (!HERE(RUG)) {
788             rspeak(FLAP_ARMS);
789             return GO_CLEAROBJ;
790         }
791         if (game.prop[RUG] != RUG_HOVER) {
792             rspeak(RUG_NOTHING2);
793             return GO_CLEAROBJ;
794         }
795         obj = RUG;
796     }
797
798     if (obj != RUG) {
799         rspeak(actions[verb].message);
800         return GO_CLEAROBJ;
801     }
802     if (game.prop[RUG] != RUG_HOVER) {
803         rspeak(RUG_NOTHING1);
804         return GO_CLEAROBJ;
805     }
806     game.oldlc2 = game.oldloc;
807     game.oldloc = game.loc;
808     /* FIXME: Arithmetic on location values */
809     game.newloc = game.place[RUG] + game.fixed[RUG] - game.loc;
810
811     if (game.prop[SAPPH] == STATE_NOTFOUND) {
812         rspeak(RUG_GOES);
813     } else {
814         rspeak(RUG_RETURNS);
815     }
816     return GO_TERMINATE;
817 }
818
819 static int inven(void)
820 /* Inventory. If object, treat same as find.  Else report on current burden. */
821 {
822     bool empty = true;
823     for (int i = 1; i <= NOBJECTS; i++) {
824         if (i == BEAR ||
825             !TOTING(i))
826             continue;
827         if (empty) {
828             rspeak(NOW_HOLDING);
829             empty = false;
830         }
831         pspeak(i, touch, -1, false);
832     }
833     if (TOTING(BEAR))
834         rspeak(TAME_BEAR);
835     if (empty)
836         rspeak(NO_CARRY);
837     return GO_CLEAROBJ;
838 }
839
840 static int light(token_t verb, token_t obj)
841 /*  Light.  Applicable only to lamp and urn. */
842 {
843     if (obj == INTRANSITIVE) {
844         if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0)
845             obj = LAMP;
846         if (HERE(URN) && game.prop[URN] == URN_DARK)
847             obj =  URN;
848         if (obj == INTRANSITIVE ||
849             (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0 &&
850              HERE(URN) && game.prop[URN] == URN_DARK))
851             return GO_UNKNOWN;
852     }
853
854     if (obj == URN) {
855         state_change(URN, game.prop[URN] == URN_EMPTY ?
856                      URN_EMPTY :
857                      URN_LIT);
858         return GO_CLEAROBJ;
859     } else {
860         if (obj != LAMP) {
861             rspeak(actions[verb].message);
862             return GO_CLEAROBJ;
863         }
864         if (game.limit < 0) {
865             rspeak(LAMP_OUT);
866             return GO_CLEAROBJ;
867         }
868         state_change(LAMP, LAMP_BRIGHT);
869         if (game.wzdark)
870             return GO_TOP;
871         else
872             return GO_CLEAROBJ;
873     }
874 }
875
876 static int listen(void)
877 /*  Listen.  Intransitive only.  Print stuff based on object sound proprties. */
878 {
879     long sound = locations[game.loc].sound;
880     if (sound != SILENT) {
881         rspeak(sound);
882         if (!locations[game.loc].loud)
883             rspeak(NO_MESSAGE);
884         return GO_CLEAROBJ;
885     }
886     for (int i = 1; i <= NOBJECTS; i++) {
887         if (!HERE(i) ||
888             objects[i].sounds[0] == NULL ||
889             game.prop[i] < 0)
890             continue;
891         int mi =  game.prop[i];
892         if (i == BIRD)
893             mi += 3 * game.blooded;
894         long packed_zzword = token_to_packed(game.zzword);
895         pspeak(i, hear, mi, true, packed_zzword);
896         rspeak(NO_MESSAGE);
897         if (i == BIRD && mi == BIRD_ENDSTATE)
898             DESTROY(BIRD);
899         return GO_CLEAROBJ;
900     }
901     rspeak(ALL_SILENT);
902     return GO_CLEAROBJ;
903 }
904
905 static int lock(token_t verb, token_t obj)
906 /* Lock, unlock, no object given.  Assume various things if present. */
907 {
908     if (obj == INTRANSITIVE) {
909         if (HERE(CLAM))
910             obj = CLAM;
911         if (HERE(OYSTER))
912             obj = OYSTER;
913         if (AT(DOOR))
914             obj = DOOR;
915         if (AT(GRATE))
916             obj = GRATE;
917         if (HERE(CHAIN))
918             obj = CHAIN;
919         if (obj == INTRANSITIVE) {
920             rspeak(NOTHING_LOCKED);
921             return GO_CLEAROBJ;
922         }
923     }
924
925     /*  Lock, unlock object.  Special stuff for opening clam/oyster
926      *  and for chain. */
927     if (obj == GRATE ||
928         obj == CHAIN) {
929         if (HERE(KEYS)) {
930             if (obj == CHAIN)
931                 return chain(verb);
932             if (game.closng) {
933                 rspeak(EXIT_CLOSED);
934                 if (!game.panic)
935                     game.clock2 = PANICTIME;
936                 game.panic = true;
937                 return GO_CLEAROBJ ;
938             } else {
939                 state_change(GRATE, (verb == LOCK) ?
940                              GRATE_CLOSED :
941                              GRATE_OPEN);
942                 return GO_CLEAROBJ;
943             }
944         }
945         rspeak(NO_KEYS);
946         return GO_CLEAROBJ;
947     }
948
949     switch (obj) {
950     case CLAM:
951         if (verb == LOCK)
952             rspeak(HUH_MAN);
953         else if (!TOTING(TRIDENT))
954             rspeak(OYSTER_OPENER);
955         else {
956             DESTROY(CLAM);
957             drop(OYSTER, game.loc);
958             drop(PEARL, LOC_CULDESAC);
959             rspeak(PEARL_FALLS);
960         }
961         return GO_CLEAROBJ;
962     case OYSTER:
963         if (verb == LOCK)
964             rspeak(HUH_MAN);
965         else
966             rspeak(OYSTER_OPENER);
967
968         return GO_CLEAROBJ;
969     case DOOR:
970         rspeak((game.prop[DOOR] == DOOR_UNRUSTED) ? OK_MAN : RUSTY_DOOR);
971         break;
972     case CAGE:
973         rspeak( NO_LOCK);
974         break;
975     case KEYS:
976         rspeak(CANNOT_UNLOCK);
977         break;
978     default:
979         rspeak(actions[verb].message);
980     }
981
982     return GO_CLEAROBJ;
983 }
984
985 static int pour(token_t verb, token_t obj)
986 /*  Pour.  If no object, or object is bottle, assume contents of bottle.
987  *  special tests for pouring water or oil on plant or rusty door. */
988 {
989     if (obj == BOTTLE ||
990         obj == NO_OBJECT)
991         obj = LIQUID();
992     if (obj == NO_OBJECT)
993         return GO_UNKNOWN;
994     if (!TOTING(obj)) {
995         rspeak(actions[verb].message);
996         return GO_CLEAROBJ;
997     }
998
999     if (obj != OIL && obj != WATER) {
1000         rspeak(CANT_POUR);
1001         return GO_CLEAROBJ;
1002     }
1003     if (HERE(URN) && game.prop[URN] == URN_EMPTY)
1004         return fill(verb, URN);
1005     game.prop[BOTTLE] = EMPTY_BOTTLE;
1006     game.place[obj] = LOC_NOWHERE;
1007     if (!(AT(PLANT) ||
1008           AT(DOOR))) {
1009         rspeak(GROUND_WET);
1010         return GO_CLEAROBJ;
1011     }
1012     if (!AT(DOOR)) {
1013         if (obj == WATER) {
1014             /* cycle through the three plant states */
1015             state_change(PLANT, MOD(game.prop[PLANT] + 1, 3));
1016             game.prop[PLANT2] = game.prop[PLANT];
1017             return GO_MOVE;
1018         } else {
1019             rspeak(SHAKING_LEAVES);
1020             return GO_CLEAROBJ;
1021         }
1022     } else {
1023         state_change(DOOR, (obj == OIL) ?
1024                      DOOR_UNRUSTED :
1025                      DOOR_RUSTED);
1026         return GO_CLEAROBJ;
1027     }
1028 }
1029
1030 static int quit(void)
1031 /*  Quit.  Intransitive only.  Verify intent and exit if that's what he wants. */
1032 {
1033     if (yes(arbitrary_messages[REALLY_QUIT], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
1034         terminate(quitgame);
1035     return GO_CLEAROBJ;
1036 }
1037
1038 static int read(struct command_t command)
1039 /*  Read.  Print stuff based on objtxt.  Oyster (?) is special case. */
1040 {
1041     if (command.obj == INTRANSITIVE) {
1042         command.obj = 0;
1043         for (int i = 1; i <= NOBJECTS; i++) {
1044             if (HERE(i) && objects[i].texts[0] != NULL && game.prop[i] >= 0)
1045                 command.obj = command.obj * NOBJECTS + i;
1046         }
1047         if (command.obj > NOBJECTS ||
1048             command.obj == 0 ||
1049             DARK(game.loc))
1050             return GO_UNKNOWN;
1051     }
1052
1053     if (DARK(game.loc)) {
1054         sspeak(NO_SEE, command.raw1);
1055     } else if (command.obj == OYSTER && !game.clshnt && game.closed) {
1056         game.clshnt = yes(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
1057     } else if (objects[command.obj].texts[0] == NULL ||
1058                game.prop[command.obj] < 0) {
1059         rspeak(actions[command.verb].message);
1060     } else
1061         pspeak(command.obj, study, game.prop[command.obj], true);
1062     return GO_CLEAROBJ;
1063 }
1064
1065 static int reservoir(void)
1066 /*  Z'ZZZ (word gets recomputed at startup; different each game). */
1067 {
1068     /* FIXME: Arithmetic on state numbers */
1069     if (!AT(RESER) && game.loc != game.fixed[RESER] - 1) {
1070         rspeak(NOTHING_HAPPENS);
1071         return GO_CLEAROBJ;
1072     } else {
1073         state_change(RESER,
1074                      game.prop[RESER] == WATERS_PARTED ? WATERS_UNPARTED : WATERS_PARTED);
1075         if (AT(RESER))
1076             return GO_CLEAROBJ;
1077         else {
1078             game.oldlc2 = game.loc;
1079             game.newloc = LOC_NOWHERE;
1080             rspeak(NOT_BRIGHT);
1081             return GO_TERMINATE;
1082         }
1083     }
1084 }
1085
1086 static int rub(token_t verb, token_t obj)
1087 /* Rub.  Yields various snide remarks except for lit urn. */
1088 {
1089     if (obj == URN && game.prop[URN] == URN_LIT) {
1090         DESTROY(URN);
1091         drop(AMBER, game.loc);
1092         game.prop[AMBER] = AMBER_IN_ROCK;
1093         --game.tally;
1094         drop(CAVITY, game.loc);
1095         rspeak(URN_GENIES);
1096     } else if (obj != LAMP) {
1097         rspeak(PECULIAR_NOTHING);
1098     } else {
1099         rspeak(actions[verb].message);
1100     }
1101     return GO_CLEAROBJ;
1102 }
1103
1104 static int say(struct command_t *command)
1105 /* Say.  Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).)  Magic words override. */
1106 {
1107     if (command->wd2 > 0) {
1108         command->wd1 = command->wd2;
1109         strcpy(command->raw1, command->raw2);
1110     }
1111     char word1[TOKLEN + 1];
1112     packed_to_token(command->wd1, word1);
1113     int wd = (int) get_vocab_id(word1);
1114     if (wd == MOTION_WORD(XYZZY) ||
1115         wd == MOTION_WORD(PLUGH) ||
1116         wd == MOTION_WORD(PLOVER) ||
1117         wd == ACTION_WORD(GIANTWORDS) ||
1118         wd == ACTION_WORD(PART)) {
1119         /* FIXME: scribbles on the interpreter's command block */
1120         wordclear(&command->wd2);
1121         return GO_LOOKUP;
1122     }
1123     sspeak(OKEY_DOKEY, command->raw1);
1124     return GO_CLEAROBJ;
1125 }
1126
1127 static int throw_support(long spk)
1128 {
1129     rspeak(spk);
1130     drop(AXE, game.loc);
1131     return GO_MOVE;
1132 }
1133
1134 static int throw (struct command_t *command)
1135 /*  Throw.  Same as discard unless axe.  Then same as attack except
1136  *  ignore bird, and if dwarf is present then one might be killed.
1137  *  (Only way to do so!)  Axe also special for dragon, bear, and
1138  *  troll.  Treasures special for troll. */
1139 {
1140     if (!TOTING(command->obj)) {
1141         rspeak(actions[command->verb].message);
1142         return GO_CLEAROBJ;
1143     }
1144     if (objects[command->obj].is_treasure && AT(TROLL)) {
1145         /*  Snarf a treasure for the troll. */
1146         drop(command->obj, LOC_NOWHERE);
1147         move(TROLL, LOC_NOWHERE);
1148         move(TROLL + NOBJECTS, LOC_NOWHERE);
1149         drop(TROLL2, objects[TROLL].plac);
1150         drop(TROLL2 + NOBJECTS, objects[TROLL].fixd);
1151         juggle(CHASM);
1152         rspeak(TROLL_SATISFIED);
1153         return GO_CLEAROBJ;
1154     }
1155     if (command->obj == FOOD && HERE(BEAR)) {
1156         /* But throwing food is another story. */
1157         command->obj = BEAR;
1158         return (feed(command->verb, command->obj));
1159     }
1160     if (command->obj != AXE)
1161         return (discard(command->verb, command->obj, false));
1162     else {
1163         if (atdwrf(game.loc) <= 0) {
1164             if (AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS)
1165                 return throw_support(DRAGON_SCALES);
1166             if (AT(TROLL))
1167                 return throw_support(TROLL_RETURNS);
1168             else if (AT(OGRE))
1169                 return throw_support(OGRE_DODGE);
1170             else if (HERE(BEAR) && game.prop[BEAR] == UNTAMED_BEAR) {
1171                 /* This'll teach him to throw the axe at the bear! */
1172                 drop(AXE, game.loc);
1173                 game.fixed[AXE] = IS_FIXED;
1174                 juggle(BEAR);
1175                 state_change(AXE, AXE_LOST);
1176                 return GO_CLEAROBJ;
1177             }
1178             command->obj = NO_OBJECT;
1179             return (attack(command));
1180         }
1181
1182         if (randrange(NDWARVES + 1) < game.dflag) {
1183             return throw_support(DWARF_DODGES);
1184         } else {
1185             long i = atdwrf(game.loc);
1186             game.dseen[i] = false;
1187             game.dloc[i] = LOC_NOWHERE;
1188             return throw_support((++game.dkill == 1) ?
1189                                  DWARF_SMOKE :
1190                                  KILLED_DWARF);
1191         }
1192     }
1193 }
1194
1195 static int wake(token_t verb, token_t obj)
1196 /* Wake.  Only use is to disturb the dwarves. */
1197 {
1198     if (obj != DWARF ||
1199         !game.closed) {
1200         rspeak(actions[verb].message);
1201         return GO_CLEAROBJ;
1202     } else {
1203         rspeak(PROD_DWARF);
1204         return GO_DWARFWAKE;
1205     }
1206 }
1207
1208 static int wave(token_t verb, token_t obj)
1209 /* Wave.  No effect unless waving rod at fissure or at bird. */
1210 {
1211     if (obj != ROD ||
1212         !TOTING(obj) ||
1213         (!HERE(BIRD) &&
1214          (game.closng ||
1215           !AT(FISSURE)))) {
1216         rspeak(((!TOTING(obj)) && (obj != ROD ||
1217                                    !TOTING(ROD2))) ?
1218                ARENT_CARRYING :
1219                actions[verb].message);
1220         return GO_CLEAROBJ;
1221     }
1222
1223     if (game.prop[BIRD] == BIRD_UNCAGED && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
1224         drop(JADE, game.loc);
1225         game.prop[JADE] = STATE_FOUND;
1226         --game.tally;
1227         rspeak(NECKLACE_FLY);
1228         return GO_CLEAROBJ;
1229     } else {
1230         if (game.closed) {
1231             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1232                    CAGE_FLY :
1233                    FREE_FLY);
1234             return GO_DWARFWAKE;
1235         }
1236         if (game.closng ||
1237             !AT(FISSURE)) {
1238             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1239                    CAGE_FLY :
1240                    FREE_FLY);
1241             return GO_CLEAROBJ;
1242         }
1243         if (HERE(BIRD))
1244             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1245                    CAGE_FLY :
1246                    FREE_FLY);
1247
1248         state_change(FISSURE,
1249                      game.prop[FISSURE] == BRIDGED ? UNBRIDGED : BRIDGED);
1250         return GO_CLEAROBJ;
1251     }
1252 }
1253
1254 int action(struct command_t *command)
1255 /*  Analyse a verb.  Remember what it was, go back for object if second word
1256  *  unless verb is "say", which snarfs arbitrary second word.
1257  */
1258 {
1259     if (command->part == unknown) {
1260         /*  Analyse an object word.  See if the thing is here, whether
1261          *  we've got a verb yet, and so on.  Object must be here
1262          *  unless verb is "find" or "invent(ory)" (and no new verb
1263          *  yet to be analysed).  Water and oil are also funny, since
1264          *  they are never actually dropped at any location, but might
1265          *  be here inside the bottle or urn or as a feature of the
1266          *  location. */
1267         if (HERE(command->obj))
1268             /* FALL THROUGH */;
1269         else if (command->obj == GRATE) {
1270             if (game.loc == LOC_START ||
1271                 game.loc == LOC_VALLEY ||
1272                 game.loc == LOC_SLIT) {
1273                 command->obj = DPRSSN;
1274             }
1275             if (game.loc == LOC_COBBLE ||
1276                 game.loc == LOC_DEBRIS ||
1277                 game.loc == LOC_AWKWARD ||
1278                 game.loc == LOC_BIRD ||
1279                 game.loc == LOC_PITTOP) {
1280                 command->obj = ENTRNC;
1281             }
1282         } else if (command->obj == DWARF && atdwrf(game.loc) > 0)
1283             /* FALL THROUGH */;
1284         else if ((LIQUID() == command->obj && HERE(BOTTLE)) ||
1285                  command->obj == LIQLOC(game.loc))
1286             /* FALL THROUGH */;
1287         else if (command->obj == OIL && HERE(URN) && game.prop[URN] != 0) {
1288             command->obj = URN;
1289             /* FALL THROUGH */;
1290         } else if (command->obj == PLANT && AT(PLANT2) && game.prop[PLANT2] != 0) {
1291             command->obj = PLANT2;
1292             /* FALL THROUGH */;
1293         } else if (command->obj == KNIFE && game.knfloc == game.loc) {
1294             game.knfloc = -1;
1295             rspeak(KNIVES_VANISH);
1296             return GO_CLEAROBJ;
1297         } else if (command->obj == ROD && HERE(ROD2)) {
1298             command->obj = ROD2;
1299             /* FALL THROUGH */;
1300         } else if ((command->verb == FIND ||
1301                     command->verb == INVENTORY) && command->wd2 <= 0)
1302             /* FALL THROUGH */;
1303         else {
1304             sspeak(NO_SEE, command->raw1);
1305             return GO_CLEAROBJ;
1306         }
1307
1308         if (command->wd2 > 0)
1309             return GO_WORD2;
1310         if (command->verb != 0)
1311             command->part = transitive;
1312     }
1313
1314     switch (command->part) {
1315     case intransitive:
1316         if (command->wd2 > 0 && command->verb != SAY)
1317             return GO_WORD2;
1318         if (command->verb == SAY)
1319             command->obj = command->wd2;
1320         if (command->obj == NO_OBJECT ||
1321             command->obj == INTRANSITIVE) {
1322             /*  Analyse an intransitive verb (ie, no object given yet). */
1323             switch (command->verb) {
1324             case CARRY:
1325                 return vcarry(command->verb, INTRANSITIVE);
1326             case  DROP:
1327                 return GO_UNKNOWN;
1328             case  SAY:
1329                 return GO_UNKNOWN;
1330             case  UNLOCK:
1331                 return lock(command->verb, INTRANSITIVE);
1332             case  NOTHING: {
1333                 rspeak(OK_MAN);
1334                 return (GO_CLEAROBJ);
1335             }
1336             case  LOCK:
1337                 return lock(command->verb, INTRANSITIVE);
1338             case  LIGHT:
1339                 return light(command->verb, INTRANSITIVE);
1340             case  EXTINGUISH:
1341                 return extinguish(command->verb, INTRANSITIVE);
1342             case  WAVE:
1343                 return GO_UNKNOWN;
1344             case  TAME:
1345                 return GO_UNKNOWN;
1346             case GO: {
1347                 rspeak(actions[command->verb].message);
1348                 return GO_CLEAROBJ;
1349             }
1350             case ATTACK:
1351                 return attack(command);
1352             case POUR:
1353                 return pour(command->verb, command->obj);
1354             case EAT:
1355                 return eat(command->verb, INTRANSITIVE);
1356             case DRINK:
1357                 return drink(command->verb, command->obj);
1358             case RUB:
1359                 return GO_UNKNOWN;
1360             case THROW:
1361                 return GO_UNKNOWN;
1362             case QUIT:
1363                 return quit();
1364             case FIND:
1365                 return GO_UNKNOWN;
1366             case INVENTORY:
1367                 return inven();
1368             case FEED:
1369                 return GO_UNKNOWN;
1370             case FILL:
1371                 return fill(command->verb, command->obj);
1372             case BLAST:
1373                 blast();
1374                 return GO_CLEAROBJ;
1375             case SCORE:
1376                 score(scoregame);
1377                 return GO_CLEAROBJ;
1378             case GIANTWORDS:
1379                 return bigwords(command->wd1);
1380             case BRIEF:
1381                 return brief();
1382             case READ:
1383                 command->obj = INTRANSITIVE;
1384                 return read(*command);
1385             case BREAK:
1386                 return GO_UNKNOWN;
1387             case WAKE:
1388                 return GO_UNKNOWN;
1389             case SAVE:
1390                 return suspend();
1391             case RESUME:
1392                 return resume();
1393             case FLY:
1394                 return fly(command->verb, INTRANSITIVE);
1395             case LISTEN:
1396                 return listen();
1397             case PART:
1398                 return reservoir();
1399             default:
1400                 BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
1401             }
1402         }
1403     /* FALLTHRU */
1404     case transitive:
1405         /*  Analyse a transitive verb. */
1406         switch (command->verb) {
1407         case  CARRY:
1408             return vcarry(command->verb, command->obj);
1409         case  DROP:
1410             return discard(command->verb, command->obj, false);
1411         case  SAY:
1412             return say(command);
1413         case  UNLOCK:
1414             return lock(command->verb, command->obj);
1415         case  NOTHING: {
1416             rspeak(OK_MAN);
1417             return (GO_CLEAROBJ);
1418         }
1419         case  LOCK:
1420             return lock(command->verb, command->obj);
1421         case LIGHT:
1422             return light(command->verb, command->obj);
1423         case EXTINGUISH:
1424             return extinguish(command->verb, command->obj);
1425         case WAVE:
1426             return wave(command->verb, command->obj);
1427         case TAME: {
1428             rspeak(actions[command->verb].message);
1429             return GO_CLEAROBJ;
1430         }
1431         case GO: {
1432             rspeak(actions[command->verb].message);
1433             return GO_CLEAROBJ;
1434         }
1435         case ATTACK:
1436             return attack(command);
1437         case POUR:
1438             return pour(command->verb, command->obj);
1439         case EAT:
1440             return eat(command->verb, command->obj);
1441         case DRINK:
1442             return drink(command->verb, command->obj);
1443         case RUB:
1444             return rub(command->verb, command->obj);
1445         case THROW:
1446             return throw (command);
1447         case QUIT: {
1448             rspeak(actions[command->verb].message);
1449             return GO_CLEAROBJ;
1450         }
1451         case FIND:
1452             return find(command->verb, command->obj);
1453         case INVENTORY:
1454             return find(command->verb, command->obj);
1455         case FEED:
1456             return feed(command->verb, command->obj);
1457         case FILL:
1458             return fill(command->verb, command->obj);
1459         case BLAST:
1460             blast();
1461             return GO_CLEAROBJ;
1462         case SCORE: {
1463             rspeak(actions[command->verb].message);
1464             return GO_CLEAROBJ;
1465         }
1466         case GIANTWORDS: {
1467             rspeak(actions[command->verb].message);
1468             return GO_CLEAROBJ;
1469         }
1470         case BRIEF: {
1471             rspeak(actions[command->verb].message);
1472             return GO_CLEAROBJ;
1473         }
1474         case READ:
1475             return read(*command);
1476         case BREAK:
1477             return vbreak(command->verb, command->obj);
1478         case WAKE:
1479             return wake(command->verb, command->obj);
1480         case SAVE: {
1481             rspeak(actions[command->verb].message);
1482             return GO_CLEAROBJ;
1483         }
1484         case RESUME: {
1485             rspeak(actions[command->verb].message);
1486             return GO_CLEAROBJ;
1487         }
1488         case FLY:
1489             return fly(command->verb, command->obj);
1490         case LISTEN: {
1491             rspeak(actions[command->verb].message);
1492             return GO_CLEAROBJ;
1493         }
1494         case PART:
1495             return reservoir();
1496         default:
1497             BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
1498         }
1499     case unknown:
1500         /* Unknown verb, couldn't deduce object - might need hint */
1501         sspeak(WHAT_DO, command->raw1);
1502         return GO_CHECKHINT;
1503     default:
1504         BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN); // LCOV_EXCL_LINE
1505     }
1506 }