|
|
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 the above copyright notice and this paragraph are
7: * duplicated in all such forms and that any documentation,
8: * advertising materials, and other materials related to such
9: * distribution and use acknowledge that the software was developed
10: * by the University of California, Berkeley. The name of the
11: * University may not be used to endorse or promote products derived
12: * from this software without specific prior written permission.
13: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16: */
17:
18: #ifndef lint
19: static char sccsid[] = "@(#)com6.c 5.2 (Berkeley) 6/19/88";
20: #endif /* not lint */
21:
22: #include "externs.h"
23:
24: launch()
25: {
26: if (testbit(location[position].objects,VIPER) && !notes[CANTLAUNCH]){
27: if (fuel > 4){
28: clearbit(location[position].objects,VIPER);
29: position = location[position].up;
30: notes[LAUNCHED] = 1;
31: time++;
32: fuel -= 4;
33: puts("You climb into the viper and prepare for launch.");
34: puts("With a touch of your thumb the turbo engines ignite, thrusting you back into\nyour seat.");
35: return(1);
36: }
37: else
38: puts("Not enough fuel to launch.");
39: }
40: else
41: puts("Can't launch.");
42: return(0);
43: }
44:
45: land()
46: {
47: if (notes[LAUNCHED] && testbit(location[position].objects,LAND) && location[position].down){
48: notes[LAUNCHED] = 0;
49: position = location[position].down;
50: setbit(location[position].objects,VIPER);
51: fuel -= 2;
52: time++;
53: puts("You are down.");
54: return(1);
55: }
56: else
57: puts("You can't land here.");
58: return(0);
59: }
60:
61: die() /* endgame */
62: {
63: printf("bye.\nYour rating was %s.\n", rate());
64: post(' ');
65: exit(0);
66: }
67:
68: live()
69: {
70: puts("\nYou win!");
71: post('!');
72: exit(0);
73: }
74:
75: #include <sys/time.h>
76: post(ch)
77: char ch;
78: {
79: FILE *fp;
80: struct timeval tv;
81: char *date;
82: int s = sigblock(sigmask(SIGINT));
83:
84: gettimeofday(&tv, (struct timezone *)0); /* can't call time */
85: date = ctime(&tv.tv_sec);
86: date[24] = '\0';
87: if (fp = fopen(logfile,"a")) {
88: fprintf(fp, "%s %8s %c%20s", date, uname, ch, rate());
89: if (wiz)
90: fprintf(fp, " wizard\n");
91: else if (tempwiz)
92: fprintf(fp, " WIZARD!\n");
93: else
94: fprintf(fp, "\n");
95: } else
96: perror(logfile);
97: sigsetmask(s);
98: }
99:
100: char *
101: rate()
102: {
103: int score;
104:
105: score = max(max(pleasure,power),ego);
106: if (score == pleasure){
107: if (score < 5)
108: return("novice");
109: else if (score < 20)
110: return("junior voyeur");
111: else if (score < 35)
112: return("Don Juan");
113: else return("Marquis De Sade");
114: }
115: else if (score == power){
116: if (score < 5)
117: return("serf");
118: else if (score < 8)
119: return("Samurai");
120: else if (score < 13)
121: return("Klingon");
122: else if (score < 22)
123: return("Darth Vader");
124: else return("Sauron the Great");
125: }
126: else{
127: if (score < 5)
128: return("Polyanna");
129: else if (score < 10)
130: return("philanthropist");
131: else if (score < 20)
132: return("Tattoo");
133: else return("Mr. Roarke");
134: }
135: }
136:
137: drive()
138: {
139: if (testbit(location[position].objects,CAR)){
140: puts("You hop in the car and turn the key. There is a perceptible grating noise,");
141: puts("and an explosion knocks you unconscious...");
142: clearbit(location[position].objects,CAR);
143: setbit(location[position].objects,CRASH);
144: injuries[5] = injuries[6] = injuries[7] = injuries[8] = 1;
145: time += 15;
146: zzz();
147: return(0);
148: }
149: else
150: puts("There is nothing to drive here.");
151: return(-1);
152: }
153:
154: ride()
155: {
156: if (testbit(location[position].objects,HORSE)){
157: puts("You climb onto the stallion and kick it in the guts. The stupid steed launches");
158: puts("forward through bush and fern. You are thrown and the horse gallups off.");
159: clearbit(location[position].objects,HORSE);
160: while (!(position = rnd(NUMOFROOMS+1)) || !OUTSIDE || !beenthere[position] || location[position].flyhere);
161: setbit(location[position].objects,HORSE);
162: if (location[position].north)
163: position = location[position].north;
164: else if (location[position].south)
165: position = location[position].south;
166: else if (location[position].east)
167: position = location[position].east;
168: else
169: position = location[position].west;
170: return(0);
171: }
172: else puts("There is no horse here.");
173: return(-1);
174: }
175:
176: light() /* synonyms = {strike, smoke} */
177: { /* for matches, cigars */
178: if (testbit(inven,MATCHES) && matchcount){
179: puts("Your match splutters to life.");
180: time++;
181: matchlight = 1;
182: matchcount--;
183: if (position == 217){
184: puts("The whole bungalow explodes with an intense blast.");
185: die();
186: }
187: }
188: else puts("You're out of matches.");
189: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.