5 RANDOMIZE TIMER
10 REM		ADVENTURE SHELL
20 REM **********************************
30 REM 		by Tim Hartnell
40 REM       Interface publications    	      
50 REM **********************************
60 GOSUB 3950:REM INITIALISE
70 REM **********************************
80 REM REPORT TO PLAYER
110 IF RO=16 THEN QU=1:GOTO 2950
120 REM *********************************
130 GOSUB 3060:REM ** ROOM DESCRIPTIONS **
140 REM ** NEXT LINE ACTIVATED IF OBJECT IN ROOM **
150 IF (A(RO,5)<>0) OR (A(RO,6)<>0) OR (A(RO,7)<>0) THEN GOSUB 3850:REM OBJECTS
160 IF A(RO,8)=0 THEN 210:REM ** NO MONSTER IN ROOM **
170 PRINT TAB(3);"LOOK OUT!":PRINT "THERE IS AN ";M$(A(RO,8));" HERE!" 
180 IF RND(1)>.7 THEN PRINT "THE ";M$(A(RO,8));" ATTACKS!":KW=1:GOSUB 1670:GOTO 80
190 REM *************************************
200 REM ** NEXT LINES DECREMENT ATTRIBUTES **
210 IF RND(1)>.94 THEN ST=ST-1:IF ST<0 THEN ST=0
220 IF RND(1)>.94 THEN CH=CH-1:IF CH<0 THEN CH=0
230 IF RND(1)>.94 THEN DE=DE-1:IF DE<0 THEN DE=0
240 IF RND(1)>.94 THEN IT=IT-1:IF IT<0 THEN IT=0
250 IF RND(1)>.94 THEN WI=WI-1:IF WI<0 THEN WI=0
260 IF RND(1)>.94 THEN CO=CO-1:IF CO<0 THEN CO=0
270 REM ** NEXT LINES REPORT ATTRIBUTES TO PLAYER **
280 PRINT:PRINT"Your attributes are:"
290 PRINT TAB(4);"Strength -";ST;"   Charisma -";CH
300 PRINT TAB(4);"Dexterity -";DE;"  Intelligence -";IT
310 PRINT TAB(4);"Wisdom -";WI;"     Constitution -";CO
320 REM ** NEXT LINE CHECKS IF ANY ATTRIBUTE IS ZERO **
330 IF ST*CH*DE*CO*IT*WI<>0 THEN 380
340 PRINT:PRINT "Unfortunately you are exhausted..."
350 PRINT "So this adventure must end":QU=2:GOTO 2990
360 REM *************************************
370 REM ** NEXT LINES CHECK TO SEE IF PLAYER IS CARRYING ANYTHING **
380 FLAG=0
390 FOR J=1 TO 5
400 IF P(J)<>0 THEN FLAG=1
410 NEXT J
420 IF FLAG=0 THEN 490
430 CASH=0
440 PRINT:PRINT "You are carrying:"
450 FOR J=1 TO 5
460 IF P(J)<>0 THEN PRINT TAB(4);O$(P(J)):CASH=CASH+V(P(J))
470 NEXT J
480 IF CASH>0 THEN PRINT TAB(8);"Total value - $";STR$(CASH)
490 PRINT
500 REM ************************************
510 REM ** NEXT LINES ACCEPT PLAYER INPUT **
520 KW=0:REM ** KW STANDS FOR KEYWORD - EQUALS 1 IF UNDERSTOOD **
530 FOR Z=1 TO 1000:NEXT Z
540 INPUT"What do you want to do",A$
550 REM ** NEXT LINES ADD SPACES IF LESS THAN 7 LONG **
560 IF A$="" THEN 540
570 AS=ASC(A$)
580 M=LEN(A$):IF M<7 THEN A$=A$+" ":GOTO 580
590 REM *************************************
600 REM ** GET FIRST THREE CHARACTERS - CHECK IF HELP OR QUIT
610 B$=LEFT$(A$,3)
620 IF B$="HEL" THEN PRINT TAB(3);"You must be joking!":GOTO 1050
630 IF B$="QUI" THEN QU=4:GOTO 2890
640 REM *********************************                                      
650 REM ** NOW BREAK DOWN PLAYER INPUT **
660 N=1
670 IF MID$(A$,N,1)<>" " THEN 700
680 C$=MID$(A$,N+1,3):IF LEFT$(C$,1)<>" " THEN 770
690 IF LEFT$(C$,1)=" " THEN 730
700 IF N<M THEN N=N+1:GOTO 670
710 REM ***********************************
720 REM ** GETS HERE IF ONLY ONE WORD ENTERED BY PLAYER, CHOOSE REPLY **
730 IF RND(1)>.5 THEN 750
740 PRINT TAB(6);"By itself, ";A$:PRINT TAB(6);"Can't be acted upon":GOTO 540
750 PRINT A$;" is just one word":PRINT TAB(4);" I need two":GOTO 540
760 REM *************************************
770 REM ** NEXT LINES 'UNDERSTAND' INPUT
780 REM ** NEXT LINE ACCEPTS 'KILL' OR 'FIGHT'
790 IF (B$="KIL") OR (B$="FIG") THEN KW=1:GOSUB 1670
820 REM ** NEXT LINE ACCEPTS 'RUN' 'GO' OR 'MOV'
830 IF (B$="GO ") OR (B$="MOV") OR (B$="RUN") THEN KW=1:GOSUB 1080
840 REM ** NEXT LINE ACCEPTS 'GET' 'TAKE' OR 'LIFT'
850 IF (B$="GET") OR (B$="TAK") OR (B$="LIF") THEN KW=1:GOSUB 1200
860 REM ** NEXT LINE ACCEPTS 'DROP' 'PUT' OR 'LEAVE'
870 IF (B$="DRO") OR (B$="PUT") OR (B$="LEA") THEN KW=1:GOSUB 1440
880 REM ** USE THIS SPACE TO ENTER OWN COMMANDS GOSUBBING THE GIVEN NUMBERS
890 REM e.g. IF (B$="LOO") OR (B$="SEE") THEN GOSUB 2700
900 REM 
910 REM 2730
920 REM
930 REM 2770
940 REM 
950 REM 2810
960 REM
970 REM 2850
980 IF KW=1 THEN 1050
990 REM **********************************
1000 REM ** CHOOSE I DON'T UNDERSTAND MESSAGE
1010 R=INT(RND(1)*3)
1020 IF R=0 THEN PRINT "It would not be wise to ";A$
1030 IF R=1 THEN PRINT "Only a fool would try to ";A$
1040 IF R=2 THEN PRINT "I don't understand ";A$
1050 FOR Z=1 TO 500:NEXT Z
1060 GOTO 80
1070 REM ************************************
1080 REM ** MOVEMENT
1090 C$=LEFT$(C$,1)
1100 IF (C$="N") AND (A(RO,1)=0) THEN PRINT "You can not go that way":RETURN
1110 IF (C$="S") AND (A(RO,2)=0) THEN PRINT "There is no exit south":RETURN
1120 IF (C$="E") AND (A(RO,3)=0) THEN PRINT "I see nowhere east to go":RETURN
1130 IF (C$="W") AND (A(RO,4)=0) THEN PRINT "You can't walk through walls":RETURN
1140 IF C$="N" THEN RO=A(RO,1)
1150 IF C$="S" THEN RO=A(RO,2)
1160 IF C$="E" THEN RO=A(RO,3)
1170 IF C$="W" THEN RO=A(RO,4)
1180 RETURN
1190 REM *******************
1200 REM ** GET OBJECTS ROUTINE
1210 FLAG=0
1220 FOR J=1 TO 5
1230 IF P(J)<>0 THEN FLAG=FLAG+1
1240 NEXT J
1250 IF FLAG=5 THEN PRINT "You are already carrying five objects":RETURN
1260 REM ** CHECK IF ANYTHING IN ROOM TO BE PICKED UP 
1270 IF (A(RO,5)<>0) OR (A(RO,6)<>0) OR (A(RO,7)<>0) THEN 1310
1280 PRINT "I see nothing to pick up":RETURN
1290 REM *************************************
1300 REM ** NOW PICK IT UP
1310 D$="":E$="":F$=""
1320 D$=LEFT$(O$(A(RO,5)),3)
1330 E$=LEFT$(O$(A(RO,6)),3)
1340 F$=LEFT$(O$(A(RO,7)),3)
1350 IF C$=D$ THEN N=A(RO,5):A(RO,5)=0:GOTO 1380
1360 IF C$=E$ THEN N=A(RO,6):A(RO,6)=0:GOTO 1380
1370 IF C$=F$ THEN N=A(RO,7):A(RO,7)=0
1380 J=1
1390 IF P(J)=0 THEN P(J)=N:GOTO 1410
1400 IF J<5 THEN J=J+1:GOTO 1390
1410 PRINT TAB(3);">-> YOU NOW HAVE THE ";O$(N)
1420 RETURN
1430 REM *************************************
1440 REM ** DROP ROUTINE
1450 FLAG=0
1460 FOR J=1 TO 5
1470 IF P(J)<>0 THEN FLAG=1 
1480 NEXT J
1490 IF FLAG=0 THEN PRINT "You are not carrying anything":RETURN
1500 IF (A(RO,5)=0) OR (A(RO,6)=0) OR (A(RO,7)=0) THEN 1520
1510 PRINT "This room already holds it's maximum number of objects":RETURN
1520 D$="":D=0
1530 FOR J=1 TO 8
1540 IF LEFT$(O$(J),3)=C$ THEN D$=O$(J):D=J
1550 NEXT J
1560 IF D$<>"" THEN 1580
1570 PRINT "How can you when you're not holding it":RETURN
1580 FOR J=1 TO 5
1590 IF P(J)=D THEN P(J)=0
1600 NEXT J
1610 IF A(RO,5)=0 THEN A(RO,5)=D:GOTO 1640
1620 IF A(RO,6)=0 THEN A(RO,6)=D:GOTO 1640
1630 IF A(RO,7)=0 THEN A(RO,7)=D
1640 PRINT "You have dropped the ";D$
1650 RETURN
1660 REM *************
1670 REM ** FIGHT ROUTINE
1680 REM ** NEXT LINES CHECK IF MONSTER IS PRESENT TO FIGHT
1690 IF A(RO,8)<>0 THEN 1750
1700 R=RND(1)
1710 IF R<.5 THEN PRINT "There is nothing to fight here"
1720 IF R>=.5 THEN PRINT "You can't fight empty air"
1730 RETURN
1740 REM ** SET G$ EQUAL TO NAME OF MONSTER/CREATE ITS ATTRIBUTES
1750 G$=M$(A(RO,8))
1760 S1=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
1770 H1=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
1780 D1=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
1790 I1=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
1800 W1=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
1810 C1=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
1820 PRINT "---------------------------------------"
1830 PRINT "YOUR OPPONENT IS AN ";G$
1840 MT=0:HT=0:REM ** MONSTER TALLY, HUMAN TALLY
1850 FF=S1*(INT(RND(1)*6)+1)
1860 PRINT "---------------------------------------"
1870 PRINT "THE ";G$;"'S DANGER LEVEL IS ";FF
1880 PRINT "---------------------------------------"
1890 FOR Z=1 TO 1500:NEXT Z
1900 REM ** CHECK IF CARRYING WEAPONS
1910 FOR J=1 TO 5
1920 T(J)=0
1930 IF P(J)=6 THEN PRINT "Your axe might be handy":T(J)=6
1940 IF P(J)=5 THEN PRINT "Your sword may stand you in good stead":T(J)=5
1950 NEXT J
1960 FLAG=0
1970 FOR J=1 TO 5
1980 IF T(J)<>0 THEN FLAG=FLAG+1
1990 NEXT J
2000 IF FLAG<>0 THEN 2020
2010 PRINT "You must fight the ";G$;" with your bare hands":GOTO 2170
2020 IF FLAG>1 THEN 2090
2030 FOR J=1 TO 5
2040 IF T(J)<>0 THEN FLAG=T(J)
2050 NEXT J
2060 PRINT "You must fight with your ";O$(FLAG)
2070 FF=INT(FF*2/FLAG)
2080 GOTO 2170
2090 PRINT "Choose your weapon:"
2100 FOR J=1 TO 5
2110 IF P(J)<>0 THEN PRINT J;" - ";O$(P(J))
2120 NEXT J
2130 INPUT "Enter the number you choose",J
2140 IF P(J)=0 THEN PRINT "You do not have the ";O$(J):GOTO 2130
2150 PRINT "Right, so you choose to fight with the ";O$(P(J))
2160 FF=INT(FF*2/J)
2170 FOR Z=1 TO 1500:NEXT Z
2180 PRINT "========================================"
2190 PRINT "THE ";G$;" HAS THE FOLLOWING ATTRIBUTES:"
2200 PRINT "1 - Strength     ",S1,"2 - Charisma     ",H1
2210 PRINT "3 - Dexterity    ",D1,"4 - Intelligence ",I1
2220 PRINT "5 - Wisdom       ",W1,"6 - Constitution ",C1
2230 PRINT:PRINT:PRINT "YOUR ATTRIBUTES ARE:"
2240 PRINT "1 - Strength     ",ST,"2 - Charisma     ",CH
2250 PRINT "3 - Dexterity    ",DE,"4 - Intelligence ",IT
2260 PRINT "5 - Wisdom       ",WI,"6 - Constitution ",CO
2270 PRINT:PRINT "Which attributes will you fight with (2)";
2280 INPUT Z,Q
2290 IF (Z>0) AND (Z<7) AND (Q>0) AND (Q<7) AND (Z<>Q) THEN 2310
2300 PRINT "DON'T FOOL AROUND WITH A ";G$;" IN THE ROOM WITH YOU!!":GOTO 2280
2310 IF (Z=1) OR (Q=1) THEN MT=MT+S1:HT=HT+ST
2320 IF (Z=2) OR (Q=2) THEN MT=MT+H1:HT=HT+CH
2330 IF (Z=3) OR (Q=3) THEN MT=MT+D1:HT=HT+DE
2340 IF (Z=4) OR (Q=4) THEN MT=MT+I1:HT=HT+IT
2350 IF (Z=5) OR (Q=5) THEN MT=MT+W1:HT=HT+WI
2360 IF (Z=6) OR (Q=6) THEN MT=MT+C1:HT=HT+CO
2370 IF HT=MT THEN PRINT TAB(10);"You are evenly matched":GOTO 2420
2380 PRINT "It looks like the odds "
2390 PRINT "are in favour of ";
2400 IF HT>MT THEN PRINT "you"
2410 IF HT<MT THEN PRINT "the";G$
2420 PRINT "---------------------------------------"
2430 REM ** NEXT LINES CONTROL THE FIGHT ITSELF
2435 KK=0
2440 K=INT(RND(1)*7):IF K=KK THEN 2440
2445 KK=K
2450 FOR Z=1 TO 700:NEXT Z
2460 PRINT "The ";G$;" -";MT
2470 PRINT "     YOU -";HT
2480 PRINT "---------------------------------------"
2490 IF K=0 THEN PRINT "You struck a splendid blow!":MT=MT-1
2500 IF K=1 THEN PRINT "The ";G$;" strikes out":HT=HT-1:CH=CH-1
2510 IF K=2 THEN PRINT "You draw the ";G$;"'s blood":S1=S1-1
2520 IF K=3 THEN PRINT "You are wounded!!":IT=IT-1
2530 IF K=4 THEN PRINT "The ";G$;" is tiring":D1=D1-1
2540 IF K=5 THEN PRINT "You are bleeding...":WI=WI-1
2550 IF K=6 THEN PRINT "You wound the";G$:MT=MT-1
2560 IF (RND(1)>.25) AND (HT>0) AND (MT>0) THEN FOR T=1 TO 1600:NEXT T:GOTO 2440
2570 IF HT<MT THEN 2600
2580 PRINT "You have slain the ";G$
2590 ST=ST+2:DE=DE+2:WI=WI+2:CH=CH+2:IT=IT+2:CO=CO+2:MK=MK+1:GOTO 2670
2600 PRINT "The ";G$;" got the better of you that time..."
2610 IF (Z=1) OR (Q=1) THEN ST=4*INT(ST/5)
2620 IF (Z=2) OR (Q=2) THEN CH=3*INT(CH/4)
2630 IF (Z=3) OR (Q=3) THEN DE=6*INT(DE/7)
2640 IF (Z=4) OR (Q=4) THEN IT=2*INT(IT/3)
2650 IF (Z=5) OR (Q=5) THEN WI=5*INT(WI/6)
2660 IF (Z=6) OR (Q=6) THEN CO=INT(CO/2)
2670 A(RO,8)=0
2680 FOR Z=1 TO 500:NEXT Z
2690 RETURN
2700 REM ** OWN COMMANDS CARRIED OUT HERE
2880 REM ***********
2890 REM END OF GAME
2900 PRINT
2910 SC=0:REM ** SCORE
2920 IF QU<>4 THEN 2950
2930 PRINT "I did not imagine you would turn"
2940 PRINT TAB(5);"out to be a quitter!":GOTO 2990
2950 PRINT:PRINT "CONGRATULATIONS... You have completed"
2960 PRINT TAB(7) "the ADVENTURE!!!!"
2970 SC=100
2980 PRINT:PRINT
2990 SC=99*(SC+20*CASH+4*MK+ST+2*CH+3*DE+4+IT+5*WI+6*CO)/QU
3000 IF MK>0 THEN PRINT "You killed ";MK;" monsters"
3010 PRINT:PRINT TAB(7);"You found $";STR$(CASH);" worth"
3020 PRINT TAB(8);"Of treasure":PRINT
3030 PRINT:PRINT "Your score for this adventure is ";SC
3040 END
3050 REM ********************
3060 REM ** ROOM DESCRIPTIONS
3065 PRINT "You are in ";
3070 IF RO<9 THEN ON RO GOSUB 3090,3140,3190,3240,3290,3340,3390,3440
3075 IF RO>8 THEN ON RO-8 GOSUB 3490,3540,3590,3640,3690,3740,3790
3080 RETURN
3090 REM ** ROOM ONE
3100 PRINT "ROOM ONE"
3110 REM
3120 REM
3130 RETURN
3140 REM ** ROOM TWO
3150 PRINT "ROOM TWO"
3160 REM
3170 REM
3180 RETURN
3190 REM ** ROOM THREE
3200 PRINT "ROOM THREE"
3210 REM
3220 REM
3230 RETURN
3240 REM ** ROOM FOUR
3250 PRINT "ROOM FOUR"
3260 REM
3270 REM
3280 RETURN
3290 REM ** ROOM FIVE
3300 PRINT "ROOM FIVE"
3310 REM
3320 REM
3330 RETURN
3340 REM ** ROOM SIX
3350 PRINT "ROOM SIX"
3360 REM
3370 REM
3380 RETURN
3390 REM ** ROOM SEVEN
3400 PRINT "ROOM SEVEN"
3410 REM
3420 REM
3430 RETURN
3440 REM ** ROOM EIGHT
3450 PRINT "ROOM EIGHT"
3460 REM
3470 REM
3480 RETURN
3490 REM ** ROOM NINE
3500 PRINT "ROOM NINE"
3510 REM
3520 REM
3530 RETURN
3540 REM ** ROOM TEN
3550 PRINT "ROOM TEN"
3560 REM
3570 REM
3580 RETURN
3590 REM ** ROOM ELEVEN
3600 PRINT "ROOM ELEVEN"
3610 REM
3620 REM
3630 RETURN
3640 REM ** ROOM TWELVE
3650 PRINT "ROOM TWELVE"
3660 REM
3670 REM
3680 RETURN
3690 REM ** ROOM THIRTEEN
3700 PRINT "ROOM THIRTEEN"
3710 REM
3720 REM
3730 RETURN
3740 REM ** ROOM FOURTEEN
3750 PRINT "ROOM FOURTEEN"
3760 REM
3770 REM
3780 RETURN
3790 REM ** ROOM FIFTEEN
3800 PRINT "ROOM FIFTEEN"
3810 REM
3820 REM
3830 RETURN
3840 REM *******************
3850 REM ** DESCRIBE OBJECTS
3860 PRINT
3870 PRINT TAB(3);"You can see :"
3880 IF A(RO,5)<>0 THEN PRINT TAB(4);O$(A(RO,5))
3890 IF A(RO,6)<>0 THEN PRINT TAB(4);O$(A(RO,6))
3900 IF A(RO,7)<>0 THEN PRINT TAB(4);O$(A(RO,7))
3910 FOR Z=1 TO 500:NEXT Z
3920 PRINT
3930 RETURN
3940 REM *************
3950 REM ** INITIALISE
3960 DIM A(16,8),P(5),O$(8),V(20),M$(8),T(5)
3970 REM ** NEXT LINES DECIDE HUMAN ATTRIBUTES
3980 ST=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
3990 CH=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
4000 DE=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
4010 IT=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
4020 WI=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
4030 CO=INT(RND(1)*6+RND(1)*6+RND(1)*6)+3
4040 CASH=0:REM ** TREASURE
4050 RO=9:REM ** STARTING ROOM
4060 QU=1:REM ** END OF GAME FLAG
4070 MK=0:REM ** MONSTERS KILLED
4080 C$=""
4090 REM ** SET UP ROOMS
4100 FOR X=1 TO 16
4110 FOR Y=1 TO 4
4120 READ A(X,Y)
4130 NEXT Y
4140 NEXT X
4150 REM ** DISTRIBUTE TREASURE
4160 FOR Z=1 TO 8
4170 READ O$(Z),V(Z)
4180 NEXT Z
4190 FOR Q=5 TO 8
4200 Z=INT(RND(1)*15+1)
4210 IF A(Z,5)<>0 THEN 4200
4220 A(Z,5)=Q:REM ** OBJECT NO. IN ROOM
4230 NEXT Q
4240 PRINT
4250 REM ** DISTRIBUTE MONSTERS
4260 FOR J=1 TO 8
4270 READ M$(J)
4280 Z=INT(RND(1)*15+1)
4290 IF A(Z,8)<>0 THEN 4280
4300 A(Z,8)=J
4310 NEXT J
4320 CLS
4340 RETURN
4350 REM ******************************
4360 REM ** ROOM DATA
4370 DATA 0,4,0,0:REM * ROOM 1
4380 DATA 0,5,3,0:REM * ROOM 2
4390 DATA 16,0,0,2:REM * ROOM 3
4400 DATA 1,8,5,0:REM * ROOM 4
4410 DATA 2,0,6,4:REM * ROOM 5
4420 DATA 0,0,0,5:REM * ROOM 6
4430 DATA 0,13,0,0:REM * ROOM 7
4440 DATA 4,11,0,0:REM * ROOM 8
4450 DATA 0,12,10,0:REM * ROOM 9
4460 DATA 0,0,0,9:REM * ROOM 10
4470 DATA 8,14,12,0:REM * ROOM 11
4480 DATA 9,0,13,11:REM * ROOM 12
4490 DATA 7,0,0,12:REM * ROOM 13
4500 DATA 11,0,15,0:REM * ROOM 14
4510 DATA 0,0,0,14:REM * ROOM 15
4520 DATA 0,3,0,0:REM * ROOM 16
4530 REM ** OBJECT DATA
4540 DATA "RING",567
4550 DATA "KEY",2
4560 DATA "LOCKET",15
4570 DATA "ELVEN-GOLD",799
4580 DATA "SWORD",0,"AXE",0
4590 DATA "AMYTHEST",27
4600 DATA "CRYSTAL",45
4610 REM ** MONSTER NAMES
4620 DATA "ENTANGLER"
4630 DATA "ARTIFACTUM"
4640 DATA "INKBLOTT"
4650 DATA "UGLY UNDEAD"
4660 DATA "'ORRIBLE ORC"
4670 DATA "ICE-DRAGON"
4680 DATA "EMBIHUUND"
4690 DATA "INSALIVATE"
