1  REM     EAMON ADVENTURE #78
2  REM  -> THE PRINCE'S TAVERN <-
4  REM        BY BOB DAVIS
5  REM     REV DATE - 11/11/84
6  REM   CONVERSION DATE 6-10-90; 8-18-90
7  REM
'
'           REV. 9-14-85
'           BY NATIONAL EAMON USERS CLUB
'           7420 Hickory Lane
'           Urbandale, IOWA  50322
'
'
      DEFINT A-Z
      DECLARE SUB pgprt (sp, LIT$)
      DECLARE SUB SPPRT (Speed, LIT$)
'      INPUT "Path:", PATH$
REM $$INCL:'\Eamon\Copy\CHARDEF.BAS'
	' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	'
	'   Module:  CHARDEF.BAS
	'   Eamon Version:  Eamon-QB (or Eamon-PC)
	' ------------------------------------------------------------
	'  Character Definition for Eamon QB/PC
	'        Basic version:  QuickBASIC 4.0, GW-BASIC, QBasic *
	'                        or BASIC 7.0 PDS
	'       uses Field statements for record description
	'       This module will work for QBasic, but QBasic cannot
REM $$INCL:statements, so module must be copied
	'       into programs manually or merged using a utility
	' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	'
TYPE WeaponRec
	Nam             AS STRING * 20
	Wpntyp          AS INTEGER
	Odds            AS INTEGER
	Dice            AS INTEGER
	Sides           AS INTEGER
END TYPE

TYPE CharacterRecord
	Nam             AS STRING * 30
	Hd              AS INTEGER
	Ag              AS INTEGER
	Ch              AS INTEGER
	SA1             AS INTEGER
	SA2             AS INTEGER
	SA3             AS INTEGER
	SA4             AS INTEGER
	WA1             AS INTEGER
	WA2             AS INTEGER
	WA3             AS INTEGER
	WA4             AS INTEGER
	WA5             AS INTEGER
	Sex             AS STRING * 1
	Gold            AS LONG
	Bank            AS LONG
	AE              AS INTEGER
	ArmNam          AS STRING * 20
	ArmHit          AS INTEGER
	Armadj          AS INTEGER
	ShdNam          AS STRING * 20
	ShdHit          AS INTEGER
	ShdAdj          AS INTEGER
	Wpn1Nam         AS STRING * 20
	Wpn1typ         AS INTEGER
	Wpn1Wpntyp      AS INTEGER
	Wpn1odds        AS INTEGER
	Wpn1Dice        AS INTEGER
	Wpn1Sides       AS INTEGER
	Wpn2Nam         AS STRING * 20
	Wpn2typ         AS INTEGER
	Wpn2Wpntyp      AS INTEGER
	Wpn2odds        AS INTEGER
	Wpn2Dice        AS INTEGER
	Wpn2Sides       AS INTEGER
	Wpn3Nam         AS STRING * 20
	Wpn3typ         AS INTEGER
	Wpn3Wpntyp      AS INTEGER
	Wpn3odds        AS INTEGER
	Wpn3Dice        AS INTEGER
	Wpn3Sides       AS INTEGER
	Wpn4Nam         AS STRING * 20
	Wpn4typ         AS INTEGER
	Wpn4Wpntyp      AS INTEGER
	Wpn4odds        AS INTEGER
	Wpn4Dice        AS INTEGER
	Wpn4Sides       AS INTEGER
	Filler          AS STRING * 23
END TYPE
DIM Char AS CharacterRecord
TYPE CharControl
	NbrChar         AS INTEGER
	Filler          AS STRING * 254
END TYPE
DIM CharCtl AS CharControl

    '------- (end of include file) -------    
 ' 
REM $$INCL:'\Eamon\Copy\ColorRtn.bas'
     ON ERROR GOTO NoColors
     OPEN "EAMCOLOR" FOR INPUT AS #1
     INPUT #1, fgc%
     INPUT #1, bgc%
     INPUT #1, hfg%
     INPUT #1, hbg%
     CLOSE
In.BW:
     ON ERROR GOTO 0
     COLOR fgc%, bgc%
     GOTO Colorset
NoColors:
      fgc% = 7
      bgc% = 0
      hfg% = 0
      hbg% = 7
      RESUME In.BW
Colorset:

    '------- (end of include file) -------    
 ' 
      RANDOMIZE TIMER
      READ NC, sc: DIM c$(sc): FOR c = 1 TO sc: READ c$(c): NEXT
      OPEN PATH$ + "desc.r0" FOR INPUT AS #1: INPUT #1, nr, nz, ne, NM: CLOSE : na = nz
      DIM AN$(na + 6), AD%(na + 6, 9)
      DIM SA%(4), WA%(5), fd%(3), td%(3), S2%(4), CO$(5)
      DIM FSA$(4), FWA$(5)
      DIM FWN$(4), FWT$(4), FWC$(4), FWD$(4), FWS$(4)
      DIM V%(96)
      OPEN PATH$ + "artif.txt" FOR RANDOM AS #1 LEN = 128
      FIELD 1, 20 AS af.nam$
      DIM AF.DAT$(8)
      FOR X = 1 TO 8
      FIELD 1, 20 AS X$, (X - 1) * 2 AS X$, 2 AS AF.DAT$(X)
      NEXT
      ND = 6
      FOR A = 1 TO na
      GET #1, A
      AN$(A) = RTRIM$(af.nam$)
      FOR a2 = 1 TO 4
      AD%(A, a2) = CVI(AF.DAT$(a2))
      NEXT a2
      IF AD%(A, 2) > 1 THEN
	  nw = nw + 1
	  FOR a2 = 5 TO 8
	      AD%(A, a2) = CVI(AF.DAT$(a2))
	  NEXT a2
      END IF
      NEXT A
      CLOSE 1
     nw = 15
     DIM WN$(NW), WR%(NW), WT%(NW), WC%(nw), WD%(nw), WS%(nw), wp%(nw)
      OPEN PATH$ + "monst.txt" FOR RANDOM AS #1 LEN = 128
      FIELD 1, 20 AS mf.nam$
      DIM MF.DAT$(12)
      FOR X = 1 TO 12
      FIELD 1, 20 AS X$, (X - 1) * 2 AS X$, 2 AS MF.DAT$(X)
      NEXT
      DIM MN$(NM), MD%(NM, 15)
      FOR A = 1 TO NM:
	  GET #1, A
	  MN$(A) = RTRIM$(mf.nam$)
	  FOR a2 = 1 TO 12
	      MD%(A, a2) = CVI(MF.DAT$(a2))
	  NEXT a2, A
     CLOSE
     GOTO 1000
100  REM  ///MAIN LOOP
120  IF spd THEN spd = spd - 1: IF spd = 0 THEN MD%(0, 2) = MD%(0, 2) / 2: MD%(0, 10) = MD%(0, 10) - 2 * MD%(0, 2): IF RND(1) > .8 THEN pgprt 2, "Your speed spell has just expired!"
130  IF V%(Room) THEN GOSUB 29000: pgprt 2, "You are " + A$
135  IF V%(Room) = 0 AND Room = dr THEN dc = 1: ef = 1: GOSUB 25000: REM  contest begins
136  IF V%(Room) = 0 AND Room = 40 AND zb = 0 THEN zb = 1: ef = 11: GOSUB 25000: GOSUB 24000
138  IF Room = 9 THEN wb = wb - 1: IF wb < 1 THEN ef = 35: GOSUB 25000: di = 1: GOTO 2000
140  IF V%(Room) = 0 THEN GET #2, Room: A$ = RTRIM$(DESC$): pgprt 2, A$
145  IF Room = 51 AND fw = 0 THEN GOSUB 24000: ef = 7: GOSUB 25000: ef = 8: GOSUB 25000: fw = 1
148 V%(Room) = 1
150  FOR M = 1 TO NM:
     IF MD%(M, 5) = Room AND MD%(M, 15) AND MD%(M, 6) <> 999 THEN pgprt 2, MN$(M) + " is here."
155  IF MD%(M, 5) = Room AND MD%(M, 15) AND MD%(M, 6) = 999 THEN pgprt 2, MN$(M) + " are here."
160  IF MD%(M, 5) = Room AND MD%(M, 15) = 0 THEN GET #2, M + 300: A$ = RTRIM$(DESC$): pgprt 2, A$: MD%(M, 15) = 1
170  NEXT M: sp = 2: FOR A = 1 TO nz: IF AD%(A, 4) = Room AND AD%(A, 9) THEN pgprt sp, "You see " + AN$(A) + ".": sp = 1
180  IF AD%(A, 4) = Room AND AD%(A, 9) = 0 THEN GET #2, A + 100: A$ = RTRIM$(DESC$): pgprt 2, A$: AD%(A, 9) = 1
190  NEXT A: sp = 2: FOR A = A TO na: IF AD%(A, 4) = Room THEN pgprt sp, "Your " + AN$(A) + " is here.": sp = 1
200  NEXT A: V%(Room) = 1
210  pgprt 0, ""
     pgprt 1, " "
     COLOR hfg%, hbg%
     PRINT "  Your Command ";
     COLOR fgc%, bgc%
     INPUT " ", A$
     A$ = UCASE$(A$)
220  IF LEFT$(A$, 1) = " " THEN A$ = MID$(A$, 2): GOTO 220
230  IF A$ = "" THEN A$ = cz$: LOCATE CSRLIN - 1, 17: pgprt 1, A$
     A$ = UCASE$(A$)
     IF A$ = "EXIT NOW" THEN GOTO 2032
240  cz$ = A$: A = INSTR(A$, " ")
250  IF A > 0 THEN V$ = RTRIM$(LTRIM$(LEFT$(A$, A - 1))): S$ = MID$(A$, A + 1) ELSE V$ = A$: S$ = ""
260  S$ = LTRIM$(RTRIM$(S$))
270  pgprt 1, ""
     Cmd = 0
     FOR c = 1 TO sc:
	 IF UCASE$(c$(c)) = UCASE$(V$) OR UCASE$(c$(c)) = S$ THEN Cmd = c: EXIT FOR
     NEXT:
     IF Cmd > 0 THEN GOTO 280
     CLS
     pgprt 1, "You are slurring.  Use these commands--     "
     FOR c = 1 TO NC:
     PRINT c$(c); SPC(20 - LEN(c$(c))); : NEXT: pgprt 1, "": GOTO 210
280  IF c$(c) = S$ THEN S$ = V$: V$ = UCASE$(c$(c))
290  ON c GOTO 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 4000, 4000, 5000, 5000, 6000, 6000, 7000, 8000, 8000, 8000, 9000, 10000, 10000, 11000, 12000, 13000, 14000, 15000, 15000, 16000, 17000
295  ON c - 33 GOTO 18000, 19000, 20000, 21000, 22000, 20000, 30000, 28000
300  REM ///commands return to here
305  IF zd THEN zd = 0: GOTO 27620
310  IF nbtl = 0 THEN 500
320  FOR M = 1 TO NM: IF MD%(M, 5) <> Room THEN 490
330  MR = FD%(MD%(M, 14)) / TD%(MD%(M, 14)) - FD%(4 - MD%(M, 14)) / TD%(4 - MD%(M, 14)) / 5 + INT(41 * RND(1) - 20)
340  IF MD%(M, 4) < mr THEN pgprt 2, MN$(M) + " flees out an exit.": GOSUB 8500: MD%(M, 5) = r2: m2 = MD%(M, 14): td%(m2) = td%(m2) - MD%(M, 1): fd%(m2) = fd%(m2) - MD%(M, 13): GOTO 490
345  IF MD%(M, 14) = 2 THEN 490
350  IF MD%(M, 14) = 3 THEN 390
360  of = M: IF td%(3) = MD%(0, 1) THEN df = 0: GOSUB 7500: GOTO 490
365  IF M = 17 AND MD%(11, 5) = Room THEN df = 11: GOSUB 7500: GOTO 490
370  FOR m2 = 1 TO NM:
     IF MD%(m2, 5) = Room AND MD%(m2, 14) = 3 AND RND(1) < .25 THEN df = m2: GOSUB 7500: EXIT FOR
380  NEXT m2:
     IF df = 0 THEN GOSUB 7500: GOTO 490
390  of = M: IF M = 11 AND MD%(17, 5) = Room THEN df = 17: GOSUB 7500: GOTO 490
400  FOR m2 = 1 TO NM: IF MD%(m2, 5) = Room AND MD%(m2, 14) = 1 THEN df = m2: GOSUB 7500: EXIT FOR
410  NEXT m2
490  nbtl = (fd%(1) < td%(1)):
     IF nbtl = 0 THEN EXIT FOR
     NEXT M
500  REM
550  IF oag > MD%(0, 2) THEN MD%(0, 2) = MD%(0, 2) + 1: IF MD%(0, 2) > oag THEN MD%(0, 2) = oag
560  IF dc = 0 THEN IF dp THEN dp = dp - 2: IF dp < 0 THEN dp = 0
600  IF Room = 42 AND MD%(31, 5) = Room THEN ef = 3: GOSUB 25000: GOTO 900
900  GOTO 100
1000  REM ///initialize data
REM $$INCL:'\Eamon\copy\READMEAT.BAS'
    OPEN "MEAT" FOR INPUT AS #2
    INPUT #2, Nbr.Party
    INPUT #2, REC
    INPUT #2, MN$(0)
    INPUT #2, MD%(0, 1)
    INPUT #2, MD%(0, 2)
    INPUT #2, MD%(0, 3)
    CH = MD%(0, 3)
    FOR X = 1 TO 4
    INPUT #2, SA%(X)
    S2%(X) = SA%(X)
    NEXT
    FOR X = 1 TO 5
    INPUT #2, WA%(X)
    NEXT
    INPUT #2, SEX$
    INPUT #2, GOLD&
    INPUT #2, BANK&
    INPUT #2, AE
    INPUT #2, ArmNam$
    INPUT #2, ArmHit
    INPUT #2, ArmAdj
    INPUT #2, ShdNam$
    INPUT #2, ShdHit
    INPUT #2, ShdAdj
    FOR X = 1 TO 4
      INPUT #2, A$
      IF RTRIM$(A$) = "" THEN A$ = "NONE"
      WN$(X) = A$
      INPUT #2, WT%(X)
      INPUT #2, WC%(X)
      INPUT #2, WD%(X)
      INPUT #2, WS%(X)
      IF A$ <> "NONE" THEN
          NA = NA + 1
          AN$(NA) = WN$(X)
          AD%(NA, 2) = 2
          AD%(NA, 3) = 2
          AD%(NA, 4) = -1
          AD%(NA, 5) = WC%(X)
          AD%(NA, 6) = WT%(X)
          AD%(NA, 7) = WD%(X)
          AD%(NA, 8) = WS%(X)
      END IF
    NEXT
    IF ArmHit <> 0 THEN
          WN$(5) = ArmNam$ + " Armor"
          WT%(5) = 1
          WD%(5) = ArmHit
          WC%(5) = ArmAdj
          NA = NA + 1
          MD%(0, 8) = ArmHit
          Armptr = NA
          AN$(NA) = WN$(5)
          AD%(NA, 1) = ArmHit * 15
          AD%(NA, 2) = 11
          AD%(NA, 3) = ArmHit * 2
          AD%(NA, 4) = -1
          AD%(NA, 5) = WC%(X)
          AD%(NA, 6) = WT%(X)
          AD%(NA, 7) = WD%(X)
          AD%(NA, 8) = WS%(X)
    END IF
    IF ShdHit <> 0 THEN
          WN$(6) = ShdNam$ + " Shield"
          WT%(6) = 2
          WD%(6) = ShdHit
          WC%(6) = ShdAdj
          NA = NA + 1
          MD%(0, 8) = MD%(0, 8) + ShdHit
          Shdptr = NA
          AN$(NA) = WN$(6)
          AD%(NA, 1) = ArmHit * 15
          AD%(NA, 2) = 11
          AD%(NA, 3) = ArmHit * 2
          AD%(NA, 4) = -1
          AD%(NA, 5) = WC%(X)
          AD%(NA, 6) = WT%(X)
          AD%(NA, 7) = WD%(X)
          AD%(NA, 8) = WS%(X)
    END IF
    INPUT #2, MastPath$
    CLOSE 2
    EA = -(ArmAdj + ShdAdj)
    MD%(0, 8) = ArmHit + ShdHit
    IF NA > NZ THEN
        MD%(0, 10) = MD%(0, 2) * 2 + WC%(1) + WA%(WT%(1)) + (EA + AE) * ABS(-EA > AE)
        MD%(0, 7) = 0
        MD%(0, 9) = NZ + 1
        MD%(0, 11) = WD%(1)
        MD%(0, 12) = WS%(1)
        MD%(0, 14) = 3
    END IF

    '------- (end of include file) -------    
 ' 
1060  OPEN PATH$ + "Desc.txt" FOR RANDOM AS #2 LEN = 256
      FIELD 2, 255 AS DESC$
      OPEN PATH$ + "rmnames.txt" FOR RANDOM AS #1 LEN = 64
      FIELD 1, 64 AS rmn.nam$
      OPEN PATH$ + "rooms.txt" FOR RANDOM AS #3 LEN = 64
      DIM rf.rm$(ND)
      FOR D = 1 TO ND
	  FIELD 3, (D - 1) * 2 AS X$, 2 AS rf.rm$(D)
      NEXT
      DIM rd%(nr, ND)
      FOR r = 1 TO nr
	  GET #3, r
	  FOR D = 1 TO ND
	      rd%(r, D) = CVI(rf.rm$(D))
	  NEXT
      NEXT
1140  FOR S = 1 TO 4: S2%(S) = SA%(S): NEXT: Room = 1
1150  READ ND
      DIM dr$(ND), dp%(ND), dc%(ND), ds%(ND), DM%(ND)
      FOR c = 1 TO ND: READ dr$(c): READ dp%(c): READ dc%(c): NEXT
1160  REM  /// set m13 & m14 nuetral
1170 oag = MD%(0, 2): dr = 22: hk = 0: fw = 0: bf = 0: vl = 1: gb = 1
1175  FOR X = 1 TO 4: CO$(X) = MID$(STR$(INT(RND(1) * 10) + 32), 2) + "-" + MID$(STR$(INT(RND(1) * 8) + 20), 2) + "-" + MID$(STR$(INT(RND(1) * 8) + 30), 2): NEXT
1180 MD%(13, 14) = 2: MD%(14, 14) = 2: MD%(25, 14) = 2: MD%(18, 14) = 2: MD%(30, 14) = 2: MD%(32, 14) = 2
1900  GOTO 100
1910  DATA  40,41
1920  DATA north,n,south,s,east,e,west,w,up,u,down,d,get,take,drop,put,look,examine,attack,flee,retreat,escape,give,inventory,i,blast,heal,power,speed,smile,wave,say,ready
1930  DATA use,pay,drink,eat,read,order,save,locate
1960  DATA 13
1970  DATA seven-7,4,2,martini,5,3,manhatten,7,3,beer,3,1,whiskey sour,4,2
1975  DATA whiskey seven,5,2,vodka sour,5,2,wallbanger,6,2,wine,3,2,screwdriver,5,2
1980  DATA rum,4,1,brandy,4,1,suicide,9,6
chkdup:
      dup = 0
      FOR A = 1 TO na - wcnt
	  IF UCASE$(AN$(A)) = UCASE$(WN$(w2)) THEN AN$(A) = AN$(A) + "#": dup = -1: EXIT FOR
      NEXT
      IF dup THEN GOTO chkdup
      RETURN
2000  REM ///done with game
2010  IF die THEN GOSUB 24000
2030  IF die = 0 THEN GOSUB 29100
2032  IF spd THEN MD%(0, 2) = MD%(0, 2) / 2
2035  CLOSE : IF die THEN GOTO Get.Master
2040  FOR W = 1 TO 4: WN$(W) = "NONE": NEXT
      w2 = 1
      FOR A = 1 TO na
	  IF AD%(A, 2) > 1 AND AD%(A, 4) = -1 THEN
	      WN$(w2) = AN$(A)
	      wp%(w2) = A
	      w2 = w2 + 1
	      AD%(A, 4) = 0
	  END IF
2050  NEXT A: IF w2 < 6 THEN 2300
2060  CLS
      LOCATE 5, 1: pgprt 2, "As you start to enter the main hall, Lord William Misslefire appears and":
      pgprt 1, "tells you, 'You have too many weapons to keep them all--4 is the legal limit.":
      pgprt 2, "Your weapons are--"
2070  FOR W = 1 TO w2 - 1: pgprt 1, "    " + STR$(W) + "--" + WN$(W): NEXT: pgprt 1, "":
      pgprt 1, "Enter the number of the weapon to sell  (1-" + STR$(w2 - 1) + ") "
2080  LOCATE CSRLIN, 23: INPUT A$: w5 = VAL(A$): IF w5 < 1 OR w5 > w2 - 1 OR w5 <> INT(w5) THEN 2080
2090  AD%(wp%(w5), 4) = -1: WN$(w5) = WN$(w2 - 1): wp%(w5) = wp%(w2 - 1): w2 = w2 - 1: IF w2 > 5 THEN 2060
2300  FOR W = 1 TO 4: IF wp%(W) THEN WT%(W) = AD%(wp%(W), 6): WC%(W) = AD%(wp%(W), 5): WD%(W) = AD%(wp%(W), 7): WS%(W) = AD%(wp%(W), 8)
2310  NEXT W:
      CLS
      LOCATE 5, 1: pgprt 1, "As you deliver your treasures to Sam Slicker, the local buyer for such":
      pgprt 1, "things, he examines your goods and pays you -"
2320  tp = 0: FOR A = 1 TO na: IF AD%(A, 4) <> -1 THEN 2350
      IF A = ArmPtr OR A = ShdPtr THEN GOTO 2350
2330  IF AD%(A, 2) <> 0 THEN AD%(A, 1) = AD%(A, 1) * CH / 10
2340 tp = tp + AD%(A, 1): pgprt 1, STR$(AD%(A, 1)) + " gp for " + AN$(A)
2350  NEXT A: pgprt 2, "Total is " + STR$(tp) + " gold pieces."
2360 GOLD& = GOLD& + tp: pgprt 2, "(Hit any key to continue)  ": A$ = INPUT$(1): PRINT
Get.Master:
    CLS
    LOCATE 5, 1
  ' PRINT "  Insert Eamon Master Diskette, and press <RETURN>  OR     "
  ' PRINT
  ' PRINT "  Enter Path of Master ===> ";
  ' INPUT "", MastPath$
    IF INSTR(MastPath$, ":") = 2 THEN dr$ = LEFT$(MastPath$, 2): MastPath$ = MID$(MastPath$, 3): SHELL dr$
    IF MastPath$ <> "" THEN CHDIR MastPath$
    'ON ERROR GOTO Invalid.Path
2540  IF die THEN KILL "advent": GOTO 2900
      CLOSE
2550  GOSUB OPEN.CHARACTERS
      Nam$ = MN$(0)
      HD = MD%(0, 1)
      AG = MD%(0, 2)
      CH = MD%(0, 3)
      GOSUB WRITE.CHARACTER
      CLOSE
2570  OPEN PATH$ + "advent" FOR OUTPUT AS #1
      PRINT #1, MN$(0)
      PRINT #1, REC
      CLOSE
2900  '  run Main Hall program now ...
      CLEAR
2920  RUN "hall"
Invalid.Path:
    PRINT
    PRINT "Invalid Path, or Master Not Found. Please re-try ..."
    PRINT " (press any key to continue)";
    A$ = INPUT$(1)
    RESUME Get.Master
3000  REM  ///move
3005  IF dc THEN pgprt 2, "The men in the room won't let you leave.": GOTO 100
3010  IF nbtl THEN pgprt 2, "You can't do that with unfriendlies about!": GOTO 100
3020  D = INSTR("NSEWUD", UCASE$(LEFT$(V$, 1)))
3025  IF Room = 2 AND the.key = 0 AND D = 2 THEN 3490
3026  IF Room = 59 AND vl AND D = 2 THEN 18300
3027  IF Room = 59 AND vl = 0 AND D = 2 THEN r2 = 60: GOTO 3500
3028  IF (Room = 42 AND D = 3) OR (Room = 48 AND D = 4) THEN pgprt 2, "You have walked through the mirror!"
3030  r2 = rd%(Room, D)
3040  IF r2 > 0 THEN 3500
3050  REM ///special moves
3055  IF r2 = 0 THEN 3490
3060  IF r2 = -99 THEN 2000
3070  IF r2 = -5 THEN ef = 5: GOSUB 25000: ef = 6: GOSUB 25000: die = 1: GOTO 2000
3490  pgprt 2, "You can't go that way!": V%(Room) = 0: GOTO 100
3500  r3 = Room: Room = r2: GOSUB 3600
3590  GOTO 100
3600  REM ///check reactions on monsters
3610 td%(1) = 0: td%(3) = MD%(0, 1): fd%(1) = 0: fd%(3) = MD%(0, 13)
3620  FOR M = 1 TO NM: IF MD%(M, 5) = r3 THEN IF MD%(M, 14) = 3 OR (MD%(M, 14) = 1 AND 200 * RND(1) < MD%(M, 4)) THEN MD%(M, 5) = Room: GOTO 3670
3630  IF MD%(M, 5) <> Room THEN 3900
3640  IF MD%(M, 14) THEN 3670
3650  fr = MD%(M, 3): IF fr AND fr <> 100 THEN fr = fr + INT((CH - 10) / 2)
3660  MD%(M, 14) = 1: IF fr > (100 * RND(1)) THEN MD%(M, 14) = 2: IF fr > (100 * RND(1)) THEN MD%(M, 14) = 3
3670  A = MD%(M, 14): fd%(A) = fd%(A) + MD%(M, 13): td%(A) = td%(A) + MD%(M, 1)
3900  NEXT M: nbtl = (td%(1) > 0): RETURN
4000  REM  ///get
4010  GOSUB 4900
4020  IF S$ = "ALL" THEN 4160
4120  FOR A = 1 TO na
      IF (UCASE$(AN$(A)) = S$ OR LEFT$(UCASE$(AN$(A)), LEN(S$)) = S$ OR RIGHT$(UCASE$(AN$(A)), LEN(S$)) = S$) AND AD%(A, 4) = Room THEN Found = -1: EXIT FOR
      NEXT
      IF Found THEN GOTO 4130
      pgprt 2, "I see no " + S$ + " here!"
      GOTO 100
4130  IF WT + AD%(A, 3) > 10 * MD%(0, 1) THEN pgprt 2, "It is too heavy for you.": GOTO 100
4140  GOSUB 4200
      IF POP THEN GOTO 300
      pgprt 2, "Got it.": AD%(A, 4) = -1: WT = WT + AD%(A, 3): IF AD%(A, 2) < 2 OR MD%(0, 9) <> -1 THEN 4152
4150  GOTO 17980
4152  IF r2 = 16 AND gb = 0 THEN 3500
4154  GOTO 300
4160  FOR A = 1 TO na: IF AD%(A, 4) <> Room THEN 4190
4170  GOSUB 4200
      IF POP THEN GOTO 300
      IF WT + AD%(A, 3) > 10 * MD%(0, 1) THEN pgprt 1, AN$(A) + " is too heavy!": GOTO 4190
4180  pgprt 1, AN$(A) + " taken.": AD%(A, 4) = -1: WT = WT + AD%(A, 3)
4190  NEXT: GOTO 4152
4200  REM ///insert here special effects of picking something up
      POP = 0
4210  IF A = 35 AND gb THEN ef = 34: GOSUB 25000: r2 = 16: gb = 0
4220  IF A = 31 OR A = 32 THEN GOLD& = GOLD& + AD%(A, 1): AD%(A, 4) = 0: POP = -1: pgprt 2, "You place them in your coin purse.": GOTO 300
4299  RETURN
Monster.Search:
      Found = 0
      FOR M = 1 TO NM
      IF (S$ = UCASE$(MN$(M)) OR LEFT$(UCASE$(MN$(M)), LEN(S$)) = S$ OR RIGHT$(UCASE$(MN$(M)), LEN(S$)) = S$) AND MD%(M, 5) = Room THEN Found = -1: EXIT FOR
      NEXT
      RETURN
4700  REM  /// in search of m ///
4710 Found = 0: FOR X = 1 TO NM: IF S$ <> UCASE$(MN$(X)) AND LEFT$(UCASE$(MN$(X)), LEN(S$)) <> S$ AND RIGHT$(UCASE$(MN$(X)), LEN(S$)) <> S$ THEN 4750
4730  IF S$ = UCASE$(MN$(X)) THEN bm = X
4740 Found = Found + 1: M = X
4750  NEXT: IF Found > 1 THEN M = bm
4760  RETURN
4800  REM  /// in search of a ///
4810 Found = 0: FOR X = 1 TO na: IF S$ <> UCASE$(AN$(X)) AND LEFT$(UCASE$(AN$(X)), LEN(S$)) <> S$ AND RIGHT$(UCASE$(AN$(X)), LEN(S$)) <> S$ THEN 4850
4830  IF S$ = UCASE$(AN$(X)) THEN bm = X
4840 Found = Found + 1: A = X
4850  NEXT: IF Found > 1 THEN A = bm
4860  RETURN
4900  REM ///routine to get s$ if not previously specified.
4905  IF S$ = "" THEN pgprt 1, "": PRINT c$(c); " what"; : INPUT S$: GOTO 4900
      S$ = UCASE$(S$)
4910  RETURN
5000  REM  ///drop
5020  IF S$ = "ALL" THEN 5100
      Found = 0
5030  FOR A = 1 TO na
	  IF UCASE$(AN$(A)) = S$ AND AD%(A, 4) = -1 THEN Found = -1: EXIT FOR
      NEXT
      IF Found THEN GOTO 5040
      pgprt 2, "You aren't carrying a " + LCASE$(S$): GOTO 100
5040 WT = WT - AD%(A, 3): AD%(A, 4) = Room: pgprt 1, AN$(A) + " dropped."
5050  IF WT > 10 * MD%(0, 1) THEN pgprt 2, "You suddenly find you cannot carry all of the items you are carrying,": pgprt 1, "and they all fall to the ground.": GOTO 5100
5060  IF MD%(0, 9) > 0 THEN IF AD%(MD%(0, 9), 4) <> -1 THEN MD%(0, 9) = -1
5070  GOTO 300
5100  FOR A = 1 TO na: IF AD%(A, 4) = -1 THEN pgprt 1, AN$(A) + " dropped.": AD%(A, 4) = Room
5110  NEXT A: WT = 0: GOTO 5060
6000  REM  ///look
6010  IF S$ = "VAULT" AND Room = 59 THEN ef = 33: GOSUB 25000: GOTO 300
6015  IF S$ = "MIRROR" AND Room = 42 THEN ef = 36: GOSUB 25000: GOTO 300
6020 lk = 0: FOR A = 1 TO nz:
      IF UCASE$(AN$(A)) = S$ AND (AD%(A, 4) = Room OR AD%(A, 4) = -1) THEN
	  GET #2, A + 100:
	  A$ = RTRIM$(DESC$):
	  pgprt 2, A$:
	  lk = 1
      END IF
6030  NEXT A: IF lk THEN 300
6040  FOR A = 1 TO NM: IF UCASE$(MN$(A)) = S$ AND MD%(A, 5) = Room THEN GET #2, A + 300: A$ = RTRIM$(DESC$): pgprt 2, A$: lk = 1
6050  NEXT A: IF lk THEN 300
6060 V%(Room) = 0: GOTO 300
7000  REM  ///attack
7010  GOSUB 4900
7020  IF Room = 7 THEN ef = 9: GOSUB 25000: r2 = 63: GOTO 3500
      GOSUB Monster.Search
      IF Found THEN GOTO 7290
      IF Found THEN GOTO 7290
      GOSUB 7800
      IF POP THEN POP = 0: GOTO 100
      pgprt 2, "Attack who?": GOTO 100
7290  IF MD%(0, 9) = -1 THEN pgprt 2, "You have no weapon ready!": GOTO 100
7300 of = 0: df = M: GOSUB 7500: IF hit = 0 THEN 7360
7310  IF inc THEN w2 = AD%(MD%(0, 9), 6): WA%(w2) = WA%(w2) + 2
7320  IF -ea <= AE THEN 300
7330  IF INT(100 * RND(1) + 1) <= MD%(0, 10) THEN 7360
7340 A = 2: IF ea + AE = -1 THEN A = 1
7350 AE = AE + A: MD%(0, 10) = MD%(0, 10) + A
7360  IF MD%(df, 14) = 1 OR df = 0 THEN 300
7370  MD%(df, 3) = MD%(df, 3) / 2: FOR M = 1 TO NM: IF MD%(M, 5) = Room AND MD%(M, 14) > 1 THEN MD%(M, 14) = 0
7380  NEXT M: r3 = Room: GOSUB 3600: GOTO 300
7400  REM ///monster tries to pick up weapon
7410  IF MD%(of, 10) = 0 THEN RETURN
      Found = 0
7420  FOR A = 1 TO na: IF AD%(A, 4) = Room AND AD%(A, 2) < 2 THEN Found = -1: EXIT FOR
      NEXT: RETURN
7430  pgprt 2, MN$(of) + " picks up " + AN$(A): AD%(A, 4) = 0: MD%(of, 9) = A: MD%(of, 10) = MD%(of, 10) + AD%(A, 5): MD%(of, 4) = MD%(of, 4) * 2: RETURN
7500 hit = 0: IF MD%(of, 9) = -1 THEN 7400
7505  pgprt 2, MN$(of) + " attacks " + MN$(df): PRINT " --"; : rl = INT(100 * RND(1) + 1): hit = 0: IF (rl < 5 OR rl < MD%(of, 10)) AND rl < 96 THEN hit = 1
7510  IF hit THEN 7600
7520  IF rl < 97 THEN pgprt 1, "a miss.": RETURN
7525  pgprt 1, "a fumble!": fr = INT(100 * RND(1) + 1):
      IF fr <= 35 + 40 * (MD%(of, 9) = 0) THEN pgprt 1, "  fumble recovered.": pgprt 1, "": RETURN
7530  IF fr < 76 THEN pgprt 1, "  weapon dropped!": AD%(MD%(of, 9), 4) = Room: MD%(of, 10) = MD%(of, 10) - AD%(MD%(of, 9), 5): MD%(of, 9) = -1: MD%(of, 4) = MD%(of, 4) / 2: RETURN
7535  IF fr > 95 THEN 7550
7540  pgprt 1, "  weapon broken!": AD%(MD%(of, 9), 4) = 0: MD%(of, 10) = MD%(of, 10) - AD%(MD%(of, 9), 5): MD%(of, 9) = -1: MD%(of, 4) = MD%(of, 4) / 2: IF RND(1) > .5 THEN RETURN
7545  pgprt 1, "  broken weapon hurts user!"
7550  IF fr = 100 THEN 7560
7555 D = MD%(of, 11): S = MD%(of, 12): df = of: A = 1: GOTO 7635
7560 D = MD%(of, 11) * 2: S = MD%(of, 12): df = of: A = 0: GOTO 7635
7600 inc = (INT(100 * RND(1) + 1) > MD%(of, 10)): MD%(of, 10) = MD%(of, 10) + 2 * inc
7605 D = MD%(of, 11): S = MD%(of, 12): A = 1: IF rl > 5 THEN pgprt 1, "a hit!": GOTO 7635
7610  pgprt 1, "a critical hit!": r2 = INT(100 * RND(1) + 1): IF r2 < 51 THEN A = 0: GOTO 7635
7615  IF r2 < 86 THEN S = 1.5 * S: GOTO 7635
7620  IF r2 < 96 THEN D = 2 * D: GOTO 7635
7625  IF r2 < 100 THEN D = 3 * D: GOTO 7635
7630  GOTO 7700
7635 d2 = 0: FOR d3 = 1 TO D: d2 = d2 + INT(S * RND(1) + 1): NEXT: d2 = d2 - A * MD%(df, 8): IF d2 < 1 THEN pgprt 1, "   blow bounces off armour": RETURN
7640 MD%(df, 13) = MD%(df, 13) + d2: IF MD%(df, 13) >= MD%(df, 1) THEN 7700
7645 A = MD%(df, 14): fd%(A) = fd%(A) + d2
7650  pgprt 1, "": PRINT MN$(df); : ON INT(MD%(df, 13) * 5 / MD%(df, 1) + 1) GOTO 7655, 7660, 7665, 7670, 7675
7655  PRINT " is still in good shape.": RETURN
7660  PRINT " is hurting.": RETURN
7665  PRINT " is in pain.": RETURN
7670  PRINT " is very badly injured.": RETURN
7675  PRINT " is at death's door, knocking loudly.": RETURN
7700  pgprt 1, MN$(df) + " is dead!": pgprt 1, "": A = MD%(df, 14): fd%(A) = fd%(A) + MD%(df, 1) - MD%(df, 13) + d2: MD%(df, 5) = 0: a2 = df + nz - NM: AD%(a2, 4) = Room: IF MD%(df, 9) > 0 THEN AD%(MD%(df, 9), 4) = Room: MD%(df, 10) = MD%(df, 10) -  _
AD%(MD%(df, 9), 5): MD%(df, 9) = -1: MD%(df, 4) = MD%(df, 4) / 2
7705  IF df = 12 AND AD%(28, 4) = 0 THEN AD%(28, 4) = Room
7710  IF df = 0 THEN die = 1: GOTO 2000
7715  IF df = 12 AND AD%(28, 4) = 0 THEN AD%(28, 4) = Room
7720  pgprt 1, "": MD%(df, 2) = 0: RETURN
7800  IF S$ = "MEN" OR S$ = "SIX MEN" THEN 7820
7801  IF S$ = "POKER PLAYERS" OR S$ = "CARD PLAYERS" THEN 7830
7810  RETURN
7820  IF MD%(0, 9) = -1 THEN pgprt 2, "You are unarmed!!": GOTO 7890
7830  IF Room = dr AND dc THEN AD%(MD%(0, 9), 4) = Room: MD%(0, 9) = -1: ef = 4: GOSUB 25000: GOTO 7890
7840  IF Room = 46 THEN ef = 3: GOSUB 25000: POP = -1: RETURN
7880  RETURN
7890  POP = -1: RETURN
8000  REM  ///flee
8005  IF dc THEN pgprt 2, "The men have blocked your path!!": GOTO 100
8010  IF nbtl = 0 THEN pgprt 2, "There's nothing to flee from!": GOTO 100
8490  GOSUB 8500: GOTO 3500
8500  '
8510 r2 = rd%(Room, 6 * RND(1) + 1): IF r2 < 1 THEN 8510
8520  RETURN
9000  REM  ///give
9010 a2 = 1
9020  FOR M = 1 TO NM: IF LEFT$(S$, LEN(MN$(M))) = UCASE$(MN$(M)) AND MD%(M, 5) = Room THEN 9050
9030  NEXT: IF a2 = 1 THEN a2 = 2: pgprt 1, "": INPUT "Who to give to? ", S$: S$ = UCASE$(S$): GOTO 9020
9040  pgprt 2, "Nobody here by that name!": GOTO 100
9050 S$ = LTRIM$(RTRIM$(UCASE$(MID$(S$, LEN(MN$(M)) + 1))))
9060
9065  IF VAL(S$) > 0 THEN 9500
9070  FOR A = 1 TO na: IF LEFT$(S$, LEN(AN$(A))) = UCASE$(AN$(A)) AND AD%(A, 4) = -1 THEN 9095
9080  NEXT: IF a2 = 2 THEN a2 = 3: pgprt 1, "": INPUT "What to give? ", S$: GOTO 9065
9090  pgprt 2, "You aren't carrying a " + S$ + "!": GOTO 100
9095  IF A = MD%(0, 9) THEN MD%(0, 9) = -1
9096  pgprt 2, "Okay.": IF A = 8 AND M = 6 THEN ef = 37: GOSUB 25000
9097  IF M = 32 AND A = 13 THEN ef = 13: GOSUB 25000: ef = 14: GOSUB 25000: GOSUB 24000: MD%(M, 5) = 0: hk = 1
9098  IF M = 12 AND A = 22 THEN ef = 38: GOSUB 25000: GOSUB 24000: AD%(28, 4) = -1: MD%(M, 3) = 100
9100 AD%(A, 4) = 0: MD%(M, 14) = 0: MD%(M, 3) = MD%(M, 3) * (1 + AD%(A, 1) / 100)
9110  IF MD%(M, 10) <> 0 AND MD%(M, 9) = -1 THEN MD%(M, 9) = A: MD%(M, 10) = MD%(M, 9) + AD%(A, 5): MD%(M, 4) = 2 * MD%(M, 4)
9120 r3 = Room: GOSUB 3600: GOTO 5050
9500  IF VAL(S$) > GOLD& THEN pgprt 2, "You aren't carrying that much gold of      your own!": GOTO 300
9510 GOLD& = INT(GOLD& - VAL(S$)): MD%(M, 14) = 0: MD%(M, 3) = MD%(M, 3) * (1 + VAL(S$) / 100): GOTO 9120
10000  REM  ///inventory
10010  pgprt 2, "You are carrying the following--":
       a0 = 0: FOR A = 1 TO na:
       IF AD%(A, 4) = -1 THEN
	   pgprt 1, " " + AN$(A) + LEFT$(" (ready weapon)", 1 + 20 * ABS(A = MD%(0, 9))):
       END IF
10020  NEXT: pgprt 1, STR$(GOLD&) + " gold pieces.": GOTO 300
11000  REM  ///blast
11005  IF Room = 7 THEN 14090
11010  GOSUB 4900
11470  FOR M = 1 TO NM
       IF S$ = UCASE$(MN$(M)) AND MD%(M, 5) <> Room THEN Found = -1: EXIT FOR
       NEXT
       IF Found THEN GOTO 11480
       pgprt 2, "You can't blast " + LCASE$(S$) + "!": GOTO 100
11480 S = 1: GOSUB 11500: IF suc = 0 THEN 300
11490 pgprt 2, "Direct Hit!"
      S = 6: D = 1: df = M: A = 0: GOSUB 7635: GOTO 300
11500 suc = 0: IF SA%(S) THEN rl = INT(100 * RND(1) + 1): suc = (((rl < S2%(S)) OR (rl < 5)) AND (rl < 95)): IF rl = 100 THEN 11600
11510  IF suc = 0 THEN ON S GOTO 11550, 11560, 11570, 11580
11520 rl = RND(100 * RND(1) + 1): IF rl > S2%(S) THEN S2%(S) = S2%(S) + 2: SA%(S) = SA%(S) + 2
11530  IF S < 3 THEN S2%(S) = S2%(S) / 2
11540  RETURN
11550  pgprt 2, "The spell sputters and fizzles, sparks dropping from your fingertips straight": pgprt 1, "to the ground.": RETURN
11560  pgprt 2, "Your wounds do not diminish. fatigue and pain still fill your head": RETURN
11570  pgprt 2, "The spell is miscast. you feel a dull ache in your muscles, but it quickly": pgprt 1, "subsides.": RETURN
11580  pgprt 2, "You feel something begin to happen, but it quickly subsides. the spell has": pgprt 1, "failed.": RETURN
11600  pgprt 2, "The strain of attempting to cast this spell overloads your brain and you      forget it completely.": SA%(S) = 0: RETURN
12000  REM  ///heal
12005  IF Room = 7 THEN 14090
12010 S = 2: GOSUB 11500: IF suc = 0 THEN 300
12020 IF MD%(0, 13) THEN pgprt 2, "Some of your wounds seem to clear up."
12030 MD%(0, 13) = MD%(0, 13) - INT(10 * RND(1) + 1): IF MD%(0, 13) < 0 THEN MD%(0, 13) = 0
12040 df = 0: GOSUB 7650: GOTO 300
13000  REM  ///power
13005  IF Room = 7 THEN 14090
13010 S = 4: GOSUB 11500: IF suc = 0 THEN 300
13020  IF MD%(25, 5) = Room THEN ef = 12: GOSUB 25000: MD%(25, 5) = 0: AD%(13, 4) = -1: r3 = Room: GOSUB 3600: GOTO 300
13030 raise = 0: FOR M = 1 TO NM: m2 = nz - NM + M: IF AD%(m2, 4) = Room OR AD%(m2, 4) = -1 THEN raise = 1: pgprt 1, MN$(M) + " comes alive!": AD%(m2, 4) = 0: MD%(M, 5) = Room: MD%(M, 13) = 0: WT = WT - AD%(m2, 3)
13040  NEXT M: IF raise THEN r3 = Room: GOSUB 3600: GOTO 300
13045 rr = INT(100 * RND(1) + 1)
13050  IF rr > 10 THEN 13060
13055  pgprt 2, "You feel an increase in your magic abilities!": FOR S = 1 TO 4: IF SA%(S) THEN SA%(S) = SA%(S) + 5: S2%(S) = S2%(S) + 5
13057  NEXT: GOTO 300
13060  IF rr < 30 THEN pgprt 2, "Small fireballs circle your head, faster and faster, then explode": pgprt 1, "   in a shower of sparks!": GOTO 300
13070  IF ib = 0 AND rr < 37 THEN ef = 15: GOSUB 25000: r2 = 9: wb = 4: ib = 1: GOTO 3500
13080  IF rr < 44 THEN CLS : ef = 16: GOSUB 25000: ef = 17: GOSUB 25000: ef = 18: GOSUB 25000: GOSUB 24000: GOTO 300
13085  IF rr < 85 THEN 13200
13090  IF rr > 95 THEN pgprt 2, "All of your wounds are healed.": MD%(0, 13) = 0: GOTO 300
13100  GOTO 14020
13200  REM  /// strangeness
13210 rr = INT(RND(1) * 5 + 1): ef = rr + 19: GOSUB 25000: ON rr GOTO 13300, 13310, 13320, 13330, 13340
13300 MD%(0, 1) = MD%(0, 1) + 4: GOTO 300
13310 df = 0: d2 = 3: GOSUB 7640: GOTO 300
13320  IF LEFT$(UCASE$(MN$(0)), 11) <> "the lovely " THEN MN$(0) = "the lovely " + MN$(0)
13325 CH = ((CH < 15) * 15) + ((CH > 14) * CH) + 5: GOTO 300
13330 ef = 25: GOSUB 25000: GOSUB 24000: FOR X = 1 TO 5: WA%(X) = WA%(X) - 10: NEXT: GOTO 300
13340 di = 1: GOTO 2000
14000  REM  ///speed
14005  IF Room = 7 THEN 14090
14010 S = 3: GOSUB 11500: IF suc = 0 THEN 300
14020  IF spd = 0 THEN MD%(0, 10) = MD%(0, 10) + 2 * MD%(0, 2): MD%(0, 2) = 2 * MD%(0, 2)
14030 spd = spd + INT(25 * RND(1) + 10): pgprt 2, "You can feel the new agility flowing through you!": GOTO 300
14090 ef = 10: GOSUB 25000: GOTO 300
15000  REM  /// Smile
15005  IF dc = 0 THEN 15010
15006  IF nbtl THEN pgprt 1, "You must love battle! " + STR$(6 - po) + " fiendish": pgprt 1, "smiles flash back at you.": GOTO 100
15007  pgprt 2, "Everybody smiles. (What a friendly bunch!)": GOTO 300
15010  sp = 2: FOR M = 1 TO NM: IF MD%(M, 5) <> Room THEN 15100
15020  ON MD%(M, 14) GOTO 15030, 15040, 15050
15030 rr = INT(RND(1) * 4 + 1): ON rr GOTO 15032, 15034, 15036, 15038
15032  pgprt sp, MN$(M) + " snort" + MID$("s", 1, ABS(MD%(M, 6) <> 999)) + " at you.": sp = 1: GOTO 15100
15034  pgprt sp, MN$(M) + " sneer" + MID$("s", 1, ABS(MD%(M, 6) <> 999)) + " at you.": sp = 1: GOTO 15100
15036  pgprt sp, MN$(M) + " snarl" + MID$("s", 1, ABS(MD%(M, 6) <> 999)) + " at you.": sp = 1: GOTO 15100
15038  pgprt sp, MN$(M) + " growl" + MID$("s", 1, ABS(MD%(M, 6) <> 999)) + " at you.": sp = 1: GOTO 15100
15040  pgprt sp, MN$(M) + " ignore" + MID$("s", 1, ABS(MD%(M, 6) <> 999)) + " you.": sp = 1: GOTO 15100
15050  pgprt sp, MN$(M) + " " + c$(c) + MID$("s", 1, ABS(MD%(M, 6) <> 999)) + " back.": sp = 1: GOTO 15100
15100  NEXT M: GOTO 300
16000  REM  ///say
16010  GOSUB 4900
16030  IF S$ = "BLAST" THEN V$ = S$: S$ = "": GOTO 11000
16040  IF S$ = "HEAL" THEN 12000
16050  IF S$ = "POWER" THEN 13000
16060  IF S$ = "SPEED" THEN 14000
16070  IF S$ = "EVANTKE" AND Room = 50 THEN ef = 26: GOSUB 25000: r2 = 61: GOTO 3500
16080  IF (S$ = "GRONK" OR S$ = "GRUNT") AND MD%(6, 5) = Room THEN ef = 43: GOSUB 25000: GOTO 300
16090  IF hk AND LEFT$(S$, 6) = "LOCATE" THEN S$ = MID$(S$, 8): GOTO 28000
16900  pgprt 2, "Okay, '" + LCASE$(S$) + "'": GOTO 300
17000  REM  ///ready
17010  GOSUB 4900
       Found = 0
17020  FOR A = 1 TO na
       IF UCASE$(AN$(A)) <> S$ OR AD%(A, 4) <> -1 THEN Found = -1: EXIT FOR
       NEXT
       IF Found THEN GOTO 17030
       pgprt 2, "You aren't carrying it!": GOTO 100
17030  IF AD%(A, 2) < 2 THEN pgprt 2, "That isn't a weapon!": GOTO 100
17980 MD%(0, 10) = (ea + AE) * (-ea > AE) + AD%(A, 5) + WA%(AD%(A, 6)) + 2 * MD%(0, 2): MD%(0, 9) = A: MD%(0, 11) = AD%(A, 7): MD%(0, 12) = AD%(A, 8)
17990  pgprt 2, "Readied.": GOTO 300
18000  REM   /// use
18010  GOSUB 4900: IF S$ <> "MATCH" THEN GOTO 18100
18020  IF AD%(1, 4) <> -1 THEN pgprt 2, "But you haven't any matches.": GOTO 300
18030  INPUT "Use match on what?", S$: S$ = UCASE$(S$)
18035  IF S$ = "CANDLE" AND AD%(15, 4) <> -1 THEN pgprt 2, "You have no candle": GOTO 300
18040  IF S$ = "CANDLE" THEN r2 = INT(RND(1) * 63 + 1): pgprt 2, "You have been teleported!": r2 = ((r2 < 2) * 57) + ((r2 > 1) * r2): AD%(1, 4) = 0: wb = 0: GOTO 3500
18050  IF (S$ = "BOOK" OR S$ = "COOK BOOK") AND AD%(14, 4) = -1 THEN pgprt 2, "You've just burned up your cook book.": AD%(14, 4) = 0: pgprt 1, "The ashes disintegrate and fall to the  ground.": GOTO 300
18060  pgprt 2, "You can't use your match on a " + LCASE$(S$) + "!": GOTO 300
18100  IF S$ = "GOLD KEY" OR S$ = "KEY" THEN GOTO 18200
18110  IF S$ = "TROUGH" OR S$ = "BATHROOM" THEN 18150
18120  IF S$ = "COMBINATION" THEN 18300
18130  IF S$ = "CANDLE" THEN pgprt 2, "It must be lit to be used.": GOTO 100
18140  pgprt 2, "I dont know what you mean!": GOTO 300
18150  IF Room <> 38 THEN GOTO 18170
18160  pgprt 2, "You feel much better now.": GOTO 300
18170  pgprt 2, "It would be disasterous to go here!": GOTO 300
18200  IF AD%(28, 4) <> -1 THEN pgprt 2, "You have no key!": GOTO 300
18205  pgprt 2, "The door swings open, you are free to go."
18210 the.key = 1: GOTO 300
18300  REM  /// combo
18310  pgprt 1, "": INPUT "Enter combination (use dashes):", cm$:
       IF cm$ = CO$(4) THEN vl = 0: pgprt 2, "The vault door swings open!": GOTO 300
18320  pgprt 2, "The vault door did not open.": GOTO 300
19000  REM  /// pay
19040  IF nbtl AND Room = 36 AND (MD%(13, 5) = 36 OR MD%(14, 5) = 36) THEN nbtl = 0: GOLD& = INT(GOLD& / 2): MD%(14, 14) = 2: MD%(13, 14) = 2: pgprt 2, "You have paid for your drink plus damages. The bar is now open.": GOTO 100
19050  GOTO 9000
20000  REM  /// drink
20005  IF dc = 0 THEN GOTO 27000
20010  CLS : pgprt 2, "The bartender hands you a drink menu:": FOR D = 1 TO ND: pgprt 1, " " + STR$(D) + " " + dr$(D): NEXT: pgprt 1, ""
20015  INPUT "no. of drink:", D: IF D > ND OR D < 1 THEN GOTO 20015
20020  pgprt 2, "The bartender pours you a " + dr$(D): pgprt 1, "You may sip it, drink it or guzzle it."
20025  PRINT "specify s, d or g:";
20030  D$ = INPUT$(1)
       D$ = UCASE$(D$)
       IF UCASE$(D$) <> "S" AND UCASE$(D$) <> "D" AND UCASE$(D$) <> "G" THEN 20030
20035  pgprt 1, D$: GOSUB 20500: IF dc = 0 THEN 300
20040  A = INSTR("SDG", D$)
20050  dp = dp + ((.5 * A) * dp%(D)): IF A = 3 THEN nbtl = 0
20060  ds%(A) = ds%(A) + 1: IF dw AND A < 3 THEN pgprt 2, "The men attack you!!": GOTO 20900
20075  IF A < 3 AND ds%(1) + ds%(2) = 2 THEN pgprt 2, "The men have had enough of your stalling!!  They draw their weapons!!!": dw = 1: pgprt 1, ""
20080  IF A < 3 AND ds%(1) + ds%(2) = 1 THEN pgprt 2, "The men are unimpressed. You had better drink faster if you want them to": pgprt 1, "refrain from carving you up!"
20090  IF dp > MD%(0, 1) THEN MD%(0, 2) = oag - (dp - MD%(0, 1))
20100  IF MD%(0, 2) = oag THEN GOTO 300
20105  IF MD%(0, 2) < 0 THEN MD%(0, 2) = 0
20110  IF MD%(0, 2) = 0 THEN pgprt 1, "": COLOR hfg%, hbg%: pgprt 1, "You have passed out!": COLOR fgc%, bgc%: GOSUB 26000: zd = 0: GOTO 300
20120  IF MD%(0, 2) / oag < .25 THEN pgprt 2, "You feel extremely numb, dizzy and sick.": GOTO 300
20130  IF MD%(0, 2) / oag < .5 THEN pgprt 2, "You feel very numb and are staggering very badly!": GOTO 300
20140  IF MD%(0, 2) / oag < .75 THEN pgprt 2, "You are very dizzy. you don't feel well.": GOTO 300
20150  IF MD%(0, 2) / oag < .99 THEN pgprt 2, "Boy, are you drunk!!!": GOTO 300
20200  GOTO 300
20500  CLS : Speed = 150: FOR X = 19 TO 24: GOSUB 20600
20520  NEXT: Speed = 255
20530  IF po = 6 THEN dc = 0: dr = 0: pgprt 1, "The drinking contest is over.": pgprt 1, "You notice a stack of gold on the table.": AD%(31, 4) = Room: GOSUB 3600
20590  RETURN
20600  REM  --- men buy drinks and guzzle
20610  IF MD%(X, 2) = 0 THEN 20690
20640  SPPRT Speed, MN$(X) + " buys a " + dr$(RND(1) * ND + 1)
       SPPRT Speed, " and he guzzles it!"
       PRINT
       DM%(X - 18) = DM%(X - 18) + 1.5 * dp%(RND(0) * ND + 1)
20650  IF DM%(X - 18) > MD%(X, 2) THEN COLOR hfg%, hbg%: pgprt 1, MN$(X) + " passes out.": COLOR fgc%, bgc%: AD%(X + 36, 4) = Room: MD%(X, 15) = MD%(X, 1) + 1: MD%(X, 2) = 0: po = po + 1: IF MD%(X, 5) = Room THEN MD%(X, 5) = 0
20690  RETURN
20900  REM  men attack routine
20905  IF ir THEN 300
20910  FOR M = 19 TO 24: IF MD%(M, 2) <> 0 THEN MD%(M, 5) = Room: MD%(M, 3) = 0
20920  NEXT: ir = 1: GOSUB 3600
20950  GOTO 300
21000  REM  /// eat
21010  GOSUB 4900: IF S$ = "PEANUTS" AND AD%(17, 4) = -1 THEN ef = 2: GOSUB 25000: r2 = 36: GOTO 3500
21020  IF S$ = "PEANUTS" THEN pgprt 2, "You don't have any peanuts!": GOTO 100
21800  PRINT "You aren't "; : COLOR hfg%, hbg%: PRINT "that"; : COLOR fgc%, bgc%: pgprt 1, " hungry!"
21999  GOTO 300
22000  REM   /// read
22010  GOSUB 4900: IF (S$ = "COOK BOOK" OR S$ = "COOKBOOK") AND AD%(14, 4) = -1 THEN pgprt 2, "The knowledge frightens you and you never want to eat meatloaf again!": GOTO 100
22020  IF S$ = "COOK BOOK" OR S$ = "COOKBOOK" THEN pgprt 2, "You don't have any cook book.": GOTO 100
22040  IF Room = 16 AND S$ = "MARKINGS" THEN pgprt 2, "The markings read 'this side up'.": GOTO 100
22060  IF Room = 38 AND (S$ = "WALL" OR S$ = "GRAFFITTI") THEN 23000
22999  pgprt 2, "I don't know what you mean.": GOTO 300
23000  REM  /// graffitti
23010  pgprt 2, "You see some names and measurements on the wall ---": pgprt 2, "   Deede Berry - " + CO$(1): pgprt 1, "   Fifi Lafrentz - " + CO$(2)
23020  pgprt 1, "   V. Alt - " + CO$(4): pgprt 1, "   Jamie Zena - " + CO$(3): pgprt 1, "": GOTO 300
24000  REM   /// press any key
24010  pgprt 1, "": PRINT "   (Hit any key to continue)   "; : A$ = INPUT$(1): pgprt 1, ""
24030  LOCATE CSRLIN, 1: pgprt 1, SPACE$(40): RETURN
25000  REM  /// read eff & print
25010  GET #2, ef + 200: ef$ = RTRIM$(DESC$): pgprt 2, ef$
25020  RETURN
26000  REM  /// adventurer passed out.possessions scattered.
26010  FOR X = 1 TO na: IF AD%(X, 4) <> -1 THEN 26025
26020  AD%(X, 4) = RND(1) * nr + 1
26025  NEXT
26030  dr = 0: dc = 0: pgprt 2, "You wake up " + STR$(INT(RND(1) * 22)) + " hours later.": pgprt 1, "You find all your possessions gone.  They must have been stolen while you were passed out."
26040  FOR X = 19 TO 24: IF MD%(X, 1) - 1 < MD%(X, 13) THEN 26070
26050 AD%(X + 36, 4) = 0: MD%(X, 3) = 50: MD%(X, 14) = 2: MD%(X, 5) = RND(1) * nr + 1
26070  NEXT
26080 MD%(0, 9) = -1: AD%(32, 1) = GOLD&: GOLD& = 0: AD%(32, 4) = INT(RND(1) * nr + 1)
26090  RETURN
27000  REM  /// recreational drinking    (not professional : i.e. contests)
27010  IF Room = 36 THEN GOTO 27600
27020  IF Room = 22 AND dc = 0 THEN pgprt 2, "The bartender says you have had enough.": GOTO 300
27030  GOSUB 4900
27035  IF S$ = "WINE" AND Room = 9 THEN ef = 19: GOSUB 25000: r2 = 12: GOTO 3500
27040  IF S$ = "RUM" OR S$ = "BRANDY" OR S$ = "VODKA" THEN GOTO 27500
27050  IF S$ = "SCOTCH" AND AD%(25, 4) = -1 THEN pgprt 2, "That was probably the most expensive drink you've ever had!!!": AD%(25, 4) = 0: AD%(26, 4) = -1: GOTO 300
27060  IF (S$ = "STRANGE BREW" OR S$ = "BREW") AND (AD%(18, 4) = -1 OR AD%(18, 4) = Room) THEN 27700
27490  pgprt 2, "No one served you " + LCASE$(S$) + "!": GOTO 100
27500  REM   /// pink elephant appears
27510 y = 0: FOR X = 19 TO 21: IF UCASE$(AN$(X)) = S$ AND AD%(X, 4) = -1 THEN y = X
27515  NEXT: IF y = 0 THEN 27530
27520  pgprt 2, "What a lush!": MD%(11, 5) = Room: ef = 27: GOSUB 25000: GOSUB 3600: GOTO 100
27530  pgprt 2, "I don't see any " + LCASE$(S$) + " here.": GOTO 100
27600  REM  /// bartender training
27605  IF GOLD& = 0 OR nbtl OR MD%(13, 5) <> 36 OR MD%(14, 5) <> 36 THEN pgprt 2, "Sorry. The bar is closed.": GOTO 300
27610 X = INT(RND(1) * ND + 1): pgprt 2, "The bartender gives you a " + dr$(X) + ".": pgprt 1, "You drink it and he asks for " + STR$(dc%(X)) + " gp.": dp = dp + dp%(X): zd = 1: GOTO 20090
27620  pgprt 0, "":
       pgprt 1, " "
       COLOR hfg%, hbg%
       PRINT "  Your Command ";
       COLOR fgc%, bgc%
       INPUT " ", A$
27625  IF A$ = "" THEN A$ = cz$: LOCATE CSRLIN - 1, 17: pgprt 1, A$
       A$ = UCASE$(A$)
27630  IF zz AND LEFT$(A$, 3) <> "PAY" THEN MD%(13, 14) = 0: MD%(14, 14) = 0: GOSUB 3600: zz = 0: GOTO 300
27640  IF LEFT$(A$, 3) <> "PAY" THEN pgprt 2, "The bartender is asking you politely    to pay up or incur bodily damage from   the bouncer.": zz = 1: GOTO 27620
27645  IF dc%(X) > GOLD& THEN pgprt 2, "The bartender accepts the last of your gold as payment.": GOLD& = 0: GOTO 300
27650 GOLD& = GOLD& - dc%(X): zz = 0: pgprt 2, "The bartender smiles and replies thank  you.": GOTO 100
27700  REM  brew is unpredictable - cannot drink all
27710 rr = INT(RND(1) * 5 + 1): ef = rr + 27: GOSUB 25000: ON rr GOTO 27720, 13320, 27740, 27750, 27760
27720 CH = CH - 5: GOTO 300
27740 AG = AG - 5: GOTO 300
27750  FOR X = 1 TO 5: WA%(X) = WA%(X) + 7: NEXT: GOTO 300
27760 MD%(0, 9) = MD%(0, 7) + 10: GOTO 300
28000  REM  /// locate
28010  IF hk = 0 THEN pgprt 2, "nothing happens.": GOTO 300
28020  GOSUB 4900: pgprt 2, "Your mind reaches past your body..."
28040  GOSUB 4800: IF Found = 0 THEN 28100
28050  IF AD%(A, 4) = -1 THEN 28360
28060  IF AD%(A, 4) < 1 THEN 28100
28070 sr = Room: Room = AD%(A, 4): GOTO 28290
28100  GOSUB 4700: IF Found = 0 THEN 28380
28120  IF MD%(M, 5) = -1 THEN 28360
28140  IF MD%(M, 5) < 1 THEN 28380
28160 sr = Room: Room = MD%(M, 5): GOTO 28290
28290  GOSUB 29000: pgprt 2, LCASE$(S$) + " is " + A$: pgprt 1, "": Room = sr: GOTO 300
28360  pgprt 2, LCASE$(S$) + " is in your possession!": pgprt 1, "": GOTO 300
28380  pgprt 2, LCASE$(S$) + " could not be located with the range you possess.": GOTO 300
29000  GET #1, Room: A$ = rmn.nam$: RETURN
29100  REM   done good?
29110  IF Room = 53 THEN RETURN
29120  IF AD%(25, 4) <> -1 THEN ef = 39: GOSUB 25000: ef = 40: GOSUB 25000: GOSUB 24000: di = 1: GOTO 29190
29160 ef = 41: GOSUB 25000: ef = 42: GOSUB 25000: GOSUB 24000: AD%(25, 4) = 0: GOLD& = GOLD& + 2500
29190  RETURN
30000  REM   // save game
       PRINT "Save game is not supported at this time.": GOTO 100
31000  REM   /// restart
       GOTO 1000
REM $$INCL:'\Eamon\Copy\Chario.Bas'
        ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        '
        '   Module:  CHARIO.BAS
        '   Eamon Version:  Eamon-QB (or Eamon-PC)
        ' ------------------------------------------------------------
        '  Character File I/O Routines for Eamon QB/PC
        '        Basic version:  QuickBASIC 4.0, GW-BASIC, QBasic *
        '                        or BASIC 7.0 PDS
        '       uses User defined types for record definition
        '       This module will work for QBasic, but QBasic cannot
REM $$INCL:statements, so module must be built
        '       manually or merged using a utility
        ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        '
OPEN.CHARACTERS:
      OPEN "CHARACT.DAT" FOR RANDOM AS #1 LEN = LEN(Char)
      RETURN
READ.NBR.CHARS:
      GET #1, 1, CharCtl
      NC = CharCtl.NbrChar
      IF NC > LOF(1) \ LEN(Char) THEN NC = LOF(1) \ LEN(Char) - 1
      RETURN
READ.CHARACTER:
      GET #1, REC, Char
      Nam$ = RTRIM$(Char.Nam$)
      HD = Char.Hd
      AG = Char.Ag
      CH = Char.Ch
      SA%(1) = Char.SA1
      SA%(2) = Char.SA2
      SA%(3) = Char.SA3
      SA%(4) = Char.SA4
      WA%(1) = Char.WA1
      WA%(2) = Char.WA2
      WA%(3) = Char.WA3
      WA%(4) = Char.WA4
      WA%(5) = Char.WA5
      SEX$ = Char.SEX
      GOLD& = Char.GOLD
      BANK& = Char.BANK
      AE = Char.AE
      ArmNam$ = RTRIM$(Char.ArmNam)
      ArmHit = Char.ArmHit
      ArmAdj = Char.ArmAdj
      ShdNam$ = RTRIM$(Char.ShdNam)
      ShdHit = Char.ShdHit
      ShdAdj = Char.ShdAdj
      WN$(1) = RTRIM$(Char.Wpn1Nam)
      WR%(1) = Char.Wpn1Typ
      WT%(1) = Char.Wpn1WpnTyp
      WC%(1) = Char.Wpn1Odds
      WD%(1) = Char.Wpn1Dice
      WS%(1) = Char.Wpn1Sides
      WN$(2) = RTRIM$(Char.Wpn2Nam)
      WR%(2) = Char.Wpn2Typ
      WT%(2) = Char.Wpn2WpnTyp
      WC%(2) = Char.Wpn2Odds
      WD%(2) = Char.Wpn2Dice
      WS%(2) = Char.Wpn2Sides
      WN$(3) = RTRIM$(Char.Wpn3Nam)
      WR%(3) = Char.Wpn3Typ
      WT%(3) = Char.Wpn3WpnTyp
      WC%(3) = Char.Wpn3Odds
      WD%(3) = Char.Wpn3Dice
      WS%(3) = Char.Wpn3Sides
      WN$(4) = RTRIM$(Char.Wpn4Nam)
      WR%(4) = Char.Wpn4Typ
      WT%(4) = Char.Wpn4WpnTyp
      WC%(4) = Char.Wpn4Odds
      WD%(4) = Char.Wpn4Dice
      WS%(4) = Char.Wpn4Sides
      RETURN
WRITE.CHARACTER:
      Char.Nam = Nam$
      Char.Hd = HD
      Char.Ag = AG
      Char.Ch = CH
      Char.SA1 = SA%(1)
      Char.SA2 = SA%(2)
      Char.SA3 = SA%(3)
      Char.SA4 = SA%(4)
      Char.WA1 = WA%(1)
      Char.WA2 = WA%(2)
      Char.WA3 = WA%(3)
      Char.WA4 = WA%(4)
      Char.WA5 = WA%(5)
      Char.SEX = SEX$
      Char.GOLD = GOLD&
      Char.BANK = BANK&
      Char.AE = AE
      Char.ArmNam = ArmNam$
      Char.ArmHit = ArmHit
      Char.ArmAdj = ArmAdj
      Char.ShdNam = ShdNam$
      Char.ShdHit = ShdHit
      Char.ShdAdj = ShdAdj
      Char.Wpn1Nam = WN$(1)
      Char.Wpn1Typ = WR%(1)
      Char.Wpn1WpnTyp = WT%(1)
      Char.Wpn1Odds = WC%(1)
      Char.Wpn1Dice = WD%(1)
      Char.Wpn1Sides = WS%(1)
      Char.Wpn2Nam = WN$(2)
      Char.Wpn2Typ = WR%(2)
      Char.Wpn2WpnTyp = WT%(2)
      Char.Wpn2Odds = WC%(2)
      Char.Wpn2Dice = WD%(2)
      Char.Wpn2Sides = WS%(2)
      Char.Wpn3Nam = WN$(3)
      Char.Wpn3Typ = WR%(3)
      Char.Wpn3WpnTyp = WT%(3)
      Char.Wpn3Odds = WC%(3)
      Char.Wpn3Dice = WD%(3)
      Char.Wpn3Sides = WS%(3)
      Char.Wpn4Nam = WN$(4)
      Char.Wpn4Typ = WR%(4)
      Char.Wpn4WpnTyp = WT%(4)
      Char.Wpn4Odds = WC%(4)
      Char.Wpn4Dice = WD%(4)
      Char.Wpn4Sides = WS%(4)
      PUT #1, REC, Char
      RETURN
WRITE.NBR.CHARS:
      CharCtl.NbrChar = NC
      PUT #1, 1, CharCtl
      RETURN

    '------- (end of include file) -------    
 ' 

SUB pgprt (sp, LIT$)
    STATIC LINE.PG
    IF sp = 0 THEN LINE.PG = 0: EXIT SUB
    IF LIT$ = "" THEN LINE.PG = LINE.PG + sp: EXIT SUB
    IF sp > 1 THEN
	FOR X = 1 TO sp - 1
	PRINT
	LINE.PG = LINE.PG + 1
	NEXT
    END IF
    IF LINE.PG > 20 THEN
	PRINT STRING$(25, "-"); " Press Any Key to Continue "; STRING$(25, "-")
	A$ = INPUT$(1)
	LOCATE CSRLIN - 1, 1
	PRINT SPC(79);
	LINE.PG = 0
    END IF
    PRINT LIT$
    LINE.PG = LINE.PG + LEN(LIT$) / 79 + 1


END SUB

SUB SPPRT (Speed, LIT$)
	FOR X = 1 TO LEN(LIT$)
	    PRINT MID$(LIT$, X, 1);
	    FOR dlay = 1 TO (255 - Speed)
	    NEXT
	NEXT
END SUB

