10 '  DND.BAS BY BOB THOMAS
20 REM  ==> THIS LINE MODIFIED FROM: RANDOMIZE (RND(1)*100)
30 REM  ==> Use CLOCK from Xerox 820-II to Seed RANDOMIZE
40 RANDOMIZE ((PEEK(&HFF59+1)*100)+PEEK(&HFF59 +2))
50 E$=CHR$(26):X=RND(PEEK(8216)):PRINT E$
60 PRINT CHR$(5)+CHR$(32)
70 DEFDBL E,G:DEF FNP$(I,J)=CHR$(27)+"="+CHR$(32+I)+CHR$(32+J)
80 FOR I=0 TO 4:S1$=S1$+SPACE$(49)+CHR$(13):NEXT
90 DEFINT V,F
91 DIM FX(10),FY(10),FZ(10),M$(20),MA$(20),W$(6),W(20),C1(3),CK(3), CB(3)
100 DEF FND(J)=INT((J*RND(J))+1):DEF FNUP(H)=H AND 3:DEF FNLF(H)=INT(H/4)AND 3
110 DEF FNR(H)=INT(RND(1)*H+1):DEF FNS(H)=INT(H/256)
120 OPEN "I",1,"DND.DAT":INPUT #1,S$,MO$,T$,Z$,PP$
130 DEF FNDS(I)=SQR((CX-FX(I))^2+(CY-FY(I))^2+(CZ-FZ(I))^2)
140 R$=CHR$(27)+"7"+CHR$(27)+")"
150 O$=CHR$(27)+"("
160 ESD$=CHR$(8):ESB$=CHR$(10)
170 MN$=CHR$(31)+CHR$(21)
180 V$=CHR$(31)+CHR$(124)
190 VH$=CHR$(31)+CHR$(25)
200 LN$=CHR$(31)+CHR$(19)
210 ES$=CHR$(27)
220 B$=CHR$(10)
230 L$=CHR$(27)+"E"
240 DIM P(3,3),ST(5),SF(10),I(20),S$(36),FM(10),FL(10),FH(10)
260 FOR I=1 TO 13:INPUT#1,M$(I),MA$(I):NEXT
270 FOR I=1 TO 36:INPUT#1,S$(I):NEXT:FOR I=1 TO 15:INPUT #1,CR$:NEXT
280 FOR I=1 TO 6: INPUT #1,W$(I):NEXT:FOR I=1 TO 19:INPUT #1,W(I):NEXT:CLOSE
290 PRINT FNP$(9,2);"Welcome to the "FNP$(11,7);R$;"Xerox Dungeon";O$
300 GOSUB 4560:PRINT:LINE INPUT "Character Name? ";NM$:ON ERROR GOTO 470
310 OPEN "I",1,NM$:FOR I=0 TO 5:INPUT #1,ST(I):NEXT
320 INPUT #1,LV,GD,TG,EX,CH,HP,CX,CY,CZ,SU,CS,CN$
330 FOR I=1 TO 10:INPUT #1,SF(I):NEXT:FOR I=1 TO 13:INPUT #1,I(I):NEXT
340 FOR I=1 TO 10:INPUT #1,FM(I),FL(I),FH(I),FX(I),FY(I),FZ(I):NEXT
350 FOR I=1 TO 3:INPUT #1,CB(I),CK(I):NEXT:INPUT #1,DX,DY,DZ
360 INPUT #1,XO,YO,ZO,W0:INPUT #1,WORD$:CLOSE #1
370 D$="  "+ESD$+ESD$+ESB$:FOR I=0 TO 5:DD$=DD$+D$:NEXT
380 D$=" "+V$+ESD$+ESD$+ESB$:V$="":FOR I=0 TO 1:V$=V$+D$:NEXT
390 IF I(6)=0 THEN I(6)=FND(HP*.05)
400 IF CZ=0 THEN CZ=1
410 IF DX>20 THEN DX=DX-20:GOTO 410
420 IF DY>20 THEN DY=DY-20:GOTO 420
430 IF CX>20 THEN CX=CX-20:GOTO 430
440 IF CY>20 THEN CY=CY-20:GOTO 440
441 GOTO 450
442 PRINT E$;FNP$(5,5);NM$;" THE ";CN$FNP$(8,10);"IS NOW RE-ENTERING THE DUNGEON....":GOSUB 4560:GOTO 460
450 PRINT E$;FNP$(5,5);NM$;" THE ";CN$;FNP$(8,10);"IS NOW ENTERING THE DUNGEON....":GOSUB 4560
460 SY=1:ON ERROR GOTO 0:PRINT FNP$(11,15);"THE DUNGEON DOOR SLAMS.":GOSUB 4690:GOTO 520
470 PRINT NM$;" IS NOT IN THE DUNGEON!":GOSUB 4560:CLOSE:RESUME 300
480 X=FND(20):Y=FND(20):Z=1:GOSUB 3660:I=FNS(H)
490 IF I>9 THEN I=I-9:GOTO 490
500 IF I<>1 THEN 480
510 CX=X:CY=Y:CZ=1:RETURN
520 FOR I=1 TO 10:SF(I)=SF(I)-1:NEXT
530 L=CZ:IF SY=1 THEN DN=0:UP=0:GOSUB 3790
540 SY=1:CH=CH+I(6):IF CH>HP THEN CH=HP
550 GOSUB 4810:GOSUB 6570:IF M<>0 THEN PRINT FNP$(7,22);"#  ":GOTO 590
560 IF RND(1)>.3 THEN 1460
570 IF SF(6)>0 AND FND(M+1)<FND(LV+1) THEN 1460
580 PRINT FNP$(7,22);"#  ":M=FND(20)
590 ML=FND(CZ*2)+FND(LV/CZ)-1:GOSUB 4880
600 IF FND(2*ML)<FND(2*I(4)+1) THEN 4910
610 IF M=0 OR ML=0 THEN 550 ELSE GOSUB 4400:M$=MID$(MO$,M*8-7,8):PRINT "YOU HAVE ENCOUNTERED A LEVEL";ML;M$
620 GOSUB 4430:IF SF(9)>0 AND FND(M+1)<FND(LV+1) THEN GOSUB 4400:GOTO 1450
630 IF SF(7)>0 AND FND(ML+1)<FND(LV+1) THEN PRINT "IT RUNS IN FEAR!":GOSUB 4430:PRINT FNP$(7,22);"  ":GOTO 1450
640 PRINT FNP$(17,20);R$;"LEVEL";STR$(ML);" ";M$;O$:GOSUB 4400
650 MH=ML*M*FND(2):L=ML:XXX=MH:XXX1=XXX:IF M<>9 THEN 700
660 IF FND(10*ML)>FND(LV*ST(5)) OR CH=HP THEN 700
670 PRINT "THE ELF LIKES YOUR BODY":PRINT "HE HEALS YOU TO FULL STRENGTH":CH=HP
680 M=0:GOSUB 4560:GOSUB 4810:PRINT FNP$(7,22);" "
690 PRINT FNP$(17,20);SPACE$(35):GOTO 1460
700 IF FND(ML*M+2)=>FND(LV*ST(4)+I(5)) THEN GOSUB 4400:GOTO 890
710 PRINT FNP$(18,0);R$;"F";O$;"IGHT, ";R$;"C";O$;"AST OR ";R$;"E";O$;"VADE: ";FNP$(18,0);S1$;S1$;S1$;
711 PRINT R$;" ";M$;"  ";XXX;"/";XXX1;" SP ";O$;" => ";
720 GOSUB 4340
730 FOR I%=1 TO 4:IF MID$("FCE.",I%,1)=C$ THEN 750
740 NEXT:PRINT FNP$(19,0);"THE ";M$;" IS NOT AMUSED":GOSUB 4430
750 ON I% GOTO 760,1220,1350,1220,890
760 PRINT "FIGHT":IF FND(ML*M/2+2)<FND(LV*ST(4)+I(7)) THEN 780
770 PRINT "YOU MISSED...":GOTO 890
780 DB=1:IF SF(1)>0 THEN DB=2
790 I=FND(LV*ST(4)/2+I(1)*DB)+FND(DB*(LV*ST(0)/2+I(1)))
800 PRINT "YOU DO ";I;"POINTS DAMAGE "
805 XXX=XXX-I
810 MH=MH-I:IF MH>0 THEN 890
820 IF M<>20 OR FND(ML)<FND(2*LV) THEN 840
830 FOR II=1 TO 3:IF CK(II)<>0 THEN NEXT ELSE KK=FND(3):IF CK(KK)<>0 THEN 830 ELSE GOSUB 4430:PRINT "THE DIEING DRAGON WHISPERS THE COMBINATION:":GOSUB 4560:PRINT "COM: ";KK;" IS ";CB(KK):CK(KK)=CB(KK):GOSUB 4690
840 PRINT "...IT DIED.":GOSUB 4560
850 GOSUB 4430:PRINT FNP$(7,22);"  ";FNP$(17,18);SPACE$(44):E=ML*M*10:EX=EX+E
860 PRINT "YOU GAIN ";E;" EXPERIENCE POINTS":GOSUB 4810:GOSUB 4440:GOSUB 4560
870 IF UN=1 THEN 880 ELSE GOSUB 4400:IF RND(1)>.1 THEN 880 ELSE PRINT "YOU FIND A ";M$(11):I(11)=I(11)+1:GOSUB 4560:GOSUB 4690
880 GOSUB 4400:GOSUB 6750:GOTO 1450
890 IF M<>20 AND FND(ML)<FND(LV) AND UN=0 THEN 1230
900 DB=1:I=FND(M*ML):IF SF(4)>0 THEN I=I-LV
910 IF I<FND(LV*ST(4)+I(3))THEN PRINT "IT MISSED...":GOSUB 4430:GOTO 710
920 IF UN=1 THEN 960
930 IF M=20 THEN 1150
940 IF M=15 THEN 1070
950 IF RND(1)<.3 THEN 1060
960 I=FND(DB*M*ML/4+2)+FND(DB*M*ML/4+2)-1
970 IF I<2*I(2) THEN I=INT(I/2)+1 ELSE I=I-I(2)
980 PRINT "IT DOES ";I;" POINTS DAMAGE "
990 CH=CH-I:GOSUB 4810:IF CH<1 THEN 3610
1000 IF UN=0 OR RND(1)>.3 THEN 1040
1010 IF LEN(WORD$)=>5 THEN PRINT "YOU LOSE THE MAGIC WORD!!":WORD$="":GOSUB 4560:GOSUB 4790:GOTO 710
1020 IF M<11 THEN 1050
1030 PRINT "IT DRAINS A LEVEL!!":KKK=EX:KKK=KKK/2:KKK=INT(KKK):EX=EX-KKK:IF LV=1 THEN EX=-1
1040 GOSUB 4440:GOSUB 4430:GOTO 710
1050 PRINT "YOU'RE PARALYZED!!";SPC(20):GOSUB 4430:GOTO 890
1060 WM=W(M):PRINT "IT USES ITS ";W$(WM);"!":DB=2:GOTO 960
1070 IF RND(1)>.3 THEN 960
1080 PRINT "IT CASTS A SPELL!!"
1090 IF FND(ML+1)<FND(2*LV) THEN PRINT "IT DOESN'T WORK!!":GOSUB 4430:GOTO 710
1100 PRINT "YOU'VE BEEN TELEPORTED!!"
1110 CX=FND(20):CY=FND(20):CZ=CZ+FND(ML+1)+FND(ML+1)-ML-2:M=0
1120 IF CZ<1 THEN CZ=1
1130 IF CZ>50 THEN CZ=50
1140 GOTO 520
1150 IF RND(1)>.3 THEN 960
1160 PRINT "THE DRAGON BREATHES FIRE!!":GOSUB 4560
1170 I=FND(20*ML):IF I(12)>0 THEN 1180 ELSE IF FND(10*ML)<FND(LV*ST(4)+I(5)) THEN 1200 ELSE 1210
1180 I=INT(I/10+.5):I(12)=I(12)-1:PRINT "YOUR MAGIC LANCE KEEPS THE DRAGON AWAY"
1190 GOSUB 4690:GOSUB 4430:GOTO 1210
1200 PRINT "YOU PARTIALLY DODGE IT.":I=INT(I/2+.5):GOSUB 4430
1210 PRINT "YOU BURN FOR ";I;"POINTS DAMAGE.":GOSUB 4570:GOTO 990
1220 D=1:GOTO 4950
1230 PRINT "THE ";M$;" TRIES TO STEAL SOMETHING!":GOSUB 4560
1240 FOR I=1 TO 13:IF I(I)>0 THEN 1270
1250 NEXT:IF GD<>0 THEN 1270
1260 PRINT "YOU HAVE NOTHING HE WANTS TO STEAL!":GOTO 680
1270 PRINT "HE STEALS ";
1280 IF GD=0 THEN 1300
1290 IF RND(1)<.1 THEN 1340
1300 I=FND(13):IF I(I)<1 THEN 1280
1310 IF I<8 THEN PRINT "YOUR ";M$(I):I(I)=0:GOTO 1330
1320 PRINT "A ";M$(I):I(I)=I(I)-1
1330 GOSUB 4690:GOTO 680
1340 I=FND(GD):GD=GD-I:PRINT I;" GOLD!":GOTO 680
1350 PRINT "EVADE":IF FND(ML*M/8+2)<FND(LV*ST(4)+I(5)) THEN 1370
1360 PRINT "YOU'RE ROOTED TO THE SPOT!":GOSUB 4560:GOTO 890
1370 IF SF(8)>0 THEN C=FND(5):GOTO 1440
1380 ON FND(4) GOTO 1390,1400,1410,1420
1390 C=1:IF FNUP(L%)<2 THEN 1440
1400 C=2:IF FNUP(P(2,1))<2 THEN 1440
1410 C=3:IF FNLF(L%)<2 THEN 1440
1420 C=4:IF FNLF(P(1,2))<2 THEN 1440
1430 GOTO 1360
1440 GOSUB 6720:C%=C:GOTO 3200
1450 IF RND(1)>.2 THEN 1470
1460 IF RND(1)>.4 THEN 1880
1470 T=0:IF RND(1)>.85 THEN T=1
1480 PRINT FNP$(7,22);"$  ":GOSUB 4400:C=0:IF RND(1)>.5 THEN 1660
1490 GOSUB 4400:PRINT "YOU SEE SOME ";:I=FND(5)-1
1500 PRINT MID$(T$,I*6+1,6):PRINT "<RET> TO PICK UP:"
1510 IF T=1 THEN IF (SF(2)>0 AND RND(1)>.1) OR RND(1)<.02*ST(2) THEN PRINT "YOU DETECT TRAPS!"
1520 GOSUB 4340:IF C$=CHR$(13) THEN 1540
1530 PRINT "LEAVE IT.":GOSUB 4570:GOTO 1880
1540 PRINT "GRAB IT":GOSUB 4570:GOSUB 4400:IF T=0 THEN 1570
1550 Q=FND(3*L):PRINT "IT'S TRAPPED!":GOSUB 4570:PRINT "YOU SUFFER ";Q;"POINTS DAMAGE"
1560 CH=CH-Q:GOSUB 4810:IF CH<1 THEN 3610 ELSE 1870
1570 J=FND(I*CZ*50*(ML*M+1)):M=0:PRINT "IT'S WORTH ";J;"GOLD"
1580 GD=GD+J:IF I=0 AND RND(1)>.8 THEN GOSUB 4810:GOTO 1780
1590 IF I<>0 THEN 1650
1600 GOSUB 4430:PRINT "YOU SEE WRITING ON THE REFUSE!":GOSUB 4560:IF FND(CZ*10)>FND(LV*ST(1)) THEN 1640
1610 IF RND(1)>.5 THEN 1630
1620 FOR II=1 TO 3:IF CK(II)<>0 THEN NEXT ELSE KK=FND(3):IF CK(KK)<>0 THEN 1620 ELSE CK(KK)=CB(KK):PRINT "YOU COMPREHEND THE MESSAGE.":GOSUB 4560:PRINT "COMBINATION NUMBER ";KK;" IS ";CK(KK):GOTO 1650
1630 GOSUB 6790:GOTO 1650
1640 PRINT "THE WRITING IS GIBBERISH.":GOSUB 4560
1650 GOSUB 4690:GOSUB 4810:GOTO 1870
1660 M=0:IF RND(1)>.5 THEN 1780
1670 PRINT "YOU HAVE FOUND A TREASURE CHEST!"
1680 PRINT "<RET> TO OPEN IT:";SPC(20)
1690 IF T=1 THEN IF SF(2)>0 AND RND(1)>.1 THEN PRINT "YOU DETECT TRAPS";
1700 GOSUB 4340:IF C$<>CHR$(13) THEN PRINT "IGNORE IT":GOTO 1880
1710 PRINT "OPEN IT":IF T=0 THEN 1740
1720 GOSUB 4430:PRINT "CHEST EXPLODES!":I=FND(10*L):CH=CH-I
1730 PRINT "YOU SUFFER ";I;"POINTS DAMAGE":GOSUB 4810:IF CH<1 THEN 3610 ELSE 1870
1740 GOSUB 4430:I=INT((RND(1)*1000*L^2+1)*(2*T+1))
1750 IF RND(1)>.9 THEN PRINT "INSIDE--- ONLY COBWEBS...":GOSUB 4430:GOTO 1870
1760 PRINT "INSIDE ARE";I;"GOLD PIECES!":GD=GD+I:GOSUB 4810:IF RND(1)>.5 THEN 1880
1770 C=1:GOSUB 4560:GOSUB 4420
1780 I=FND(10):PRINT "YOU SEE A ";M$(I):J=FND(L+1)+FND(L+1)-1
1790 PRINT "<RET> TO PICK IT UP:":GOSUB 4340:IF C$=CHR$(13) THEN 1810
1800 PRINT "LEAVE IT":IF C=1 THEN 1860 ELSE 1880
1810 IF I<>1 OR T<>1 THEN 1850
1820 PRINT "IT'S A HOSTILE +";J;" SWORD!":GOSUB 4560:I=FND(J*5)
1830 PRINT "YOU SUFFER ";I;" POINTS DAMAGE":GOSUB 4560:CH=CH-I:GOSUB 4810
1840 IF CH<1 THEN 3610 ELSE 1870
1850 PRINT "IT'S YOURS!":I(I)=I(I)+1:IF I<8 THEN GOSUB 4430:PRINT "IT'S A +";J;M$(I):I(I)=J
1860 GOSUB 4690:IF C=1 AND RND(1)>.5 THEN GOSUB 4430:GOTO 1780
1870 PRINT FNP$(7,21);"   ":GOSUB 6570:IF M<>0 THEN PRINT FNP$(7,22);"#  ":GOTO 610
1880 M=0:PRINT FNP$(7,21);"   ":X=CX:Y=CY:Z=CZ-1:GOSUB 3660
1890 J=FNS(H):I=FNS(L%):GOSUB 4400
1900 IF I>9 THEN I=I-9:GOTO 1900
1910 IF J>9 THEN J=J-9:GOTO 1910
1920 IF CZ=1 THEN J=0
1930 IF CZ=50 AND I=4 THEN I=3
1940 IF J=4 THEN 2210
1950 IF I=0 THEN 3150
1960 ON I GOTO 2070,2100,2160,2210,2280,2400,2540,2660,2950
1970 PRINT E$:FOR I=1 TO 10:SF(I)=0:NEXT
1980 X=CX:Y=21-CY:PRINT FNP$(11,0);"YOU'VE FOUND A ROADSIDE TAVERN AT ("X","Y")."
1990 PRINT "THEY CASH YOUR GOLD":EX=EX+GD:TG=TG+GD:GD=0
2000 GOSUB 4440:GOSUB 6740:GOSUB 4400:CH=HP:CS=SU:PRINT FNP$(14,7);"YOU HAVE ";: PRINT USING "**$#################, IN THE KEG";TG
2010 PRINT FNP$(15,7);"YOU SPEND THE NIGHT":GOSUB 4690:GOSUB 4810
2020 PRINT FNP$(16,7);"YOU FEEL BETTER."
2030 PRINT FNP$(18,7);"PRESS <RET> TO RETURN TO DUNGEON, <ESC> TO STORE"
2040 C$=INPUT$(1):IF C$=CHR$(13) THEN 2060 ELSE IF C$=ES$ THEN 3400
2050 PRINT "??????":GOSUB 4430:GOTO 2030
2060 PRINT "RE-ENTER":GOSUB 4560:PRINT E$:GOSUB 4690:CZ=1:GOTO 520
2070 IF CZ=1 THEN J=4:GOTO 2210
2080 GOSUB 4400:PRINT FNP$(7,22);"ELV";FNP$(17,0);"YOU FEEL HEAVY FOR A MOMENT."
2090 CZ=CZ-1:GOTO 520
2100 IF CZ=50 THEN 2070
2110 GOSUB 4400:PRINT FNP$(7,22);"PIT";FNP$(18,0);"YOU SEE A PIT."
2120 IF SF(5)>0 THEN PRINT "YOU ARE HOVERING ABOVE A PIT":GOTO 2140
2130 IF FND(20*CZ)>FND(LV)*FND(ST(4))+FND(I(5)) THEN 2150
2140 DN=1:GOTO 3160
2150 GOSUB 4560:PRINT "YOU FALL IN!!!":L=CZ:GOSUB 4570:GOSUB 4580:CZ=CZ+1:GOTO 520
2160 GOSUB 4400:PRINT FNP$(7,22);"TPT";FNP$(17,0):IF SF(5)>0 THEN 3150
2170 PRINT "ZAP!! YOU'VE BEEN TELEPORTED...":GOSUB 6740
2180 CX=FND(20):CY=FND(20):CZ=CZ+FND(LV+1)-FND(LV+1):IF CZ<1 THEN CZ=1
2190 IF CZ>50 THEN CZ=50
2200 GOTO 520
2210 GOSUB 4400:IF J=4 THEN PRINT FNP$(7,22);"/"
2220 IF I=4 THEN PRINT FNP$(7,22);"\"
2230 GOSUB 4400:PRINT "YOU HAVE FOUND A CIRCULAR STAIRWAY,"
2240 IF J=4 THEN PRINT "GOING UP";:UP=1:IF I=4 THEN PRINT " AND ";
2250 IF I=4 THEN PRINT "GOING DOWN";:DN=1
2260 PRINT ".":IF J=4 AND CZ=1 THEN GOSUB 4560:PRINT "YOU SEE A ";R$;"LIGHT";O$;" ABOVE.";CL$:GOSUB 4560
2270 GOTO 3160
2280 GOSUB 4400:PRINT FNP$(7,22);"ALT";FNP$(18,0);"YOU FOUND A HOLY ALTER"
2290 PRINT "<RET> TO WORSHIP":GOSUB 4340:IF C$=CHR$(13) THEN 2350 ELSE IF RND(1)>.2 THEN 3170
2300 PRINT "PAGAN TRASH!!":GOSUB 4560:IF FND(10*CZ)>FND(LV*ST(2)) THEN 2330
2310 I=FND(2*CZ):CS=CS-I:IF CS<0 THEN SU=SU+CS:CS=0:IF SU<0 THEN SU=0
2320 GOSUB 4400:PRINT "YOU LOSE ";I;"SPELL UNITS.":GOSUB 4810:GOTO 3150
2330 PRINT FNP$(7,22);"#  ":M=FND(20):GOSUB 4880:IF UN=0 THEN 2330
2340 GOSUB 4430:ML=FND(4)*CZ:GOTO 610
2350 PRINT B$;"HOW MUCH GOLD";:GOSUB 4900:GOSUB 4420
2360 IF C>GD THEN PRINT "YOU DON'T HAVE THAT MUCH!":GOTO 2300
2370 GD=GD-C:IF C<30*(LV+FND(GD/1000)) THEN 2300 ELSE PRINT "THANKS FOR THE DONATION":GOSUB 4810
2380 IF RND(1)<C/(GD+C) THEN 3150
2390 I=FND(4*CZ*C/(GD+C)+1):PRINT "YOU RECEIVE ";I;" SPELL UNITS":SU=SU+I:CS=SU:GOSUB 4810:GOSUB 4400:GOTO 3150
2400 GOSUB 4400:PRINT FNP$(7,22);"FNT";FNP$(18,0);"YOU HAVE FOUND A FOUNTAIN"
2410 C=FND(9):PRINT "WITH RUNNING ";MID$("WHITEGREENCLEARRED  BLACKGREY BLUE PINK MUDDY",C*5-4,5);" WATER"
2420 PRINT "<RET> TO DRINK SOME:";:GOSUB 4340:IF C$=CHR$(13) THEN 2440
2430 GOSUB 4400:GOTO 3170
2440 GOSUB 4400:IF RND(1)>1-C*.15 THEN 2480
2450 PRINT "YOU FEEL BETTER":GOSUB 4560:I=FND(3*CZ)
2460 PRINT "YOU HEAL";I;"POINTS":CH=CH+I:IF CH>HP THEN CH=HP
2470 GOSUB 4810:GOSUB 4430:GOTO 3150
2480 IF RND(1)>.15*C THEN 2520
2490 PRINT "IT'S POISON!!":I=FND(3*CZ):PRINT "YOU LOSE";I;"POINTS"
2500 CH=CH-I:GOSUB 4810:IF CH<1 THEN 3610
2510 GOSUB 6750:GOTO 3150
2520 PRINT "A MYSTERIOUS MAGIC GRIPS YOU..."
2530 GOSUB 4430:GOSUB 4610:GOSUB 4430:GOTO 3150
2540 PRINT FNP$(7,22);"GMC";FNP$(18,0);"YOU SEE A LARGE GRAY MISTY CUBE"
2550 PRINT "<RET> TO WALK IN:":GOSUB 4340:IF CHR$(13)<>C$ THEN 3170
2560 PRINT B$;"A NUMBER FROM 1 TO 50:";:GOSUB 4900
2570 IF C<1 OR C>50 THEN PRINT "NO YOU FOOL! ";:GOSUB 4430:GOTO 2590 ELSE C=INT(C/2)
2580 CZ=FND(C)+C:IF FND(10*CZ)<FND(LV*ST(2)) THEN 2600
2590 C=FND(50)
2600 C=ABS(C-CZ)/5+2:CX=CX+FND(C)+FND(C)-C-1
2610 IF CX>20 OR CX<1 THEN CX=FND(20)
2620 CY=CY+FND(C)+FND(C)-C-1
2630 IF CY>20 OR CY<1 THEN CY=FND(20)
2640 PRINT E$;FNP$(8,6);"YOU FLOAT"
2650 PRINT TAB(15);"IN SPACE...":GOSUB 4690:GOTO 520
2660 GOSUB 4400:PRINT FNP$(7,22);"THR";FNP$(18,0);
2670 PRINT "YOU SEE A JEWEL-ENCRUSTED THRONE."
2680 PRINT "DO YOU WANT TO ";R$;"P";O$;"RY SOME JEWELS, "
2690 PRINT R$;"S";O$;"IT DOWN, OR ";R$;"R";O$;"EAD THE RUINES? ";:GOSUB 4340
2700 IF C$<>"P" THEN 2750
2710 PRINT "PRY":GOSUB 4430:IF RND(1)<.1 THEN 2930
2720 IF RND(1)>.5 THEN 2920
2730 PRINT "THEY POP INTO YOUR GREEDY HANDS!!":I=FND(500*CZ)
2740 PRINT "THEY ARE WORTH ";I;"GOLD":GD=GD+I:GOSUB 4810:GOSUB 4430:GOTO 3150
2750 IF C$<>"S" THEN 2840
2760 PRINT "SIT":GOSUB 4430:IF RND(1)<.1 THEN 2930
2770 IF RND(1)>.6 THEN 2920
2780 IF RND(1)>.4 THEN 2170
2790 PRINT "A LOUD GONG SOUNDS!";:GOSUB 4430:IF RND(1)<.6 THEN 2820
2800 KKK=EX/2:KKK=INT(KKK):EX=EX-KKK:IF LV=1 THEN EX=-1
2810 GOSUB 4440:GOTO 3150
2820 IF LV>CZ THEN PRINT "NOTHING HAPPENS...";:GOTO 2910
2830 GOSUB 4440:GOTO 3150
2840 IF C$<>"R" THEN 3170
2850 PRINT "READ":GOSUB 4430
2860 IF RND(1)<.1 THEN 2930
2870 IF FND(10*CZ)<FND(LV*ST(1)) THEN 2890
2880 PRINT "YOU DON'T UNDERSTAND THEM...";:GOTO 2910
2890 IF RND(1)<.5 THEN GOSUB 6790:GOTO 2910
2900 PRINT "A MYSTERIOUS MAGIC GRIPS YOU...":GOSUB 4650
2910 GOSUB 4430:GOTO 3150
2920 PRINT "NOTHING HAPPENS.....";:GOTO 2910
2930 PRINT "THE DWARVEN KING RETURNS!!!":GOSUB 4430:GOSUB 4410
2940 PRINT FNP$(7,22);"#  ":M=11:ML=3*CZ:UN=0:GOTO 610
2950 GOSUB 4400:PRINT FNP$(7,22);"VLT";FNP$(18,0);"YOU SEE A XEROX VAULT."
2960 PRINT "<RET> TO TRY THE COMBINATION.":GOSUB 4340
2970 IF C$=CHR$(13) THEN 2980 ELSE 3170
2980 GOSUB 4400:PRINT B$;:INPUT "COMBINATION";C1(1),C1(2),C1(3)
2990 FOR II=1 TO 3: IF CB(II)<>C1(II) THEN 3140 ELSE NEXT
3000 GOSUB 4400:PRINT "THE VAULT SWINGS OPEN..."
3010 IF RND(1)>.9 THEN 6830
3020 IF RND(1)<.75 OR LEN(WORD$)=5 THEN 3050
3030 GOSUB 4430:PRINT "A CHOKING FOG ENVELOPES YOU.":GOSUB 4560
3040 PRINT "YOU GASP FOR BREATH.":GOSUB 4430:KKK=EX/2:KKK=INT(KKK):EX=EX-KKK:GOSUB 4440:GOTO 3120
3050 GOSUB 4560:II=FND(4):ON II GOTO 3060,3080,3090,3100
3060 KK=INT(100000!*CZ*(.5+RND(1))):PRINT "YOU HAVE FOUND A WEALTH OF GOLD!"
3070 GOSUB 4430:PRINT "IT'S WORTH ";KK;" IN GOLD.":GD=GD+KK:GOTO 3120
3080 PRINT "YOU HAVE ACQUIRED ";R$;" A MAGIC LANCE!";O$:I(12)=I(12)+1:GOTO 3120
3090 PRINT "YOU HAVE FOUND A SACRED SCROLL OF ENTRY!":I(13)=I(13)+1:GOTO 3120
3100 J=20:FOR II=0 TO 5:IF ST(II)<JJ THEN JJ=ST(II):KK=II
3110 NEXT:ST(KK)=18:PRINT "YOUR ";MID$(S$,3*KK+1,3);" IS SUPREME!"
3120 GOSUB 4430:FOR II=1 TO 3:CB(II)=FND(4):CK(II)=0:NEXT:GOSUB 4690
3130 GOSUB 4810:GOTO 3150
3140 GOSUB 4400:PRINT "AN ELECTRIC SHOCK SENDS YOU REELING!":GOSUB 4560:GOTO 2170
3150 PRINT FNP$(7,22);"   ":M=0:GOSUB 4400
3160 PRINT "=> ";:GOSUB 4340
3170 IF C$="" THEN C$="5"
3180 FOR C%=1 TO 13:IF MID$(Z$,C%,1)=C$ THEN 3200 ELSE NEXT
3190 PRINT "==NO";:FOR I=1 TO 500:NEXT:GOTO 3150
3200 ON C% GOTO 3210,3240,3270,3300,3330,3470,3600,3400,3480,3530,3560,3360,3380
3210 IF SF(8)>0 THEN 3230 ELSE IF FNUP(L%)>2 THEN 3190
3220 IF FNUP(L%)=2 THEN GOSUB 3340:IF OP=0 THEN 3330
3230 PRINT "NORTH":CY=CY-1:GOTO 520
3240 IF SF(8)>0 THEN 3260 ELSE IF FNUP(P(2,1))>2 THEN 3190
3250 IF FNUP(P(2,1))=2 THEN GOSUB 3340:IF OP=0 THEN 3330
3260 PRINT "SOUTH":CY=CY+1:GOTO 520
3270 IF SF(8)>0 THEN 3290 ELSE IF FNLF(L%)>2 THEN 3190
3280 IF FNLF(L%)=2 THEN GOSUB 3340:IF OP=0 THEN 3330
3290 PRINT "WEST":CX=CX-1:GOTO 520
3300 IF SF(8)>0 THEN 3320 ELSE IF FNLF(P(1,2))>2 THEN 3190
3310 IF FNLF(P(1,2))=2 THEN GOSUB 3340:IF OP=0 THEN 3330
3320 PRINT "EAST":CX=CX+1:GOTO 520
3330 PRINT "STAY";FNP$(7,22);"   ":SY=0:GOTO 520
3340 IF FND(CZ)<FND(2*LV+I(11)+10*I(13)) THEN PRINT "THE DOOR OPENS":OP=1:RETURN
3350 PRINT "THE DOOR REMAINS SHUT":GOSUB 4560:GOSUB 6570:OP=0:RETURN
3360 IF UP<>1 THEN 3330
3370 PRINT "UP";:CZ=CZ-1:IF CZ=0 THEN 1970 ELSE 520
3380 IF DN<>1 THEN 3330
3390 PRINT "DOWN";:CZ=CZ+1:GOTO 520
3400 PRINT E$;"STORE ";NM$:KILL NM$:OPEN "O",1,NM$
3410 FOR I=0 TO 5:PRINT#1,ST(I):NEXT
3420 PRINT#1,LV;GD;TG;EX;CH;HP;CX;CY;CZ;SU;CS;CN$
3430 FOR I=1 TO 10:PRINT#1,SF(I):NEXT:FOR I=1 TO 13:PRINT#1,I(I):NEXT
3440 FOR I=1 TO 10:PRINT#1,FM(I);FL(I);FH(I);FX(I);FY(I);FZ(I):NEXT
3450 FOR I=1 TO 3:PRINT#1,CB(I);CK(I):NEXT:PRINT#1,DX;DY;DZ
3460 PRINT#1,XO;YO;ZO;W0:PRINT#1,WORD$:CLOSE:PRINT "STORED.":INPUT "CONTINUE? (Y/N) ";XXX$
3461 IF XXX$="Y" THEN 442 ELSE RUN "DND"
3470 PRINT "RE-PLOT": GOSUB 4560:PRINT E$:GOSUB 3790:GOSUB 4690:GOTO 550
3475 PRINT E$:GOSUB 3790:GOSUB 4690:RETURN
3480 GOSUB 4400:PRINT "USE SCROLL OF RESCUE":IF I(8)<1 THEN 3510
3490 I(8)=I(8)-1:PRINT "<<<<<ZAPPP!!>>>":GOSUB 480:GOSUB 6740
3500 GD=FND(GD/LV):GOSUB 4810:GOTO 520
3510 PRINT "YOU DON'T HAVE ONE"
3520 GOSUB 4810:GOSUB 4430:GOTO 3150
3530 PRINT "DRINK HEALING POTION":IF I(9)<1 THEN 3510
3540 I(9)=I(9)-1:GOSUB 4690:CH=CH+FND(3*LV)+FND(2*LV):IF CH>HP THEN CH=HP
3550 PRINT "YOU FEEL BETTER":GOTO 3520
3560 PRINT "DRINK STRENGTH POTION":IF I(10)<1 THEN 3510
3570 IF SF(1)<0 THEN SF(1)=0
3580 SF(1)=SF(1)+10+FND(20):PRINT "STRENGTH FLOWS THROUGH YOUR BODY"
3590 I(10)=I(10)-1:GOSUB 4690:GOTO 3520
3600 D=0:GOTO 4950
3610 FF=0:GOSUB 4560:PRINT "YOU DIED, ";NM$;"!!":GOSUB 4430
3620 IF SF(10)>0 THEN 6360
3630 PRINT E$;FNP$(6,5);"ANOTHER ";:IF LV<4 THEN PRINT "NOT SO ";
3640 PRINT "MIGHTY ADVENTURER"
3650 PRINT FNP$(8,15);"BITES THE DUST";B$:PRINT CHR$(5)+CHR$(2):KILL NM$:RUN "DND"
3660 Q=X*XO+Y*YO+Z*ZO+(X+XO)*(Y+YO)*(Z+ZO)
3670 H=(Q-INT(Q))*W0:IF FNS(H)>9 THEN H=H AND 255
3680 IF X=1 OR X=51 THEN H=H OR 12
3690 IF Y=1 OR Y=51 THEN H=H OR 3
3700 RETURN
3710 IF W<2 THEN RETURN
3720 PS=L%+1:GOSUB 3780:PRINT FNP$(XX,YY);R$;SPACE$(15);O$:IF W>2 THEN RETURN
3730 PS=L%+5:GOSUB 3780:FOR I=1 TO 6:PRINT FNP$(XX,YY);LN$;:NEXT I:RETURN
3740 IF W<2 THEN RETURN
3750 PS=L%:GOSUB 3780:PRINT FNP$(XX,YY);R$;DD$;O$
3760 IF W>2 THEN RETURN
3770 Q%=2:PS=80*Q%+L%:GOSUB 3780:PRINT FNP$(XX,YY);V$:RETURN
3780 XX=INT(PS/80):YY=PS-80*XX:RETURN
3790 Z=CZ:FOR Q2=0 TO 3:Y=CY+Q2-1:FOR Q1=0 TO 3:X=CX+Q1-1:GOSUB 3660
3800 P(Q2,Q1)=H:NEXT:NEXT
3810 PRINT CHR$(30);S1$:FOR I=0 TO 21:PRINT FNP$(I,0);S1$:NEXT I:PRINT FNP$(0,0)
3820 IF FNUP(P(1,1))>1 OR FNLF(P(0,1))>1 THEN 3840
3830 L%=0:W=FNUP(P(0,0)):GOSUB 3710
3840 IF FNUP(P(1,0))>1 OR FNLF(P(1,1))>1 THEN 3860
3850 L%=0:W=FNLF(P(0,0)):GOSUB 3740
3860 IF FNUP(P(1,1))>1 THEN 3890
3870 L%=15:W=FNUP(P(0,1)):GOSUB 3710:W=FNLF(P(0,1)):GOSUB 3740
3880 L%=30:W=FNLF(P(0,2)):GOSUB 3740
3890 IF FNUP(P(1,1))>1 OR FNLF(P(0,2))>1 THEN 3910
3900 L%=30:W=FNUP(P(0,2)):GOSUB 3710
3910 IF FNLF(P(1,2))>1 OR FNUP(P(1,2))>1 THEN 3930
3920 L%=45:W=FNLF(P(0,3)):GOSUB 3740
3930 IF FNLF(P(1,2))>1 THEN 3960
3940 L%=430:W=FNUP(P(1,2)):GOSUB 3710:L%=445:W=FNLF(P(1,3)):GOSUB 3740
3950 L%=830:W=FNUP(P(2,2)):GOSUB 3710
3960 IF FNUP(P(2,1))>1 OR FNLF(P(2,2))>1 THEN 3980
3970 L%=1230:W=FNUP(P(3,2)):GOSUB 3710
3980 IF FNLF(P(1,2))>1 OR FNUP(P(2,2))>1 THEN 4000
3990 L%=845:W=FNLF(P(2,3)):GOSUB 3740
4000 IF FNUP(P(2,1))>1 THEN 4030
4010 L%=830:W=FNLF(P(2,2)):GOSUB 3740
4020 L%=1215:W=FNUP(P(3,1)):GOSUB 3710:L%=815:W=FNLF(P(2,1)):GOSUB 3740
4030 IF FNUP(P(2,1))>1 OR FNLF(P(2,1))>1 THEN 4050
4040 L%=1200:W=FNUP(P(3,0)):GOSUB 3710
4050 IF FNLF(P(1,1))>1 OR FNUP(P(2,0))>1 THEN 4070
4060 L%=800:W=FNLF(P(2,0)):GOSUB 3740
4070 IF FNLF(P(1,1))>1 THEN 4100
4080 L%=800:W=FNUP(P(2,0)):GOSUB 3710
4090 L%=400:W=FNLF(P(1,0)):GOSUB 3740:W=FNUP(P(1,0)):GOSUB 3710
4100 L%=415:W=FNLF(P(1,1)):GOSUB 3740:W=FNUP(P(1,1)):GOSUB 3710
4110 L%=430:W=FNLF(P(1,2)):GOSUB 3740:L%=815:W=FNUP(P(2,1)):GOSUB 3710
4120 PRINT FNP$(8,23);MN$:L%=P(1,1):IF SF(3)<=0 THEN RETURN
4130 IF FNS(P(0,0))=0 THEN 4170
4140 IF FNUP(P(1,0))<2 AND FNLF(P(1,1))<2 THEN 4160
4150 IF FNUP(P(1,1))>1 OR FNLF(P(0,1))>1 THEN 4170
4160 PRINT FNP$(2,7);"[]"
4170 IF FNS(P(0,1))<>0 AND FNUP(P(1,1))<2 THEN PRINT FNP$(2,22);"[]"
4180 IF FNS(P(0,2))=0 THEN 4220
4190 IF FNUP(P(1,1))<2 AND FNLF(P(0,2))<2 THEN 4210
4200 IF FNUP(P(1,2))>1 OR FNLF(P(1,2))>1 THEN 4220
4210 PRINT FNP$(2,37);"[]"
4220 IF FNS(P(1,2))<>0 AND FNLF(P(1,2))<2 THEN PRINT FNP$(7,37);"[]"
4230 IF FNS(P(2,2))=0 THEN 4270
4240 IF FNUP(P(2,2))<2 AND FNLF(P(1,2))<2 THEN 4260
4250 IF FNUP(P(2,1))>1 OR FNLF(P(2,2))>1 THEN 4270
4260 PRINT FNP$(12,37);"[]"
4270 IF FNS(P(2,1))<>0 AND FNUP(P(2,1))<2 THEN PRINT FNP$(12,22);"[]"
4280 IF FNS(P(2,0))=0 THEN 4320
4290 IF FNUP(P(2,0))<2 AND FNLF(P(1,1))<2 THEN 4310
4300 IF FNUP(P(2,1))>1 OR FNLF(P(2,1))>1 THEN 4320
4310 PRINT FNP$(12,7);"[]"
4320 IF FNS(P(1,0))<>0 AND FNLF(P(1,1))<2 THEN PRINT FNP$(7,7);"[]"
4330 RETURN
4340 C$=""
4350 FOR X%=1 TO 1500:
4360 IF X%=1500 THEN RETURN
4370 C$=INKEY$
4380 IF C$<>"" THEN RETURN
4390 NEXT X%
4400 FOR I%=0 TO 5:PRINT FNP$(17+I%,0);S1$;:NEXT I%:PRINT FNP$(17,0):RETURN
4410 PRINT FNP$(7,22);"   ";FNP$(7,22):RETURN
4420 M=FND(8):RETURN
4430 GOSUB 4560:GOSUB 4400:RETURN
4440 IF EX<1000*2^LV THEN GOTO 4490
4450 GOSUB 4430:PRINT "YOU WENT UP A LEVEL!";:LV=LV+1:J=FND(ST(0))+FND(ST(4))
4460 CH=CH+J:HP=HP+J:
4470 CS=CS+LV:SU=SU+LV:GOSUB 4690
4480 GOSUB 4430:PRINT "YOU GAIN ";J;"HIT POINTS":GOSUB 4810:RETURN
4490 IF LV=1 AND EX>=0 THEN RETURN
4500 IF EX>=1000*2^(LV-1) THEN RETURN
4510 GOSUB 4430:PRINT "YOU GO DOWN A LEVEL!";:LV=LV-1:J=FND(ST(0))+FND(ST(4))
4520 CH=CH-J:HP=HP-J:GOSUB 4690
4530 GOSUB 4430:PRINT "YOU LOSE";J;"HIT POINTS.":GOSUB 4810
4540 IF CH>0 AND LV>0 THEN RETURN
4550 GOSUB 4560:GOTO 3610
4560 FOR JJ%=1 TO 6000:NEXT:RETURN
4570 FOR J=1 TO 600:NEXT:RETURN
4580 D=FND(L*5):PRINT "YOU SUFFER";D;"POINTS":CH=CH-D
4590 IF CH>0 THEN GOSUB 4810:RETURN
4600 GOTO 3610
4610 I=FND(500*CZ):PRINT "YOU JUST ";
4620 IF RND(1)>.5 THEN PRINT "LOST";:I=-I:GOTO 4640
4630 PRINT "GAINED";
4640 PRINT ABS(I);"EXPERIENCE POINTS";:EX=EX+I:GOSUB 4440:GOSUB 4810:RETURN
4650 I=FND(6)-1:IF RND(1)>.5 THEN 4670
4660 PRINT "YOUR ";MID$(S$,I*3+1,3);" GOES UP";:ST(I)=ST(I)+1:GOTO 4680
4670 PRINT "YOUR ";MID$(S$,I*3+1,3);" GOES DOWN";:ST(I)=ST(I)-1
4680 PRINT " BY 1";CL$:GOSUB 4560:GOSUB 4690:RETURN
4690 PRINT FNP$(0,49);LEFT$(NM$,10);" THE ";CN$;" +";STR$(INT(LV))
4700 FOR I%=1 TO 13:IF I(I%)<1 THEN PRINT FNP$(6+I%,61);CHR$(24):GOTO 4760
4710 IF I%>7 THEN 4750
4720 PRINT FNP$(6+I%,61);MA$(I%);
4730 IF I(I%)>0 THEN PRINT FNP$(6+I%,70);" +";INT(I(I%));CHR$(24)
4740 GOTO 4760
4750 PRINT FNP$(6+I%,61);INT(I(I%));" ";MA$(I%);CHR$(24)
4760 NEXT
4770 FOR KK%=1 TO 3:IF CK(KK%)=0 THEN PRINT FNP$(22,2*KK%+61);VH$ ELSE PRINT FNP$(22,2*KK%+60);CK(KK%)
4780 NEXT:
4790 PRINT FNP$(21,63);"MG WD ";R$;WORD$;O$
4800 FOR I%=0 TO 5:PRINT FNP$(I%+2,49);MID$(S$,I%*3+1,3);ST(I%):NEXT:GOSUB 4400:I=K:RETURN
4810 K=I:FOR I%=1 TO 10:IF SF(I%)<1 THEN PRINT O$;FNP$(16,5*I%-5);"    ":GOTO 4830
4820 PRINT R$;FNP$(16,5*I%-5);MID$(PP$,I%*4-3,4);O$
4830 NEXT:I=K
4840 PRINT FNP$(2,64);"HP";INT(CH);"/";INT(HP);CHR$(24)
4850 PRINT FNP$(3,64);"SU";INT(CS);"/";INT(SU);CHR$(24)
4860 PRINT FNP$(4,57);:PRINT USING "##################, EX";EX
4870 PRINT FNP$(5,57);:PRINT USING "$$################, GD";GD:GOSUB 4400:RETURN
4880 UN=0:IF M=3 OR M=8 OR M=10 OR M=13 OR M=17 OR M=18 THEN UN=1
4890 RETURN
4900 INPUT C:RETURN
4910 GOSUB 4400:PRINT "YOU HAVE NOT BEEN NOTICED..."
4920 PRINT "<RET> TO APPROACH":GOSUB 4340
4930 IF C$=CHR$(13) THEN GOSUB 4420:GOTO 610
4940 PRINT FNP$(6,29);" ":GOSUB 4420:GOTO 1460
4950 PRINT "CAST":FOR II=1 TO 300:NEXT:GOSUB 4400:PRINT "SPELL LEVEL";:GOSUB 4340
4960 C=VAL(C$):PRINT FNP$(18,13);C$
4970 IF C>0 AND C<=INT(LV/3)+1 AND C<7 THEN 5000
4980 IF C=0 THEN 5160
4990 PRINT "YOU DON'T SPELL THAT WELL, DIMWIT!":GOSUB 4430:GOTO 5160
5000 IF C>CS THEN PRINT "YOU DON'T HAVE ENOUGH SPELL UNITS.":GOTO 5150
5010 PRINT "SPELL( <=> TO LIST):";:GOSUB 4340:IF C$=CHR$(13) OR C$="" THEN 5150
5020 GOSUB 4880:IF C$<"1" OR C$>"6" THEN C$="="
5030 IF C$="=" THEN GOSUB 4400:GOTO 5050
5040 CS=CS-C:GOSUB 4810:GOTO 5100
5050 FOR I=1 TO 3
5060 PRINT I;LEFT$(S$(I+6*(C-1)),20);TAB(25);I+3;LEFT$(S$(I+3+6*(C-1)),19):NEXT
5070 PRINT "PRESS ANY KEY TO CONTINUE.":GOSUB 4340:GOSUB 4420
5080 IF C$<"1" OR C$>"6" THEN GOSUB 4400:GOTO 5010
5090 GOTO 5040
5100 S=VAL(C$):ON C GOTO 5190,5420,5590,5770,5990,6330
5110 MH=MH-I:PRINT "IT SUFFERS";I;"HIT POINTS":IF MH>0 THEN 5150
5120 GOTO 820
5130 PRINT "NOT IN MELEE!":GOSUB 4430:GOTO 890
5140 PRINT "YOU JUST WASTED A COMBAT SPELL!"
5150 GOSUB 4430:IF D=1 THEN 890 ELSE 3150
5160 IF D=1 THEN 710 ELSE 3150
5170 GOSUB 4430:GOTO 1460
5180 PRINT "UNDEAD ARE ALREADY DEAD.":GOTO 5150
5190 ON S GOTO 5200,5220,5290,5320,5350,5410
5200 PRINT S$(1):GOSUB 4430:IF D=0 THEN 5140
5210 I=INT(FND(18)+RND(1)*(ST(1)*LV)^.5):GOTO 5110
5220 PRINT S$(2):GOSUB 4430:IF D=0 THEN 5140
5230 IF UN=1 THEN PRINT "UNDEAD DON'T SLEEP!":GOTO 890
5240 IF INT(FND(21))>ST(1) THEN PRINT "THE ";M$;" ISN'T SLEEPY.":GOTO 890
5250 PRINT "THE ";M$;" IS SLEEPING":PRINT "PRESS <RET> TO KILL:";:GOSUB 4340
5260 IF C$<>CHR$(13) THEN GOSUB 4420:GOTO 1370
5270 IF RND(1)>.2 THEN 820
5280 PRINT "IT WOKE UP!":GOSUB 4560:GOTO 890
5290 PRINT S$(3):I=FND(2*LV)+FND(2*LV):PRINT "YOU FEEL BETTER":CH=CH+I
5300 IF CH>HP THEN CH=HP
5310 GOSUB 4810:GOTO 5150
5320 S=4:T=3:U=1:GOSUB 4130
5330 GOSUB 4400:PRINT S$(S):IF SF(T)<0 THEN SF(T)=0
5340 SF(T)=SF(T)+FND(U)+5:GOSUB 4810:GOTO 5150
5350 PRINT S$(5):GOSUB 4430:IF D=0 THEN 5140
5360 IF UN=1 THEN 5380
5370 PRINT "THE ";M$;" IS INSULTED":PRINT "AT BEING CALLED UNDEAD.":GOTO 5150
5380 IF RND(1)<.05*ST(2)+.05*LV-.05*ML THEN 5400
5390 PRINT "THE ";M$;" LISTENS WITH DEAF EARS.":GOTO 5150
5400 ML=INT((ML/2)+.5):PRINT "IT RUNS IN FEAR!":GOTO 850
5410 S=6:T=4:U=11:GOTO 5330
5420 ON S GOTO 5430,5490,5500,5520,5530,5580
5430 PRINT S$(7):GOSUB 4430:IF D=0 THEN 5140
5440 IF INT((RND(1)^2)*20+1)>ST(1) THEN PRINT "THE ";M$;" DODGES!":GOTO 5150
5450 PRINT "THE ";M$;" IS WEBBED!":PRINT "<RET> TO KILL.";:GOSUB 4340
5460 IF C$<>CHR$(13) THEN GOTO 1370
5470 IF RND(1)>.2 THEN 820
5480 GOSUB 4400:PRINT "IT BROKE FREE!!":GOSUB 4430:GOTO 890
5490 S=8:T=5:U=21:GOTO 5330
5500 PRINT S$(9):GOSUB 4430:IF D=0 THEN 5140
5510 I=FND(12)+3:GOTO 5110
5520 S=10:T=2:U=21:GOTO 5330
5530 PRINT S$(11):GOSUB 4430:IF D=0 THEN 5140
5540 IF UN=1 THEN PRINT "THE UNDEAD IGNORE YOUR WILES!":GOTO 890
5550 IF INT((RND(1)^2)*20+1)>ST(5) THEN PRINT "THE ";M$;" RESISTS YOU.":GOTO 5150
5560 PRINT "THE ";M$;" IS CHARMED.":PRINT "<RET> TO KILL.";:GOSUB 4340
5570 GOTO 5460
5580 S=12:T=1:UI=21:GOTO 5330
5590 ON S GOTO 5600,5620,5650,5660,5670,5730
5600 PRINT S$(13):GOSUB 4420:PRINT "ZZZZAAAAPP!!!":IF D=0 THEN 5140
5610 GOSUB 4560:I=FND(6*LV)+15:GOTO 5110
5620 PRINT S$(14):I=FND(4*LV)+FND(4*LV):PRINT "YOU FEEL BETTER.":CH=CH+1
5630 IF CH>HP THEN CH=HP
5640 GOSUB 4810:GOTO 5150
5650 S=15:T=3:U=60:GOSUB 4130:GOTO 5330
5660 S=16:T=6:U=21:GOTO 5330
5670 PRINT S$(17):GOSUB 4430:IF D=0 THEN 5140
5680 IF FND(M)>FND(ST(1)) THEN PRINT "THE ";M$;" IGNORES YOU.":GOSUB 4430:GOTO 890
5690 PRINT "THE ";M$;" IS HELD!":PRINT "<RET> TO KILL:";:GOSUB 4340
5700 IF C$<>CHR$(13) THEN GOSUB 4420:GOTO 1370
5710 IF RND(1)>.2 THEN 820
5720 PRINT "IT BROKE FREE!":GOSUB 4560:GOTO 890
5730 PRINT S$(18):GOSUB 4430:IF D=0 THEN 5140
5740 IF FND(30)+ML=ST(1)+LV THEN 5760
5750 PRINT "THE ";M$;" DOESN'T BELIEVE!":GOTO 890
5760 PRINT "IT BELIEVES!...AAARGH....":GOTO 820
5770 ON S GOTO 5780,5870,5890,5910,5940,5950
5780 PRINT S$(19):GOSUB 4430:IF D=1 THEN 5130
5790 PRINT "DIRECTION:";:GOSUB 4340
5800 FOR I=1 TO 8:IF MID$("WXAD8246",I,1)=C$ THEN 5820
5810 NEXT:PRINT "????":GOSUB 4420:GOTO 5790
5820 IF I>4 THEN I=I-4
5830 IF I=5 THEN 5150
5840 IF (I=1 AND CY>1) OR (I=2 AND Y<50) OR (I=3 AND CX>1) OR (I=4 AND CX<50) THEN 5860
5850 PRINT "ONLY STONE THERE...":GOTO 5150
5860 PRINT FNP$(18,33);R$;"*** POOF ****";O$:ON I GOTO 3230,3260,3290,3320
5870 PRINT S$(20):PRINT "WHOOOOOSH!!":IF D=0 THEN 5140
5880 PRINT "THE ";M$;" IS BURNING.":I=INT(RND(1)*12*LV+15):GOSUB 4560:GOTO 5110
5890 PRINT S$(21):GOSUB 4430:IF D=0 THEN 5140
5900 I=FND(MH)+LV:GOTO 5110
5910 PRINT S$(22):GOSUB 4430:IF D=0 THEN 5140
5920 IF RND(1)>.6 THEN PRINT "THE ";M$;" ISN'T AFFECTED.":GOTO 890
5930 PRINT "ONE STONE STATUE..":GOTO 820
5940 S=23:T=7:U=30:GOTO 5330
5950 PRINT S$(24):GOSUB 4430:PRINT "DIE, YOU GRAVY-SUCKING PIG!!":IF D=0 THEN 5140
5960 IF UN=1 THEN 5180
5970 GOSUB 4560:IF RND(1)>.3+ML*.04-LV*.03 THEN 820
5980 PRINT "THE ";M$;" LAUGHS AT YOUR BLASPHEMY!":GOSUB 4430:GOTO 890
5990 ON S GOTO 6000,6110,6120,6150,6170,6270
6000 PRINT S$(25):GOSUB 4430:IF D=1 THEN 5130
6010 PRINT FNP$(17,0);"ENTER A + OR - NUMBER";B$
6020 PRINT "<+>NORTH,<->SOUTH";:GOSUB 4900:NY=C
6030 PRINT "<+>EAST,<->WEST";:GOSUB 4900
6040 NX=C:PRINT "<+>UP,<->DOWN:";:GOSUB 4900:NZ=C:I=SQR(NX^2+NY^2+(NZ*5)^2+1)
6050 IF I>LV*5+1 THEN PRINT "TOO FAR FOR THE LIKES OF YOU. TRY AGAIN.":GOSUB 4430:GOTO 6010
6060 NX=CX+NX:NY=CY-NY:NZ=CZ-NZ
6070 IF NX>0 AND NY<51 AND NY>0 AND NY<51 AND NZ<51 THEN 6090
6080 PRINT "(BONK) ONLY STONE THERE, HARDHEAD.... SPELL FAILS.":GOTO 5150
6090 IF NZ<1 THEN PRINT "ONLY THIN AIR... SPELL FAILS.":GOTO 5150
6100 CX=NX:CY=NY:CZ=NZ:PRINT R$;"**** POOF ****";O$:GOSUB 6740:GOTO 520
6110 S=26:T=8:U=16:GOTO 5330
6120 PRINT S$(27):GOSUB 4430:IF D=0 THEN 5140
6130 PRINT "PORTREZEBIE!":GOSUB 4560:IF RND(1)<.8 THEN 820
6140 PRINT "THE ";M$;" DOESN'T HEAR, WEAK LUNGS.":GOTO 5150
6150 PRINT S$(28):GOSUB 4430:IF D=0 THEN 5140
6160 PRINT "BBRRRRR!!":I=90+FND(20):GOTO 5110
6170 PRINT S$(29):GOSUB 4430:FOR X=1 TO 3:PRINT FNP$(7,21+X);"*":
6180 PRINT FNP$(9,21+X);"*":NEXT
6190 PRINT FNP$(8,22);"*";FNP$(8,24);"*";FNP$(18,0);"WHOOOOOSH!!"
6200 PRINT "A WALL OF FIRE APPEARS ABOUT YOU.":GOSUB 4430
6210 FOR X=0 TO 2:PRINT FNP$(7,22+X);" ";FNP$(9,22+X);" ":NEXT:PRINT FNP$(8,22);" ";FNP$(8,24);" "
6220 IF D=0 THEN 5140
6230 IF RND(1)>.4 THEN PRINT FNP$(18,0);"THE ";M$;" IS GONE.":ZF=1
6240 IF ZF=1 THEN ZF=0:PRINT FNP$(17,0);SPACE$(53):GOTO 5170
6250 PRINT FNP$(7,22);"#";FNP$(18,0);"THE ";M$;" WALKS THROUGH!"
6260 I=FND(12)+8:GOTO 5110
6270 PRINT S$(30):GOSUB 4430:IF D=0 THEN 5140
6280 IF UN=1 THEN 5180
6290 PRINT "BLACK DEATH FOR THE ";M$
6300 GOSUB 4430:IF RND(1)>ST(2)*.05 THEN PRINT "IT IS IMMUNE.":GOTO 5150
6310 IF RND(1)>.05 THEN 820
6320 PRINT "THE SPELL BACKFIRES!":GOSUB 4430:GOTO 3610
6330 ON S GOTO 6340,6350,6400,6440,6470,6490
6340 S=31:T=9:U=20:GOTO 5330
6350 S=32:T=10:U=40:GOTO 5330
6360 PRINT S$(32):GOSUB 4430:ST(3)=ST(3)-1
6370 SF(10)=0:IF RND(1)>ST(3)*.05 THEN 6390
6380 PRINT "IT WORKS!!":CH=HP:GOSUB 4810:GOTO 5150
6390 PRINT "IT DOESN'T WORK, MAGGOT-EYES!!":GOTO 3610
6400 PRINT S$(33):GOSUB 4430:IF D=0 THEN 5140
6410 FOR X=1 TO 5:FOR U=1 TO 9:PRINT FNP$(7,22);MID$("W*Q^?&%$!",U,1):NEXT U,X:GOSUB 4570
6420 GOSUB 4430:IF RND(1)<.9 THEN 820
6430 PRINT FNP$(18,0);"THE ";M$;" DOESN'T SEE...";FNP$(7,22);"#":GOTO 5150
6440 PRINT S$(34):GOSUB 4430:IF D=1 THEN 5130
6450 GOSUB 4690:GOSUB 6740
6460 PRINT "<<<<<ZAP!!>>>>>":GOSUB 480:GOTO 520
6470 PRINT S$(35):GOSUB 4430:PRINT "YOU FEEL BETTER!":CH=HP:GOSUB 4810
6480 GOTO 5150
6490 PRINT S$(36):GOSUB 4430:PRINT "A SHIFTING MULTI-COLORED WALL APPEARS."
6500 IF D=0 THEN 5140
6510 PW$="BDQP":FOR J=1 TO 8:FOR P=1 TO 4
6520 WP$=MID$(PW$,P,1):PRINT FNP$(7,22);WP$;WP$;WP$
6530 PRINT FNP$(8,24);WP$:FOR Q=2 TO 0 STEP-1:PRINT FNP$(9,22+Q);WP$:NEXT Q
6540 PRINT FNP$(8,22);WP$:NEXT P,J:GOSUB 4430
6550 PRINT FNP$(7,22);"   ";FNP$(8,22);" ";MN$;" ";FNP$(9,22);"        "
6560 PRINT FNP$(18,1);"THE ";M$;" IS GONE";CL$;FNP$(17,0);SPACE$(55):GOTO 5170
6570 MN=0:FOR I=1 TO 10:IF FM(I)=0 THEN 6690
6580 IF RND(1)<.01 THEN FM(I)=0:GOTO 6690
6590 J=FND(4):ON J GOTO 6600,6610,6620,6630
6600 FX(I)=FX(I)+SGN(CX-FX(I)):GOTO 6670
6610 FY(I)=FY(I)+SGN(CY-FY(I)):GOTO 6670
6620 FZ(I)=FZ(I)+SGN(CZ-FZ(I)):GOTO 6670
6630 J=FND(3):ON J GOTO 6640,6650,6660
6640 FX(I)=FX(I)+FND(3)-2:GOTO 6670
6650 FY(I)=FY(I)+FND(3)-2:GOTO 6670
6660 FZ(I)=FZ(I)+FND(3)-2:GOTO 6670
6670 IF FNDS(I)=0 THEN NM=FM(I):ML=FL(I):MH=FH(I):FM(I)=0:GOSUB 4880:RETURN
6680 IF FNDS(I)<=2 THEN MN=1
6690 NEXT
6700 IF MN=1 THEN GOSUB 4400:PRINT "YOU HEAR STRANGE NOISES NEARBY":GOSUB 4560
6710 RETURN
6720 FOR I=1 TO 10:IF FM(I)=0 THEN 6730 ELSE NEXT:I=FND(10)
6730 FM(I)=M:FL(I)=ML:FH(I)=MH:FX(I)=CX:FY(I)=CY:FZ(I)=CZ:M=0:RETURN
6740 FOR Q=1 TO 10:FM(Q)=0:FL(Q)=0:FH(Q)=0:NEXT:M=0:RETURN
6750 IF LEN(WORD$)>=5 OR UN<>1 OR FND(ML)<FND(2*LV) THEN RETURN
6760 PRINT "YOU ARE EMBRACED BY THE SPIRITS OF THE UNDEAD":GOSUB 4560
6770 PRINT "THEY TRANSFER ANOTHER LETTER OF THE ";R$;"WORD";O$;"!"
6780 WORD$=WORD$+CHR$(96+FND(26)):GOSUB 4690:RETURN
6790 IF RND(1)<.5 THEN 6810 ELSE PRINT "YOU ARE ON LEVEL ";CZ;" OF THE DUNGEON."
6800 GOSUB 4560:GOSUB 4430:RETURN
6810 X=CX:Y=21-CY:PRINT "YOU ARE AT (";X;",";Y;") LEVEL ";CZ;" OF THE DUNGEON."
6820 GOSUB 4560:GOSUB 4430:RETURN
6830 PRINT E$:PRINT "YOU HAVE FOUND THE LAIR OF THE"
6840 PRINT "LORD OF THE DUNGEON":SY=1
6850 IF RND(1)>.4 AND LV>3 THEN 6851 ELSE 6860
6851 PRINT "Your presence has been accepted":PRINT "You have ";M$;" soup and gain his favor":GOSUB 4560:PRINT:PRINT
6852 XYZZ = INT(EX*RND(1)):GD=GD+XYZZ:PRINT "He grants you a BOON of ";XYZZ;"gold pieces...."
6853 PRINT "HOWEVER....YOU DID NOT THANK HIM PROPERLY":GOSUB 4650:GOTO 2170
6854 IF LEN(WORD$)<5 THEN PRINT:PRINT R$;" THE MAGIC WORD WILL NOT HELP YOU ";O$
6855 GOSUB 4560:GOSUB 4560: GOTO 2170
6860 PRINT:PRINT "SORRY, THE LORD OF THE ":PRINT "DUNGEON IS ON VACATION."
6870 GOSUB 4560:PRINT:PRINT:PRINT "A SIGN READS ----":PRINT:PRINT:PRINT R$;" TRESPASSERS WILL BE TELEPORTED ";O$:GOSUB 4650:GOSUB 4650
6871 IF LEN(WORD$)<5 THEN GOTO 2170 ELSE GOTO 520
6880 PRINT "SO LONG....":GOSUB 4560:PRINT E$:GOSUB 3400
6890 END
