xref: /csrg-svn/contrib/dungeon/demons.F (revision 35973)
1*35973SbosticC FIGHTD- INTERMOVE FIGHT DEMON
2*35973SbosticC
3*35973SbosticC COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142
4*35973SbosticC ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED
5*35973SbosticC WRITTEN BY R. M. SUPNIK
6*35973SbosticC
7*35973SbosticC DECLARATIONS
8*35973SbosticC
9*35973Sbostic	SUBROUTINE FIGHTD
10*35973Sbostic	IMPLICIT INTEGER (A-Z)
11*35973Sbostic	LOGICAL PROB,OAPPLI
12*35973Sbostic#include "parser.h"
13*35973Sbostic#include "gamestate.h"
14*35973Sbostic#include "objects.h"
15*35973Sbostic#include "oflags.h"
16*35973Sbostic#include "oindex.h"
17*35973Sbostic#include "villians.h"
18*35973Sbostic#include "advers.h"
19*35973Sbostic#include "verbs.h"
20*35973Sbostic#include "flags.h"
21*35973SbosticC
22*35973Sbostic	LOGICAL F
23*35973SbosticC
24*35973SbosticC FUNCTIONS AND DATA
25*35973SbosticC
26*35973Sbostic	DATA ROUT/1/
27*35973SbosticC FIGHTD, PAGE 2
28*35973SbosticC
29*35973Sbostic	DO 2400 I=1,VLNT
30*35973SbosticC						!LOOP THRU VILLAINS.
31*35973Sbostic	  VOPPS(I)=0
32*35973SbosticC						!CLEAR OPPONENT SLOT.
33*35973Sbostic	  OBJ=VILLNS(I)
34*35973SbosticC						!GET OBJECT NO.
35*35973Sbostic	  RA=OACTIO(OBJ)
36*35973SbosticC						!GET HIS ACTION.
37*35973Sbostic	  IF(HERE.NE.OROOM(OBJ)) GO TO 2200
38*35973SbosticC						!ADVENTURER STILL HERE?
39*35973Sbostic	  IF((OBJ.EQ.THIEF).AND.THFENF) GO TO 2400
40*35973SbosticC						!THIEF ENGROSSED?
41*35973Sbostic	  IF(OCAPAC(OBJ).GE.0) GO TO 2050
42*35973SbosticC						!YES, VILL AWAKE?
43*35973Sbostic	  IF((VPROB(I).EQ.0).OR..NOT.PROB(VPROB(I),VPROB(I)))
44*35973Sbostic&		GO TO 2025
45*35973Sbostic	  OCAPAC(OBJ)=IABS(OCAPAC(OBJ))
46*35973Sbostic	  VPROB(I)=0
47*35973Sbostic	  IF(RA.EQ.0) GO TO 2400
48*35973SbosticC						!ANYTHING TO DO?
49*35973Sbostic	  PRSA=INXW
50*35973SbosticC						!YES, WAKE HIM UP.
51*35973Sbostic	  F=OAPPLI(RA,0)
52*35973Sbostic	  GO TO 2400
53*35973SbosticC						!NOTHING ELSE HAPPENS.
54*35973SbosticC
55*35973Sbostic2025	  VPROB(I)=VPROB(I)+10
56*35973SbosticC						!INCREASE WAKEUP PROB.
57*35973Sbostic	  GO TO 2400
58*35973SbosticC						!NOTHING ELSE.
59*35973SbosticC
60*35973Sbostic2050	  IF((and(OFLAG2(OBJ),FITEBT)).EQ.0) GO TO 2100
61*35973Sbostic	  VOPPS(I)=OBJ
62*35973SbosticC						!FIGHTING, SET UP OPP.
63*35973Sbostic	  GO TO 2400
64*35973SbosticC
65*35973Sbostic2100	  IF(RA.EQ.0) GO TO 2400
66*35973SbosticC						!NOT FIGHTING,
67*35973Sbostic	  PRSA=FRSTQW
68*35973SbosticC						!SET UP PROBABILITY
69*35973Sbostic	  IF(.NOT.OAPPLI(RA,0)) GO TO 2400
70*35973SbosticC						!OF FIGHTING.
71*35973Sbostic	  OFLAG2(OBJ)=or(OFLAG2(OBJ),FITEBT)
72*35973Sbostic	  VOPPS(I)=OBJ
73*35973SbosticC						!SET UP OPP.
74*35973Sbostic	  GO TO 2400
75*35973SbosticC
76*35973Sbostic2200	  IF((and(OFLAG2(OBJ),FITEBT).EQ.0).OR.(RA.EQ.0))
77*35973Sbostic&		GO TO 2300
78*35973Sbostic	  PRSA=FIGHTW
79*35973SbosticC						!HAVE A FIGHT.
80*35973Sbostic	  F=OAPPLI(RA,0)
81*35973Sbostic2300	  IF(OBJ.EQ.THIEF) THFENF=.FALSE.
82*35973SbosticC						!TURN OFF ENGROSSED.
83*35973Sbostic	  AFLAG(PLAYER)=and(AFLAG(PLAYER), not(ASTAG))
84*35973Sbostic	  OFLAG2(OBJ)=and(OFLAG2(OBJ), not(STAGBT+FITEBT))
85*35973Sbostic	  IF((OCAPAC(OBJ).GE.0).OR.(RA.EQ.0))
86*35973Sbostic&		GO TO 2400
87*35973Sbostic	  PRSA=INXW
88*35973SbosticC						!WAKE HIM UP.
89*35973Sbostic	  F=OAPPLI(RA,0)
90*35973Sbostic	  OCAPAC(OBJ)=IABS(OCAPAC(OBJ))
91*35973Sbostic2400	CONTINUE
92*35973SbosticC FIGHTD, PAGE 3
93*35973SbosticC
94*35973SbosticC NOW DO ACTUAL COUNTERBLOWS.
95*35973SbosticC
96*35973Sbostic	OUT=0
97*35973SbosticC						!ASSUME HERO OK.
98*35973Sbostic2600	DO 2700 I=1,VLNT
99*35973SbosticC						!LOOP THRU OPPS.
100*35973Sbostic	  J=VOPPS(I)
101*35973Sbostic	  IF(J.EQ.0) GO TO 2700
102*35973SbosticC						!SLOT EMPTY?
103*35973Sbostic	  PRSCON=1
104*35973SbosticC						!STOP CMD STREAM.
105*35973Sbostic	  RA=OACTIO(J)
106*35973Sbostic	  IF(RA.EQ.0) GO TO 2650
107*35973SbosticC						!VILLAIN ACTION?
108*35973Sbostic	  PRSA=FIGHTW
109*35973SbosticC						!SEE IF
110*35973Sbostic	  IF(OAPPLI(RA,0)) GO TO 2700
111*35973SbosticC						!SPECIAL ACTION.
112*35973Sbostic2650	  RES=BLOW(PLAYER,J,VMELEE(I),.FALSE.,OUT)
113*35973SbosticC						!STRIKE BLOW.
114*35973Sbostic	  IF(RES.LT.0) RETURN
115*35973SbosticC						!IF HERO DEAD, EXIT.
116*35973Sbostic	  IF(RES.EQ.ROUT) OUT=2+RND(3)
117*35973SbosticC						!IF HERO OUT, SET FLG.
118*35973Sbostic2700	CONTINUE
119*35973Sbostic	OUT=OUT-1
120*35973SbosticC						!DECREMENT OUT COUNT.
121*35973Sbostic	IF(OUT.GT.0) GO TO 2600
122*35973SbosticC						!IF STILL OUT, GO AGAIN.
123*35973Sbostic	RETURN
124*35973SbosticC
125*35973Sbostic	END
126*35973SbosticC BLOW- STRIKE BLOW
127*35973SbosticC
128*35973SbosticC DECLARATIONS
129*35973SbosticC
130*35973Sbostic	INTEGER FUNCTION BLOW(H,V,RMK,HFLG,OUT)
131*35973Sbostic	IMPLICIT INTEGER (A-Z)
132*35973Sbostic	LOGICAL HFLG,OAPPLI,PROB
133*35973Sbostic	INTEGER DEF1R(3),DEF2R(4),DEF3R(5)
134*35973Sbostic	INTEGER RVECTR(66),RSTATE(45)
135*35973Sbostic#include "gamestate.h"
136*35973Sbostic#include "debug.h"
137*35973SbosticC
138*35973SbosticC PARSE VECTOR
139*35973SbosticC
140*35973Sbostic	LOGICAL PRSWON
141*35973Sbostic#include "parser.h"
142*35973SbosticC
143*35973SbosticC MISCELLANEOUS VARIABLES
144*35973SbosticC
145*35973Sbostic	COMMON /STAR/ MBASE,STRBIT
146*35973Sbostic#include "objects.h"
147*35973Sbostic#include "oflags.h"
148*35973SbosticC
149*35973Sbostic#include "clock.h"
150*35973Sbostic
151*35973Sbostic#include "advers.h"
152*35973Sbostic#include "verbs.h"
153*35973SbosticC
154*35973Sbostic	LOGICAL F
155*35973SbosticC
156*35973SbosticC FUNCTIONS AND DATA
157*35973SbosticC
158*35973Sbostic	DATA RMISS/0/,ROUT/1/,RKILL/2/,RLIGHT/3/
159*35973Sbostic	DATA RSER/4/,RSTAG/5/,RLOSE/6/,RHES/7/,RSIT/8/
160*35973Sbostic	DATA DEF1R/1,2,3/
161*35973Sbostic	DATA DEF2R/13,23,24,25/
162*35973Sbostic	DATA DEF3R/35,36,46,47,57/
163*35973SbosticC
164*35973Sbostic	DATA RVECTR/0,0,0,0,5,5,1,1,2,2,2,2,
165*35973Sbostic&		0,0,0,0,0,5,5,3,3,1,
166*35973Sbostic&		0,0,0,5,5,3,3,3,1,2,2,2,
167*35973Sbostic&		0,0,0,0,0,5,5,3,3,4,4,
168*35973Sbostic&		0,0,0,5,5,3,3,3,4,4,4,
169*35973Sbostic&		0,5,5,3,3,3,3,4,4,4/
170*35973Sbostic	DATA RSTATE/5000,3005,3008,4011,3015,3018,1021,0,0,
171*35973Sbostic&		5022,3027,3030,4033,3037,3040,1043,0,0,
172*35973Sbostic&		4044,2048,4050,4054,5058,4063,4067,3071,1074,
173*35973Sbostic&		4075,1079,4080,4084,4088,4092,4096,4100,1104,
174*35973Sbostic&		4105,2109,4111,4115,4119,4123,4127,3131,3134/
175*35973SbosticC BLOW, PAGE 3
176*35973SbosticC
177*35973Sbostic	RA=OACTIO(V)
178*35973SbosticC						!GET VILLAIN ACTION,
179*35973Sbostic	DV=ODESC2(V)
180*35973SbosticC						!DESCRIPTION.
181*35973Sbostic	BLOW=RMISS
182*35973SbosticC						!ASSUME NO RESULT.
183*35973Sbostic#ifdef debug
184*35973Sbostic	IF(DFLAG) PRINT 10,H,V,RMK,HFLG,OUT
185*35973Sbostic#ifdef NOCC
186*35973Sbostic10	FORMAT('BLOW 10-- ',3I7,L7,I7)
187*35973Sbostic#else NOCC
188*35973Sbostic10	FORMAT(' BLOW 10-- ',3I7,L7,I7)
189*35973Sbostic#endif NOCC
190*35973Sbostic#endif debug
191*35973Sbostic	IF(.NOT.HFLG) GO TO 1000
192*35973SbosticC						!HERO STRIKING BLOW?
193*35973SbosticC
194*35973SbosticC HERO IS ATTACKER, VILLAIN IS DEFENDER.
195*35973SbosticC
196*35973Sbostic	PBLOSE=10
197*35973SbosticC						!BAD LK PROB.
198*35973Sbostic	OFLAG2(V)=or(OFLAG2(V),FITEBT)
199*35973Sbostic	IF(and(AFLAG(H),ASTAG).EQ.0) GO TO 100
200*35973Sbostic	CALL RSPEAK(591)
201*35973SbosticC						!YES, CANT FIGHT.
202*35973Sbostic	AFLAG(H)=and(AFLAG(H), not(ASTAG))
203*35973Sbostic	RETURN
204*35973SbosticC
205*35973Sbostic100	ATT=FIGHTS(H,.TRUE.)
206*35973SbosticC						!GET HIS STRENGTH.
207*35973Sbostic	OA=ATT
208*35973Sbostic	DEF=VILSTR(V)
209*35973SbosticC						!GET VILL STRENGTH.
210*35973Sbostic	OD=DEF
211*35973Sbostic	DWEAP=0
212*35973SbosticC						!ASSUME NO WEAPON.
213*35973Sbostic	DO 200 I=1,OLNT
214*35973SbosticC						!SEARCH VILLAIN.
215*35973Sbostic	  IF((OCAN(I).EQ.V).AND.(and(OFLAG2(I),WEAPBT).NE.0))
216*35973Sbostic&		DWEAP=I
217*35973Sbostic200	CONTINUE
218*35973Sbostic	IF(V.EQ.AOBJ(PLAYER)) GO TO 300
219*35973SbosticC						!KILLING SELF?
220*35973Sbostic	IF(DEF.NE.0) GO TO 2000
221*35973SbosticC						!DEFENDER ALIVE?
222*35973Sbostic	CALL RSPSUB(592,DV)
223*35973SbosticC						!VILLAIN DEAD.
224*35973Sbostic	RETURN
225*35973SbosticC
226*35973Sbostic300	CALL JIGSUP(593)
227*35973SbosticC						!KILLING SELF.
228*35973Sbostic	RETURN
229*35973SbosticC
230*35973SbosticC VILLAIN IS ATTACKER, HERO IS DEFENDER.
231*35973SbosticC
232*35973Sbostic1000	PBLOSE=50
233*35973SbosticC						!BAD LK PROB.
234*35973Sbostic	AFLAG(H)=and(AFLAG(H),not(ASTAG))
235*35973Sbostic	IF(and(OFLAG2(V),STAGBT).EQ.0) GO TO 1200
236*35973Sbostic	OFLAG2(V)=and(OFLAG2(V), not(STAGBT))
237*35973Sbostic	CALL RSPSUB(594,DV)
238*35973SbosticC						!DESCRIBE.
239*35973Sbostic	RETURN
240*35973SbosticC
241*35973Sbostic1200	ATT=VILSTR(V)
242*35973SbosticC						!SET UP ATT, DEF.
243*35973Sbostic	OA=ATT
244*35973Sbostic	DEF=FIGHTS(H,.TRUE.)
245*35973Sbostic	IF(DEF.LE.0) RETURN
246*35973SbosticC						!DONT ALLOW DEAD DEF.
247*35973Sbostic	OD=FIGHTS(H,.FALSE.)
248*35973Sbostic	DWEAP=IABS(FWIM(0,WEAPBT,0,0,H,.TRUE.))
249*35973SbosticC						!FIND A WEAPON.
250*35973SbosticC BLOW, PAGE 4
251*35973SbosticC
252*35973SbosticC PARTIES ARE NOW EQUIPPED.  DEF CANNOT BE ZERO.
253*35973SbosticC ATT MUST BE > 0.
254*35973SbosticC
255*35973Sbostic2000	CONTINUE
256*35973Sbostic#ifdef debug
257*35973Sbostic	IF(DFLAG) PRINT 2050,ATT,OA,DEF,OD,DWEAP
258*35973Sbostic#ifdef NOCC
259*35973Sbostic2050	FORMAT('BLOW 2050-- ',5I7)
260*35973Sbostic#else NOCC
261*35973Sbostic2050	FORMAT(' BLOW 2050-- ',5I7)
262*35973Sbostic#endif NOCC
263*35973Sbostic#endif debug
264*35973Sbostic	IF(DEF.GT.0) GO TO 2100
265*35973SbosticC						!DEF ALIVE?
266*35973Sbostic	RES=RKILL
267*35973Sbostic	IF(HFLG) CALL RSPSUB(595,DV)
268*35973SbosticC						!DEADER.
269*35973Sbostic	GO TO 3000
270*35973SbosticC
271*35973Sbostic2100	IF(DEF-2) 2200,2300,2400
272*35973SbosticC						!DEF <2,=2,>2
273*35973Sbostic2200	ATT=MIN0(ATT,3)
274*35973SbosticC						!SCALE ATT.
275*35973Sbostic	TBL=DEF1R(ATT)
276*35973SbosticC						!CHOOSE TABLE.
277*35973Sbostic	GO TO 2500
278*35973SbosticC
279*35973Sbostic2300	ATT=MIN0(ATT,4)
280*35973SbosticC						!SCALE ATT.
281*35973Sbostic	TBL=DEF2R(ATT)
282*35973SbosticC						!CHOOSE TABLE.
283*35973Sbostic	GO TO 2500
284*35973SbosticC
285*35973Sbostic2400	ATT=ATT-DEF
286*35973SbosticC						!SCALE ATT.
287*35973Sbostic	ATT=MIN0(2,MAX0(-2,ATT))+3
288*35973Sbostic	TBL=DEF3R(ATT)
289*35973SbosticC
290*35973Sbostic2500	RES=RVECTR(TBL+RND(10))
291*35973SbosticC						!GET RESULT.
292*35973Sbostic	IF(OUT.EQ.0) GO TO 2600
293*35973SbosticC						!WAS HE OUT?
294*35973Sbostic	IF(RES.EQ.RSTAG) GO TO 2550
295*35973SbosticC						!YES, STAG--> HES.
296*35973Sbostic	RES=RSIT
297*35973SbosticC						!OTHERWISE, SITTING.
298*35973Sbostic	GO TO 2600
299*35973Sbostic2550	RES=RHES
300*35973Sbostic2600	IF((RES.EQ.RSTAG).AND.(DWEAP.NE.0).AND.PROB(25,PBLOSE))
301*35973Sbostic&		RES=RLOSE
302*35973SbosticC
303*35973Sbostic	MI=RSTATE(((RMK-1)*9)+RES+1)
304*35973SbosticC						!CHOOSE TABLE ENTRY.
305*35973Sbostic	IF(MI.EQ.0) GO TO 3000
306*35973Sbostic	I=(MOD(MI,1000)+RND(MI/1000))+MBASE+1
307*35973Sbostic	J=DV
308*35973Sbostic	IF(.NOT.HFLG .AND.(DWEAP.NE.0)) J=ODESC2(DWEAP)
309*35973Sbostic#ifdef debug
310*35973Sbostic	IF(DFLAG) PRINT 2650,RES,MI,I,J,MBASE
311*35973Sbostic#ifdef NOCC
312*35973Sbostic2650	FORMAT('BLOW 2650-- ',5I7)
313*35973Sbostic#else NOCC
314*35973Sbostic2650	FORMAT(' BLOW 2650-- ',5I7)
315*35973Sbostic#endif NOCC
316*35973Sbostic#endif debug
317*35973Sbostic	CALL RSPSUB(I,J)
318*35973SbosticC						!PRESENT RESULT.
319*35973SbosticC BLOW, PAGE 5
320*35973SbosticC
321*35973SbosticC NOW APPLY RESULT
322*35973SbosticC
323*35973Sbostic3000	GO TO (4000,3100,3200,3300,3400,3500,3600,4000,3200),RES+1
324*35973SbosticC
325*35973Sbostic3100	IF(HFLG) DEF=-DEF
326*35973SbosticC						!UNCONSCIOUS.
327*35973Sbostic	GO TO 4000
328*35973SbosticC
329*35973Sbostic3200	DEF=0
330*35973SbosticC						!KILLED OR SITTING DUCK.
331*35973Sbostic	GO TO 4000
332*35973SbosticC
333*35973Sbostic3300	DEF=MAX0(0,DEF-1)
334*35973SbosticC						!LIGHT WOUND.
335*35973Sbostic	GO TO 4000
336*35973SbosticC
337*35973Sbostic3400	DEF=MAX0(0,DEF-2)
338*35973SbosticC						!SERIOUS WOUND.
339*35973Sbostic	GO TO 4000
340*35973SbosticC
341*35973Sbostic3500	IF(HFLG) GO TO 3550
342*35973SbosticC						!STAGGERED.
343*35973Sbostic	AFLAG(H)=or(AFLAG(H),ASTAG)
344*35973Sbostic	GO TO 4000
345*35973SbosticC
346*35973Sbostic3550	OFLAG2(V)=or(OFLAG2(V),STAGBT)
347*35973Sbostic	GO TO 4000
348*35973SbosticC
349*35973Sbostic3600	CALL NEWSTA(DWEAP,0,HERE,0,0)
350*35973SbosticC						!LOSE WEAPON.
351*35973Sbostic	DWEAP=0
352*35973Sbostic	IF(HFLG) GO TO 4000
353*35973SbosticC						!IF HERO, DONE.
354*35973Sbostic	DWEAP=IABS(FWIM(0,WEAPBT,0,0,H,.TRUE.))
355*35973SbosticC						!GET NEW.
356*35973Sbostic	IF(DWEAP.NE.0) CALL RSPSUB(605,ODESC2(DWEAP))
357*35973SbosticC BLOW, PAGE 6
358*35973SbosticC
359*35973Sbostic4000	BLOW=RES
360*35973SbosticC						!RETURN RESULT.
361*35973Sbostic	IF(.NOT.HFLG) GO TO 4500
362*35973SbosticC						!HERO?
363*35973Sbostic	OCAPAC(V)=DEF
364*35973SbosticC						!STORE NEW CAPACITY.
365*35973Sbostic	IF(DEF.NE.0) GO TO 4100
366*35973SbosticC						!DEAD?
367*35973Sbostic	OFLAG2(V)=and(OFLAG2(V), not(FITEBT))
368*35973Sbostic	CALL RSPSUB(572,DV)
369*35973SbosticC						!HE DIES.
370*35973Sbostic	CALL NEWSTA(V,0,0,0,0)
371*35973SbosticC						!MAKE HIM DISAPPEAR.
372*35973Sbostic	IF(RA.EQ.0) RETURN
373*35973SbosticC						!IF NX TO DO, EXIT.
374*35973Sbostic	PRSA=DEADXW
375*35973SbosticC						!LET HIM KNOW.
376*35973Sbostic	F=OAPPLI(RA,0)
377*35973Sbostic	RETURN
378*35973SbosticC
379*35973Sbostic4100	IF((RES.NE.ROUT).OR.(RA.EQ.0)) RETURN
380*35973Sbostic	PRSA=OUTXW
381*35973SbosticC						!LET HIM BE OUT.
382*35973Sbostic	F=OAPPLI(RA,0)
383*35973Sbostic	RETURN
384*35973SbosticC
385*35973Sbostic4500	ASTREN(H)=-10000
386*35973SbosticC						!ASSUME DEAD.
387*35973Sbostic	IF(DEF.NE.0) ASTREN(H)=DEF-OD
388*35973Sbostic	IF(DEF.GE.OD) GO TO 4600
389*35973Sbostic	CTICK(CEVCUR)=30
390*35973Sbostic	CFLAG(CEVCUR)=.TRUE.
391*35973Sbostic4600	IF(FIGHTS(H,.TRUE.).GT.0) RETURN
392*35973Sbostic	ASTREN(H)=1-FIGHTS(H,.FALSE.)
393*35973SbosticC						!HE'S DEAD.
394*35973Sbostic	CALL JIGSUP(596)
395*35973Sbostic	BLOW=-1
396*35973Sbostic	RETURN
397*35973SbosticC
398*35973Sbostic	END
399*35973SbosticC SWORDD- SWORD INTERMOVE DEMON
400*35973SbosticC
401*35973SbosticC DECLARATIONS
402*35973SbosticC
403*35973Sbostic	SUBROUTINE SWORDD
404*35973Sbostic	IMPLICIT INTEGER(A-Z)
405*35973Sbostic	LOGICAL INFEST,FINDXT
406*35973Sbostic#include "gamestate.h"
407*35973Sbostic#include "curxt.h"
408*35973Sbostic#include "xsrch.h"
409*35973Sbostic#include "objects.h"
410*35973Sbostic#include "oindex.h"
411*35973Sbostic#include "villians.h"
412*35973Sbostic#include "advers.h"
413*35973SbosticC SWORDD, PAGE 2
414*35973SbosticC
415*35973Sbostic	IF(OADV(SWORD).NE.PLAYER) GO TO 500
416*35973SbosticC						!HOLDING SWORD?
417*35973Sbostic	NG=2
418*35973SbosticC						!ASSUME VILL CLOSE.
419*35973Sbostic	IF(INFEST(HERE)) GO TO 300
420*35973SbosticC						!VILL HERE?
421*35973Sbostic	NG=1
422*35973Sbostic	DO 200 I=XMIN,XMAX,XMIN
423*35973SbosticC						!NO, SEARCH ROOMS.
424*35973Sbostic	  IF(.NOT.FINDXT(I,HERE)) GO TO 200
425*35973SbosticC						!ROOM THAT WAY?
426*35973Sbostic	  GO TO (50,200,50,50),XTYPE
427*35973SbosticC						!SEE IF ROOM AT ALL.
428*35973Sbostic50	  IF(INFEST(XROOM1)) GO TO 300
429*35973SbosticC						!CHECK ROOM.
430*35973Sbostic200	CONTINUE
431*35973Sbostic	NG=0
432*35973SbosticC						!NO GLOW.
433*35973SbosticC
434*35973Sbostic300	IF(NG.EQ.SWDSTA) RETURN
435*35973SbosticC						!ANY STATE CHANGE?
436*35973Sbostic	CALL RSPEAK(NG+495)
437*35973SbosticC						!YES, TELL NEW STATE.
438*35973Sbostic	SWDSTA=NG
439*35973Sbostic	RETURN
440*35973SbosticC
441*35973Sbostic500	SWDACT=.FALSE.
442*35973SbosticC						!DROPPED SWORD,
443*35973Sbostic	RETURN
444*35973SbosticC						!DISABLE DEMON.
445*35973Sbostic	END
446*35973SbosticC INFEST-	SUBROUTINE TO TEST FOR INFESTED ROOM
447*35973SbosticC
448*35973SbosticC DECLARATIONS
449*35973SbosticC
450*35973Sbostic	LOGICAL FUNCTION INFEST(R)
451*35973Sbostic	IMPLICIT INTEGER(A-Z)
452*35973SbosticC
453*35973SbosticC ROOMS
454*35973Sbostic#include "rindex.h"
455*35973Sbostic#include "objects.h"
456*35973Sbostic#include "oindex.h"
457*35973Sbostic#include "villians.h"
458*35973Sbostic#include "flags.h"
459*35973SbosticC
460*35973Sbostic	IF(.NOT.ENDGMF) INFEST=(OROOM(CYCLO).EQ.R).OR.
461*35973Sbostic&		(OROOM(TROLL).EQ.R).OR.
462*35973Sbostic&		((OROOM(THIEF).EQ.R).AND.THFACT)
463*35973Sbostic	IF(ENDGMF) INFEST=(R.EQ.MRG).OR.(R.EQ.MRGE).OR.
464*35973Sbostic&		(R.EQ.MRGW).OR.
465*35973Sbostic&		((R.EQ.INMIR).AND.(MLOC.EQ.MRG))
466*35973Sbostic	RETURN
467*35973Sbostic	END
468