actors.F 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. C AAPPLI- APPLICABLES FOR ADVENTURERS
  2. C
  3. C COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142
  4. C ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED
  5. C WRITTEN BY R. M. SUPNIK
  6. C
  7. C DECLARATIONS
  8. C
  9. LOGICAL FUNCTION AAPPLI(RI)
  10. IMPLICIT INTEGER (A-Z)
  11. LOGICAL F,MOVETO
  12. include 'parser.h'
  13. include 'gamestat.h'
  14. include 'rooms.h'
  15. include 'rflag.h'
  16. include 'rindex.h'
  17. include 'xsrch.h'
  18. include 'objects.h'
  19. include 'oflags.h'
  20. include 'oindex.h'
  21. include 'clock.h'
  22. include 'advers.h'
  23. include 'verbs.h'
  24. include 'flags.h'
  25. C AAPPLI, PAGE 2
  26. C
  27. IF(RI.EQ.0) GO TO 10
  28. C !IF ZERO, NO APP.
  29. AAPPLI=.TRUE.
  30. C !ASSUME WINS.
  31. GO TO (1000,2000),RI
  32. C !BRANCH ON ADV.
  33. CALL BUG(11,RI)
  34. C
  35. C COMMON FALSE RETURN.
  36. C
  37. 10 AAPPLI=.FALSE.
  38. RETURN
  39. C
  40. C A1-- ROBOT. PROCESS MOST COMMANDS GIVEN TO ROBOT.
  41. C
  42. 1000 IF((PRSA.NE.RAISEW).OR.(PRSO.NE.RCAGE)) GO TO 1200
  43. CFLAG(CEVSPH)=.FALSE.
  44. C !ROBOT RAISED CAGE.
  45. WINNER=PLAYER
  46. C !RESET FOR PLAYER.
  47. F=MOVETO(CAGER,WINNER)
  48. C !MOVE TO NEW ROOM.
  49. CALL NEWSTA(CAGE,567,CAGER,0,0)
  50. C !INSTALL CAGE IN ROOM.
  51. CALL NEWSTA(ROBOT,0,CAGER,0,0)
  52. C !INSTALL ROBOT IN ROOM.
  53. AROOM(AROBOT)=CAGER
  54. C !ALSO MOVE ROBOT/ADV.
  55. CAGESF=.TRUE.
  56. C !CAGE SOLVED.
  57. OFLAG1(ROBOT)=IAND(OFLAG1(ROBOT),NOT(NDSCBT))
  58. OFLAG1(SPHER)=IOR(OFLAG1(SPHER),TAKEBT)
  59. RETURN
  60. C
  61. 1200 IF((PRSA.NE.DRINKW).AND.(PRSA.NE.EATW)) GO TO 1300
  62. CALL RSPEAK(568)
  63. C !EAT OR DRINK, JOKE.
  64. RETURN
  65. C
  66. 1300 IF(PRSA.NE.READW) GO TO 1400
  67. C !READ,
  68. CALL RSPEAK(569)
  69. C !JOKE.
  70. RETURN
  71. C
  72. 1400 IF((PRSA.EQ.WALKW).OR.(PRSA.EQ.TAKEW).OR.(PRSA.EQ.DROPW)
  73. & .OR.(PRSA.EQ.PUTW).OR.(PRSA.EQ.PUSHW).OR.(PRSA.EQ.THROWW)
  74. & .OR.(PRSA.EQ.TURNW).OR.(PRSA.EQ.LEAPW)) GO TO 10
  75. CALL RSPEAK(570)
  76. C !JOKE.
  77. RETURN
  78. C AAPPLI, PAGE 3
  79. C
  80. C A2-- MASTER. PROCESS MOST COMMANDS GIVEN TO MASTER.
  81. C
  82. 2000 IF(IAND(OFLAG2(QDOOR),OPENBT).NE.0) GO TO 2100
  83. CALL RSPEAK(783)
  84. C !NO MASTER YET.
  85. RETURN
  86. C
  87. 2100 IF(PRSA.NE.WALKW) GO TO 2200
  88. C !WALK?
  89. I=784
  90. C !ASSUME WONT.
  91. IF(((HERE.EQ.SCORR).AND.
  92. & ((PRSO.EQ.XNORTH).OR.(PRSO.EQ.XENTER))).OR.
  93. & ((HERE.EQ.NCORR).AND.
  94. & ((PRSO.EQ.XSOUTH).OR.(PRSO.EQ.XENTER))))
  95. & I=785
  96. CALL RSPEAK(I)
  97. RETURN
  98. C
  99. 2200 IF((PRSA.EQ.TAKEW).OR.(PRSA.EQ.DROPW).OR.(PRSA.EQ.PUTW).OR.
  100. & (PRSA.EQ.THROWW).OR.(PRSA.EQ.PUSHW).OR.(PRSA.EQ.TURNW).OR.
  101. & (PRSA.EQ.SPINW).OR.(PRSA.EQ.TRNTOW).OR.(PRSA.EQ.FOLLOW).OR.
  102. & (PRSA.EQ.STAYW).OR.(PRSA.EQ.OPENW).OR.(PRSA.EQ.CLOSEW).OR.
  103. & (PRSA.EQ.KILLW)) GO TO 10
  104. CALL RSPEAK(786)
  105. C !MASTER CANT DO IT.
  106. RETURN
  107. C
  108. END
  109. C THIEFD- INTERMOVE THIEF DEMON
  110. C
  111. C DECLARATIONS
  112. C
  113. SUBROUTINE THIEFD
  114. IMPLICIT INTEGER (A-Z)
  115. LOGICAL ONCE,PROB,QHERE,QSTILL,LIT,WINNIN
  116. INCLUDE 'gamestat.h'
  117. C
  118. INCLUDE 'debug.h'
  119. INCLUDE 'rooms.h'
  120. INCLUDE 'rflag.h'
  121. INCLUDE 'rindex.h'
  122. INCLUDE 'objects.h'
  123. INCLUDE 'oflags.h'
  124. INCLUDE 'oindex.h'
  125. INCLUDE 'villians.h'
  126. INCLUDE 'flags.h'
  127. C
  128. C FUNCTIONS AND DATA
  129. C
  130. QSTILL(R)=(QHERE(STILL,R).OR.(OADV(STILL).EQ.-THIEF))
  131. C THIEFD, PAGE 2
  132. C
  133. D DFLAG=IAND(PRSFLG, 32768).NE.0
  134. C !SET UP DETAIL FLAG.
  135. ONCE=.FALSE.
  136. C !INIT FLAG.
  137. 1025 RHERE=OROOM(THIEF)
  138. C !VISIBLE POS.
  139. IF(RHERE.NE.0) THFPOS=RHERE
  140. C
  141. IF(THFPOS.EQ.HERE) GO TO 1100
  142. C !THIEF IN WIN RM?
  143. IF(THFPOS.NE.TREAS) GO TO 1400
  144. C !THIEF NOT IN TREAS?
  145. C
  146. C THIEF IS IN TREASURE ROOM, AND WINNER IS NOT.
  147. C
  148. D IF(DFLAG) PRINT 10
  149. D10 FORMAT(' THIEFD-- IN TREASURE ROOM')
  150. IF(RHERE.EQ.0) GO TO 1050
  151. C !VISIBLE?
  152. CALL NEWSTA(THIEF,0,0,0,0)
  153. C !YES, VANISH.
  154. RHERE=0
  155. IF(QSTILL(TREAS)) CALL NEWSTA(STILL,0,0,THIEF,0)
  156. 1050 I=ROBADV(-THIEF,THFPOS,0,0)
  157. C !DROP VALUABLES.
  158. IF(QHERE(EGG,THFPOS)) OFLAG2(EGG)=IOR(OFLAG2(EGG),OPENBT)
  159. GO TO 1700
  160. C
  161. C THIEF AND WINNER IN SAME ROOM.
  162. C
  163. 1100 IF(THFPOS.EQ.TREAS) GO TO 1700
  164. C !IF TREAS ROOM, NOTHING.
  165. IF(IAND(RFLAG(THFPOS),RLIGHT).NE.0) GO TO 1400
  166. D IF(DFLAG) PRINT 20
  167. D20 FORMAT(' THIEFD-- IN ADV ROOM')
  168. IF(THFFLG) GO TO 1300
  169. C !THIEF ANNOUNCED?
  170. IF((RHERE.NE.0).OR.PROB(70,70)) GO TO 1150
  171. C !IF INVIS AND 30%.
  172. IF(OCAN(STILL).NE.THIEF) GO TO 1700
  173. C !ABORT IF NO STILLETTO.
  174. CALL NEWSTA(THIEF,583,THFPOS,0,0)
  175. C !INSERT THIEF INTO ROOM.
  176. THFFLG=.TRUE.
  177. C !THIEF IS ANNOUNCED.
  178. RETURN
  179. C
  180. 1150 IF((RHERE.EQ.0).OR.(IAND(OFLAG2(THIEF),FITEBT).EQ.0))
  181. & GO TO 1200
  182. IF(WINNIN(THIEF,WINNER)) GO TO 1175
  183. C !WINNING?
  184. CALL NEWSTA(THIEF,584,0,0,0)
  185. C !NO, VANISH THIEF.
  186. OFLAG2(THIEF)=IAND(OFLAG2(THIEF), not(FITEBT))
  187. IF(QSTILL(THFPOS)) CALL NEWSTA(STILL,0,0,THIEF,0)
  188. RETURN
  189. C
  190. 1175 IF(PROB(90,90)) GO TO 1700
  191. C !90% CHANCE TO STAY.
  192. C
  193. 1200 IF((RHERE.EQ.0).OR.PROB(70,70)) GO TO 1250
  194. C !IF VISIBLE AND 30%
  195. CALL NEWSTA(THIEF,585,0,0,0)
  196. C !VANISH THIEF.
  197. IF(QSTILL(THFPOS)) CALL NEWSTA(STILL,0,0,THIEF,0)
  198. RETURN
  199. C
  200. 1300 IF(RHERE.EQ.0) GO TO 1700
  201. C !ANNOUNCED. VISIBLE?
  202. 1250 IF(PROB(70,70)) RETURN
  203. C !70% CHANCE TO DO NOTHING.
  204. THFFLG=.TRUE.
  205. NR=ROBRM(THFPOS,100,0,0,-THIEF)+ROBADV(WINNER,0,0,-THIEF)
  206. I=586
  207. C !ROBBED EM.
  208. IF(RHERE.NE.0) I=588
  209. C !WAS HE VISIBLE?
  210. IF(NR.NE.0) I=I+1
  211. C !DID HE GET ANYTHING?
  212. CALL NEWSTA(THIEF,I,0,0,0)
  213. C !VANISH THIEF.
  214. IF(QSTILL(THFPOS))
  215. & CALL NEWSTA(STILL,0,0,THIEF,0)
  216. IF((NR.NE.0).AND..NOT.LIT(THFPOS)) CALL RSPEAK(406)
  217. RHERE=0
  218. GO TO 1700
  219. C !ONWARD.
  220. C
  221. C NOT IN ADVENTURERS ROOM.
  222. C
  223. 1400 CALL NEWSTA(THIEF,0,0,0,0)
  224. C !VANISH.
  225. RHERE=0
  226. D IF(DFLAG) PRINT 30,THFPOS
  227. D30 FORMAT(' THIEFD-- IN ROOM ',I4)
  228. IF(QSTILL(THFPOS))
  229. & CALL NEWSTA(STILL,0,0,THIEF,0)
  230. IF(IAND(RFLAG(THFPOS),RSEEN).EQ.0) GO TO 1700
  231. I=ROBRM(THFPOS,75,0,0,-THIEF)
  232. C !ROB ROOM 75%.
  233. IF((THFPOS.LT.MAZE1).OR.(THFPOS.GT.MAZ15).OR.
  234. & (HERE.LT.MAZE1).OR.(HERE.GT.MAZ15)) GO TO 1500
  235. DO 1450 I=1,OLNT
  236. C !BOTH IN MAZE.
  237. IF(.NOT.QHERE(I,THFPOS).OR.PROB(60,60).OR.
  238. & (IAND(OFLAG1(I),(VISIBT+TAKEBT)).NE.(VISIBT+TAKEBT)))
  239. & GO TO 1450
  240. CALL RSPSUB(590,ODESC2(I))
  241. C !TAKE OBJECT.
  242. IF(PROB(40,20)) GO TO 1700
  243. CALL NEWSTA(I,0,0,0,-THIEF)
  244. C !MOST OF THE TIME.
  245. OFLAG2(I)=IOR(OFLAG2(I),TCHBT)
  246. GO TO 1700
  247. 1450 CONTINUE
  248. GO TO 1700
  249. C
  250. 1500 DO 1550 I=1,OLNT
  251. C !NOT IN MAZE.
  252. IF(.NOT.QHERE(I,THFPOS).OR.(OTVAL(I).NE.0).OR.PROB(80,60).OR.
  253. & (IAND(OFLAG1(I),(VISIBT+TAKEBT)).NE.(VISIBT+TAKEBT)))
  254. & GO TO 1550
  255. CALL NEWSTA(I,0,0,0,-THIEF)
  256. OFLAG2(I)=IOR(OFLAG2(I),TCHBT)
  257. GO TO 1700
  258. 1550 CONTINUE
  259. C
  260. C NOW MOVE TO NEW ROOM.
  261. C
  262. 1700 IF(OADV(ROPE).EQ.-THIEF) DOMEF=.FALSE.
  263. IF(ONCE) GO TO 1800
  264. ONCE=.NOT.ONCE
  265. 1750 THFPOS=THFPOS-1
  266. C !NEXT ROOM.
  267. IF(THFPOS.LE.0) THFPOS=RLNT
  268. IF(IAND(RFLAG(THFPOS),(RLAND+RSACRD+REND)).NE.RLAND)
  269. & GO TO 1750
  270. THFFLG=.FALSE.
  271. C !NOT ANNOUNCED.
  272. GO TO 1025
  273. C !ONCE MORE.
  274. C
  275. C ALL DONE.
  276. C
  277. 1800 IF(THFPOS.EQ.TREAS) RETURN
  278. C !IN TREASURE ROOM?
  279. J=591
  280. C !NO, DROP STUFF.
  281. IF(THFPOS.NE.HERE) J=0
  282. DO 1850 I=1,OLNT
  283. IF((OADV(I).NE.-THIEF).OR.PROB(70,70).OR.
  284. & (OTVAL(I).GT.0)) GO TO 1850
  285. CALL NEWSTA(I,J,THFPOS,0,0)
  286. J=0
  287. 1850 CONTINUE
  288. RETURN
  289. C
  290. END