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