C TROLLP-      TROLL FUNCTION
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
      LOGICAL FUNCTION TROLLP(ARG)
      IMPLICIT INTEGER (A-Z)
      LOGICAL QHERE,PROB
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 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 TROLLP, PAGE 2
C
      I=ARG
      TROLLP=.TRUE.    
C ASSUME WINS.
      IF(PRSA.NE.FIGHTW) GO TO 1100    
C FIGHT?
      IF(OCAN(AXE).EQ.TROLL) GO TO 10    
C GOT AXE?  NOTHING.
      I=433  
C ASSUME CANT GET.
      IF(.NOT.QHERE(AXE,HERE)) GO TO 1050  
C HERE?
      I=434  
C YES, RECOVER.
      CALL NEWSTA(AXE,0,0,TROLL,0)
1050      IF(QHERE(TROLL,HERE)) CALL RSPEAK(I)  
C IF PLAYER HERE.
      RETURN
C
1100      IF(PRSA.NE.DEADXW) GO TO 1200    
C DEAD?
      TROLLF=.TRUE.    
C PERMIT EXITS.
      RETURN
C
1200      IF(PRSA.NE.OUTXW) GO TO 1300    
C OUT?
      TROLLF=.TRUE.    
C PERMIT EXITS.
      OFLAG1(AXE)=ZAND(OFLAG1(AXE),ZNOT(VISIBT))
      ODESC1(TROLL)=435  
C TROLL OUT.
      RETURN
C
1300      IF(PRSA.NE.INXW) GO TO 1400    
C WAKE UP?
      TROLLF=.FALSE.    
C FORBID EXITS.
      OFLAG1(AXE)=ZOR(OFLAG1(AXE),VISIBT)
      ODESC1(TROLL)=436  
C TROLL IN.
      IF(QHERE(TROLL,HERE)) CALL RSPEAK(437)
      RETURN
C
1400      IF(PRSA.NE.FRSTQW) GO TO 1500    
C FIRST ENCOUNTER?
      TROLLP=PROB(33,66)    
C 33% TRUE UNLESS BADLK.
      RETURN
C
1500      IF((PRSA.NE.MOVEW).AND.(PRSA.NE.TAKEW).AND.(PRSA.NE.MUNGW)
     1      .AND.(PRSA.NE.THROWW).AND.(PRSA.NE.GIVEW)) GO TO 2000
      IF(OCAPAC(TROLL).GE.0) GO TO 1550  
C TROLL OUT?
      OCAPAC(TROLL)=-OCAPAC(TROLL)    
C YES, WAKE HIM.
      OFLAG1(AXE)=ZOR(OFLAG1(AXE),VISIBT)
      TROLLF=.FALSE.
      ODESC1(TROLL)=436
      CALL RSPEAK(437)
C
1550      IF((PRSA.NE.TAKEW).AND.(PRSA.NE.MOVEW)) GO TO 1600
      CALL RSPEAK(438)  
C JOKE.
      RETURN
C
1600      IF(PRSA.NE.MUNGW) GO TO 1700    
C MUNG?
      CALL RSPEAK(439)  
C JOKE.
      RETURN
C
1700      IF(PRSO.EQ.0) GO TO 10  
C NO OBJECT?
      I=440  
C ASSUME THROW.
      IF(PRSA.EQ.GIVEW) I=441  
C GIVE?
      CALL RSPSUB(I,ODESC2(PRSO))    
C TROLL TAKES.
      IF(PRSO.EQ.KNIFE) GO TO 1900    
C OBJ KNIFE?
      CALL NEWSTA(PRSO,442,0,0,0)    
C NO, EATS IT.
      RETURN
C
1900      CALL RSPEAK(443)  
C KNIFE, THROWS IT BACK
      OFLAG2(TROLL)=ZOR(OFLAG2(TROLL),FITEBT)  
C AND GETS MAD.
      RETURN
C
2000      IF(.NOT.TROLLF.OR.(PRSA.NE.HELLOW)) GO TO 10
      CALL RSPEAK(366)  
C TROLL OUT.
      RETURN
C
10      TROLLP=.FALSE.    
C COULDNT HANDLE IT.
      RETURN
      END
C CYCLOP-      CYCLOPS FUNCTION
C
C DECLARATIONS
C
      LOGICAL FUNCTION CYCLOP(ARG)
      IMPLICIT INTEGER (A-Z)
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 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 CYCLOP, PAGE 2
C
      I=ARG
      CYCLOP=.TRUE.    
C ASSUME WINS.
      IF(.NOT.CYCLOF) GO TO 100    
C ASLEEP?
      IF((PRSA.NE.ALARMW).AND.(PRSA.NE.MUNGW).AND.(PRSA.NE.HELLOW).AND.
     1      (PRSA.NE.BURNW).AND.(PRSA.NE.KILLW).AND.(PRSA.NE.ATTACW))
     2       GO TO 10
      CYCLOF=.FALSE.  
C WAKE CYCLOPS.
      CALL RSPEAK(187)  
C DESCRIBE.
      RVCYC=IABS(RVCYC)
      OFLAG2(CYCLO)=ZAND(ZOR(OFLAG2(CYCLO),FITEBT),ZNOT(SLEPBT))
      RETURN
C
100      IF((PRSA.EQ.FIGHTW).OR.(PRSA.EQ.FRSTQW)) GO TO 10
      IF(IABS(RVCYC).LE.5) GO TO 200    
C ANNOYED TOO MUCH?
      RVCYC=0  
C RESTART COUNT.
      CALL JIGSUP(188)  
C YES, EATS PLAYER.
      RETURN
C
200      IF(PRSA.NE.GIVEW) GO TO 500    
C GIVE?
      IF((PRSO.NE.FOOD).OR.(RVCYC.LT.0)) GO TO 300 
C FOOD WHEN HUNGRY?
      CALL NEWSTA(FOOD,189,0,0,0)    
C EATS PEPPERS.
      RVCYC=MIN0(-1,-RVCYC)  
C GETS THIRSTY.
      RETURN
C
300      IF(PRSO.NE.WATER) GO TO 400    
C DRINK WHEN THIRSTY?
      IF(RVCYC.GE.0) GO TO 350
      CALL NEWSTA(PRSO,190,0,0,0)    
C DRINKS AND
      CYCLOF=.TRUE.    
C FALLS ASLEEP.
      OFLAG2(CYCLO)=ZAND(ZOR(OFLAG2(CYCLO),SLEPBT),ZNOT(FITEBT))
      RETURN
C
350      CALL RSPEAK(191)  
C NOT THIRSTY.
10      CYCLOP=.FALSE.    
C FAILS.
      RETURN
C
400      I=192  
C ASSUME INEDIBLE.
      IF(PRSO.EQ.GARLI) I=193  
C GARLIC IS JOKE.
450      CALL RSPEAK(I)    
C DISDAIN IT.
      IF(RVCYC.LT.0) RVCYC=RVCYC-1
      IF(RVCYC.GE.0) RVCYC=RVCYC+1
      IF(.NOT.CYCLOF) CALL RSPEAK(193+IABS(RVCYC))
      RETURN
C
500      I=0  
C ASSUME NOT HANDLED.
      IF(PRSA.EQ.HELLOW) GO TO 450    
C HELLO IS NO GO.
      IF((PRSA.EQ.THROWW).OR.(PRSA.EQ.MUNGW)) I=200+ZRND(2)
      IF(PRSA.EQ.TAKEW) I=202
      IF(PRSA.EQ.TIEW) I=203
      IF(I) 10,10,450  
C SEE IF HANDLED.
C
      END
C THIEFP-      THIEF FUNCTION
C
C DECLARATIONS
C
      LOGICAL FUNCTION THIEFP(ARG)
      IMPLICIT INTEGER (A-Z)
      LOGICAL QHERE,PROB
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 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 /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 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 VILLAINS AND DEMONS
C
      LOGICAL THFFLG,SWDACT,THFACT
      COMMON /HACK/ THFPOS,THFFLG,THFACT,SWDACT,SWDSTA
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 THIEFP, PAGE 2
C
      I=ARG
      THIEFP=.TRUE.    
C ASSUME WINS.
      IF(PRSA.NE.FIGHTW) GO TO 100    
C FIGHT?
      IF(OCAN(STILL).EQ.THIEF) GO TO 10  
C GOT STILLETTO?  F.
      IF(QHERE(STILL,THFPOS)) GO TO 50  
C CAN HE RECOVER IT?
      CALL NEWSTA(THIEF,0,0,0,0)    
C NO, VANISH.
      IF(QHERE(THIEF,HERE)) CALL RSPEAK(498)  
C IF HERO, TELL.
      RETURN
C
50      CALL NEWSTA(STILL,0,0,THIEF,0)    
C YES, RECOVER.
      IF(QHERE(THIEF,HERE)) CALL RSPEAK(499)  
C IF HERO, TELL.
      RETURN
C
100      IF(PRSA.NE.DEADXW) GO TO 200    
C DEAD?
      THFACT=.FALSE.    
C DISABLE DEMON.
      OFLAG1(CHALI)=ZOR(OFLAG1(CHALI),TAKEBT)
      J=0
      DO 125 I=1,OLNT    
C CARRYING ANYTHING?
125        IF(OADV(I).EQ.-THIEF) J=500
      CALL RSPEAK(J)    
C TELL IF BOOTY REAPPEARS.
C
      J=501
      DO 150 I=1,OLNT  
C LOOP.
        IF((I.EQ.CHALI).OR.(I.EQ.THIEF).OR.(HERE.NE.TREAS)
     1      .OR. .NOT.QHERE(I,HERE)) GO TO 135
        OFLAG1(I)=ZOR(OFLAG1(I),VISIBT)    
C REMATERIALIZE OBJECTS.
        CALL RSPSUB(J,ODESC2(I))    
C DESCRIBE.
        J=502
        GO TO 150
C
135        IF(OADV(I).EQ.-THIEF) CALL NEWSTA(I,0,HERE,0,0)
150      CONTINUE
      RETURN
C
200      IF(PRSA.NE.FRSTQW) GO TO 250    
C FIRST ENCOUNTER?
      THIEFP=PROB(20,75)
      RETURN
C
250      IF((PRSA.NE.HELLOW).OR.(ODESC1(THIEF).NE.504))
     1      GO TO 300  
C HELLO TO OUT THIEF?
      CALL RSPEAK(626)
      RETURN
C
300      IF(PRSA.NE.OUTXW) GO TO 400    
C OUT?
      THFACT=.FALSE.    
C DISABLE DEMON.
      ODESC1(THIEF)=504  
C CHANGE DESCRIPTION.
      OFLAG1(STILL)=ZAND(OFLAG1(STILL),ZNOT(VISIBT))
      OFLAG1(CHALI)=ZOR(OFLAG1(CHALI),TAKEBT)
      RETURN
C
400      IF(PRSA.NE.INXW) GO TO 500    
C IN?
      IF(QHERE(THIEF,HERE)) CALL RSPEAK(505)  
C CAN HERO SEE?
      THFACT=.TRUE.    
C ENABLE DEMON.
      ODESC1(THIEF)=503  
C CHANGE DESCRIPTION.
      OFLAG1(STILL)=ZOR(OFLAG1(STILL),VISIBT)
      IF((HERE.EQ.TREAS).AND.QHERE(CHALI,HERE))
     1      OFLAG1(CHALI)=ZAND(OFLAG1(CHALI),ZNOT(TAKEBT))
      RETURN
C
500      IF(PRSA.NE.TAKEW) GO TO 600    
C TAKE?
      CALL RSPEAK(506)  
C JOKE.
      RETURN
C
600      IF((PRSA.NE.THROWW).OR.(PRSO.NE.KNIFE).OR.
     1      (ZAND(OFLAG2(THIEF),FITEBT).NE.0)) GO TO 700
C?????????????????????JDM  NEXT LINE WAS PROB(10)
      IF(PROB(10,90)) GO TO 650  
C THREW KNIFE, 10%?
      CALL RSPEAK(507)  
C NO, JUST MAKES
      OFLAG2(THIEF)=ZOR(OFLAG2(THIEF),FITEBT)  
C THIEF MAD.
      RETURN
C
650      J=508  
C THIEF DROPS STUFF.
      DO 675 I=1,OLNT
        IF(OADV(I).NE.-THIEF) GO TO 675  
C THIEF CARRYING?
        J=509
        CALL NEWSTA(I,0,HERE,0,0)
675      CONTINUE
      CALL NEWSTA(THIEF,J,0,0,0)    
C THIEF VANISHES.
      RETURN
C
700      IF(((PRSA.NE.THROWW).AND.(PRSA.NE.GIVEW)).OR.(PRSO.EQ.0).OR.
     1      (PRSO.EQ.THIEF)) GO TO 10  
C THRO/GIVE TO THIEF?
      IF(OCAPAC(THIEF).GE.0) GO TO 750  
C WAKE HIM UP.
      OCAPAC(THIEF)=-OCAPAC(THIEF)
      THFACT=.TRUE.
      OFLAG1(STILL)=ZOR(OFLAG1(STILL),VISIBT)
      ODESC1(THIEF)=503
      CALL RSPEAK(510)
C
750      IF((PRSO.NE.BRICK).OR.(OCAN(FUSE).NE.BRICK).OR.
     1      (CTICK(CEVFUS).EQ.0)) GO TO 800
      CALL RSPEAK(511)  
C THIEF REFUSES BOMB.
      RETURN
C
800      CALL NEWSTA(PRSO,0,0,0,-THIEF)    
C THIEF TAKES GIFT.
      IF(OTVAL(PRSO).GT.0) GO TO 900    
C A TREASURE?
      CALL RSPSUB(512,ODESC2(PRSO))
      RETURN
C
900      CALL RSPSUB(627,ODESC2(PRSO))    
C THIEF ENGROSSED.
      THFENF=.TRUE.
      RETURN
C
10      THIEFP=.FALSE.
      RETURN
      END
