villns.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. /* TROLLP- TROLL FUNCTION */
  2. /*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
  3. /* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
  4. /* WRITTEN BY R. M. SUPNIK */
  5. #include "funcs.h"
  6. #include "vars.h"
  7. logical trollp_(arg)
  8. integer arg;
  9. {
  10. /* System generated locals */
  11. logical ret_val;
  12. /* Local variables */
  13. integer i;
  14. ret_val = TRUE_;
  15. /* !ASSUME WINS. */
  16. if (prsvec_1.prsa != vindex_1.fightw) {
  17. goto L1100;
  18. }
  19. /* !FIGHT? */
  20. if (objcts_1.ocan[oindex_1.axe - 1] == oindex_1.troll) {
  21. goto L10;
  22. }
  23. /* !GOT AXE? NOTHING. */
  24. i = 433;
  25. /* !ASSUME CANT GET. */
  26. if (! qhere_(oindex_1.axe, play_1.here)) {
  27. goto L1050;
  28. }
  29. /* !HERE? */
  30. i = 434;
  31. /* !YES, RECOVER. */
  32. newsta_(oindex_1.axe, 0, 0, oindex_1.troll, 0);
  33. L1050:
  34. if (qhere_(oindex_1.troll, play_1.here)) {
  35. rspeak_(i);
  36. }
  37. /* !IF PLAYER HERE. */
  38. return ret_val;
  39. L1100:
  40. if (prsvec_1.prsa != vindex_1.deadxw) {
  41. goto L1200;
  42. }
  43. /* !DEAD? */
  44. findex_1.trollf = TRUE_;
  45. /* !PERMIT EXITS. */
  46. return ret_val;
  47. L1200:
  48. if (prsvec_1.prsa != vindex_1.outxw) {
  49. goto L1300;
  50. }
  51. /* !OUT? */
  52. findex_1.trollf = TRUE_;
  53. /* !PERMIT EXITS. */
  54. objcts_1.oflag1[oindex_1.axe - 1] &= ~ VISIBT;
  55. objcts_1.odesc1[oindex_1.troll - 1] = 435;
  56. /* !TROLL OUT. */
  57. return ret_val;
  58. L1300:
  59. if (prsvec_1.prsa != vindex_1.inxw) {
  60. goto L1400;
  61. }
  62. /* !WAKE UP? */
  63. findex_1.trollf = FALSE_;
  64. /* !FORBID EXITS. */
  65. objcts_1.oflag1[oindex_1.axe - 1] |= VISIBT;
  66. objcts_1.odesc1[oindex_1.troll - 1] = 436;
  67. /* !TROLL IN. */
  68. if (qhere_(oindex_1.troll, play_1.here)) {
  69. rspeak_(437);
  70. }
  71. return ret_val;
  72. L1400:
  73. if (prsvec_1.prsa != vindex_1.frstqw) {
  74. goto L1500;
  75. }
  76. /* !FIRST ENCOUNTER? */
  77. ret_val = prob_(33, 66);
  78. /* !33% TRUE UNLESS BADLK. */
  79. return ret_val;
  80. L1500:
  81. if (prsvec_1.prsa != vindex_1.movew && prsvec_1.prsa != vindex_1.takew &&
  82. prsvec_1.prsa != vindex_1.mungw && prsvec_1.prsa !=
  83. vindex_1.throww && prsvec_1.prsa != vindex_1.givew) {
  84. goto L2000;
  85. }
  86. if (objcts_1.ocapac[oindex_1.troll - 1] >= 0) {
  87. goto L1550;
  88. }
  89. /* !TROLL OUT? */
  90. objcts_1.ocapac[oindex_1.troll - 1] = -objcts_1.ocapac[oindex_1.troll - 1]
  91. ;
  92. /* !YES, WAKE HIM. */
  93. objcts_1.oflag1[oindex_1.axe - 1] |= VISIBT;
  94. findex_1.trollf = FALSE_;
  95. objcts_1.odesc1[oindex_1.troll - 1] = 436;
  96. rspeak_(437);
  97. L1550:
  98. if (prsvec_1.prsa != vindex_1.takew && prsvec_1.prsa != vindex_1.movew) {
  99. goto L1600;
  100. }
  101. rspeak_(438);
  102. /* !JOKE. */
  103. return ret_val;
  104. L1600:
  105. if (prsvec_1.prsa != vindex_1.mungw) {
  106. goto L1700;
  107. }
  108. /* !MUNG? */
  109. rspeak_(439);
  110. /* !JOKE. */
  111. return ret_val;
  112. L1700:
  113. if (prsvec_1.prso == 0) {
  114. goto L10;
  115. }
  116. /* !NO OBJECT? */
  117. i = 440;
  118. /* !ASSUME THROW. */
  119. if (prsvec_1.prsa == vindex_1.givew) {
  120. i = 441;
  121. }
  122. /* !GIVE? */
  123. rspsub_(i, objcts_1.odesc2[prsvec_1.prso - 1]);
  124. /* !TROLL TAKES. */
  125. if (prsvec_1.prso == oindex_1.knife) {
  126. goto L1900;
  127. }
  128. /* !OBJ KNIFE? */
  129. newsta_(prsvec_1.prso, 442, 0, 0, 0);
  130. /* !NO, EATS IT. */
  131. return ret_val;
  132. L1900:
  133. rspeak_(443);
  134. /* !KNIFE, THROWS IT BACK */
  135. objcts_1.oflag2[oindex_1.troll - 1] |= FITEBT;
  136. return ret_val;
  137. L2000:
  138. if (! findex_1.trollf || prsvec_1.prsa != vindex_1.hellow) {
  139. goto L10;
  140. }
  141. rspeak_(366);
  142. /* !TROLL OUT. */
  143. return ret_val;
  144. L10:
  145. ret_val = FALSE_;
  146. /* !COULDNT HANDLE IT. */
  147. return ret_val;
  148. } /* trollp_ */
  149. /* CYCLOP- CYCLOPS FUNCTION */
  150. /* DECLARATIONS */
  151. logical cyclop_(arg)
  152. integer arg;
  153. {
  154. /* System generated locals */
  155. integer i__1, i__2;
  156. logical ret_val;
  157. /* Local variables */
  158. integer i;
  159. ret_val = TRUE_;
  160. /* !ASSUME WINS. */
  161. if (! findex_1.cyclof) {
  162. goto L100;
  163. }
  164. /* !ASLEEP? */
  165. if (prsvec_1.prsa != vindex_1.alarmw && prsvec_1.prsa != vindex_1.mungw &&
  166. prsvec_1.prsa != vindex_1.hellow && prsvec_1.prsa !=
  167. vindex_1.burnw && prsvec_1.prsa != vindex_1.killw &&
  168. prsvec_1.prsa != vindex_1.attacw) {
  169. goto L10;
  170. }
  171. findex_1.cyclof = FALSE_;
  172. /* !WAKE CYCLOPS. */
  173. rspeak_(187);
  174. /* !DESCRIBE. */
  175. findex_1.rvcyc = abs(findex_1.rvcyc);
  176. objcts_1.oflag2[oindex_1.cyclo - 1] = (objcts_1.oflag2[oindex_1.cyclo - 1]
  177. | FITEBT) & ~ SLEPBT;
  178. return ret_val;
  179. L100:
  180. if (prsvec_1.prsa == vindex_1.fightw || prsvec_1.prsa == vindex_1.frstqw)
  181. {
  182. goto L10;
  183. }
  184. if (abs(findex_1.rvcyc) <= 5) {
  185. goto L200;
  186. }
  187. /* !ANNOYED TOO MUCH? */
  188. findex_1.rvcyc = 0;
  189. /* !RESTART COUNT. */
  190. jigsup_(188);
  191. /* !YES, EATS PLAYER. */
  192. return ret_val;
  193. L200:
  194. if (prsvec_1.prsa != vindex_1.givew) {
  195. goto L500;
  196. }
  197. /* !GIVE? */
  198. if (prsvec_1.prso != oindex_1.food || findex_1.rvcyc < 0) {
  199. goto L300;
  200. }
  201. /* !FOOD WHEN HUNGRY? */
  202. newsta_(oindex_1.food, 189, 0, 0, 0);
  203. /* !EATS PEPPERS. */
  204. /* Computing MIN */
  205. i__1 = -1, i__2 = -findex_1.rvcyc;
  206. findex_1.rvcyc = min(i__1,i__2);
  207. /* !GETS THIRSTY. */
  208. return ret_val;
  209. L300:
  210. if (prsvec_1.prso != oindex_1.water) {
  211. goto L400;
  212. }
  213. /* !DRINK WHEN THIRSTY? */
  214. if (findex_1.rvcyc >= 0) {
  215. goto L350;
  216. }
  217. newsta_(prsvec_1.prso, 190, 0, 0, 0);
  218. /* !DRINKS AND */
  219. findex_1.cyclof = TRUE_;
  220. /* !FALLS ASLEEP. */
  221. objcts_1.oflag2[oindex_1.cyclo - 1] = (objcts_1.oflag2[oindex_1.cyclo - 1]
  222. | SLEPBT) & ~ FITEBT;
  223. return ret_val;
  224. L350:
  225. rspeak_(191);
  226. /* !NOT THIRSTY. */
  227. L10:
  228. ret_val = FALSE_;
  229. /* !FAILS. */
  230. return ret_val;
  231. L400:
  232. i = 192;
  233. /* !ASSUME INEDIBLE. */
  234. if (prsvec_1.prso == oindex_1.garli) {
  235. i = 193;
  236. }
  237. /* !GARLIC IS JOKE. */
  238. L450:
  239. rspeak_(i);
  240. /* !DISDAIN IT. */
  241. if (findex_1.rvcyc < 0) {
  242. --findex_1.rvcyc;
  243. }
  244. if (findex_1.rvcyc >= 0) {
  245. ++findex_1.rvcyc;
  246. }
  247. if (! findex_1.cyclof) {
  248. i__1 = abs(findex_1.rvcyc) + 193;
  249. rspeak_(i__1);
  250. }
  251. return ret_val;
  252. L500:
  253. i = 0;
  254. /* !ASSUME NOT HANDLED. */
  255. if (prsvec_1.prsa == vindex_1.hellow) {
  256. goto L450;
  257. }
  258. /* !HELLO IS NO GO. */
  259. if (prsvec_1.prsa == vindex_1.throww || prsvec_1.prsa == vindex_1.mungw) {
  260. i = rnd_(2) + 200;
  261. }
  262. if (prsvec_1.prsa == vindex_1.takew) {
  263. i = 202;
  264. }
  265. if (prsvec_1.prsa == vindex_1.tiew) {
  266. i = 203;
  267. }
  268. if (i <= 0) {
  269. goto L10;
  270. } else {
  271. goto L450;
  272. }
  273. /* !SEE IF HANDLED. */
  274. } /* cyclop_ */
  275. /* THIEFP- THIEF FUNCTION */
  276. /* DECLARATIONS */
  277. logical thiefp_(arg)
  278. integer arg;
  279. {
  280. /* System generated locals */
  281. integer i__1;
  282. logical ret_val;
  283. /* Local variables */
  284. integer i, j;
  285. ret_val = TRUE_;
  286. /* !ASSUME WINS. */
  287. if (prsvec_1.prsa != vindex_1.fightw) {
  288. goto L100;
  289. }
  290. /* !FIGHT? */
  291. if (objcts_1.ocan[oindex_1.still - 1] == oindex_1.thief) {
  292. goto L10;
  293. }
  294. /* !GOT STILLETTO? F. */
  295. if (qhere_(oindex_1.still, hack_1.thfpos)) {
  296. goto L50;
  297. }
  298. /* !CAN HE RECOVER IT? */
  299. newsta_(oindex_1.thief, 0, 0, 0, 0);
  300. /* !NO, VANISH. */
  301. if (qhere_(oindex_1.thief, play_1.here)) {
  302. rspeak_(498);
  303. }
  304. /* !IF HERO, TELL. */
  305. return ret_val;
  306. L50:
  307. newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
  308. /* !YES, RECOVER. */
  309. if (qhere_(oindex_1.thief, play_1.here)) {
  310. rspeak_(499);
  311. }
  312. /* !IF HERO, TELL. */
  313. return ret_val;
  314. L100:
  315. if (prsvec_1.prsa != vindex_1.deadxw) {
  316. goto L200;
  317. }
  318. /* !DEAD? */
  319. hack_1.thfact = FALSE_;
  320. /* !DISABLE DEMON. */
  321. objcts_1.oflag1[oindex_1.chali - 1] |= TAKEBT;
  322. j = 0;
  323. i__1 = objcts_1.olnt;
  324. for (i = 1; i <= i__1; ++i) {
  325. /* !CARRYING ANYTHING? */
  326. /* L125: */
  327. if (objcts_1.oadv[i - 1] == -oindex_1.thief) {
  328. j = 500;
  329. }
  330. }
  331. rspeak_(j);
  332. /* !TELL IF BOOTY REAPPEARS. */
  333. j = 501;
  334. i__1 = objcts_1.olnt;
  335. for (i = 1; i <= i__1; ++i) {
  336. /* !LOOP. */
  337. if (i == oindex_1.chali || i == oindex_1.thief || play_1.here !=
  338. rindex_1.treas || ! qhere_(i, play_1.here)) {
  339. goto L135;
  340. }
  341. objcts_1.oflag1[i - 1] |= VISIBT;
  342. rspsub_(j, objcts_1.odesc2[i - 1]);
  343. /* !DESCRIBE. */
  344. j = 502;
  345. goto L150;
  346. L135:
  347. if (objcts_1.oadv[i - 1] == -oindex_1.thief) {
  348. newsta_(i, 0, play_1.here, 0, 0);
  349. }
  350. L150:
  351. ;
  352. }
  353. return ret_val;
  354. L200:
  355. if (prsvec_1.prsa != vindex_1.frstqw) {
  356. goto L250;
  357. }
  358. /* !FIRST ENCOUNTER? */
  359. ret_val = prob_(20, 75);
  360. return ret_val;
  361. L250:
  362. if (prsvec_1.prsa != vindex_1.hellow || objcts_1.odesc1[oindex_1.thief -
  363. 1] != 504) {
  364. goto L300;
  365. }
  366. rspeak_(626);
  367. return ret_val;
  368. L300:
  369. if (prsvec_1.prsa != vindex_1.outxw) {
  370. goto L400;
  371. }
  372. /* !OUT? */
  373. hack_1.thfact = FALSE_;
  374. /* !DISABLE DEMON. */
  375. objcts_1.odesc1[oindex_1.thief - 1] = 504;
  376. /* !CHANGE DESCRIPTION. */
  377. objcts_1.oflag1[oindex_1.still - 1] &= ~ VISIBT;
  378. objcts_1.oflag1[oindex_1.chali - 1] |= TAKEBT;
  379. return ret_val;
  380. L400:
  381. if (prsvec_1.prsa != vindex_1.inxw) {
  382. goto L500;
  383. }
  384. /* !IN? */
  385. if (qhere_(oindex_1.thief, play_1.here)) {
  386. rspeak_(505);
  387. }
  388. /* !CAN HERO SEE? */
  389. hack_1.thfact = TRUE_;
  390. /* !ENABLE DEMON. */
  391. objcts_1.odesc1[oindex_1.thief - 1] = 503;
  392. /* !CHANGE DESCRIPTION. */
  393. objcts_1.oflag1[oindex_1.still - 1] |= VISIBT;
  394. if (play_1.here == rindex_1.treas && qhere_(oindex_1.chali, play_1.here)
  395. ) {
  396. objcts_1.oflag1[oindex_1.chali - 1] &= ~ TAKEBT;
  397. }
  398. return ret_val;
  399. L500:
  400. if (prsvec_1.prsa != vindex_1.takew) {
  401. goto L600;
  402. }
  403. /* !TAKE? */
  404. rspeak_(506);
  405. /* !JOKE. */
  406. return ret_val;
  407. L600:
  408. if (prsvec_1.prsa != vindex_1.throww || prsvec_1.prso != oindex_1.knife ||
  409. (objcts_1.oflag2[oindex_1.thief - 1] & FITEBT) != 0) {
  410. goto L700;
  411. }
  412. if (prob_(10, 10)) {
  413. goto L650;
  414. }
  415. /* !THREW KNIFE, 10%? */
  416. rspeak_(507);
  417. /* !NO, JUST MAKES */
  418. objcts_1.oflag2[oindex_1.thief - 1] |= FITEBT;
  419. return ret_val;
  420. L650:
  421. j = 508;
  422. /* !THIEF DROPS STUFF. */
  423. i__1 = objcts_1.olnt;
  424. for (i = 1; i <= i__1; ++i) {
  425. if (objcts_1.oadv[i - 1] != -oindex_1.thief) {
  426. goto L675;
  427. }
  428. /* !THIEF CARRYING? */
  429. j = 509;
  430. newsta_(i, 0, play_1.here, 0, 0);
  431. L675:
  432. ;
  433. }
  434. newsta_(oindex_1.thief, j, 0, 0, 0);
  435. /* !THIEF VANISHES. */
  436. return ret_val;
  437. L700:
  438. if (prsvec_1.prsa != vindex_1.throww && prsvec_1.prsa != vindex_1.givew ||
  439. prsvec_1.prso == 0 || prsvec_1.prso == oindex_1.thief) {
  440. goto L10;
  441. }
  442. if (objcts_1.ocapac[oindex_1.thief - 1] >= 0) {
  443. goto L750;
  444. }
  445. /* !WAKE HIM UP. */
  446. objcts_1.ocapac[oindex_1.thief - 1] = -objcts_1.ocapac[oindex_1.thief - 1]
  447. ;
  448. hack_1.thfact = TRUE_;
  449. objcts_1.oflag1[oindex_1.still - 1] |= VISIBT;
  450. objcts_1.odesc1[oindex_1.thief - 1] = 503;
  451. rspeak_(510);
  452. L750:
  453. if (prsvec_1.prso != oindex_1.brick || objcts_1.ocan[oindex_1.fuse - 1] !=
  454. oindex_1.brick || cevent_1.ctick[cindex_1.cevfus - 1] == 0) {
  455. goto L800;
  456. }
  457. rspeak_(511);
  458. /* !THIEF REFUSES BOMB. */
  459. return ret_val;
  460. L800:
  461. i__1 = -oindex_1.thief;
  462. newsta_(prsvec_1.prso, 0, 0, 0, i__1);
  463. /* !THIEF TAKES GIFT. */
  464. if (objcts_1.otval[prsvec_1.prso - 1] > 0) {
  465. goto L900;
  466. }
  467. /* !A TREASURE? */
  468. rspsub_(512, objcts_1.odesc2[prsvec_1.prso - 1]);
  469. return ret_val;
  470. L900:
  471. rspsub_(627, objcts_1.odesc2[prsvec_1.prso - 1]);
  472. /* !THIEF ENGROSSED. */
  473. findex_1.thfenf = TRUE_;
  474. return ret_val;
  475. L10:
  476. ret_val = FALSE_;
  477. return ret_val;
  478. } /* thiefp_ */