1 RANDOMIZE VAL(RIGHT$(TIME$,2))
2 REM
3 REM Adventure #1 ->the Beginners Cave<-
4 REM Origionaly made by Donald Brown (bless his soul)
5 REM Converted to MBASIC by Jon Walker,139 S. Central Ave
6 REM Marshfield, WI, 54449 (no Lithuanian currency please!)
7 REM
8 REM
10 REM   CNAME$: CHARACTER NAME      HD: HARDINESS  AG: AGILITY  CH: CHARISMA
15 REM
20 REM   SA(1)-SA(4):SPELL ABILITIES
30 REM   WA(1)-WA(5):WEAPON ABILITIES
35 REM
40 REM   AE: AMROUR EXPERT.  SEX$: M OR F  GOLD: ON PERSON  BANK: GOLD IN BANK
50 REM   AC: ARMOUR CLASS  
60 REM 
70 REM WEAPON INFO:
80 REM     WNAME$: WEAPON NAME
85 REM
86 REM
87 DEF FND$(X$)=MID$(X$,INSTR(X$,".")+1)+CHR$(10)+CHR$(13)
88 REM
90 CLS:FOR I=1 TO 10:PRINT :NEXT I:PRINT"         Please wait a short while (Waking up the Monsters)"
95 GOTO 22000
96 REM
100 REM /// give room description if never here, then get command
110 PRINT
115 IF SPD>0 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)
120 IF V(ROOM) THEN GET#2,ROOM:PRINT"You are standing in ";R2$
125 IF NOT V(ROOM) THEN GET#1,ROOM:PRINT FND$(R1$)
130 FOR M=1 TO NM:IF MD(M,5)=ROOM AND MD(M,15)<>0 THEN PRINT MN$(M);" is here."
135 IF MD(M,5)=ROOM AND MD(M,15)=0 THEN GET#3,M+30:PRINT FND$(R3$):MD(M,15)=1:IF M=10 THEN GET#3,26:PRINT FND$(R3$)
140 NEXT M:FOR A=1 TO NA-1:IF AD(A,4)=ROOM AND (A<NA) AND NOT V(ROOM) THEN GET#3,A:PRINT FND$(R3$)
145 IF AD(A,4)=ROOM AND (A<NA) AND V(ROOM) THEN PRINT"You see ";AN$(A)
150 NEXT A:IF AD(NA,4)=ROOM THEN PRINT"Your ";AN$(A);" is here."
155 V(ROOM)=-1
160 PRINT:PRINT"   Your command  ";
163 LINE INPUT A$:IF A$="" THEN A$=CZ$:PRINT:PRINT A$
164 GOSUB 31000
175 CZ$=A$:A=INSTR(2,A$," ")
180 IF A<>0 THEN V$=LEFT$(A$,A-1):S$=MID$(A$,A+1) ELSE V$=A$:S$=""
185 IF LEFT$(S$,1)=" " THEN S$=MID$(S$,2):GOTO 185
190 FOR C=1 TO NC:IF C$(C)=V$ OR C$(C)=S$ THEN 195 ELSE NEXT C
191 PRINT"Huh? I only understand these commands--"
192 FOR C=1 TO NC:PRINT C$(C);SPACE$(30-LEN(C$(C)));
193 IF C/2=INT(C/2) THEN PRINT
194 NEXT C:PRINT:PRINT:GOTO 160
195 IF C$(C)=S$ THEN S$=V$:V$=C$(C)
200 ON C GOTO 1000,1000,2000,3000,4000,4000,5000,5000,5000,5000,5000,5000,5000,5000,5000,5000,5000,5000,6000,7000,8000,10000,11000,12000,13000,14000,15000,16000,17000,17000,17000,18000,18000,19000,20000,21000,28000
300 REM ///
301 REM /// commands return here
310 IF NOT NBTL THEN 440
320 FOR M=1 TO NM:IF MD(M,5)<>ROOM THEN 430
330 MR=FD(MD(M,14))/TD(MD(M,14))-FD(ABS(MD(M,14)=0))/TD(ABS(MD(M,14)=0))/5+INT(41*RND(1)-20)
340 IF MD(M,4)<MR THEN PRINT:PRINT MN$(M);" flees out an exit.":PRINT:GOSUB 17500:MD(M,5)=R2:TD(MD(M,14))=TD(MD(M,14))-MD(M,1):FD(MD(M,14))=FD(MD(M,14))-MD(M,13):GOTO 430
350 IF MD(M,14)<>0 THEN 390
360 OF=M:IF TD(1)=MD(0,1) THEN DF=0:GOSUB 3500:GOTO 430
370 SKIP=0:FOR M2=1 TO NM:IF MD(M2,5)=ROOM AND (MD(M2,14)<>0) AND RND(1)<.25 THEN DF=M2:GOSUB 3500:M2=200:SKIP=-1
380 NEXT M2:IF SKIP THEN 430 ELSE DF=0:GOSUB 3500:GOTO 430
390 OF=M
400 SKIP=0:FOR M2=1 TO NM:IF MD(M2,5)=ROOM AND MD(M2,14)=0 THEN DF=M2:GOSUB 3500:M2=200:SKIP=-1
410 NEXT M2:IF SKIP THEN 430 ELSE 400
420 REM
430 NBTL=(FD(0)<TD(0))
435 IF NBTL THEN NEXT M
440 REM
450 GOTO 100
460 REM
470 REM
1000 REM /// get command
1010 GOSUB 1950
1020 IF S$="TORCH" THEN PRINT:PRINT"All torches are bolted to the wall and cannot be removed.":PRINT:GOTO 300
1030 IF S$="ALL" THEN 1120
1040 IF S$<>"RAT" THEN 1070
1050 FOR A=14 TO 16:IF AD(A,4)=ROOM THEN S$=AN$(A)
1060 NEXT
1070 IF S$="GOLD" OR S$="COINS" THEN S$=AN$(6)
1080 FOR A=1 TO NA:IF AN$(A)<> S$ OR AD(A,4)<>ROOM THEN NEXT A:PRINT:PRINT"I see no ";S$;" here!":PRINT:GOTO 100
1090 IF WT+AD(A,3)>10*MD(0,1) THEN PRINT:PRINT"It is too heavy for you.":PRINT:GOTO 100
1100 PRINT:PRINT"Got it.":AD(A,4)=-1:WT=WT+AD(A,3):PRINT:IF AD(A,2)<2 OR MD(0,9)<>-1 THEN 300
1110 GOTO 16000
1120 FOR A=1 TO NA:IF AD(A,4)<>ROOM THEN 1150
1130 IF WT+AD(A,3)>10*MD(0,1) THEN PRINT AN$(A);" is too heavy.":GOTO 1150
1140 PRINT AN$(A);" taken.":AD(A,4)=-1:WT=WT+AD(A,3)
1150 NEXT A:PRINT:GOTO 300
1950 IF S$="" THEN PRINT:PRINT C$(C);" what ";:A3$=A$:INPUT A$:GOSUB 31000:S$=A$:A$=A3$:GOTO 1950
1960 RETURN
2000 REM /// drop command
2010 GOSUB 1950
2020 IF NBTL THEN PRINT:PRINT"You can't do that with unfrienlies about!":PRINT:GOTO 100
2030 IF S$="ALL" THEN 2060
2040 FOR A=1 TO NA:IF AN$(A)<>S$ OR AD(A,4)<>-1 THEN NEXT A:PRINT"You aren't carrying a ";S$:GOTO 100
2050 WT=WT-AD(A,3):PRINT:PRINT"Dropped.":AD(A,4)=ROOM:PRINT:GOTO 300
2060 FOR A=1 TO NA:IF AD(A,4)<>-1 THEN 2080
2070 WT=WT-AD(A,3):AD(A,4)=ROOM:PRINT AN$(A);" dropped."
2080 NEXT A:GOTO 300
3000 REM /// attack command
3010 GOSUB 1950
3020 IF S$<>"RAT" THEN 3050
3030 FOR M=1 TO 3:IF MD(M,5)=ROOM THEN S$=MN$(M)
3040 NEXT M
3050 FOR M=1 TO NM:IF S$<>MN$(M) OR MD(M,5)<>ROOM THEN NEXT M:PRINT:PRINT"Attack who?":PRINT:GOTO 100
3060 IF MD(0,9)=-1 THEN PRINT:PRINT"You have no weapon ready!":PRINT:GOTO 100
3070 OF=0:DF=M:GOSUB 3500:IF NOT HIT THEN 3130
3080 IF INC<>0 THEN W2=AD(MD(0,9),6):WA(W2)=WA(W2)+2
3090 IF -EA<=AE THEN 300
3100 IF INT(100*RND(1)+1)<=MD(0,10) THEN 3130
3110 A=2:IF EA+AE=1 THEN A=1
3120 AE=AE+A:MD(0,10)=MD(0,10)+A
3130 IF MD(DF,14)=0 OR DF=0 THEN 300
3140 MD(DF,3)=MD(DF,3)/2:IF NBTL THEN MD(DF,14)=0:TD(0)=TD(0)+MD(DF,1):TD(1)=TD(1)-MD(DF,1):FD(0)=FD(0)+MD(DF,13):FD(1)=FD(1)-MD(DF,13):GOTO 300
3150 R2=ROOM:MD(DF,14)=0:GOTO 5100
3500 HIT=0:IF MD(OF,9)=-1 THEN RETURN
3505 PRINT MN$(OF);" attacks ";MN$(DF):PRINT" -- ";
3510 RL=INT(100*RND(1)+1):HIT=0:IF RL<5 OR RL<MD(OF,10) THEN HIT=-1
3515 IF HIT THEN 3600
3520 IF RL<97 THEN PRINT"a miss.":RETURN
3525 PRINT"a fumble!":FR=INT(100*RND(1)+1):IF FR<=35+40*ABS(MD(OF,9)=0) THEN PRINT" fumble recovered.":PRINT:RETURN
3530 IF FR<76 THEN PRINT" weapon dropped!":AD(MD(OF,9),4)=ROOM:MD(OF,9)=-1:PRINT:RETURN
3535 IF FR>95 THEN 3550
3540 PRINT" weapon broken!":AD(MD(OF,9),4)=0:MD(OF,9)=-1:IF RND(1)>.9 THEN PRINT:RETURN
3545 PRINT" Broken weapon hurts user!"
3550 IF FR=100 THEN 3560
3555 D=MD(OF,11):S=MD(OF,12):DF=OF:A=1:GOTO 3650
3560 D=MD(OF,11)*2:S=MD(OF,12):DF=OF:A=0:GOTO 3650
3600 INC=INT(100*RND(1)+1)>MD(OF,10):MD(OF,10)=MD(OF,10)+2*(-INC)
3605 D=MD(OF,11):S=MD(OF,12):A=1:IF RL>5 THEN PRINT"a hit!":GOTO 3650
3610 PRINT"a critical hit!":R2=INT(100*RND(1)+1):IF R2<51 THEN A=0:GOTO 3650
3615 IF R2<86 THEN S=1.5*S:GOTO 3650
3620 IF R2<96 THEN D=2*D:GOTO 3650
3625 IF R2<100 THEN D=3*D:GOTO 3650
3630 GOTO 3700
3650 D2=0:FOR D3=1 TO D:D2=D2+INT(S*RND(1)+1):NEXT D3:D2=D2-A*MD(DF,8):IF D2<1 THEN PRINT" blow bounces off armour":PRINT:RETURN
3655 MD(DF,13)=MD(DF,13)+D2:IF MD(DF,13)>=MD(DF,1) THEN 3700
3660 A=MD(DF,14):FD(A)=FD(A)+D2
3665 ON INT(MD(DF,13)*5/MD(DF,1)+1) GOTO 3670,3675,3680,3685,3690
3670 PRINT:PRINT MN$(DF);" takes damage but is still in good shape.":RETURN
3675 PRINT:PRINT MN$(DF);" is hurting.":RETURN
3680 PRINT:PRINT MN$(DF);" is in pain.":RETURN
3685 PRINT:PRINT MN$(DF);" is very badly injured.":RETURN
3690 PRINT:PRINT MN$(DF);"is at death's door, knocking loudly.":RETURN
3700 PRINT MN$(DF);" is dead!":PRINT:A=MD(DF,14):FD(A)=FD(A)+MD(DF,1)-MD(DF,13)+D2:MD(DF,5)=0:A2=NA-1-NM+DF:AD(A2,4)=ROOM:IF MD(DF,9)>0 THEN AD(MD(DF,9),4)=ROOM
3710 IF FD(0)>TD(0) THEN NBTL=0
3720 IF DF=0 THEN DIE=-1:GOTO 23010
3730 IF MN$(DF)="PIRATE" THEN GET#3,27:PRINT FND$(R3$):PRINT:AD(11,8)=6:V(ROOM)=0:RETURN
3740 IF MN$(DF)="MIMIC" THEN PRINT:PRINT"As the mimic dies, it rolls over and you find a ring underneath it.":AD(7,4)=ROOM
3750 PRINT:RETURN
3760 REM
4000 REM /// look command
4010 IF NBTL THEN 2020
4020 IF S$="LABEL" OR S$="BOTTLE" THEN 15000
4030 LK=0
4040 FOR A=1 TO NA-1:IF AN$(A)=S$ AND (AD(A,4)=ROOM OR AD(A,4)=-1) THEN GET#3,A:PRINT FND$(R3$):LK=-1
4050 NEXT A:IF LK THEN 300
4060 IF ROOM<>15 THEN V(ROOM)=0:GOTO 300
4070 PRINT"You found a hidden tunnel going off to the east!":PRINT:GOTO 300
4080 REM
5000 REM /// movement command
5010 IF NBTL THEN 2020
5020 FOR D=1 TO 6:IF LEFT$(V$,1)<>MID$("NSEWUD",D,1) THEN NEXT
5030 R2=MAP(ROOM,D)
5040 IF R2<>0 THEN 5100
5050 IF ROOM=1 AND D=1 THEN PRINT:PRINT"You successfully ride off into the sunset.":GOTO 23010
5060 PRINT:PRINT"You can't go that way!":V(ROOM)=0:GOTO 100
5100 R3=ROOM:ROOM=R2:TD(0)=0:TD(1)=MD(0,1):FD(0)=0:FD(1)=MD(0,13)
5110 FOR M=1 TO NM:IF MD(M,5)=R3 THEN IF MD(M,14)<>0 OR 200*RND(1)<MD(M,4) THEN MD(M,5)=ROOM:GOTO 5150
5120 IF MD(M,5)<>ROOM THEN 5160
5130 FR=MD(M,3):IF FR<>0 AND FR<>100 THEN FR=FR+INT((CH-10)/2)
5140 MD(M,14)=ABS(FR>100*RDN(1)):IF MD(M,14)=0 THEN NBTL=1
5150 A=MD(M,14):FD(A)=FD(A)+MD(M,13):TD(A)=TD(A)+MD(M,1)
5160 NEXT M:NBTL=(TD(0)>0)
5170 GOTO 100
6000 REM /// power spell
6010 S=4:GOSUB 7500:IF NOT SUC THEN 300
6020 RAISE=0:FOR M=1 TO NM:M2=13+M:IF AD(M2,4)=ROOM OR AD(M2,4)=-1 THEN RAISE=-1:PRINT MN$(M);" come alive!":AD(M2,4)=0:MD(M,5)=ROOM:MD(M,13)=0:IF MD(M,9)>0 THEN AD(MD(M,9),4)=0:IF MD(M,9)=MD(0,9) THEN MD(0,9)=0
6030 NEXT M:IF RAISE THEN NBTL=0:R2=ROOM:GOTO 5100
6040 FOR A=1 TO NA:IF AD(A,4)=ROOM THEN RAISE=-1:PRINT AN(A);" vanishes!":AD(A,4)=0
6050 NEXT A:IF RAISE THEN PRINT:GOTO 300
6060 RR=INT(100*RND(1)+1):IF RR<11 THEN PRINT:PRINT"The section of tunnel you are in collapses and you die.":DIE=1:GOTO 23010
6070 IF RR<31 THEN PNT:PRINT"You are teleported somewhere in the dungeon":PRINT:R2=INT(26*RND(1)+1):NBTL=0:GOTO 5100
6080 IF RR<86 THEN PRINT:PRINT"You hear a very loud sonic boom that echoes through the tunnels.":PRINT:GOTO 300
6090 IF RR>95 THEN PRINT:PRINT"All of your hits are healed.":PRINT:MD(0,13)=0:GOTO 300
6100 GOTO 10020
7000 REM /// heal spell
7010 S=2:GOSUB 7500:IF NOT SUC THEN 300
7020 PRINT:IF MD(0,13)<>0 THEN PRINT"Some of your wounds seem to clear up.":PRINT
7030 MD(0,13)=MD(0,13)-INT(10*RND(1)+1):IF MD(0,13)<0 THEN MD(0,13)=0
7040 IF MD(0,13)=0 THEN H2=100 ELSE H2=HD/MD(0,13)
7050 IF H2>95 THEN PRINT"You feel great!.":PRINT :GOTO 7100
7060 IF H2>66 THEN PRINT"You feel better.":PRINT:GOTO 7100
7070 IF H2>33 THEN PRINT"Though you feel better, you are still very,very sick!":PRINT :GOTO 7100
7080 PRINT"Though you feel better, you are still at death's door knocking loudly!":PRINT:GOTO 7100
7090 REM
7100 GOTO 300
7495 REM
7496 REM try out success on spell
7497 REM
7500 SUC=0:IF SA(S)<>0 THEN RL=INT(100*RND(1)+1):SUC=(((RL<=S2(S)) OR (RL<5)) AND (RL<95))
7510 IF NOT SUC THEN PRINT:PRINT"Nothing happened.":RETURN
7520 RL=INT(100*RND(1)+1):IF RL>S2(S) THEN S2(S)=S2(S)+2:SA(S)=SA(S)+2
7530 S2(S)=S2(S)/2
7540 RETURN
8000 REM /// blast spell (alright!!!)
8010 GOSUB 1950
8020 FOR M=1 TO NM:IF S$<>MN$(M) OR MD(M,5)<>ROOM THEN NEXT M:PRINT:PRINT"You can't blast ";S$;"!":PRINT:GOTO 300
8030 S=1:GOSUB 7500:IF NOT SUC THEN 300
8040 PRINT:PRINT"Direct hit!":PRINT:S=5:D=1:DF=M:MD(M,14)=0:GOSUB 3650:PRINT:GOTO 300
10000 REM /// speed spell
10010 S=3:GOSUB 7500:IF NOT SUC THEN 300
10020 IF SPD=0 THEN MD(0,10)=MD(0,10)+2*MD(0,2):MD(0,2)=2*MD(0,2)
10030 SPD=INT(25*RND(1)+1:PRINT:PRINT"You can feel the new agility flowing through you!":PRINT:GOTO 300
11000 REM /// smile command
11010 PRINT:IF NBTL THEN PRINT"As you smile, the enemy attacks you.":PRINT:GOTO 300
11020 PRINT"Nothing happens.":PRINT:GOTO 300
12000 REM /// wave command
12010 PRINT:IF NBTL THEN PRINT"As you wave, the enemy attacks you.":PRINT:GOTO 300
12020 PRINT"Nothing happens.":PRINT:GOTO 300
13000 REM /// say command
13010 GOSUB 1950
13020 IF S$="TROLLSFIRE" THEN 20000
13030 IF S$="POWER" THEN 6000
13040 IF S$="HEAL" THEN 7000
13050 IF S$="BLAST" THEN 8000
13060 IF S$="SPEED" THEN 10000
13070 PRINT:PRINT"Okay, '";S$;"'":PRINT:GOTO 300
14000 REM /// drink command
14010 GOSUB 1950
14020 IF NBTL THEN 2020
14030 IF RIGHT$(S$,6)<>"POTION" AND RIGHT$(S$,6)<>"BOTTLE" THEN 14500
14040 IF AD(4,4)<>-1 AND AD(4,4)<>ROOM THEN 14500
14050 PRINT:IF MD(0,13) THEN PRINT"Some of your wounds seem to clear up.":PRINT
14060 MD(0,13)=MD(0,13)-INT(10*RND(1)+1):IF MD(0,13)<0 THEN MD(0,13)=0
14070 IF MD(0,13)=0 THEN H2=100 ELSE H2=HD/MD(0,13)
14080 IF H2>95 THEN PRINT"You feel great!.":PRINT :GOTO 14110
14090 IF H2>66 THEN PRINT"You feel better.":PRINT:GOTO 14110
14100 IF H2>33 THEN PRINT"Though you feel better, you are still very,very sick!":PRINT:GOTO 14110
14105 PRINT"Though you feel better, you are still at deaths door knocking loudly."
14110 AD(4,4)=0:AD(14,4)=-1
14130 GOTO 300
14500 IF S$<>"WATER" OR RIGHT$(S$,3)<>"SEA" THEN PRINT:PRINT"A job similiar to getting blood from a turnip.":PRINT:GOTO 300
14510 PRINT:PRINT"The water tasted salty, but it doesn't seem to be poisonous.":PRINT:GOTO 300
14520 REM
15000 REM ///read command
15010 GOSUB 1950
15020 IF NBTL THEN 2020
15030 IF S$="LABEL" OR S$="BOTTLE" THEN IF AD(4,4)=ROOM OR AD(14,4)=ROOM OR AD(4,4)=-1 OR AD(14,4)=-1 THEN PRINT"The bottle says, 'HEALING POTION'":PRINT:GOTO 300
15035 IF S$="SIGN" AND ROOM=1 THEN PRINT"It says:  'Don't forget, Eamon Dungeon Designer diskette will let you make your own dungeons.  Order yours today!'":GOTO 100
15045 IF S$="TROLLSFIRE" AND (AD(11,4)=ROOM OR AD(11,4)=-1) THEN PRINT"Among the scroll work is the word 'TROLLSFIRE":PRINT:GOTO 300
15050 IF S$<>"BOOK" THEN PRINT:PRINT"There are no markings to read!":PRINT:GOTO 300
15060 IF AD(10,4)<>-1 AND AD(10,4)<>ROOM THEN PRINT"What book?":PRINT:GOTO 300
15070 PRINT"As you read the book, you feel a weird sensation overtaking you."
15071 PRINT"You suddenly realize that you are turning into a small fish.":PRINT
15080 IF ROOM=26 THEN PRINT"You fall into the sea and are promptly eaten by a big fish.":PRINT
15090 IF ROOM<26 THEN PRINT"You flop three times and die.":PRINT
15100 DIE=-1:GOTO 23010
15110 REM
16000 REM ///ready a weapon
16010 GOSUB 1950
16020 FOR A=1 TO NA:IF AN$(A)<>S$ OR AD(A,4)<>-1 THEN NEXT A:PRINT:PRINT"You aren't carrying it!":PRINT:GOTO 100
16030 IF AD(A,2)<2 THEN PRINT:PRINT"That isn't a weapon!":PRINT:GOTO 100
16040 MD(0,10)=(EA+AE)*ABS(-EA>AE)+AD(A,4)+WA(AD(A,6))+2*MD(0,2):MD(0,9)=A:MD(0,11)=AD(A,7):MD(0,12)=AD(A,8)
16050 IF S$<>"TROLLSFIRE" THEN PRINT" readied.":PRINT:GOTO 300
16060 TR=0:MD(0,12)=10:GOTO 20000
16070 REM
17000 REM ///flee command
17010 IF NOT NBTL THEN PRINT:PRINT"What are you fleeing from?":PRINT:GOTO 100
17020 IF MD(7,5)=ROOM THEN PRINT:PRINT"You are held fast by the Mimic and connot ";V$:PRINT:GOTO 300
17030 M=0:GOSUB 17500
17040 NBTL=0:GOTO 5100
17500 ' map is in memory now
17510 R2=MAP(ROOM,INT(6*RND(1)+1)):IF R2<1 THEN 17510
17520 RETURN
18000 REM /// inventory command
18005 PRINT:PRINT"You are carrying the following --":FOR A=1 TO NA:IF AD(A,4)=-1 THEN PRINT"  ";AN$(A)
18010 NEXT A:GOTO 300
19000 REM /// enter command
19005 IF NBTL THEN 2020
19010 GOSUB 1950
19020 IF S$<>"WATER" AND S$<>"SEA" THEN 19040
19030 PRINT:PRINT"Sorry, but I'm afraid to go into the water without my life preserver!":PRINT:GOTO 300
19040 IF S$="CAVE" AND ROOM=1 THEN V$="S":GOTO 5000
19050 PRINT:PRINT"I'm not sure what you mean by that.":PRINT"Try giving a direction to move.":PRINT:GOTO 100
19060 REM
20000 REM /// trollsfire activation
20010 IF AD(11,4)<>-1 THEN PRINT:PRINT"Nothing happens.":PRINT:GOTO 300
20020 IF NOT TR THEN 20500
20030 GET#3,30:PRINT FND$(R3$):TR=0:AD(11,8)=6:IF MD(0,9)=10 THEN MD(0,12)=6
20040 GOTO 300
20500 GET#3,28:PRINT FND$(R3$):IF MD(0,9)<>11 THEN GET#3,29:PRINT FND$(R3$):S=5:D=1:DF=0:A=0:GOSUB 3650:GOTO 300
20510 TR=-1:MD(0,12)=10:SD(10,8)=10:GOTO 300
21000 REM ///open command
21010 IF NBTL THEN 2020
21020 IF S$<>"CHEST" OR ROOM<>AD(13,4) THEN 21050
21030 GET#3,25:PRINT FND$(R3$):PRINT:AD(13,4)=0:MD(7,5)=ROOM
21040 R2=ROOM:GOTO 5100
21050 IF S$="DOOR" THEN PRINT:PRINT"The door will open when you move through it.":PRINT:GOTO 100
21060 PRINT:PRINT"Would you have any bloody ideas how?":GOTO 100
22000 REM /// initialize the program!!!
22010 OPEN "I",#1,"EAMON.ART"
22011 INPUT#1,NA
22012 DIM AN$(NA+1),AD(NA+1,8)
22013 FOR A=1 TO NA:INPUT#1,AN$(A)
22014 FOR A2=1 TO 4:INPUT#1,AD(A,A2)
22015 NEXT A2:IF AD(A,2)>1 THEN FOR A2=5 TO 8:INPUT#1,AD(A,A2):NEXT A2
22016 NEXT A:CLOSE#1
22017 REM
22020 OPEN"I",#1,"EAMON.MON"
22021 INPUT#1,NM:DIM MN$(NM),MD(NM,15)
22022 FOR A=1 TO NM:INPUT#1,MN$(A)
22023 FOR A2=1 TO 12:INPUT#1,MD(A,A2)
22024 NEXT A2:NEXT A
22025 CLOSE#1
22028 ON ERROR GOTO 24000
22029 A$="FRESHMEA.T"
22030 OPEN "I",#1,A$
22031 A$="":INPUT#1,REC
22035 LINE INPUT#1,B$:GOSUB 30000
22036 CLOSE#1
22037 MN$(0)=CNAME$:MD(0,1)=HD:MD(0,2)=AG
22039 REM
22040 OPEN "R",#1,"EAMON.ROM",64
22041 FIELD 1,64 AS R5$
22045 GET#1,1:NR=VAL(R5$)
22050 DIM MAP(NR,6)
22051 FOR ROOM=1 TO NR
22052 GOSUB 25000
22053 NEXT ROOM
22054 CLOSE#1
22059 REM
22060 OPEN"R",#2,"ROOM.NAM",32
22061 FIELD 2,32 AS R2$
22062 OPEN"R",#1,"EAMON.DES",255
22063 FIELD 1,255 AS R1$
22064 OPEN"R",#3,"EAMON.EFF",255
22065 FIELD 3,255 AS R3$
22070 CLS:PRINT"You have no trouble finding a horse that you, well, borrowed to take you"
22071 PRINT"on your first adventure.  You follow several signs to take you to"
22072 PRINT"the beginners cave.":PRINT
22073 GET#2,1:PRINT:PRINT R1$:PRINT
22080 PRINT"As you stand there, you see the local Knight Marshal come out to"
22081 PRINT"inspect you before you may enter the Beginners Cave.":PRINT
22090 IF WN$(1)="NONE" THEN PRINT"He shakes his head and says, 'You must have at least one weapon to adventure":PRINT"here!  Go back to the Main Hall.'":GOTO 23010
22100 IF AE<>0 OR WA(1)<>5 OR WA(3)<>20 OR WA(5)<>0 THEN PRINT"He shakes his head and says, 'You are not a beginner! You cannot adventure":PRINT"here!  Go back to the Main Hall.'":GOTO 23010
22110 IF WN$(2)="NONE" THEN W2=1:GOTO 22160
22120 PRINT"He tells you, 'You may only take one weapon into the cave. Which shall":PRINT"it be?'"
22121 PRINT:FOR W=1 TO 4:IF WN$(W)<>"NONE" THEN PRINT W;"   ";WN$(W):NEXT W
22130 PRINT:PRINT"(Hit 1 -";W;")   ";
22140 A$=INKEY$:IF A$="" THEN 22140 ELSE W2=VAL(A$):IF W2<1 OR W2>W-1 THEN 22140
22150 PRINT A$:PRINT
22160 NA=NA+1:AN$(NA)=WN$(W2):AD(NA,2)=2:AD(NA,3)=2:AD(NA,4)=-1:AD(NA,5)=WO(W2):AD(NA,6)=WT(W2):AD(NA,7)=WD(W2):AD(NA,8)=WS(W2)
22170 EA=0:MD(0,8)=0:A2=INT(AC/2):IF A2*2<>AC THEN MD(0,8)=1:EA=-5
22180 IF A2<>0 THEN MD(0,8)=MD(0,8)+A2:EA=EA-A2*10:IF A2=3 THEN MD(0,8)=MD(0,8)+2:EA=EA-30
22190 MD(0,10)=(EA+AE)*ABS(-EA>AE)+WO(W2)+WA(WT(W2))+2*MD(0,2):MD(0,7)=0:MD(0,9)=NA:MD(0,11)=WD(W2):MD(0,12)=WS(W2)
22200 TP=TP+AD(A,1)
22210 READ NC:DIM C$(NC):FOR C=1 TO NC:READ C$(C):NEXT C
22220 FOR S=1 TO 4:S2(S)=SA(S):NEXT S
22230 DIM V(26):ROOM=1
22235 FOR A=1 TO NA-1:IF AN$(NA)=AN$(A) THEN AN$(A)=AN$(A)+"#":GOTO 22235
22236 NEXT A
22240 PRINT:PRINT"Eventually the Knight Marshal says, 'You may now proceed'"
22241 PRINT"and he walkes away.":PRINT:PRINT"(Hit any key to continue)  ";
22242 A$=INKEY$:IF A$="" THEN 22242
22243 PRINT:PRINT:GOTO 100
22250 DATA 36
22260 DATA GET,PICK,DROP,ATTACK,LOOK,EXAMINE,UP,U,DOWN,D,NORTH,N,EAST,E,WEST,W,SOUTH,S,POWER,HEAL,BLAST,SPEED,SMILE,WAVE,SAY,DRINK,READ,READY,ESCAPE,RETREAT,FLEE,INVENTORY,I,ENTER,TROLLSFIRE,OPEN
22270 END
23000 REM /// END GAME
23010 PRINT:PRINT"(Hit any key to continue)  ";
23011 A$=INKEY$:IF A$="" THEN 23011 ELSE PRINT
23020 CLOSE#1:CLOSE#2:CLOSE#3
23030 AD(10,8)=10
23040 IF SPD THEN MD(0,2)=MD(0,2)/2
23050 IF DIE THEN 23240
23060 FOR W=2 TO 4:IF WN$(W)<>"NONE" THEN NEXT W
23070 W2=W:FOR W3=1 TO NA-1:IF AD(W3,2)>1 AND AD(W3,4)=-1 THEN WN$(W2)=AN$(W3):WP(W2)=W3:W2=W2+1:AD(W3,4)=0
23080 NEXT W3:IF W2<6 THEN 23160
23090 CLS:PRINT:PRINT:PRINT:PRINT:PRINT"As you try to leave, the Knight Marshall reappears and":PRINT"tells you, 'You have too many weapons-- 4 is the leagal limit.'":PRINT:PRINT"Your weapons are---"
23100 FOR W4=1 TO W2-1:PRINT"    ";W4;"--";WN$(W4):NEXT W4:PRINT:PRINT"Hit the number key for one to throw away. ( 1 -";W2-1;")  ";
23110 A$=INKEY$:IF A$="" THEN 23110 ELSE W5=VAL(A$):IF W5<1 OR W5>W2-1 THEN 23110
23120 IF WP(W5)<>0 THEN AD(WP(W5),4)=-1
23130 WN$(W5)=WN$(W2-1):WP(W5)=WP(W2-1):W2=W2-1:IF W2>5 THEN 23090
23140 FOR W4=2 TO W2-1:FOR W5=1 TO W4-1:IF WN$(W4)=WN$(W5) THEN WN$(W4)=WN$(W4)+"#":GOTO 23140
23150 NEXT W5:NEXT W4
23160 FOR W=1 TO 4:IF WP(W)<>0 THEN WT(W)=AD(WP(W),6):WO(W)=AD(WP(W),5):WD(W)=AD(WP(W),7):WS(W)=AD(WP(W),8)
23170 NEXT W:CLS:PRINT:PRINT:PRINT:PRINT:PRINT"As you deliver your treasures to Sam Slicker, the local buyer of such things,":PRINT"he examines your goods and pays you ";
23180 TP=0:FOR A=1 TO NA-1:IF AD(A,4)<>-1 THEN 23210
23190 IF AD(A,2)<>0 THEN AD(A,1)=AD(A,1)*CH/10
23200 TP=INT(TP+AD(A,1))
23210 NEXT A:PRINT TP;"gold pieces.":PRINT:IF MD(9,5)=1 THEN PRINT:PRINT"Additionaly, you receive ";10*CH;" gold pieces as reward for the":PRINT"safe return of Cynthia.":TP=TP+10*CH
23220 GOLD=GOLD+TP
23230 PRINT:PRINT:PRINT"(Hit any key to continue)  ";
23231 A$=INKEY$:IF A$="" THEN 23231 ELSE PRINT
23240 REM KILL"FRESHMEAT"
23241 A$=INKEY$:PRINT:CLS:PRINT:PRINT:PRINT:PRINT:PRINT"(Insert EAMON MASTER diskette, then hit any key";:IF DIE THEN PRINT")  "; ELSE PRINT " to goto Main Hall)  ";
23242 A$=INKEY$:IF A$="" THEN 23242
23250 ON ERROR GOTO 24000
23251 IF DIE THEN KILL"ADVENTUR.ER":END
23260 OPEN"R",#1,"CHARACTE.RS",255
23261 GOSUB 30600
23262 FIELD 1,255 AS R1$
23263 LSET R1$=A$
23264 PUT#1,REC+1
23270 CLOSE#1
23290 OPEN "O",#1,"ADVENTUR.ER"
23291 PRINT#1,MN$(0):PRINT#1,REC
23292 CLOSE#1
23300 RUN"MAINHALL"
23310 STOP
24000 IF ERR=53 THEN 24100
24005 PRINT "Error #";ERR
24010 PRINT "At line";ERL
24020 PRINT:PRINT"Hit any key to continue"
24030 A$=INKEY$:IF A$="" THEN 24030
24040 RESUME NEXT
24050 STOP
24100 CLS
24110 IF A$<>"FRESHMEAT" THEN 24005
24120 CLS
24130 PRINT"You must enter this program through the EAMON program and main hall."
24140 PRINT:PRINT:STOP
25000 REM /// get room move info
25010 GET#1,ROOM+1
25020 R$=R5$
25030 FOR I=1 TO 6
25040 ML=INSTR(R$,",")
25045 IF ML=0 THEN MAP(ROOM,I)=VAL(R$):R$="":GOTO 25070
25050 MAP(ROOM,I)=VAL(LEFT$(R$,ML-1))
25060 R$=MID$(R$,ML+1)
25070 NEXT I
25080 RETURN
28000 T1=VAL(S$)
28010 IF T1>NR OR T1<1 THEN 300
28020 R2=T1:GOTO 5100
30000 REM
30010 REM  break up record into its needed parts
30020 REM  and damned be he the first to screw up this ordered set!!!
30030 REM
30031 REM HINT: a string of 37 commas will clear all fields!
30040 REM
30050 R$=B$
30060 W=1:X=1:Y=1:IF LEN(R$)=0 THEN R$=",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
30070 FOR I=1 TO 38
30075 A1$=""
30080 IF R$="" THEN 30555
30090 J=INSTR(R$,",")
30095 IF J<>0 THEN A1$=LEFT$(R$,J-1):R$=MID$(R$,J+1) ELSE IF R$<>"" THEN A1$=R$:R$=""
30100 REM
30110 REM
30120 ON I    GOTO 30170,30180,30190,30200,30210,30210,30210,30210,30250,30250
30130 ON I-10 GOTO 30250,30250,30250,30300,30310,30320,30330,30340,30350,30360
30140 ON I-20 GOTO 30370,30380,30390,30350,30360,30370,30380,30390,30350,30360
30150 ON I-30 GOTO 30370,30380,30390,30350,30360,30370,30380,30390
30160 STOP
30170 CNAME$=A1$:GOTO 30550
30180 HD=VAL(A1$):GOTO 30550
30190 AG=VAL(A1$):GOTO 30550
30200 CH=VAL(A1$):GOTO 30550
30210 SA(X)=VAL(A1$):X=X+1:GOTO 30550
30250 WA(Y)=VAL(A1$):Y=Y+1:GOTO 30550
30300 AE=VAL(A1$):GOTO 30550
30310 SEX$=A1$:GOTO 30550
30320 GOLD=VAL(A1$):GOTO 30550
30330 BANK=VAL(A1$):GOTO 30550
30340 AC=VAL(A1$):GOTO 30550
30350 WN$(W)=A1$:GOTO 30550
30360 WT(W)=VAL(A1$):GOTO 30550
30370 WO(W)=VAL(A1$):GOTO 30550
30380 WD(W)=VAL(A1$):GOTO 30550
30390 WS(W)=VAL(A1$):W=W+1:GOTO 30550
30550 REM
30555 NEXT I
30560 RETURN
30570 REM
30580 REM   pack the array with commas
30590 REM
30600 A$=CNAME$+","+STR$(HD)+","+STR$(AG)+","+STR$(CH)+","
30610 FOR I=1 TO 4:A$=A$+STR$(SA(I))+",":NEXT I
30620 FOR I=1 TO 5:A$=A$+STR$(WA(I))+",":NEXT I
30630 A$=A$+STR$(AE)+","+SEX$+","+STR$(GOLD)+","+STR$(BANK)+","+STR$(AC)
30640 FOR I=1 TO 4:A$=A$+","+WN$(I)+","
30650 A$=A$+STR$(WT(I))+","+STR$(WO(I))+","
30660 A$=A$+STR$(WD(I))+","+STR$(WS(I))
30670 NEXT I
30680 RETURN
31000 REM turn to upper case
31005 A2$=""
31010 FOR I=1 TO LEN(A$)
31020 A1$=MID$(A$,I,1)
31030 IF A1$<"a" OR A1$>"z" THEN 31047
31040 A2$=A2$+CHR$(ASC(A1$)-32)
31045 GOTO 31050
31047 A2$=A2$+A1$
31050 NEXT I
31055 A$=A2$
31060 RETURN
