Source to dungeon-2.5.6/demons.f
C FIGHTD- INTERMOVE FIGHT DEMON
C
C COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142
C ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED
C WRITTEN BY R. M. SUPNIK
C
C DECLARATIONS
C
SUBROUTINE FIGHTD
IMPLICIT INTEGER (A-Z)
LOGICAL PROB,OAPPLI,F
C
C PARSER OUTPUT
C
LOGICAL PRSWON
COMMON /PRSVEC/ PRSA,PRSI,PRSO,PRSWON,PRSCON
C
C GAME STATE
C
LOGICAL TELFLG
COMMON /PLAY/ WINNER,HERE,TELFLG
C
C OBJECTS
C
COMMON /OBJCTS/ OLNT,ODESC1(220),ODESC2(220),ODESCO(220),
1 OACTIO(220),OFLAG1(220),OFLAG2(220),OFVAL(220),
2 OTVAL(220),OSIZE(220),OCAPAC(220),OROOM(220),
3 OADV(220),OCAN(220),OREAD(220)
C
COMMON /OFLAGS/ VISIBT,READBT,TAKEBT,DOORBT,TRANBT,FOODBT,
1 NDSCBT,DRNKBT,CONTBT,LITEBT,VICTBT,BURNBT,FLAMBT,
2 TOOLBT,TURNBT,ONBT
COMMON /OFLAGS/ FINDBT,SLEPBT,SCRDBT,TIEBT,CLMBBT,ACTRBT,
1 WEAPBT,FITEBT,VILLBT,STAGBT,TRYBT,NOCHBT,OPENBT,
2 TCHBT,VEHBT,SCHBT
C
COMMON /OINDEX/ GARLI,FOOD,GUNK,COAL,MACHI,DIAMO,TCASE,BOTTL
COMMON /OINDEX/ WATER,ROPE,KNIFE,SWORD,LAMP,BLAMP,RUG
COMMON /OINDEX/ LEAVE,TROLL,AXE
COMMON /OINDEX/ RKNIF,KEYS,ICE,BAR
COMMON /OINDEX/ COFFI,TORCH,TBASK,FBASK,IRBOX
COMMON /OINDEX/ GHOST,TRUNK,BELL,BOOK,CANDL
COMMON /OINDEX/ MATCH,TUBE,PUTTY,WRENC,SCREW,CYCLO,CHALI
COMMON /OINDEX/ THIEF,STILL,WINDO,GRATE,DOOR
COMMON /OINDEX/ HPOLE,LEAK,RBUTT,RAILI
COMMON /OINDEX/ POT,STATU,IBOAT,DBOAT,PUMP,RBOAT
COMMON /OINDEX/ STICK,BUOY,SHOVE,BALLO,RECEP,GUANO
COMMON /OINDEX/ BROPE,HOOK1,HOOK2,SAFE,SSLOT,BRICK,FUSE
COMMON /OINDEX/ GNOME,BLABE,DBALL,TOMB
COMMON /OINDEX/ LCASE,CAGE,RCAGE,SPHER,SQBUT
COMMON /OINDEX/ FLASK,POOL,SAFFR,BUCKE,ECAKE,ORICE,RDICE,BLICE
COMMON /OINDEX/ ROBOT,FTREE,BILLS,PORTR,SCOL,ZGNOM
COMMON /OINDEX/ EGG,BEGG,BAUBL,CANAR,BCANA
COMMON /OINDEX/ YLWAL,RDWAL,PINDR,RBEAM
COMMON /OINDEX/ ODOOR,QDOOR,CDOOR,NUM1,NUM8
COMMON /OINDEX/ WARNI,CSLIT,GCARD,STLDR
COMMON /OINDEX/ HANDS,WALL,LUNGS,SAILO,AVIAT,TEETH
COMMON /OINDEX/ ITOBJ,EVERY,VALUA,OPLAY,WNORT,GWATE,MASTER
C
C VILLAINS AND DEMONS
C
COMMON /VILL/ VLNT,VILLNS(4),VPROB(4),VOPPS(4),VBEST(4),VMELEE(4)
C
C ADVENTURERS
C
COMMON /ADVS/ ALNT,AROOM(4),ASCORE(4),AVEHIC(4),
1 AOBJ(4),AACTIO(4),ASTREN(4),AFLAG(4)
C
COMMON /AFLAGS/ ASTAG
C
COMMON /AINDEX/ PLAYER,AROBOT,AMASTR
C
C VERBS
C
COMMON /VINDEX/ CINTW,DEADXW,FRSTQW,INXW,OUTXW
COMMON /VINDEX/ WALKIW,FIGHTW,FOOW
COMMON /VINDEX/ MELTW,READW,INFLAW,DEFLAW,ALARMW,EXORCW
COMMON /VINDEX/ PLUGW,KICKW,WAVEW,RAISEW,LOWERW,RUBW
COMMON /VINDEX/ PUSHW,UNTIEW,TIEW,TIEUPW,TURNW,BREATW
COMMON /VINDEX/ KNOCKW,LOOKW,EXAMIW,SHAKEW,MOVEW,TRNONW,TRNOFW
COMMON /VINDEX/OPENW,CLOSEW,FINDW,WAITW,SPINW,BOARDW,UNBOAW,TAKEW
COMMON /VINDEX/ INVENW,FILLW,EATW,DRINKW,BURNW
COMMON /VINDEX/ MUNGW,KILLW,ATTACW,SWINGW
COMMON /VINDEX/ WALKW,TELLW,PUTW,DROPW,GIVEW,POURW,THROWW
COMMON /VINDEX/ DIGW,LEAPW,STAYW,FOLLOW
COMMON /VINDEX/ HELLOW,LOOKIW,LOOKUW,PUMPW,WINDW
COMMON /VINDEX/ CLMBW,CLMBUW,CLMBDW,TRNTOW
C
C FLAGS
C
LOGICAL TROLLF,CAGESF,BUCKTF,CAROFF,CAROZF,LWTIDF
LOGICAL DOMEF,GLACRF,ECHOF,RIDDLF,LLDF,CYCLOF
LOGICAL MAGICF,LITLDF,SAFEF,GNOMEF,GNODRF,MIRRMF
LOGICAL EGYPTF,ONPOLF,BLABF,BRIEFF,SUPERF,BUOYF
LOGICAL GRUNLF,GATEF,RAINBF,CAGETF,EMPTHF,DEFLAF
LOGICAL GLACMF,FROBZF,ENDGMF,BADLKF,THFENF,SINGSF
LOGICAL MRPSHF,MROPNF,WDOPNF,MR1F,MR2F,INQSTF
LOGICAL FOLLWF,SPELLF,CPOUTF,CPUSHF
COMMON /FINDEX/ TROLLF,CAGESF,BUCKTF,CAROFF,CAROZF,LWTIDF,
1 DOMEF,GLACRF,ECHOF,RIDDLF,LLDF,CYCLOF,
2 MAGICF,LITLDF,SAFEF,GNOMEF,GNODRF,MIRRMF,
3 EGYPTF,ONPOLF,BLABF,BRIEFF,SUPERF,BUOYF,
4 GRUNLF,GATEF,RAINBF,CAGETF,EMPTHF,DEFLAF,
5 GLACMF,FROBZF,ENDGMF,BADLKF,THFENF,SINGSF,
6 MRPSHF,MROPNF,WDOPNF,MR1F,MR2F,INQSTF,
7 FOLLWF,SPELLF,CPOUTF,CPUSHF
COMMON /FINDEX/ BTIEF,BINFF
COMMON /FINDEX/ RVMNT,RVCLR,RVCYC,RVSND,RVGUA
COMMON /FINDEX/ ORRUG,ORCAND,ORMTCH,ORLAMP
COMMON /FINDEX/ MDIR,MLOC,POLEUF
COMMON /FINDEX/ QUESNO,NQATT,CORRCT
COMMON /FINDEX/ LCELL,PNUMB,ACELL,DCELL,CPHERE
C
C FUNCTIONS AND DATA
C
DATA ROUT/1/
C FIGHTD, PAGE 2
C
DO 2400 I=1,VLNT
C LOOP THRU VILLAINS.
VOPPS(I)=0
C CLEAR OPPONENT SLOT.
OBJ=VILLNS(I)
C GET OBJECT NO.
RA=OACTIO(OBJ)
C GET HIS ACTION.
IF(HERE.NE.OROOM(OBJ)) GO TO 2200
C ADVENTURER STILL HERE?
IF((OBJ.EQ.THIEF).AND.THFENF) GO TO 2400
C THIEF ENGROSSED?
IF(OCAPAC(OBJ).GE.0) GO TO 2050
C YES, VILL AWAKE?
IF((VPROB(I).EQ.0).OR..NOT.PROB(VPROB(I),VPROB(I)))
1 GO TO 2025
C NO, SEE IF WAKES UP.
OCAPAC(OBJ)=IABS(OCAPAC(OBJ))
VPROB(I)=0
IF(RA.EQ.0) GO TO 2400
C ANYTHING TO DO?
PRSA=INXW
C YES, WAKE HIM UP.
F=OAPPLI(RA,0)
GO TO 2400
C NOTHING ELSE HAPPENS.
C
2025 VPROB(I)=VPROB(I)+10
C INCREASE WAKEUP PROB.
GO TO 2400
C NOTHING ELSE.
C
2050 IF(ZAND(OFLAG2(OBJ),FITEBT).EQ.0) GO TO 2100
VOPPS(I)=OBJ
C FIGHTING, SET UP OPP.
GO TO 2400
C
2100 IF(RA.EQ.0) GO TO 2400
C NOT FIGHTING,
PRSA=FRSTQW
C SET UP PROBABILITY
IF(.NOT.OAPPLI(RA,0)) GO TO 2400
C OF FIGHTING.
OFLAG2(OBJ)=ZOR(OFLAG2(OBJ),FITEBT)
VOPPS(I)=OBJ
C SET UP OPP.
GO TO 2400
C
2200 IF((ZAND(OFLAG2(OBJ),FITEBT).EQ.0).OR.(RA.EQ.0))
1 GO TO 2300
C JOTHING TK DO.
PRSA=FIGHTW
C HAVE A FIGHT.
F=OAPPLI(RA,0)
2300 IF(OBJ.EQ.THIEF) THFENF=.FALSE.
C TURN OFF ENGROSSED.
AFLAG(PLAYER)=ZAND(AFLAG(PLAYER),NOT(ASTAG))
OFLAG2(OBJ)=ZAND(OFLAG2(OBJ), NOT(STAGBT+FITEBT))
IF((OCAPAC(OBJ).GE.0).OR.(RA.EQ.0))
1 GO TO 2400
PRSA=INXW
C WAKE HIM UP.
F=OAPPLI(RA,0)
OCAPAC(OBJ)=IABS(OCAPAC(OBJ))
2400 CONTINUE
C FIGHTD, PAGE 3
C
C NOW DO ACTUAL COUNTERBLOWS.
C
OUT=0
C ASSUME HERO OK.
2600 DO 2700 I=1,VLNT
C LOOP THRU OPPS.
J=VOPPS(I)
IF(J.EQ.0) GO TO 2700
C SLOT EMPTY?
PRSCON=1
C STOP CMD STREAM.
RA=OACTIO(J)
IF(RA.EQ.0) GO TO 2650
C VILLAIN ACTION?
PRSA=FIGHTW
C SEE IF
IF(OAPPLI(RA,0)) GO TO 2700
C SPECIAL ACTION.
2650 RES=BLOW(PLAYER,J,VMELEE(I),.FALSE.,OUT)
C STRIKE BLOW.
IF(RES.LT.0) RETURN
C IF HERO DEAD, EXIT.
IF(RES.EQ.ROUT) OUT=2+ZRND(3)
C IF HERO OUT, SET FLG.
2700 CONTINUE
OUT=OUT-1
C DECREMENT OUT COUNT.
IF(OUT.GT.0) GO TO 2600
C IF STILL OUT, GO AGAIN.
RETURN
C
END
C BLOW- STRIKE BLOW
C
C DECLARATIONS
C
INTEGER FUNCTION BLOW(H,V,RMK,HFLG,OUT)
IMPLICIT INTEGER (A-Z)
LOGICAL HFLG,OAPPLI,PROB,F
INTEGER DEF1R(3),DEF2R(4),DEF3R(5)
INTEGER RVECTR(66),RSTATE(45)
C
C GAME STATE
C
LOGICAL TELFLG
COMMON /PLAY/ WINNER,HERE,TELFLG
C
C PARSE VECTOR
C
LOGICAL PRSWON
COMMON /PRSVEC/ PRSA,PRSI,PRSO,PRSWON,PRSCON
C
C MISCELLANEOUS VARIABLES
C
COMMON /STAR/ MBASE,STRBIT
C
C OBJECTS
C
COMMON /OBJCTS/ OLNT,ODESC1(220),ODESC2(220),ODESCO(220),
1 OACTIO(220),OFLAG1(220),OFLAG2(220),OFVAL(220),
2 OTVAL(220),OSIZE(220),OCAPAC(220),OROOM(220),
3 OADV(220),OCAN(220),OREAD(220)
C
COMMON /OFLAGS/ VISIBT,READBT,TAKEBT,DOORBT,TRANBT,FOODBT,
1 NDSCBT,DRNKBT,CONTBT,LITEBT,VICTBT,BURNBT,FLAMBT,
2 TOOLBT,TURNBT,ONBT
COMMON /OFLAGS/ FINDBT,SLEPBT,SCRDBT,TIEBT,CLMBBT,ACTRBT,
1 WEAPBT,FITEBT,VILLBT,STAGBT,TRYBT,NOCHBT,OPENBT,
2 TCHBT,VEHBT,SCHBT
C
C
C CLOCK INTERRUPTS
C
LOGICAL CFLAG
COMMON /CEVENT/ CLNT,CTICK(25),CACTIO(25),CFLAG(25)
C
COMMON /CINDEX/ CEVCUR,CEVMNT,CEVLNT,CEVMAT,CEVCND,
1 CEVBAL,CEVBRN,CEVFUS,CEVLED,CEVSAF,CEVVLG,
2 CEVGNO,CEVBUC,CEVSPH,CEVEGH,
3 CEVFOR,CEVSCL,CEVZGI,CEVZGO,CEVSTE,
5 CEVMRS,CEVPIN,CEVINQ,CEVFOL
C
C ADVENTURERS
C
COMMON /ADVS/ ALNT,AROOM(4),ASCORE(4),AVEHIC(4),
1 AOBJ(4),AACTIO(4),ASTREN(4),AFLAG(4)
C
COMMON /AFLAGS/ ASTAG
C
COMMON /AINDEX/ PLAYER,AROBOT,AMASTR
C
C VERBS
C
COMMON /VINDEX/ CINTW,DEADXW,FRSTQW,INXW,OUTXW
COMMON /VINDEX/ WALKIW,FIGHTW,FOOW
COMMON /VINDEX/ MELTW,READW,INFLAW,DEFLAW,ALARMW,EXORCW
COMMON /VINDEX/ PLUGW,KICKW,WAVEW,RAISEW,LOWERW,RUBW
COMMON /VINDEX/ PUSHW,UNTIEW,TIEW,TIEUPW,TURNW,BREATW
COMMON /VINDEX/ KNOCKW,LOOKW,EXAMIW,SHAKEW,MOVEW,TRNONW,TRNOFW
COMMON /VINDEX/OPENW,CLOSEW,FINDW,WAITW,SPINW,BOARDW,UNBOAW,TAKEW
COMMON /VINDEX/ INVENW,FILLW,EATW,DRINKW,BURNW
COMMON /VINDEX/ MUNGW,KILLW,ATTACW,SWINGW
COMMON /VINDEX/ WALKW,TELLW,PUTW,DROPW,GIVEW,POURW,THROWW
COMMON /VINDEX/ DIGW,LEAPW,STAYW,FOLLOW
COMMON /VINDEX/ HELLOW,LOOKIW,LOOKUW,PUMPW,WINDW
COMMON /VINDEX/ CLMBW,CLMBUW,CLMBDW,TRNTOW
C
C FUNCTIONS AND DATA
C
DATA RMISS/0/,ROUT/1/,RKILL/2/,RLIGHT/3/
DATA RSER/4/,RSTAG/5/,RLOSE/6/,RHES/7/,RSIT/8/
DATA DEF1R/1,2,3/
DATA DEF2R/13,23,24,25/
DATA DEF3R/35,36,46,47,57/
C
DATA RVECTR/0,0,0,0,5,5,1,1,2,2,2,2,
1 0,0,0,0,0,5,5,3,3,1,
2 0,0,0,5,5,3,3,3,1,2,2,2,
3 0,0,0,0,0,5,5,3,3,4,4,
4 0,0,0,5,5,3,3,3,4,4,4,
5 0,5,5,3,3,3,3,4,4,4/
DATA RSTATE/5000,3005,3008,4011,3015,3018,1021,0,0,
1 5022,3027,3030,4033,3037,3040,1043,0,0,
2 4044,2048,4050,4054,5058,4063,4067,3071,1074,
3 4075,1079,4080,4084,4088,4092,4096,4100,1104,
4 4105,2109,4111,4115,4119,4123,4127,3131,3134/
C BLOW, PAGE 3
C
RA=OACTIO(V)
C GET VILLAIN ACTION,
DV=ODESC2(V)
C DESCRIPTION.
BLOW=RMISS
C ASSUME NO RESULT.
IF(.NOT.HFLG) GO TO 1000
C HERO STRIKING BLOW?
C
C HERO IS ATTACKER, VILLAIN IS DEFENDER.
C
PBLOSE=10
C BAD LK PROB.
OFLAG2(V)=ZOR(OFLAG2(V),FITEBT)
C YES, VILLAIN GETS MAD.
IF(ZAND(AFLAG(H),ASTAG).EQ.0) GO TO 100
C HERO STAG?
CALL RSPEAK(591)
C YES, CANT FIGHT.
AFLAG(H)=ZAND(AFLAG(H), NOT(ASTAG))
RETURN
C
100 ATT=FIGHTS(H,.TRUE.)
C GET HIS STRENGTH.
OA=ATT
DEF=VILSTR(V)
C GET VILL STRENGTH.
OD=DEF
DWEAP=0
C ASSUME NO WEAPON.
DO 200 I=1,OLNT
C SEARCH VILLAIN.
IF((OCAN(I).EQ.V).AND.(ZAND(OFLAG2(I),WEAPBT).NE.0))
1 DWEAP=I
200 CONTINUE
IF(V.EQ.AOBJ(PLAYER)) GO TO 300
C KILLING SELF?
IF(DEF.NE.0) GO TO 2000
C DEFENDER ALIVE?
CALL RSPSUB(592,DV)
C VILLAIN DEAD.
RETURN
C
300 CALL JIGSUP(593)
C KILLING SELF.
RETURN
C
C VILLAIN IS ATTACKER, HERO IS DEFENDER.
C
1000 PBLOSE=50
C BAD LK PROB.
AFLAG(H)=ZAND(AFLAG(H),NOT(ASTAG))
C VILL STRIKING.
IF(ZAND(OFLAG2(V),STAGBT).EQ.0) GO TO 1200
C VILL STAGGERED?
OFLAG2(V)=ZAND(OFLAG2(V), NOT(STAGBT))
C MAKE HIM OK.
CALL RSPSUB(594,DV)
C DESCRIBE.
RETURN
C
1200 ATT=VILSTR(V)
C SET UP ATT, DEF.
OA=ATT
DEF=FIGHTS(H,.TRUE.)
IF(DEF.LE.0) RETURN
C DONT ALLOW DEAD DEF.
OD=FIGHTS(H,.FALSE.)
DWEAP=IABS(FWIM(0,WEAPBT,0,0,H,.TRUE.))
C FIND A WEAPON.
C BLOW, PAGE 4
C
C PARTIES ARE NOW EQUIPPED. DEF CANNOT BE ZERO.
C ATT MUST BE > 0.
C
2000 CONTINUE
IF(DEF.GT.0) GO TO 2100
C DEF ALIVE?
RES=RKILL
IF(HFLG) CALL RSPSUB(595,DV)
C DEADER.
GO TO 3000
C
2100 IF(DEF-2) 2200,2300,2400
C DEF <2,=2,>2
2200 ATT=MIN0(ATT,3)
C SCALE ATT.
TBL=DEF1R(ATT)
C CHOOSE TABLE.
GO TO 2500
C
2300 ATT=MIN0(ATT,4)
C SCALE ATT.
TBL=DEF2R(ATT)
C CHOOSE TABLE.
GO TO 2500
C
2400 ATT=ATT-DEF
C SCALE ATT.
ATT=MIN0(2,MAX0(-2,ATT))+3
TBL=DEF3R(ATT)
C
2500 RES=RVECTR(TBL+ZRND(10))
C GET RESULT.
IF(OUT.EQ.0) GO TO 2600
C WAS HE OUT?
IF(RES.EQ.RSTAG) GO TO 2550
C YES, STAG--> HES.
RES=RSIT
C OTHERWISE, SITTING.
GO TO 2600
2550 RES=RHES
2600 IF((RES.EQ.RSTAG).AND.(DWEAP.NE.0).AND.PROB(25,PBLOSE))
1 RES=RLOSE
C LOSE WEAPON.
C
MI=RSTATE(((RMK-1)*9)+RES+1)
C CHOOSE TABLE ENTRY.
IF(MI.EQ.0) GO TO 3000
I=(MOD(MI,1000)+ZRND(MI/1000))+MBASE+1
J=DV
IF(.NOT.HFLG .AND.(DWEAP.NE.0)) J=ODESC2(DWEAP)
CALL RSPSUB(I,J)
C PRESENT RESULT.
C BLOW, PAGE 5
C
C NOW APPLY RESULT
C
3000 GO TO (4000,3100,3200,3300,3400,3500,3600,4000,3200),RES+1
C
3100 IF(HFLG) DEF=-DEF
C UNCONSCIOUS.
GO TO 4000
C
3200 DEF=0
C KILLED OR SITTING DUCK.
GO TO 4000
C
3300 DEF=MAX0(0,DEF-1)
C LIGHT WOUND.
GO TO 4000
C
3400 DEF=MAX0(0,DEF-2)
C SERIOUS WOUND.
GO TO 4000
C
3500 IF(HFLG) GO TO 3550
C STAGGERED.
AFLAG(H)=ZOR(AFLAG(H),ASTAG)
GO TO 4000
C
3550 OFLAG2(V)=ZOR(OFLAG2(V),STAGBT)
GO TO 4000
C
3600 CALL NEWSTA(DWEAP,0,HERE,0,0)
C LOSE WEAPON.
DWEAP=0
IF(HFLG) GO TO 4000
C IF HERO, DONE.
DWEAP=IABS(FWIM(0,WEAPBT,0,0,H,.TRUE.))
C GET NEW.
IF(DWEAP.NE.0) CALL RSPSUB(605,ODESC2(DWEAP))
C BLOW, PAGE 6
C
4000 BLOW=RES
C RETURN RESULT.
IF(.NOT.HFLG) GO TO 4500
C HERO?
OCAPAC(V)=DEF
C STORE NEW CAPACITY.
IF(DEF.NE.0) GO TO 4100
C DEAD?
OFLAG2(V)=ZAND(OFLAG2(V), NOT(FITEBT))
C YES, NOT FIGHTING.
CALL RSPSUB(572,DV)
C HE DIES.
CALL NEWSTA(V,0,0,0,0)
C MAKE HIM DISAPPEAR.
IF(RA.EQ.0) RETURN
C IF NX TO DO, EXIT.
PRSA=DEADXW
C LET HIM KNOW.
F=OAPPLI(RA,0)
RETURN
C
4100 IF((RES.NE.ROUT).OR.(RA.EQ.0)) RETURN
PRSA=OUTXW
C LET HIM BE OUT.
F=OAPPLI(RA,0)
RETURN
C
4500 ASTREN(H)=-10000
C ASSUME DEAD.
IF(DEF.NE.0) ASTREN(H)=DEF-OD
IF(DEF.GE.OD) GO TO 4600
CTICK(CEVCUR)=30
CFLAG(CEVCUR)=.TRUE.
4600 IF(FIGHTS(H,.TRUE.).GT.0) RETURN
ASTREN(H)=1-FIGHTS(H,.FALSE.)
C HE'S DEAD.
CALL JIGSUP(596)
BLOW=-1
RETURN
C
END
C SWORDD- SWORD INTERMOVE DEMON
C
C DECLARATIONS
C
SUBROUTINE SWORDD
IMPLICIT INTEGER(A-Z)
LOGICAL INFEST,FINDXT
C
C GAME STATE
C
LOGICAL TELFLG
COMMON /PLAY/ WINNER,HERE,TELFLG
C
C EXITS
C
COMMON /CURXT/ XTYPE,XROOM1,XSTRNG,XACTIO,XOBJ
C
COMMON /XSRCH/ XMIN,XMAX,XDOWN,XUP,
1 XNORTH,XSOUTH,XENTER,XEXIT,XEAST,XWEST
C
C OBJECTS
C
COMMON /OBJCTS/ OLNT,ODESC1(220),ODESC2(220),ODESCO(220),
1 OACTIO(220),OFLAG1(220),OFLAG2(220),OFVAL(220),
2 OTVAL(220),OSIZE(220),OCAPAC(220),OROOM(220),
3 OADV(220),OCAN(220),OREAD(220)
C
COMMON /OINDEX/ GARLI,FOOD,GUNK,COAL,MACHI,DIAMO,TCASE,BOTTL
COMMON /OINDEX/ WATER,ROPE,KNIFE,SWORD,LAMP,BLAMP,RUG
COMMON /OINDEX/ LEAVE,TROLL,AXE
COMMON /OINDEX/ RKNIF,KEYS,ICE,BAR
COMMON /OINDEX/ COFFI,TORCH,TBASK,FBASK,IRBOX
COMMON /OINDEX/ GHOST,TRUNK,BELL,BOOK,CANDL
COMMON /OINDEX/ MATCH,TUBE,PUTTY,WRENC,SCREW,CYCLO,CHALI
COMMON /OINDEX/ THIEF,STILL,WINDO,GRATE,DOOR
COMMON /OINDEX/ HPOLE,LEAK,RBUTT,RAILI
COMMON /OINDEX/ POT,STATU,IBOAT,DBOAT,PUMP,RBOAT
COMMON /OINDEX/ STICK,BUOY,SHOVE,BALLO,RECEP,GUANO
COMMON /OINDEX/ BROPE,HOOK1,HOOK2,SAFE,SSLOT,BRICK,FUSE
COMMON /OINDEX/ GNOME,BLABE,DBALL,TOMB
COMMON /OINDEX/ LCASE,CAGE,RCAGE,SPHER,SQBUT
COMMON /OINDEX/ FLASK,POOL,SAFFR,BUCKE,ECAKE,ORICE,RDICE,BLICE
COMMON /OINDEX/ ROBOT,FTREE,BILLS,PORTR,SCOL,ZGNOM
COMMON /OINDEX/ EGG,BEGG,BAUBL,CANAR,BCANA
COMMON /OINDEX/ YLWAL,RDWAL,PINDR,RBEAM
COMMON /OINDEX/ ODOOR,QDOOR,CDOOR,NUM1,NUM8
COMMON /OINDEX/ WARNI,CSLIT,GCARD,STLDR
COMMON /OINDEX/ HANDS,WALL,LUNGS,SAILO,AVIAT,TEETH
COMMON /OINDEX/ ITOBJ,EVERY,VALUA,OPLAY,WNORT,GWATE,MASTER
C
C VILLAINS AND DEMONS
C
LOGICAL THFFLG,SWDACT,THFACT
COMMON /HACK/ THFPOS,THFFLG,THFACT,SWDACT,SWDSTA
C
C ADVENTURERS
C
COMMON /AINDEX/ PLAYER,AROBOT,AMASTR
C SWORDD, PAGE 2
C
IF(OADV(SWORD).NE.PLAYER) GO TO 500
C HOLDING SWORD?
NG=2
C ASSUME VILL CLOSE.
IF(INFEST(HERE)) GO TO 300
C VILL HERE?
NG=1
DO 200 I=XMIN,XMAX,XMIN
C NO, SEARCH ROOMS.
IF(.NOT.FINDXT(I,HERE)) GO TO 200
C ROOM THAT WAY?
GO TO (50,200,50,50),XTYPE
C SEE IF ROOM AT ALL.
50 IF(INFEST(XROOM1)) GO TO 300
C CHECK ROOM.
200 CONTINUE
NG=0
C NO GLOW.
C
300 IF(NG.EQ.SWDSTA) RETURN
C ANY STATE CHANGE?
CALL RSPEAK(NG+495)
C YES, TELL NEW STATE.
SWDSTA=NG
RETURN
C
500 SWDACT=.FALSE.
C DROPPED SWORD,
RETURN
C DISABLE DEMON.
END
C INFEST- SUBROUTINE TO TEST FOR INFESTED ROOM
C
C DECLARATIONS
C
LOGICAL FUNCTION INFEST(R)
IMPLICIT INTEGER(A-Z)
C
C ROOMS
C
COMMON /RINDEX/ WHOUS,LROOM,CELLA
COMMON /RINDEX/ MTROL,MAZE1
COMMON /RINDEX/ MGRAT,MAZ15
COMMON /RINDEX/ FORE1,FORE3,CLEAR,RESER
COMMON /RINDEX/ STREA,EGYPT,ECHOR
COMMON /RINDEX/ TSHAF
COMMON /RINDEX/ BSHAF,MMACH,DOME,MTORC
COMMON /RINDEX/ CAROU
COMMON /RINDEX/ RIDDL,LLD2,TEMP1,TEMP2,MAINT
COMMON /RINDEX/ BLROO,TREAS,RIVR1,RIVR2,RIVR3,MCYCL
COMMON /RINDEX/ RIVR4,RIVR5,FCHMP,FALLS,MBARR
COMMON /RINDEX/ MRAIN,POG,VLBOT,VAIR1,VAIR2,VAIR3,VAIR4
COMMON /RINDEX/ LEDG2,LEDG3,LEDG4,MSAFE,CAGER
COMMON /RINDEX/ CAGED,TWELL,BWELL,ALICE,ALISM,ALITR
COMMON /RINDEX/ MTREE,BKENT,BKVW,BKTWI,BKVAU,BKBOX
COMMON /RINDEX/ CRYPT,TSTRS,MRANT,MREYE
COMMON /RINDEX/ MRA,MRB,MRC,MRG,MRD,FDOOR
COMMON /RINDEX/ MRAE,MRCE,MRCW,MRGE,MRGW,MRDW,INMIR
COMMON /RINDEX/ SCORR,NCORR,PARAP,CELL,PCELL,NCELL
COMMON /RINDEX/ CPANT,CPOUT,CPUZZ
C
C OBJECTS
C
COMMON /OBJCTS/ OLNT,ODESC1(220),ODESC2(220),ODESCO(220),
1 OACTIO(220),OFLAG1(220),OFLAG2(220),OFVAL(220),
2 OTVAL(220),OSIZE(220),OCAPAC(220),OROOM(220),
3 OADV(220),OCAN(220),OREAD(220)
C
COMMON /OINDEX/ GARLI,FOOD,GUNK,COAL,MACHI,DIAMO,TCASE,BOTTL
COMMON /OINDEX/ WATER,ROPE,KNIFE,SWORD,LAMP,BLAMP,RUG
COMMON /OINDEX/ LEAVE,TROLL,AXE
COMMON /OINDEX/ RKNIF,KEYS,ICE,BAR
COMMON /OINDEX/ COFFI,TORCH,TBASK,FBASK,IRBOX
COMMON /OINDEX/ GHOST,TRUNK,BELL,BOOK,CANDL
COMMON /OINDEX/ MATCH,TUBE,PUTTY,WRENC,SCREW,CYCLO,CHALI
COMMON /OINDEX/ THIEF,STILL,WINDO,GRATE,DOOR
COMMON /OINDEX/ HPOLE,LEAK,RBUTT,RAILI
COMMON /OINDEX/ POT,STATU,IBOAT,DBOAT,PUMP,RBOAT
COMMON /OINDEX/ STICK,BUOY,SHOVE,BALLO,RECEP,GUANO
COMMON /OINDEX/ BROPE,HOOK1,HOOK2,SAFE,SSLOT,BRICK,FUSE
COMMON /OINDEX/ GNOME,BLABE,DBALL,TOMB
COMMON /OINDEX/ LCASE,CAGE,RCAGE,SPHER,SQBUT
COMMON /OINDEX/ FLASK,POOL,SAFFR,BUCKE,ECAKE,ORICE,RDICE,BLICE
COMMON /OINDEX/ ROBOT,FTREE,BILLS,PORTR,SCOL,ZGNOM
COMMON /OINDEX/ EGG,BEGG,BAUBL,CANAR,BCANA
COMMON /OINDEX/ YLWAL,RDWAL,PINDR,RBEAM
COMMON /OINDEX/ ODOOR,QDOOR,CDOOR,NUM1,NUM8
COMMON /OINDEX/ WARNI,CSLIT,GCARD,STLDR
COMMON /OINDEX/ HANDS,WALL,LUNGS,SAILO,AVIAT,TEETH
COMMON /OINDEX/ ITOBJ,EVERY,VALUA,OPLAY,WNORT,GWATE,MASTER
C
C VILLAINS AND DEMONS
C
LOGICAL THFFLG,SWDACT,THFACT
COMMON /HACK/ THFPOS,THFFLG,THFACT,SWDACT,SWDSTA
C
C FLAGS
C
LOGICAL TROLLF,CAGESF,BUCKTF,CAROFF,CAROZF,LWTIDF
LOGICAL DOMEF,GLACRF,ECHOF,RIDDLF,LLDF,CYCLOF
LOGICAL MAGICF,LITLDF,SAFEF,GNOMEF,GNODRF,MIRRMF
LOGICAL EGYPTF,ONPOLF,BLABF,BRIEFF,SUPERF,BUOYF
LOGICAL GRUNLF,GATEF,RAINBF,CAGETF,EMPTHF,DEFLAF
LOGICAL GLACMF,FROBZF,ENDGMF,BADLKF,THFENF,SINGSF
LOGICAL MRPSHF,MROPNF,WDOPNF,MR1F,MR2F,INQSTF
LOGICAL FOLLWF,SPELLF,CPOUTF,CPUSHF
COMMON /FINDEX/ TROLLF,CAGESF,BUCKTF,CAROFF,CAROZF,LWTIDF,
1 DOMEF,GLACRF,ECHOF,RIDDLF,LLDF,CYCLOF,
2 MAGICF,LITLDF,SAFEF,GNOMEF,GNODRF,MIRRMF,
3 EGYPTF,ONPOLF,BLABF,BRIEFF,SUPERF,BUOYF,
4 GRUNLF,GATEF,RAINBF,CAGETF,EMPTHF,DEFLAF,
5 GLACMF,FROBZF,ENDGMF,BADLKF,THFENF,SINGSF,
6 MRPSHF,MROPNF,WDOPNF,MR1F,MR2F,INQSTF,
7 FOLLWF,SPELLF,CPOUTF,CPUSHF
COMMON /FINDEX/ BTIEF,BINFF
COMMON /FINDEX/ RVMNT,RVCLR,RVCYC,RVSND,RVGUA
COMMON /FINDEX/ ORRUG,ORCAND,ORMTCH,ORLAMP
COMMON /FINDEX/ MDIR,MLOC,POLEUF
COMMON /FINDEX/ QUESNO,NQATT,CORRCT
COMMON /FINDEX/ LCELL,PNUMB,ACELL,DCELL,CPHERE
C
IF(.NOT.ENDGMF) INFEST=(OROOM(CYCLO).EQ.R).OR.
1 (OROOM(TROLL).EQ.R).OR.
2 ((OROOM(THIEF).EQ.R).AND.THFACT)
IF(ENDGMF) INFEST=(R.EQ.MRG).OR.(R.EQ.MRGE).OR.
1 (R.EQ.MRGW).OR.
2 ((R.EQ.INMIR).AND.(MLOC.EQ.MRG))
RETURN
END