|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1983 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted ! 6: * provided that: (1) source distributions retain this entire copyright ! 7: * notice and comment, and (2) distributions including binaries display ! 8: * the following acknowledgement: ``This product includes software ! 9: * developed by the University of California, Berkeley and its contributors'' ! 10: * in the documentation or other materials provided with the distribution ! 11: * and in all advertising materials mentioning features or use of this ! 12: * software. Neither the name of the University nor the names of its ! 13: * contributors may be used to endorse or promote products derived ! 14: * from this software without specific prior written permission. ! 15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 18: */ ! 19: ! 20: #ifndef lint ! 21: static char sccsid[] = "@(#)com2.c 5.3 (Berkeley) 6/1/90"; ! 22: #endif /* not lint */ ! 23: ! 24: #include "externs.h" ! 25: ! 26: wearit() /* synonyms = {sheathe, sheath} */ ! 27: { ! 28: register int n; ! 29: int firstnumber, value; ! 30: ! 31: firstnumber = wordnumber; ! 32: while(wordtype[++wordnumber] == ADJS); ! 33: while(wordnumber <= wordcount){ ! 34: value = wordvalue[wordnumber]; ! 35: for (n=0; objsht[value][n]; n++); ! 36: switch(value){ ! 37: ! 38: case -1: ! 39: puts("Wear what?"); ! 40: return(firstnumber); ! 41: ! 42: default: ! 43: printf("You can't wear%s%s!\n",(objsht[value][n-1] == 's' ? " " : " a "),objsht[value]); ! 44: return(firstnumber); ! 45: ! 46: case KNIFE: ! 47: /* case SHIRT: */ ! 48: case ROBE: ! 49: case LEVIS: /* wearable things */ ! 50: case SWORD: ! 51: case MAIL: ! 52: case HELM: ! 53: case SHOES: ! 54: case PAJAMAS: ! 55: case COMPASS: ! 56: case LASER: ! 57: case AMULET: ! 58: case TALISMAN: ! 59: case MEDALION: ! 60: case ROPE: ! 61: case RING: ! 62: case BRACELET: ! 63: case GRENADE: ! 64: ! 65: if (testbit(inven,value)){ ! 66: clearbit(inven,value); ! 67: setbit(wear,value); ! 68: carrying -= objwt[value]; ! 69: encumber -= objcumber[value]; ! 70: time++; ! 71: printf("You are now wearing %s %s.\n",(objsht[value][n-1] == 's' ? "the" : "a"), objsht[value]); ! 72: } ! 73: else if (testbit(wear,value)) ! 74: printf("You are already wearing the %s.\n", objsht[value]); ! 75: else ! 76: printf("You aren't holding the %s.\n", objsht[value]); ! 77: if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) ! 78: wordnumber++; ! 79: else ! 80: return(firstnumber); ! 81: } /* end switch */ ! 82: } /* end while */ ! 83: puts("Don't be ridiculous."); ! 84: return(firstnumber); ! 85: } ! 86: ! 87: put() /* synonyms = {buckle, strap, tie} */ ! 88: { ! 89: if (wordvalue[wordnumber + 1] == ON){ ! 90: wordvalue[++wordnumber] = PUTON; ! 91: return(cypher()); ! 92: } ! 93: if (wordvalue[wordnumber + 1] == DOWN){ ! 94: wordvalue[++wordnumber] = DROP; ! 95: return(cypher()); ! 96: } ! 97: puts("I don't understand what you want to put."); ! 98: return(-1); ! 99: ! 100: } ! 101: ! 102: draw() /* synonyms = {pull, carry} */ ! 103: { ! 104: return(take(wear)); ! 105: } ! 106: ! 107: use() ! 108: { ! 109: while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount); ! 110: if (wordvalue[wordnumber] == AMULET && testbit(inven,AMULET) && position != FINAL){ ! 111: puts("The amulet begins to glow."); ! 112: if (testbit(inven,MEDALION)){ ! 113: puts("The medallion comes to life too."); ! 114: if (position == 114){ ! 115: location[position].down = 160; ! 116: whichway(location[position]); ! 117: puts("The waves subside and it is possible to descend to the sea cave now."); ! 118: time++; ! 119: return(-1); ! 120: } ! 121: } ! 122: puts("A light mist falls over your eyes and the sound of purling water trickles in"); ! 123: puts("your ears. When the mist lifts you are standing beside a cool stream."); ! 124: if (position == 229) ! 125: position = 224; ! 126: else ! 127: position = 229; ! 128: time++; ! 129: return(0); ! 130: } ! 131: else if (position == FINAL) ! 132: puts("The amulet won't work in here."); ! 133: else if (wordvalue[wordnumber] == COMPASS && testbit(inven,COMPASS)) ! 134: printf("Your compass points %s.\n",truedirec(NORTH,'-')); ! 135: else if (wordvalue[wordnumber] == COMPASS) ! 136: puts("You aren't holding the compass."); ! 137: else if (wordvalue[wordnumber] == AMULET) ! 138: puts("You aren't holding the amulet."); ! 139: else ! 140: puts("There is no apparent use."); ! 141: return(-1); ! 142: } ! 143: ! 144: murder() ! 145: { ! 146: register int n; ! 147: ! 148: 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++); ! 149: if (n == NUMOFOBJECTS) ! 150: puts("You don't have suitable weapons to kill."); ! 151: else { ! 152: printf("Your %s should do the trick.\n",objsht[n]); ! 153: while (wordtype[++wordnumber] == ADJS); ! 154: switch(wordvalue[wordnumber]){ ! 155: ! 156: case NORMGOD: ! 157: if (testbit(location[position].objects,BATHGOD)){ ! 158: puts("The goddess's head slices off. Her corpse floats in the water."); ! 159: clearbit(location[position].objects,BATHGOD); ! 160: setbit(location[position].objects,DEADGOD); ! 161: power += 5; ! 162: notes[JINXED]++; ! 163: } else if (testbit(location[position].objects,NORMGOD)){ ! 164: puts("The goddess pleads but you strike her mercilessly. Her broken body lies in a\npool of blood."); ! 165: clearbit(location[position].objects,NORMGOD); ! 166: setbit(location[position].objects,DEADGOD); ! 167: power += 5; ! 168: notes[JINXED]++; ! 169: if (wintime) ! 170: live(); ! 171: } else puts("I dont see her anywhere."); ! 172: break; ! 173: case TIMER: ! 174: if (testbit(location[position].objects,TIMER)){ ! 175: puts("The old man offers no resistance."); ! 176: clearbit(location[position].objects,TIMER); ! 177: setbit(location[position].objects,DEADTIME); ! 178: power++; ! 179: notes[JINXED]++; ! 180: } else puts("Who?"); ! 181: break; ! 182: case NATIVE: ! 183: if (testbit(location[position].objects,NATIVE)){ ! 184: puts("The girl screams as you cut her body to shreds. She is dead."); ! 185: clearbit(location[position].objects,NATIVE); ! 186: setbit(location[position].objects,DEADNATIVE); ! 187: power += 5; ! 188: notes[JINXED]++; ! 189: } else puts("What girl?"); ! 190: break; ! 191: case MAN: ! 192: if (testbit(location[position].objects,MAN)){ ! 193: puts("You strike him to the ground, and he coughs up blood."); ! 194: puts("Your fantasy is over."); ! 195: die(); ! 196: } ! 197: case -1: ! 198: puts("Kill what?"); ! 199: break; ! 200: ! 201: default: ! 202: if (wordtype[wordnumber] != NOUNS) ! 203: puts("Kill what?"); ! 204: else ! 205: printf("You can't kill the %s!\n",objsht[wordvalue[wordnumber]]); ! 206: } ! 207: } ! 208: } ! 209: ! 210: ravage() ! 211: { ! 212: while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount); ! 213: if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){ ! 214: time++; ! 215: switch(wordvalue[wordnumber]){ ! 216: case NORMGOD: ! 217: puts("You attack the goddess, and she screams as you beat her. She falls down"); ! 218: puts("crying and tries to hold her torn and bloodied dress around her."); ! 219: power += 5; ! 220: pleasure += 8; ! 221: ego -= 10; ! 222: wordnumber--; ! 223: godready = -30000; ! 224: murder(); ! 225: win = -30000; ! 226: break; ! 227: case NATIVE: ! 228: puts("The girl tries to run, but you catch her and throw her down. Her face is"); ! 229: puts("bleeding, and she screams as you tear off her clothes."); ! 230: power += 3; ! 231: pleasure += 5; ! 232: ego -= 10; ! 233: wordnumber--; ! 234: murder(); ! 235: if (rnd(100) < 50){ ! 236: puts("Her screams have attracted attention. I think we are surrounded."); ! 237: setbit(location[ahead].objects,WOODSMAN); ! 238: setbit(location[ahead].objects,DEADWOOD); ! 239: setbit(location[ahead].objects,MALLET); ! 240: setbit(location[back].objects,WOODSMAN); ! 241: setbit(location[back].objects,DEADWOOD); ! 242: setbit(location[back].objects,MALLET); ! 243: setbit(location[left].objects,WOODSMAN); ! 244: setbit(location[left].objects,DEADWOOD); ! 245: setbit(location[left].objects,MALLET); ! 246: setbit(location[right].objects,WOODSMAN); ! 247: setbit(location[right].objects,DEADWOOD); ! 248: setbit(location[right].objects,MALLET); ! 249: } ! 250: break; ! 251: default: ! 252: puts("You are perverted."); ! 253: } ! 254: } ! 255: else ! 256: puts("Who?"); ! 257: } ! 258: ! 259: follow() ! 260: { ! 261: if (followfight == time){ ! 262: puts("The Dark Lord leaps away and runs down secret tunnels and corridoors."); ! 263: puts("You chase him through the darkness and splash in pools of water."); ! 264: puts("You have cornered him. His laser sword extends as he steps forward."); ! 265: position = FINAL; ! 266: fight(DARK,75); ! 267: setbit(location[position].objects,TALISMAN); ! 268: setbit(location[position].objects,AMULET); ! 269: return(0); ! 270: } ! 271: else if (followgod == time){ ! 272: puts("The goddess leads you down a steamy tunnel and into a high, wide chamber."); ! 273: puts("She sits down on a throne."); ! 274: position = 268; ! 275: setbit(location[position].objects,NORMGOD); ! 276: notes[CANTSEE] = 1; ! 277: return(0); ! 278: } ! 279: else ! 280: puts("There is no one to follow."); ! 281: return(-1); ! 282: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.