* New upstream release, whivh includes hack, back fron bsdgames-nonfree.

* Conflict and replace with old versions of bsdgames-nonfree that include
     hack.
   * Add hack to package description and menu file.
   * Add in hack's two READ_ME files to binay package.
   * Patched hack config.h as it is patched in bsdgames-nonfree.
   * Unlike bsdgames-nonfree, put the help, hh, rumors, and data files in
     /usr/share/games/bsdgames/hack, as the patched config.h makes it look
     there.
   * postinst moves over hack state files to new directory
   * Patched phantasia to use strerror and not segfault if it cannot open the
     var files. Closes: #187251 (patch sent upstream)


git-svn-id: file:///srv/svn/joey/bsdgames-trunk@5206 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
joey
2003-04-03 02:10:44 +00:00
parent 0e204a0ae1
commit e5b45776e7
42 changed files with 504 additions and 2553 deletions

View File

@@ -1,266 +0,0 @@
/* $NetBSD: com1.c,v 1.6 1997/10/11 02:06:58 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com1.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: com1.c,v 1.6 1997/10/11 02:06:58 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
move(thataway, token)
int thataway, token;
{
wordnumber++;
if ((!notes[CANTMOVE] && !notes[LAUNCHED]) ||
testbit(location[position].objects, LAND) ||
(fuel > 0 && notes[LAUNCHED]))
if (thataway) {
position = thataway;
newway(token);
ourtime++;
} else {
puts("You can't go this way.");
newway(token);
whichway(location[position]);
return (0);
}
else
if (notes[CANTMOVE] && !notes[LAUNCHED])
puts("You aren't able to move; you better drop something.");
else
puts("You are out of fuel; now you will rot in space forever!");
return (1);
}
void
convert(tothis) /* Converts day to night and vice versa. */
int tothis; /* Day objects are permanent. Night objects
* are added */
{ /* at dusk, and subtracted at dawn. */
const struct objs *p;
unsigned int i, j;
if (tothis == TONIGHT) {
for (i = 1; i <= NUMOFROOMS; i++)
for (j = 0; j < NUMOFWORDS; j++)
nightfile[i].objects[j] = dayfile[i].objects[j];
for (p = nightobjs; p->room != 0; p++)
setbit(nightfile[p->room].objects, p->obj);
location = nightfile;
} else {
for (i = 1; i <= NUMOFROOMS; i++)
for (j = 0; j < NUMOFWORDS; j++)
dayfile[i].objects[j] = nightfile[i].objects[j];
for (p = nightobjs; p->room != 0; p++)
clearbit(dayfile[p->room].objects, p->obj);
location = dayfile;
}
}
void
news()
{
int n;
int hurt;
if (ourtime > 30 && position < 32) {
puts("An explosion of shuddering magnitude splinters bulkheads and");
puts("ruptures the battlestar's hull. You are sucked out into the");
puts("frozen void of space and killed.");
die();
}
if (ourtime > 20 && position < 32)
puts("Explosions rock the battlestar.");
if (ourtime > snooze) {
puts("You drop from exhaustion...");
zzz();
}
if (ourtime > snooze - 5)
puts("You're getting tired.");
if (ourtime > (rythmn + CYCLE)) {
if (location == nightfile) {
convert(TODAY);
if (OUTSIDE && ourtime - rythmn - CYCLE < 10) {
puts("Dew lit sunbeams stretch out from a watery sunrise and herald the dawn.");
puts("You awake from a misty dream-world into stark reality.");
puts("It is day.");
}
} else {
convert(TONIGHT);
clearbit(location[POOLS].objects, BATHGOD);
if (OUTSIDE && ourtime - rythmn - CYCLE < 10) {
puts("The dying sun sinks into the ocean, leaving a blood stained sunset.");
puts("The sky slowly fades from orange to violet to black. A few stars");
puts("flicker on, and it is night.");
puts("The world seems completly different at night.");
}
}
rythmn = ourtime - ourtime % CYCLE;
}
if (!wiz && !tempwiz)
if ((testbit(inven, TALISMAN) || testbit(wear, TALISMAN)) && (testbit(inven, MEDALION) || testbit(wear, MEDALION)) && (testbit(inven, AMULET) || testbit(wear, AMULET))) {
tempwiz = 1;
puts("The three amulets glow and reenforce each other in power.\nYou are now a wizard.");
}
if (testbit(location[position].objects, ELF)) {
printf("%s\n", objdes[ELF]);
fight(ELF, rnd(30));
}
if (testbit(location[position].objects, DARK)) {
printf("%s\n", objdes[DARK]);
fight(DARK, 100);
}
if (testbit(location[position].objects, WOODSMAN)) {
printf("%s\n", objdes[WOODSMAN]);
fight(WOODSMAN, 50);
}
switch (position) {
case 267:
case 257: /* entering a cave */
case 274:
case 246:
notes[CANTSEE] = 1;
break;
case 160:
case 216: /* leaving a cave */
case 230:
case 231:
case 232:
notes[CANTSEE] = 0;
break;
}
if (testbit(location[position].objects, GIRL))
meetgirl = 1;
if (meetgirl && CYCLE * 1.5 - ourtime < 10) {
setbit(location[GARDEN].objects, GIRLTALK);
setbit(location[GARDEN].objects, LAMPON);
setbit(location[GARDEN].objects, ROPE);
}
if (position == DOCK && (beenthere[position] || ourtime > CYCLE)) {
clearbit(location[DOCK].objects, GIRL);
clearbit(location[DOCK].objects, MAN);
}
if (meetgirl && ourtime - CYCLE * 1.5 > 10) {
clearbit(location[GARDEN].objects, GIRLTALK);
clearbit(location[GARDEN].objects, LAMPON);
clearbit(location[GARDEN].objects, ROPE);
meetgirl = 0;
}
if (testbit(location[position].objects, CYLON)) {
puts("Oh my God, you're being shot at by an alien spacecraft!");
printf("The targeting computer says we have %d seconds to attack!\n",
ourclock);
fflush(stdout);
sleep(1);
if (!visual()) {
hurt = rnd(NUMOFINJURIES);
injuries[hurt] = 1;
puts("Laser blasts sear the cockpit, and the alien veers off in a victory roll.");
puts("The viper shudders under a terrible explosion.");
printf("I'm afraid you have suffered %s.\n", ouch[hurt]);
} else
clearbit(location[position].objects, CYLON);
}
if (injuries[SKULL] && injuries[INCISE] && injuries[NECK]) {
puts("I'm afraid you have suffered fatal injuries.");
die();
}
for (n = 0; n < NUMOFINJURIES; n++)
if (injuries[n] == 1) {
injuries[n] = 2;
if (WEIGHT > 5)
WEIGHT -= 5;
else
WEIGHT = 0;
}
if (injuries[ARM] == 2) {
CUMBER -= 5;
injuries[ARM]++;
}
if (injuries[RIBS] == 2) {
CUMBER -= 2;
injuries[RIBS]++;
}
if (injuries[SPINE] == 2) {
WEIGHT = 0;
injuries[SPINE]++;
}
if (carrying > WEIGHT || encumber > CUMBER)
notes[CANTMOVE] = 1;
else
notes[CANTMOVE] = 0;
}
void
crash()
{
int hurt1, hurt2;
fuel--;
if (!location[position].flyhere ||
(testbit(location[position].objects, LAND) && fuel <= 0)) {
if (!location[position].flyhere)
puts("You're flying too low. We're going to crash!");
else {
puts("You're out of fuel. We'll have to crash land!");
if (!location[position].down) {
puts("Your viper strikes the ground and explodes into firey fragments.");
puts("Thick black smoke billows up from the wreckage.");
die();
}
position = location[position].down;
}
notes[LAUNCHED] = 0;
setbit(location[position].objects, CRASH);
ourtime += rnd(CYCLE / 4);
puts("The viper explodes into the ground and you lose consciousness...");
zzz();
hurt1 = rnd(NUMOFINJURIES - 2) + 2;
hurt2 = rnd(NUMOFINJURIES - 2) + 2;
injuries[hurt1] = 1;
injuries[hurt2] = 1;
injuries[0] = 1;/* abrasions */
injuries[1] = 1;/* lacerations */
printf("I'm afraid you have suffered %s and %s.\n",
ouch[hurt1], ouch[hurt2]);
}
}

View File

@@ -1,353 +0,0 @@
/* $NetBSD: com2.c,v 1.22 2001/06/02 17:30:28 christos Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: com2.c,v 1.22 2001/06/02 17:30:28 christos Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
wearit()
{ /* synonyms = {sheathe, sheath} */
int firstnumber, value;
firstnumber = wordnumber;
wordnumber++;
while (wordnumber <= wordcount && (wordtype[wordnumber] == OBJECT ||
wordtype[wordnumber] == NOUNS) && wordvalue[wordnumber] != DOOR) {
value = wordvalue[wordnumber];
if (value >= 0 && objsht[value] == NULL)
break;
switch (value) {
case -1:
puts("Wear what?");
return (firstnumber);
default:
printf("You can't wear %s%s!\n",
A_OR_AN_OR_BLANK(value), objsht[value]);
return (firstnumber);
case KNIFE:
/* case SHIRT: */
case ROBE:
case LEVIS: /* wearable things */
case SWORD:
case MAIL:
case HELM:
case SHOES:
case PAJAMAS:
case COMPASS:
case LASER:
case AMULET:
case TALISMAN:
case MEDALION:
case ROPE:
case RING:
case BRACELET:
case GRENADE:
if (testbit(inven, value)) {
clearbit(inven, value);
setbit(wear, value);
carrying -= objwt[value];
encumber -= objcumber[value];
ourtime++;
printf("You are now wearing %s%s.\n",
A_OR_AN_OR_THE(value), objsht[value]);
} else
if (testbit(wear, value))
printf("You are already wearing the %s.\n",
objsht[value]);
else
printf("You aren't holding the %s.\n",
objsht[value]);
if (wordnumber < wordcount - 1 &&
wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (firstnumber);
} /* end switch */
} /* end while */
puts("Don't be ridiculous.");
return (firstnumber);
}
int
put()
{ /* synonyms = {buckle, strap, tie} */
if (wordvalue[wordnumber + 1] == ON) {
wordvalue[++wordnumber] = PUTON;
wordtype[wordnumber] = VERB;
return (cypher());
}
if (wordvalue[wordnumber + 1] == DOWN) {
wordvalue[++wordnumber] = DROP;
wordtype[wordnumber] = VERB;
return (cypher());
}
puts("I don't understand what you want to put.");
return (-1);
}
int
draw()
{ /* synonyms = {pull, carry} */
return (take(wear));
}
int
use()
{
wordnumber++;
if (wordvalue[wordnumber] == AMULET && testbit(inven, AMULET) &&
position != FINAL) {
puts("The amulet begins to glow.");
if (testbit(inven, MEDALION)) {
puts("The medallion comes to life too.");
if (position == 114) {
location[position].down = 160;
whichway(location[position]);
puts("The waves subside and it is possible to descend to the sea cave now.");
ourtime++;
return (-1);
}
}
puts("A light mist falls over your eyes and the sound of purling water trickles in");
puts("your ears. When the mist lifts you are standing beside a cool stream.");
if (position == 229)
position = 224;
else
position = 229;
ourtime++;
notes[CANTSEE] = 0;
return (0);
} else if (position == FINAL)
puts("The amulet won't work in here.");
else if (wordvalue[wordnumber] == COMPASS && testbit(inven, COMPASS))
printf("Your compass points %s.\n", truedirec(NORTH, '-'));
else if (wordvalue[wordnumber] == COMPASS)
puts("You aren't holding the compass.");
else if (wordvalue[wordnumber] == AMULET)
puts("You aren't holding the amulet.");
else
puts("There is no apparent use.");
return (-1);
}
void
murder()
{
int n;
for (n = 0; !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || n == HALBERD) && testbit(inven, n)) && n < NUMOFOBJECTS; n++);
if (n == NUMOFOBJECTS) {
if (testbit(inven, LASER)) {
printf("Your laser should do the trick.\n");
wordnumber++;
switch(wordvalue[wordnumber]) {
case NORMGOD:
case TIMER:
case NATIVE:
case MAN:
wordvalue[--wordnumber] = SHOOT;
cypher();
break;
case -1:
puts("Kill what?");
break;
default:
if (wordtype[wordnumber] != OBJECT ||
wordvalue[wordnumber] == EVERYTHING)
puts("You can't kill that!");
else
printf("You can't kill %s%s!\n",
A_OR_AN_OR_BLANK(wordvalue[wordnumber]),
objsht[wordvalue[wordnumber]]);
break;
}
} else
puts("You don't have suitable weapons to kill.");
} else {
printf("Your %s should do the trick.\n", objsht[n]);
wordnumber++;
switch (wordvalue[wordnumber]) {
case NORMGOD:
if (testbit(location[position].objects, BATHGOD)) {
puts("The goddess's head slices off. Her corpse floats in the water.");
clearbit(location[position].objects, BATHGOD);
setbit(location[position].objects, DEADGOD);
power += 5;
notes[JINXED]++;
} else
if (testbit(location[position].objects, NORMGOD)) {
puts("The goddess pleads but you strike her mercilessly. Her broken body lies in a\npool of blood.");
clearbit(location[position].objects, NORMGOD);
setbit(location[position].objects, DEADGOD);
power += 5;
notes[JINXED]++;
if (wintime)
live();
} else
puts("I don't see her anywhere.");
break;
case TIMER:
if (testbit(location[position].objects, TIMER)) {
puts("The old man offers no resistance.");
clearbit(location[position].objects, TIMER);
setbit(location[position].objects, DEADTIME);
power++;
notes[JINXED]++;
} else
puts("Who?");
break;
case NATIVE:
if (testbit(location[position].objects, NATIVE)) {
puts("The girl screams as you cut her body to shreds. She is dead.");
clearbit(location[position].objects, NATIVE);
setbit(location[position].objects, DEADNATIVE);
power += 5;
notes[JINXED]++;
} else
puts("What girl?");
break;
case MAN:
if (testbit(location[position].objects, MAN)) {
puts("You strike him to the ground, and he coughs up blood.");
puts("Your fantasy is over.");
die();
}
case -1:
puts("Kill what?");
break;
default:
if (wordtype[wordnumber] != OBJECT ||
wordvalue[wordnumber] == EVERYTHING)
puts("You can't kill that!");
else
printf("You can't kill the %s!\n",
objsht[wordvalue[wordnumber]]);
}
}
}
void
ravage()
{
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)
continue;
if (wordtype[wordnumber] == NOUNS && (testbit(location[position].objects, wordvalue[wordnumber])
|| (wordvalue[wordnumber] == NORMGOD && testbit(location[position].objects, BATHGOD)))) {
ourtime++;
switch (wordvalue[wordnumber]) {
case NORMGOD:
puts("You attack the goddess, and she screams as you beat her. She falls down");
if (testbit(location[position].objects, BATHGOD))
puts("crying and tries to cover her nakedness.");
else
puts("crying and tries to hold her torn and bloodied dress around her.");
power += 5;
pleasure += 8;
ego -= 10;
wordnumber--;
godready = -30000;
murder();
win = -30000;
break;
case NATIVE:
puts("The girl tries to run, but you catch her and throw her down. Her face is");
puts("bleeding, and she screams as you tear off her clothes.");
power += 3;
pleasure += 5;
ego -= 10;
wordnumber--;
murder();
if (rnd(100) < 50) {
puts("Her screams have attracted attention. I think we are surrounded.");
setbit(location[ahead].objects, WOODSMAN);
setbit(location[ahead].objects, DEADWOOD);
setbit(location[ahead].objects, MALLET);
setbit(location[back].objects, WOODSMAN);
setbit(location[back].objects, DEADWOOD);
setbit(location[back].objects, MALLET);
setbit(location[left].objects, WOODSMAN);
setbit(location[left].objects, DEADWOOD);
setbit(location[left].objects, MALLET);
setbit(location[right].objects, WOODSMAN);
setbit(location[right].objects, DEADWOOD);
setbit(location[right].objects, MALLET);
}
break;
default:
puts("You are perverted.");
}
} else
puts("Who?");
}
int
follow()
{
if (followfight == ourtime) {
puts("The Dark Lord leaps away and runs down secret tunnels and corridors.");
puts("You chase him through the darkness and splash in pools of water.");
puts("You have cornered him. His laser sword extends as he steps forward.");
position = FINAL;
fight(DARK, 75);
setbit(location[position].objects, TALISMAN);
setbit(location[position].objects, AMULET);
return (0);
} else
if (followgod == ourtime) {
puts("The goddess leads you down a steamy tunnel and into a high, wide chamber.");
puts("She sits down on a throne.");
position = 268;
setbit(location[position].objects, NORMGOD);
notes[CANTSEE] = 1;
return (0);
} else
puts("There is no one to follow.");
return (-1);
}

View File

@@ -1,321 +0,0 @@
/* $NetBSD: com3.c,v 1.7 1998/08/24 00:19:25 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com3.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: com3.c,v 1.7 1998/08/24 00:19:25 hubertf Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
dig()
{
if (testbit(inven, SHOVEL)) {
puts("OK");
ourtime++;
switch (position) {
case 144: /* copse near beach */
if (!notes[DUG]) {
setbit(location[position].objects, DEADWOOD);
setbit(location[position].objects, COMPASS);
setbit(location[position].objects, KNIFE);
setbit(location[position].objects, MACE);
notes[DUG] = 1;
}
break;
default:
puts("Nothing happens.");
}
} else
puts("You don't have a shovel.");
}
int
jump()
{
int n;
switch (position) {
default:
puts("Nothing happens.");
return (-1);
case 242:
position = 133;
break;
case 214:
case 215:
case 162:
case 159:
position = 145;
break;
case 232:
position = 275;
break;
case 3:
position = 1;
break;
case 172:
position = 201;
}
puts("Ahhhhhhh...");
injuries[12] = injuries[8] = injuries[7] = injuries[6] = 1;
for (n = 0; n < NUMOFOBJECTS; n++)
if (testbit(inven, n)) {
clearbit(inven, n);
setbit(location[position].objects, n);
}
carrying = 0;
encumber = 0;
return (0);
}
void
bury()
{
int value;
if (testbit(inven, SHOVEL)) {
while (wordtype[++wordnumber] != OBJECT && wordtype[wordnumber] != NOUNS && wordnumber < wordcount);
value = wordvalue[wordnumber];
if (wordtype[wordnumber] == NOUNS && (testbit(location[position].objects, value) || value == BODY))
switch (value) {
case BODY:
wordtype[wordnumber] = OBJECT;
if (testbit(inven, MAID) || testbit(location[position].objects, MAID))
value = MAID;
if (testbit(inven, DEADWOOD) || testbit(location[position].objects, DEADWOOD))
value = DEADWOOD;
if (testbit(inven, DEADGOD) || testbit(location[position].objects, DEADGOD))
value = DEADGOD;
if (testbit(inven, DEADTIME) || testbit(location[position].objects, DEADTIME))
value = DEADTIME;
if (testbit(inven, DEADNATIVE) || testbit(location[position].objects, DEADNATIVE))
value = DEADNATIVE;
break;
case NATIVE:
case NORMGOD:
puts("She screams as you wrestle her into the hole.");
case TIMER:
power += 7;
ego -= 10;
case AMULET:
case MEDALION:
case TALISMAN:
wordtype[wordnumber] = OBJECT;
break;
default:
puts("Wha..?");
}
if (wordtype[wordnumber] == OBJECT && position > 88 && (testbit(inven, value) || testbit(location[position].objects, value))) {
puts("Buried.");
if (testbit(inven, value)) {
clearbit(inven, value);
carrying -= objwt[value];
encumber -= objcumber[value];
}
clearbit(location[position].objects, value);
switch (value) {
case MAID:
case DEADWOOD:
case DEADNATIVE:
case DEADTIME:
case DEADGOD:
ego += 2;
printf("The %s should rest easier now.\n", objsht[value]);
}
} else
puts("It doesn't seem to work.");
} else
puts("You aren't holding a shovel.");
}
void
drink()
{
int n;
if (testbit(inven, POTION)) {
puts("The cool liquid runs down your throat but turns to fire and you choke.");
puts("The heat reaches your limbs and tingles your spirit. You feel like falling");
puts("asleep.");
clearbit(inven, POTION);
WEIGHT = MAXWEIGHT;
CUMBER = MAXCUMBER;
for (n = 0; n < NUMOFINJURIES; n++)
injuries[n] = 0;
ourtime++;
zzz();
} else
puts("I'm not thirsty.");
}
int
shoot()
{
int firstnumber, value;
int n;
firstnumber = wordnumber;
if (!testbit(inven, LASER))
puts("You aren't holding a blaster.");
else {
while (wordtype[++wordnumber] == ADJS);
while (wordnumber <= wordcount && wordtype[wordnumber] == OBJECT) {
value = wordvalue[wordnumber];
printf("%s:\n", objsht[value]);
for (n = 0; objsht[value][n]; n++);
if (testbit(location[position].objects, value)) {
clearbit(location[position].objects, value);
ourtime++;
printf("The %s explode%s\n", objsht[value], (objsht[value][n - 1] == 's' ? (objsht[value][n - 2] == 's' ? "s." : ".") : "s."));
if (value == BOMB)
die();
} else
printf("I dont see any %s around here.\n", objsht[value]);
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (firstnumber);
}
/* special cases with their own return()'s */
if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS) {
ourtime++;
switch (wordvalue[wordnumber]) {
case DOOR:
switch (position) {
case 189:
case 231:
puts("The door is unhinged.");
location[189].north = 231;
location[231].south = 189;
whichway(location[position]);
break;
case 30:
puts("The wooden door splinters.");
location[30].west = 25;
whichway(location[position]);
break;
case 31:
puts("The laser blast has no effect on the door.");
break;
case 20:
puts("The blast hits the door and it explodes into flame. The magnesium burns");
puts("so rapidly that we have no chance to escape.");
die();
default:
puts("Nothing happens.");
}
break;
case NORMGOD:
if (testbit(location[position].objects, BATHGOD)) {
puts("The goddess is hit in the chest and splashes back against the rocks.");
puts("Dark blood oozes from the charred blast hole. Her naked body floats in the");
puts("pools and then off downstream.");
clearbit(location[position].objects, BATHGOD);
setbit(location[180].objects, DEADGOD);
power += 5;
ego -= 10;
notes[JINXED]++;
} else
if (testbit(location[position].objects, NORMGOD)) {
puts("The blast catches the goddess in the stomach, knocking her to the ground.");
puts("She writhes in the dirt as the agony of death taunts her.");
puts("She has stopped moving.");
clearbit(location[position].objects, NORMGOD);
setbit(location[position].objects, DEADGOD);
power += 5;
ego -= 10;
notes[JINXED]++;
if (wintime)
live();
break;
} else
puts("I don't see any goddess around here.");
break;
case TIMER:
if (testbit(location[position].objects, TIMER)) {
puts("The old man slumps over the bar.");
power++;
ego -= 2;
notes[JINXED]++;
clearbit(location[position].objects, TIMER);
setbit(location[position].objects, DEADTIME);
} else
puts("What old timer?");
break;
case MAN:
if (testbit(location[position].objects, MAN)) {
puts("The man falls to the ground with blood pouring all over his white suit.");
puts("Your fantasy is over.");
die();
} else
puts("What man?");
break;
case NATIVE:
if (testbit(location[position].objects, NATIVE)) {
puts("The girl is blown backwards several feet and lies in a pool of blood.");
clearbit(location[position].objects, NATIVE);
setbit(location[position].objects, DEADNATIVE);
power += 5;
ego -= 2;
notes[JINXED]++;
} else
puts("There is no girl here.");
break;
case -1:
puts("Shoot what?");
break;
default:
printf("You can't shoot the %s.\n", objsht[wordvalue[wordnumber]]);
}
} else
puts("You must be a looney.");
}
return (firstnumber);
}

View File

@@ -1,395 +0,0 @@
/* $NetBSD: com4.c,v 1.6 1997/10/11 02:07:04 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com4.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: com4.c,v 1.6 1997/10/11 02:07:04 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
take(from)
unsigned int from[];
{
int firstnumber, heavy, bulky, value;
int n;
firstnumber = wordnumber;
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == OFF) {
wordnumber++;
wordvalue[wordnumber] = TAKEOFF;
return (cypher());
} else {
while (wordtype[++wordnumber] == ADJS);
while (wordnumber <= wordcount && wordtype[wordnumber] == OBJECT) {
value = wordvalue[wordnumber];
printf("%s:\n", objsht[value]);
for (n = 0; objsht[value][n]; n++);
heavy = (carrying + objwt[value]) <= WEIGHT;
bulky = (encumber + objcumber[value]) <= CUMBER;
if ((testbit(from, value) || wiz || tempwiz) && heavy && bulky && !testbit(inven, value)) {
setbit(inven, value);
carrying += objwt[value];
encumber += objcumber[value];
ourtime++;
if (testbit(from, value))
printf("Taken.\n");
else
printf("Zap! Taken from thin air.\n");
clearbit(from, value);
if (value == MEDALION)
win--;
} else
if (testbit(inven, value))
printf("You're already holding%s%s.\n", (objsht[value][n - 1] == 's' ? " " : " a "), objsht[value]);
else
if (!heavy)
printf("The %s %s too heavy.\n", objsht[value], (objsht[value][n - 1] == 's' ? "are" : "is"));
else
if (!bulky)
printf("The %s %s too cumbersome to hold.\n", objsht[value], (objsht[value][n - 1] == 's' ? "are" : "is"));
else
printf("I dont see any %s around here.\n", objsht[value]);
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (firstnumber);
}
}
/* special cases with their own return()'s */
if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS)
switch (wordvalue[wordnumber]) {
case SWORD:
if (testbit(from, SWORD)) {
wordtype[wordnumber--] = OBJECT;
return (take(from));
}
if (testbit(from, TWO_HANDED)) {
wordvalue[wordnumber] = TWO_HANDED;
wordtype[wordnumber--] = OBJECT;
return (take(from));
}
wordvalue[wordnumber] = BROAD;
wordtype[wordnumber--] = OBJECT;
return (take(from));
case BODY:
if (testbit(from, MAID)) {
wordvalue[wordnumber] = MAID;
wordtype[wordnumber--] = OBJECT;
return (take(from));
} else
if (testbit(from, DEADWOOD)) {
wordvalue[wordnumber] = DEADWOOD;
wordtype[wordnumber--] = OBJECT;
return (take(from));
} else
if (testbit(from, DEADNATIVE)) {
wordvalue[wordnumber] = DEADNATIVE;
wordtype[wordnumber--] = OBJECT;
return (take(from));
} else
if (testbit(from, DEADGOD)) {
wordvalue[wordnumber] = DEADGOD;
wordtype[wordnumber--] = OBJECT;
return (take(from));
} else {
wordvalue[wordnumber] = DEADTIME;
wordtype[wordnumber--] = OBJECT;
return (take(from));
}
break;
case AMULET:
if (testbit(location[position].objects, AMULET)) {
puts("The amulet is warm to the touch, and its beauty catches your breath.");
puts("A mist falls over your eyes, but then it is gone. Sounds seem clearer");
puts("and sharper but far away as if in a dream. The sound of purling water reaches");
puts("you from afar. The mist falls again, and your heart leaps in horror. The gold");
puts("freezes your hands and fathomless darkness engulfs your soul.");
}
wordtype[wordnumber--] = OBJECT;
return (take(from));
case MEDALION:
if (testbit(location[position].objects, MEDALION)) {
puts("The medallion is warm, and it rekindles your spirit with the warmth of life.");
puts("Your amulet begins to glow as the medallion is brought near to it, and together\nthey radiate.");
}
wordtype[wordnumber--] = OBJECT;
return (take(from));
case TALISMAN:
if (testbit(location[position].objects, TALISMAN)) {
puts("The talisman is cold to the touch, and it sends a chill down your spine.");
}
wordtype[wordnumber--] = OBJECT;
return (take(from));
case NORMGOD:
if (testbit(location[position].objects, BATHGOD) && (testbit(wear, AMULET) || testbit(inven, AMULET))) {
puts("She offers a delicate hand, and you help her out of the sparkling springs.");
puts("Water droplets like liquid silver bedew her golden skin, but when they part");
puts("from her, they fall as teardrops. She wraps a single cloth around her and");
puts("ties it at the waist. Around her neck hangs a golden amulet.");
puts("She bids you to follow her.");
pleasure++;
followgod = ourtime;
clearbit(location[position].objects, BATHGOD);
} else
if (!testbit(location[position].objects, BATHGOD))
puts("You're in no position to take her.");
else
puts("She moves away from you.");
break;
default:
puts("It doesn't seem to work.");
}
else
puts("You've got to be kidding.");
return (firstnumber);
}
int
throw(name)
const char *name;
{
unsigned int n;
int deposit = 0;
int first, value;
first = wordnumber;
if (drop(name) != -1) {
switch (wordvalue[wordnumber]) {
case AHEAD:
deposit = ahead;
break;
case BACK:
deposit = back;
break;
case LEFT:
deposit = left;
break;
case RIGHT:
deposit = right;
break;
case UP:
deposit = location[position].up * (location[position].access || position == FINAL);
break;
case DOWN:
deposit = location[position].down;
break;
}
wordnumber = first;
while (wordtype[++wordnumber] == ADJS);
while (wordnumber <= wordcount) {
value = wordvalue[wordnumber];
if (deposit && testbit(location[position].objects, value)) {
clearbit(location[position].objects, value);
if (value != GRENADE)
setbit(location[deposit].objects, value);
else {
puts("A thundering explosion nearby sends up a cloud of smoke and shrapnel.");
for (n = 0; n < NUMOFWORDS; n++)
location[deposit].objects[n] = 0;
setbit(location[deposit].objects, CHAR);
}
if (value == ROPE && position == FINAL)
location[position].access = 1;
switch (deposit) {
case 189:
case 231:
puts("The stone door is unhinged.");
location[189].north = 231;
location[231].south = 189;
break;
case 30:
puts("The wooden door is blown open.");
location[30].west = 25;
break;
case 31:
puts("The door is not damaged.");
}
} else
if (value == GRENADE && testbit(location[position].objects, value)) {
puts("You are blown into shreds when your grenade explodes.");
die();
}
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (first);
}
return (first);
}
return (first);
}
int
drop(name)
const char *name;
{
int firstnumber, value;
firstnumber = wordnumber;
while (wordtype[++wordnumber] == ADJS);
while (wordnumber <= wordcount && (wordtype[wordnumber] == OBJECT || wordtype[wordnumber] == NOUNS)) {
value = wordvalue[wordnumber];
printf("%s:\n", objsht[value]);
if (testbit(inven, value)) {
clearbit(inven, value);
carrying -= objwt[value];
encumber -= objcumber[value];
if (value == BOMB) {
puts("The bomb explodes. A blinding white light and immense concussion obliterate us.");
die();
}
if (value != AMULET && value != MEDALION && value != TALISMAN)
setbit(location[position].objects, value);
else
tempwiz = 0;
ourtime++;
if (*name == 'K')
puts("Drop kicked.");
else
printf("%s.\n", name);
} else {
if (*name != 'K') {
printf("You aren't holding the %s.\n", objsht[value]);
if (testbit(location[position].objects, value)) {
if (*name == 'T')
puts("Kicked instead.");
else
if (*name == 'G')
puts("Given anyway.");
}
} else
puts("Kicked.");
}
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (firstnumber);
}
puts("Do what?");
return (-1);
}
int
takeoff()
{
wordnumber = take(wear);
return (drop("Dropped"));
}
int
puton()
{
wordnumber = take(location[position].objects);
return (wearit());
}
int
eat()
{
int firstnumber, value;
firstnumber = wordnumber;
while (wordtype[++wordnumber] == ADJS);
while (wordnumber <= wordcount) {
value = wordvalue[wordnumber];
switch (value) {
case -1:
puts("Eat what?");
return (firstnumber);
default:
printf("You can't eat%s%s!\n",
wordtype[wordnumber] == OBJECT &&
objsht[value]
[strlen(objsht[value]) - 1] == 's' ?
" " : " a ",
words[wordnumber]);
return (firstnumber);
case PAPAYAS:
case PINEAPPLE:
case KIWI:
case COCONUTS: /* eatable things */
case MANGO:
printf("%s:\n", objsht[value]);
if (testbit(inven, value) &&
ourtime > ate - CYCLE &&
testbit(inven, KNIFE)) {
clearbit(inven, value);
carrying -= objwt[value];
encumber -= objcumber[value];
ate = max(ourtime, ate) + CYCLE / 3;
snooze += CYCLE / 10;
ourtime++;
puts("Eaten. You can explore a little longer now.");
} else
if (ourtime < ate - CYCLE)
puts("You're stuffed.");
else
if (!testbit(inven, KNIFE))
puts("You need a knife.");
else
printf("You aren't holding the %s.\n", objsht[value]);
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (firstnumber);
} /* end switch */
} /* end while */
return (firstnumber);
}

View File

@@ -1,351 +0,0 @@
/* $NetBSD: com5.c,v 1.9 1998/08/30 09:19:36 veego Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com5.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: com5.c,v 1.9 1998/08/30 09:19:36 veego Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
kiss()
{
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
if (wordtype[wordnumber] == NOUNS &&
testbit(location[position].objects, wordvalue[wordnumber])) {
pleasure++;
printf("Kissed.\n");
switch (wordvalue[wordnumber]) {
case NORMGOD:
switch (godready++) {
case 0:
puts("She squirms and avoids your advances.");
break;
case 1:
puts("She is coming around; she didn't fight it as much.");
break;
case 2:
puts("She's begining to like it.");
break;
default:
puts("She's gone limp.");
}
break;
case NATIVE:
puts("The lips are warm and her body robust. She pulls you down to the ground.");
break;
case TIMER:
puts("The old man blushes.");
break;
case MAN:
puts("The dwarf punches you in the kneecap.");
break;
default:
pleasure--;
}
} else
puts("I'd prefer not to.");
}
void
love()
{
int n;
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects, wordvalue[wordnumber])) {
if (wordvalue[wordnumber] == NORMGOD && !loved) {
if (godready >= 2) {
puts("She cuddles up to you, and her mouth starts to work:\n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire\ncaptured her just after the Darkness came. My other sister, Vert, was killed\nby the Dark Lord himself. He took her amulet and warped its power.\nYour quest was foretold by my father before he died, but to get the Dark Lord's\namulet you must use cunning and skill. I will leave you my amulet.");
puts("which you may use as you wish. As for me, I am the last goddess of the\nwaters. My father was the Island King, and the rule is rightfully mine.'\n\nShe pulls the throne out into a large bed.");
power++;
pleasure += 15;
ego++;
if (card(injuries, NUMOFINJURIES)) {
puts("Her kisses revive you; your wounds are healed.\n");
for (n = 0; n < NUMOFINJURIES; n++)
injuries[n] = 0;
WEIGHT = MAXWEIGHT;
CUMBER = MAXCUMBER;
}
printf("Goddess:\n");
if (!loved)
setbit(location[position].objects, MEDALION);
loved = 1;
ourtime += 10;
zzz();
} else {
puts("You wish!");
return;
}
}
if (wordvalue[wordnumber] == NATIVE) {
puts("The girl is easy prey. She peals off her sarong and indulges you.");
power++;
pleasure += 5;
printf("Girl:\n");
ourtime += 10;
zzz();
}
printf("Loved.\n");
} else
puts("It doesn't seem to work.");
}
int
zzz()
{
int oldtime;
int n;
oldtime = ourtime;
if ((snooze - ourtime) < (0.75 * CYCLE)) {
ourtime += 0.75 * CYCLE - (snooze - ourtime);
printf("<zzz>");
for (n = 0; n < ourtime - oldtime; n++)
printf(".");
printf("\n");
snooze += 3 * (ourtime - oldtime);
if (notes[LAUNCHED]) {
fuel -= (ourtime - oldtime);
if (location[position].down) {
position = location[position].down;
crash();
} else
notes[LAUNCHED] = 0;
}
if (OUTSIDE && rnd(100) < 50) {
puts("You are awakened abruptly by the sound of someone nearby.");
switch (rnd(4)) {
case 0:
if (ucard(inven)) {
n = rnd(NUMOFOBJECTS);
while (!testbit(inven, n))
n = rnd(NUMOFOBJECTS);
clearbit(inven, n);
if (n != AMULET && n != MEDALION && n != TALISMAN)
setbit(location[position].objects, n);
carrying -= objwt[n];
encumber -= objcumber[n];
}
puts("A fiendish little Elf is stealing your treasures!");
fight(ELF, 10);
break;
case 1:
setbit(location[position].objects, DEADWOOD);
break;
case 2:
setbit(location[position].objects, HALBERD);
break;
default:
break;
}
}
} else
return (0);
return (1);
}
void
chime()
{
if ((ourtime / CYCLE + 1) % 2 && OUTSIDE)
switch ((ourtime % CYCLE) / (CYCLE / 7)) {
case 0:
puts("It is just after sunrise.");
break;
case 1:
puts("It is early morning.");
break;
case 2:
puts("It is late morning.");
break;
case 3:
puts("It is near noon.");
break;
case 4:
puts("It is early afternoon.");
break;
case 5:
puts("It is late afternoon.");
break;
case 6:
puts("It is near sunset.");
break;
}
else
if (OUTSIDE)
switch ((ourtime % CYCLE) / (CYCLE / 7)) {
case 0:
puts("It is just after sunset.");
break;
case 1:
puts("It is early evening.");
break;
case 2:
puts("The evening is getting old.");
break;
case 3:
puts("It is near midnight.");
break;
case 4:
puts("These are the wee hours of the morning.");
break;
case 5:
puts("The night is waning.");
break;
case 6:
puts("It is almost morning.");
break;
}
else
puts("I can't tell the time in here.");
}
int
give()
{
int obj = -1, result = -1, person = 0, firstnumber, last1, last2;
last1 = last2 = 0;
firstnumber = wordnumber;
while (wordtype[++wordnumber] != OBJECT && wordvalue[wordnumber] != AMULET && wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount);
if (wordnumber <= wordcount) {
obj = wordvalue[wordnumber];
if (obj == EVERYTHING)
wordtype[wordnumber] = -1;
last1 = wordnumber;
}
wordnumber = firstnumber;
while ((wordtype[++wordnumber] != NOUNS || wordvalue[wordnumber] == obj) && wordnumber <= wordcount);
if (wordtype[wordnumber] == NOUNS) {
person = wordvalue[wordnumber];
last2 = wordnumber;
}
/* Setting wordnumber to last1 - 1 looks wrong if last1 is 0, e.g.,
* plain `give'. However, detecting this case is liable to detect
* `give foo' as well, which would give a confusing error. We
* need to make sure the -1 value can cause no problems if it arises.
* If in the below we get to the drop("Given") then drop will look
* at word 0 for an object to give, and fail, which is OK; then
* result will be -1 and we get to the end, where wordnumber gets
* set to something more sensible. If we get to "I don't think
* that is possible" then again wordnumber is set to something
* sensible. The wordnumber we leave with still isn't right if
* you include words the game doesn't know in your command, but
* that's no worse than what other commands than give do in
* the same place. */
wordnumber = last1 - 1;
if (person && testbit(location[position].objects, person))
if (person == NORMGOD && godready < 2 && !(obj == RING || obj == BRACELET))
puts("The goddess won't look at you.");
else
result = drop("Given");
else {
puts("I don't think that is possible.");
wordnumber = max(last1, last2) + 1;
return (0);
}
if (result != -1 && (testbit(location[position].objects, obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)) {
clearbit(location[position].objects, obj);
ourtime++;
ego++;
switch (person) {
case NATIVE:
puts("She accepts it shyly.");
ego += 2;
break;
case NORMGOD:
if (obj == RING || obj == BRACELET) {
puts("She takes the charm and puts it on. A little kiss on the cheek is");
puts("your reward.");
ego += 5;
godready += 3;
}
if (obj == AMULET || obj == MEDALION || obj == TALISMAN) {
win++;
ego += 5;
power -= 5;
if (win >= 3) {
puts("The powers of the earth are now legitimate. You have destroyed the Darkness");
puts("and restored the goddess to her thrown. The entire island celebrates with");
puts("dancing and spring feasts. As a measure of her gratitude, the goddess weds you");
puts("in the late summer and crowns you Prince Liverwort, Lord of Fungus.");
puts("\nBut, as the year wears on and autumn comes along, you become restless and");
puts("yearn for adventure. The goddess, too, realizes that the marriage can't last.");
puts("She becomes bored and takes several more natives as husbands. One evening,");
puts("after having been out drinking with the girls, she kicks the throne particulary");
puts("hard and wakes you up. (If you want to win this game, you're going to have to\nshoot her!)");
clearbit(location[position].objects, MEDALION);
wintime = ourtime;
}
}
break;
case TIMER:
if (obj == COINS) {
puts("He fingers the coins for a moment and then looks up agape. `Kind you are and");
puts("I mean to repay you as best I can.' Grabbing a pencil and cocktail napkin...\n");
printf("+-----------------------------------------------------------------------------+\n");
printf("| xxxxxxxx\\ |\n");
printf("| xxxxx\\ CLIFFS |\n");
printf("| FOREST xxx\\ |\n");
printf("| \\\\ x\\ OCEAN |\n");
printf("| || x\\ |\n");
printf("| || ROAD x\\ |\n");
printf("| || x\\ |\n");
printf("| SECRET || ......... |\n");
printf("| - + - || ........ |\n");
printf("| ENTRANCE || ... BEACH |\n");
printf("| || ... E |\n");
printf("| || ... | |\n");
printf("| // ... N <-- + --- S |\n");
printf("| PALM GROVE // ... | |\n");
printf("| // ... W |\n");
printf("+-----------------------------------------------------------------------------+\n");
puts("\n`This map shows a secret entrance to the catacombs.");
puts("You will know when you arrive because I left an old pair of shoes there.'");
}
break;
}
}
wordnumber = max(last1, last2) + 1;
return (firstnumber);
}

View File

@@ -1,249 +0,0 @@
/* $NetBSD: com6.c,v 1.9 1997/10/13 21:05:36 cjs Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com6.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: com6.c,v 1.9 1997/10/13 21:05:36 cjs Exp $");
#endif
#endif /* not lint */
#include <time.h>
#include "extern.h"
#include "pathnames.h"
int
launch()
{
if (testbit(location[position].objects, VIPER) && !notes[CANTLAUNCH]) {
if (fuel > 4) {
clearbit(location[position].objects, VIPER);
position = location[position].up;
notes[LAUNCHED] = 1;
ourtime++;
fuel -= 4;
puts("You climb into the viper and prepare for launch.");
puts("With a touch of your thumb the turbo engines ignite, thrusting you back into\nyour seat.");
return (1);
} else
puts("Not enough fuel to launch.");
} else
puts("Can't launch.");
return (0);
}
int
land()
{
if (notes[LAUNCHED] && testbit(location[position].objects, LAND) &&
location[position].down) {
notes[LAUNCHED] = 0;
position = location[position].down;
setbit(location[position].objects, VIPER);
fuel -= 2;
ourtime++;
puts("You are down.");
return (1);
} else
puts("You can't land here.");
return (0);
}
void
die()
{ /* endgame */
printf("bye.\nYour rating was %s.\n", rate());
post(' ');
exit(0);
}
void
diesig(dummy)
int dummy __attribute__((unused));
{
die();
}
void
live()
{
puts("\nYou win!");
post('!');
exit(0);
}
static FILE *score_fp;
void
open_score_file()
{
score_fp = fopen(_PATH_SCORE, "a");
if (score_fp == NULL)
warn("open %s for append", _PATH_SCORE);
}
void
post(ch)
char ch;
{
time_t tv;
char *date;
sigset_t sigset, osigset;
sigemptyset(&sigset);
sigaddset(&sigset, SIGINT);
sigprocmask(SIG_BLOCK, &sigset, &osigset);
tv = time(NULL);
date = ctime(&tv);
date[24] = '\0';
if (score_fp != NULL) {
fprintf(score_fp, "%s %8s %c%20s", date, username, ch, rate());
if (wiz)
fprintf(score_fp, " wizard\n");
else
if (tempwiz)
fprintf(score_fp, " WIZARD!\n");
else
fprintf(score_fp, "\n");
}
sigprocmask(SIG_SETMASK, &osigset, (sigset_t *) 0);
}
const char *
rate()
{
int score;
score = max(max(pleasure, power), ego);
if (score == pleasure) {
if (score < 5)
return ("novice");
else
if (score < 20)
return ("junior voyeur");
else
if (score < 35)
return ("Don Juan");
else
return ("Marquis De Sade");
} else
if (score == power) {
if (score < 5)
return ("serf");
else
if (score < 8)
return ("Samurai");
else
if (score < 13)
return ("Klingon");
else
if (score < 22)
return ("Darth Vader");
else
return ("Sauron the Great");
} else {
if (score < 5)
return ("Polyanna");
else
if (score < 10)
return ("philanthropist");
else
if (score < 20)
return ("Tattoo");
else
return ("Mr. Roarke");
}
}
int
drive()
{
if (testbit(location[position].objects, CAR)) {
puts("You hop in the car and turn the key. There is a perceptible grating noise,");
puts("and an explosion knocks you unconscious...");
clearbit(location[position].objects, CAR);
setbit(location[position].objects, CRASH);
injuries[5] = injuries[6] = injuries[7] = injuries[8] = 1;
ourtime += 15;
zzz();
return (0);
} else
puts("There is nothing to drive here.");
return (-1);
}
int
ride()
{
if (testbit(location[position].objects, HORSE)) {
puts("You climb onto the stallion and kick it in the guts. The stupid steed launches");
puts("forward through bush and fern. You are thrown and the horse gallups off.");
clearbit(location[position].objects, HORSE);
while (!(position = rnd(NUMOFROOMS + 1)) || !OUTSIDE || !beenthere[position] || location[position].flyhere);
setbit(location[position].objects, HORSE);
if (location[position].north)
position = location[position].north;
else
if (location[position].south)
position = location[position].south;
else
if (location[position].east)
position = location[position].east;
else
position = location[position].west;
return (0);
} else
puts("There is no horse here.");
return (-1);
}
void
light()
{ /* synonyms = {strike, smoke} *//* for
* matches, cigars */
if (testbit(inven, MATCHES) && matchcount) {
puts("Your match splutters to life.");
ourtime++;
matchlight = 1;
matchcount--;
if (position == 217) {
puts("The whole bungalow explodes with an intense blast.");
die();
}
} else
puts("You're out of matches.");
}

View File

@@ -1,276 +0,0 @@
/* $NetBSD: com7.c,v 1.6 1997/10/11 02:07:10 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)com7.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: com7.c,v 1.6 1997/10/11 02:07:10 lukem Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
fight(enemy, strength)
int enemy, strength;
{
int lifeline = 0;
int hurt;
char auxbuf[LINELENGTH];
char *next;
int i;
int exhaustion;
exhaustion = 0;
fighton:
ourtime++;
snooze -= 5;
if (snooze > ourtime)
exhaustion = CYCLE / (snooze - ourtime);
else {
puts("You collapse exhausted, and he pulverizes your skull.");
die();
}
if (snooze - ourtime < 20)
puts("You look tired! I hope you're able to fight.");
next = getcom(auxbuf, LINELENGTH, "<fight!>-: ", 0);
for (i = 0; next && i < 10; i++)
next = getword(next, words[i], -1);
parse();
switch (wordvalue[wordnumber]) {
case KILL:
case SMITE:
if (testbit(inven, TWO_HANDED))
hurt = rnd(70) - 2 * card(injuries, NUMOFINJURIES) - ucard(wear) - exhaustion;
else
if (testbit(inven, SWORD) || testbit(inven, BROAD))
hurt = rnd(50) % (WEIGHT - carrying) - card(injuries, NUMOFINJURIES) - encumber - exhaustion;
else
if (testbit(inven, KNIFE) || testbit(inven, MALLET) || testbit(inven, CHAIN) || testbit(inven, MACE) || testbit(inven, HALBERD))
hurt = rnd(15) - card(injuries, NUMOFINJURIES) - exhaustion;
else
hurt = rnd(7) - encumber;
if (hurt < 5)
switch (rnd(3)) {
case 0:
puts("You swung wide and missed.");
break;
case 1:
puts("He checked your blow. CLASH! CLANG!");
break;
case 2:
puts("His filthy tunic hangs by one less thread.");
break;
}
else
if (hurt < 10) {
switch (rnd(3)) {
case 0:
puts("He's bleeding.");
break;
case 1:
puts("A trickle of blood runs down his face.");
break;
case 2:
puts("A huge purple bruise is forming on the side of his face.");
break;
}
lifeline++;
} else
if (hurt < 20) {
switch (rnd(3)) {
case 0:
puts("He staggers back quavering.");
break;
case 1:
puts("He jumps back with his hand over the wound.");
break;
case 2:
puts("His shirt falls open with a swath across the chest.");
break;
}
lifeline += 5;
} else
if (hurt < 30) {
switch (rnd(3)) {
case 0:
printf("A bloody gash opens up on his %s side.\n", (rnd(2) ? "left" : "right"));
break;
case 1:
puts("The steel bites home and scrapes along his ribs.");
break;
case 2:
puts("You pierce him, and his breath hisses through clenched teeth.");
break;
}
lifeline += 10;
} else
if (hurt < 40) {
switch (rnd(3)) {
case 0:
puts("You smite him to the ground.");
if (strength - lifeline > 20)
puts("But in a flurry of steel he regains his feet!");
break;
case 1:
puts("The force of your blow sends him to his knees.");
puts("His arm swings lifeless at his side.");
break;
case 2:
puts("Clutching his blood drenched shirt, he collapses stunned.");
break;
}
lifeline += 20;
} else {
switch (rnd(3)) {
case 0:
puts("His ribs crack under your powerful swing, flooding his lungs with blood.");
break;
case 1:
puts("You shatter his upheld arm in a spray of blood. The blade continues deep");
puts("into his back, severing the spinal cord.");
lifeline += 25;
break;
case 2:
puts("With a mighty lunge the steel slides in, and gasping, he falls to the ground.");
lifeline += 25;
break;
}
lifeline += 30;
}
break;
case BACK:
if (enemy == DARK && lifeline > strength * 0.33) {
puts("He throws you back against the rock and pummels your face.");
if (testbit(inven, AMULET) || testbit(wear, AMULET)) {
printf("Lifting the amulet from you, ");
if (testbit(inven, MEDALION) || testbit(wear, MEDALION)) {
puts("his power grows and the walls of\nthe earth tremble.");
puts("When he touches the medallion, your chest explodes and the foundations of the\nearth collapse.");
puts("The planet is consumed by darkness.");
die();
}
if (testbit(inven, AMULET)) {
clearbit(inven, AMULET);
carrying -= objwt[AMULET];
encumber -= objcumber[AMULET];
} else
clearbit(wear, AMULET);
puts("he flees down the dark caverns.");
clearbit(location[position].objects, DARK);
injuries[SKULL] = 1;
followfight = ourtime;
return (0);
} else {
puts("I'm afraid you have been killed.");
die();
}
} else {
puts("You escape stunned and disoriented from the fight.");
puts("A victorious bellow echoes from the battlescene.");
if (back && position != back)
move(back, BACK);
else
if (ahead && position != ahead)
move(ahead, AHEAD);
else
if (left && position != left)
move(left, LEFT);
else
if (right && position != right)
move(right, RIGHT);
else
move(location[position].down, AHEAD);
return (0);
}
case SHOOT:
if (testbit(inven, LASER)) {
if (strength - lifeline <= 50) {
printf("The %s took a direct hit!\n", objsht[enemy]);
lifeline += 50;
} else {
puts("With his bare hand he deflects the laser blast and whips the pistol from you!");
clearbit(inven, LASER);
setbit(location[position].objects, LASER);
carrying -= objwt[LASER];
encumber -= objcumber[LASER];
}
} else
puts("Unfortunately, you don't have a blaster handy.");
break;
case DROP:
case DRAW:
cypher();
ourtime--;
break;
default:
puts("You don't have a chance, he is too quick.");
break;
}
if (lifeline >= strength) {
printf("You have killed the %s.\n", objsht[enemy]);
if (enemy == ELF || enemy == DARK)
puts("A watery black smoke consumes his body and then vanishes with a peal of thunder!");
clearbit(location[position].objects, enemy);
power += 2;
notes[JINXED]++;
return (0);
}
puts("He attacks...");
/* some embellisments */
hurt = rnd(NUMOFINJURIES) - (testbit(inven, SHIELD) != 0) - (testbit(wear, MAIL) != 0) - (testbit(wear, HELM) != 0);
hurt += (testbit(wear, AMULET) != 0) + (testbit(wear, MEDALION) != 0) + (testbit(wear, TALISMAN) != 0);
hurt = hurt < 0 ? 0 : hurt;
hurt = hurt >= NUMOFINJURIES ? NUMOFINJURIES - 1 : hurt;
if (!injuries[hurt]) {
injuries[hurt] = 1;
printf("I'm afraid you have suffered %s.\n", ouch[hurt]);
} else
puts("You emerge unscathed.");
if (injuries[SKULL] && injuries[INCISE] && injuries[NECK]) {
puts("I'm afraid you have suffered fatal injuries.");
die();
}
goto fighton;
}