/* THROW etc. */ vthrow() { int msg; int i; if (toting(ROD2) && object == ROD && !toting(ROD)) object = ROD2; if (!toting(object)) { actspk(verb); return; } /* treasure to troll */ if (at(TROLL) && object >= 50 && object<MAXOBJ) { rspeak(159); drop(object,0); move(TROLL,0); move((TROLL+MAXOBJ),0); drop(TROLL2,117); drop((TROLL2+MAXOBJ),122); juggle(CHASM); return; } /* feed the bears... */ if (object == FOOD && here(BEAR)) { object = BEAR; vfeed(); return; } /* if not axe, same as drop... */ if (object != AXE) { vdrop(); return; } /* AXE is THROWN */ /* at a dwarf... */ if (i = dcheck()) { msg = 48; if (pct(33)) { dseen[i] = dloc[i] = 0; msg = 47; ++dkill; if (dkill == 1) msg = 149; } } /* at a dragon... */ else if (at(DRAGON) && prop[DRAGON] == 0) msg = 152; /* at the troll... */ else if (at(TROLL)) msg = 158; /* at the bear... */ else if (here(BEAR) && prop[BEAR] == 0) { rspeak(164); drop(AXE,loc); fixed[AXE] = -1; prop[AXE] = 1; juggle(BEAR); return; } /* otherwise it is an attack */ else { verb = KILL; object = 0; itverb(); return; } /* handle the left over axe... */ rspeak(msg); drop(AXE,loc); describe(); }
/* Routine to take 1 turn */ void turn() { int i, hint; static int waste = 0; if (newtravel) { /* If closing, then he can't leave except via the main office. */ if (outside(g.newloc) && g.newloc != 0 && g.closing) { rspeak(130); g.newloc = g.loc; if (!g.panic) g.clock2 = 15; g.panic = TRUE; } /* See if a dwarf has seen him and has come from where he wants to go. */ if (g.newloc != g.loc && !forced(g.loc) && g.loc_attrib[g.loc] & NOPIRAT == 0) for (i = 1; i < (DWARFMAX - 1); ++i) if (g.odloc[i] == g.newloc && g.dseen[i]) { g.newloc = g.loc; rspeak(2); break; } g.loc = g.newloc; dwarves(); /* & special dwarf(pirate who steals) */ /* Check for death */ if (g.loc == 0) { death(); return; } /* Check for forced move */ if (forced(g.loc)) { desclg(g.loc); ++g.visited[g.loc]; domove(); return; } /* Check for wandering in dark */ if (g.wzdark && dark() && pct(35)) { rspeak(23); g.oldloc2 = g.loc; death(); return; } /* see if he is wasting his batteies out in the open */ if (outside(g.loc) && g.prop[LAMP]) { waste++; if (waste > 11) { rspeak(324); waste = 0; } } else waste = 0; /* If wumpus is chasing stooge, see if wumpus gets him */ if (g.chase) { g.chase++; g.prop[WUMPUS] = g.chase / 2; move(WUMPUS, g.loc); if (g.chase >= 10) { if (dark()) rspeak(270); pspeak(WUMPUS, 5); death(); return; } } /* check for radiation poisoning. */ g.health += (outside(g.loc)) ? 3 : 1; if (g.health > 100) g.health = 100; if (here(RADIUM) && (g.place[RADIUM] != -SHIELD || ajar(SHIELD))) g.health -= 7; if (g.health < 60) { rspeak(391 + (60 - g.health) / 10); if (g.health < 0) { death(); return; } } if ((g.oldloc == 188) && (g.loc != 188 && g.loc != 189) && (g.prop[BOOTH] == 1)) { move(GNOME, 0); g.prop[BOOTH] = 0; } /* Describe his situation */ describe(); if (!blind()) { ++g.visited[g.loc]; descitem(); } } /* end of newtravel start for second entry point */ /* Check if this location is eligible for any hints. If been here long enough, branch to help section. Ignore "hints" < HNTMIN (special stuff, see database notes. */ for (hint = HNTMIN; hint <= HNTMAX; hint++) { if (g.hinted[hint]) continue; if (g.loc_attrib[g.loc] / 256 != hint - 6) g.hintlc[hint] = -1; g.hintlc[hint]++; if (g.hintlc[hint] >= g.hints[hint][1]) do_hint(hint); } if (g.closed) { if (g.prop[OYSTER] < 0 && toting(OYSTER)) pspeak(OYSTER, 1); for (i = 1; i < MAXOBJ; ++i) if (toting(i) && g.prop[i] < 0) g.prop[i] = -1 - g.prop[i]; } g.wzdark = dark(); if (g.knfloc > 0 && g.knfloc != g.loc) g.knfloc = 0; ++g.turns; i = rand(); if (stimer()) /* as the grains of sand slip by */ return; while (!english()) /* retrieve player instructions */ ; vrbx = 1; objx = objs[1] ? 1 : 0; iobx = iobjs[1] ? 1 : 0; verb = VAL(verbs[vrbx]); do { object = objx ? objs[objx] : 0; iobj = iobx ? iobjs[iobx] : 0; if (object && (objs[2] || iobjs[2])) { pspeak(object, -1); printf(" "); } switch (CLASS(verbs[vrbx])) { case MOTION: motion = verb; domove(); break; case NOUN: bug(22); case ACTION: if (object || iobj) trverb(); else itverb(); break; case MISC: rspeak(verb); if (verb == 51) g.hinted[1] = TRUE; break; default: bug(22); } if (objx) { objx++; if (objs[objx] == 0) objx = 0; } if ((!objx || !objs[objx]) && iobx) { iobx++; if (iobjs[iobx] == 0) iobx = 0; if (iobx && iobjs[1]) objx = 1; } } while (objx || iobx); return; }
/* Routines to process intransitive verbs */ void itverb() { int i; newtravel = FALSE; switch (verb) { case DROP: case SAY: case WAVE: case CALM: case RUB: case THROW: case FIND: case FEED: case BREAK: case WAKE: case WEAR: case HIT: case DIAL: case PLAY: case PICK: case PUT: case TURN: needobj(); break; case TAKE: case YANK: case GET: case INSRT: case REMOVE: case BURN: ivtake(); break; case OPEN: case CLOSE: case LOCK: case UNLOCK: ivopen(); break; case NOTHING: rspeak(54); break; case ON: case OFF: trverb(); break; case WALK: actspk(verb); break; case KILL: ivkill(); break; case POUR: ivpour(); break; case EAT: iveat(); break; case DRINK: ivdrink(); break; case QUIT: ivquit(); break; case INVENTORY: inventory(); break; case FILL: ivfill(); break; case BLAST: ivblast(); break; case SCORE: score(TRUE); break; case FOO: ivfoo(); break; case BRIEF: ivbrief(); break; case READ: ivread(); break; case SUSPEND: if (g.closing) rspeak(378); else saveadv("advent.sav"); break; case RESTORE: restore("advent.sav"); break; case ANSWER: if ((g.loc != 189) || (g.prop[PHONE] != 0)) needobj(); else { object = PHONE; itverb(); } break; case BLOW: rspeak(268); break; /* Action verb 'LEAVE' has no object */ case LEAVE: bug(29); break; /* Call if no phone is handy, yell. */ case YELL: if (!here(PHONE)) needobj(); else if (!g.closed) rspeak(271); else { rspeak(283); normend(); } break; /* Health. give him a diagnosis. */ case HEALTH: if (g.numdie) fprintf(stdout, "You have been killed %d times otherwise\n", g.numdie); if (g.health >= 95) { if (pct(50)) rspeak(348); else rspeak(349); } else { fprintf(stdout, "Your health rating is %2d out of a possible 100.\n", g.health); rspeak(381 + (100 - g.health) / 20); } break; case LOOK: ivlook(); break; case COMBO: if (at(SAFE)) ivcombo(); break; case SWEEP: /* Dust/sweep */ if (!at(CARVNG) || !athand(BRUSH) || (g.prop[CARVNG] == 1)) rspeak(342); else { g.prop[CARVNG] = 1; rspeak(363); rspeak(372); } break; case TERSE: /* Terse/unterse. supress all long_form descriptions. */ g.terse = !g.terse; g.detail = 3; rspeak(54); break; case WIZ: is_wiz = !is_wiz; case MAP: rspeak(54); break; case GATE: if (is_wiz) { static char buf[INPUTBUFLEN]; sscanf(ask("Location ? ", buf, sizeof(buf)), "%d", &g.loc); } rspeak(54); break; case PIRLOC: if (is_wiz) { fprintf(stdout, "The dwarfs are at locations:\n"); for (i = 1; i < DWARFMAX; i++) fprintf(stdout, " %4d", g.dloc[i]); fprintf(stdout, "\nThe pirate is at location %4d\n", g.dloc[DWARFMAX]); } rspeak(54); break; default: printf("This intransitive not implemented yet\n"); } return; }