20 DIM m$(15), ms(15), md(15), mp(15), mx(15), ma(15): RANDOMIZE TIMER
30 DIM ar$(27), ap(27), ac(27), wp$(43), wc(43), wd(43), wa(43)
40 DIM lx#(1000): CLS : PRINT "Welcome to Dungeon Of Doom. "; a$; ". Startup Process:": PRINT
50 a = 250: FOR z = 1 TO 1000: lx#(z) = lx#(z - 1) + a * z: a = a + 1: NEXT z: PRINT "Player Levels defined"
51 DATA 1,2,0,0,3,0,0,0,4,0,0,0,5,0,6,0,0,7,0,8,9,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,11,12,13,14,0,15,16,1,0,0,0,0,18,19,0,0,20,21,0,0,0,0,0,0,22,23,0,24,0,32,0,0,0,0,0,0,25,0,26,0,27,0,0,0,0,0,0,0,0,28,0,0,0,0,0,0,0,0,0,0,29,0,30,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,0,0,0
52 DIM al%(11, 11): FOR y = 1 TO 11: FOR x = 1 TO 11: READ al%(x, y): NEXT x, y: PRINT "Pharmacological data assembled"
53 DATA Blank Page,0,0,0,Power,1,0,2,Blood Drain,1,0,10,Major Power,1,0,12,Remedy,1,1,1,Mobility,1,1,1,Firestorm,1,0,60,Awaken,1,1,1,Fortitude,1,1,1,Ice Storm,1,0,5,Purgative,1,1,1,Flame,1,0,5,St. Elmo's Fire,1,0,10,Pyrolific Cloud,1,0,12,Sight,1,1,1,Blessing,1,1,1,Fire And Ice,1,0,24,Fireball,1,0,45,Word Of God,1,1,150,Revive,1,1,33,Dark Blessing,1,1,1
54 DATA Cone Of Cold,1,0,40,Escape,0,1,8,Teleport,0,1,6,Restore,1,1,5,Speed,1,0,6,Deposess,1,1,1,Major Speed,1,0,11,Depoison,1,1,1,Heal,1,1,5,Stone To Flesh,1,1,1,Freeze,1,0,3,Magic Map,0,1,2
55 DIM sp$(32), sc(32), sf(32), sp(32)
56 FOR z = 0 TO 32: READ sp$(z), sc(z), sf(z), sp(z): NEXT z: PRINT "Spells loaded"
60 DATA Hands,0,0,0,Stiletto,20,4,1,Hunting Knife,30,6,1,Club,50,8,2,Short Sword,100,12,2,Scimitar,200,15,2
70 DATA Morningstar,400,18,3,Battle Hammer,500,20,3,Battle Axe,750,22,4,Longsword,1000,25,4,Broadsword,1500,26,5
80 DATA Halbard,2000,27,5,Bronze Lance,3000,28,5,Steel Lance,4000,30,5,Earth Hammer,5000,30,10,Sword Of Might,7500,35,10
90 DATA Sword Of Illusion,10000,38,12,Axe Of The Dwarves,15000,40,15,Hammer Of Might,20000,48,20,King Scepter,25000,50,25
100 DATA Rod Of Striking,30000,55,30,Self-keying Orc Sword,35000,60,35,Sword of the Roaches,40000,65,40,Claw of the Witch's Cat,50000,70,45
110 DATA Great Flail,60000,75,50,Light Blade,70000,80,55,Demonstaff,80000,85,60,Frost Blade,90000,90,65,Blast Sword,100000,95,70
120 DATA Meteor Mace,120000,100,75,Storm Sword,140000,110,80,Sword Of Armageddon,160000,120,85
130 DATA Pitchfork Of Satan,180000,130,90,God's Scepter,200000,140,95,Armageddon Axe,300000,150,100
140 DATA Reaver Of The Great Orc,400000,175,110,Thor Hammer,500000,200,120,Hammer Of Death,1000000,250,130,Doom Blade,1500000,300,140,Darkblade,2000000,350,150
145 DATA Annihilation Axe,3000000,400,200,Light Sabre,4000000,450,250,Deathstaff,5000000,500,500,F.A.R.C.E. Scepter,9999999,1000,1000
150 FOR z = 0 TO 43: READ wp$(z), wc(z), wd(z), wa(z): NEXT z: PRINT "Weapon data stored"
155 DATA Blood Root,Mandrake,Wormwood,Sulphur,Holy Water,Astral Tincture,Pixie Dust,Spider Venom,Magic Balm,Frost,Crystal
156 DIM re$(11): FOR z = 1 TO 11: READ re$(z): NEXT z: PRINT "Reagents loaded"
160 DATA Loincloth,0,0,Pants and Shirt,10,1,Woven Robe,20,2,Hemp Robe,50,4,Leather Armor,100,8,Studded Leather,200,10
170 DATA Splint Mail,500,15,Ring Mail,1000,20,Chain Mail,2000,25,Plate Mail,4000,30,Field Plate,6000,35
180 DATA Frost Armor,8000,40,Sun Armor,10000,45,Magic Plate,15000,50,Dragon Plate,20000,60,Ultra Armor,40000,70,Assault Armor,80000,80
190 DATA Robe Of Illusion,100000,90,Robe Of Protection,150000,100,Ultimate Armor,200000,120,Fabric Of Reality,300000,130,Robe Of Power,400000,140,Warding Cloak,500000,150,Force Field,750000,200
195 DATA Vibro Field,1000000,300,Armor Of Light,1500000,400,Robe Of Invulnerability,2000000,500,The F.A.R.C.E. Field,5000000,1000
200 FOR z = 0 TO 27: READ ar$(z), ap(z), ac(z): NEXT z: PRINT "Armor data loaded"
210 DATA Badge Of Courage,Cross Of Spirituality,Dagger Of Sacrifice,Medallion Of Honor,Sword Of Valor,Codex Of Wisdom,Staff Of Humility,Cone Of Power
220 DIM tr$(8), tl(8), tx(8), ty(8), tf(8): FOR z = 1 TO 8: READ tr$(z): NEXT z: PRINT "Treasures loaded"
224 DATA n,s,ns,e,ne,se,nse,w,nw,sw,nsw,ew,new,sew,nsew
225 DIM dr$(15): FOR z = 1 TO 15: READ dr$(z): NEXT z: PRINT "Directionals loaded"
360 NEXT z: FOR z = 1 TO 15: INPUT #1, si(z): NEXT z
361 INPUT #1, bt: FOR z = 1 TO 20: INPUT #1, sb(z): NEXT z
364 CLOSE 1: ON ERROR GOTO 0
365 IF pz = 0 THEN 4000
370 OPEN "lev" + STR$(pz) FOR INPUT AS #1
380 FOR y = 1 TO 20: FOR x = 1 TO 20: INPUT #1, d%(x, y): NEXT x, y: CLOSE 1
390 GOTO 8100
1000 CLS : PRINT " Fifteen years ago, under the rule of king Tomas Veeder XI, the Cone Of": PRINT "Power and the seven treasures of the kingdom had been stolen from the royal": PRINT "palace.": PRINT
1001 OPEN "doomsave" FOR OUTPUT AS 1: CLOSE 1: SHELL "del doomsave": SHELL "copy npcs.org npcs >null:"
1010 PRINT " These treasures, being vital to the success of the kingdom, are rumored to be found deep within the dungeon below the town of Veederville. This dungeon,": PRINT "known to the locals as the Dungeon Of Doom, holds terrors few have lived to": PRINT "speak of.": PRINT
1020 PRINT " You have been commissioned by King Tomas Veeder XII to descend into the": PRINT "Dungeon Of Doom and retrieve them. You are advised to equip yourself with ": PRINT "what you can obtain from the shops in town with the 1000 gold with which you have": PRINT "been provided.": PRINT
1030 PRINT " All of the best wishes for your success. There have been many before you,": PRINT "and time is running out! The neighboring enemy lands have become restless, and": PRINT "hungry for the kingdom's assets. You are the last we can send before we are ": PRINT "conquered by the enemy! Good luck and may you be the one to save the kingdom!": PRINT
1040 INPUT "Enter your character's name to continue"; N$(1)
5440 FOR z = 1 TO nn: INPUT #1, N$, hp, h2, st, dx, wp, ar, lv, xp&, po, pm, mm: IF z <> nh THEN PRINT #2, N$; ","; hp; ","; h2; ","; st; ","; dx; ","; wp; ","; ar; ","; lv; ","; xp&; ","; po; ","; pm; ","; mm
5450 NEXT z: CLOSE 2: CLOSE 1: SHELL "del npcs": SHELL "ren npcs.bak npcs"
5460 nn = nn - 1: PRINT N$(np); " joins your party!": GOTO 5290
6000 CLS
6010 PRINT "Welcome to the Inn Of Veederville!": PRINT
6020 PRINT "Your options:": PRINT
6030 PRINT "1. Get a room for the night"
6040 PRINT "2. Save the game"
6050 PRINT "3. Return to the town square"
6060 PRINT
6070 INPUT "Your choice:", a$: IF a$ = "1" THEN 6100
6080 IF a$ = "2" THEN fl = 1: GOSUB 8610: GOTO 6000
6090 GOTO 4000
6100 ic = 10 * np
6120 PRINT "It costs 10 GP per night per person."
6130 PRINT "Your party will cost"; ic; " GP."
6140 PRINT : IF gp& < ic THEN PRINT "Sorry, you do not have enough gold.": GOTO 6060
6150 INPUT "Would you like a room for the night"; a$: IF a$ <> "y" THEN 6060
6160 gp& = gp& - ic: IF np = 1 THEN PRINT "You go to your room and retire for the evening.": GOTO 6180
6170 PRINT N$(1); " and the members of his party bed down for the evening."
6180 PRINT "You wake up in the morning refreshed!"
6190 FOR z = 1 TO np: oh = hp(z): hp(z) = h2(z): IF (po(z) AND 1) + (po(z) AND 16) + (po(z) AND 128) + (po(z) AND 256) + (po(z) AND 512) > 0 THEN hp(z) = oh
6195 IF pm(z) < mm(z) THEN pm(z) = mm(z)
6200 NEXT z: PRINT : GOTO 6020
7000 CLS
7010 PRINT : PRINT "You are at the adventurer's camp."
7015 PRINT : PRINT "[E]ast of here is the town square,"
7020 PRINT "[S]outh of here is the Dungeon Of Doom."
7022 PRINT "[N]orth of here is a Healer's Hut, the Armory, and the Apothecary."
7023 PRINT "[W]est of here is the Mage's Workshop.": PRINT
7030 PRINT "If you need to see "; N$(INT(np * RND(1)) + 1); "'s status, use the STATS command."
7040 PRINT : FOR zz = 1 TO 8: IF tf(zz) = 1 THEN GOSUB 15000: bb = 0: IF fl = 1 THEN 8540
7045 NEXT zz
7050 INPUT a$: IF a$ = "e" OR a$ = "E" THEN 4000
7055 IF a$ = "W" OR a$ = "w" THEN 16000
7060 IF a$ = "S" OR a$ = "s" THEN 8000
7070 IF a$ = "STATS" OR a$ = "stats" THEN 7090
7071 IF a$ = "CAMP" OR a$ = "camp" THEN na = 1: GOTO 9250
7075 IF a$ = "n" THEN 7140
7080 PRINT "A command not understood by this section was entered.": GOTO 7040
7090 FOR z = 1 TO np: PRINT z; ". "; N$(z): NEXT z
7880 CLS : FOR z = 1 TO 43: PRINT fna$(z); ". "; wp$(z); TAB(30); fna$(wc(z)); " GP": IF z = 23 THEN INPUT "Press ENTER for more"; a$
7890 NEXT z: PRINT : INPUT "Press ENTER to continue"; a$: GOTO 7440
7900 CLS : FOR z = 1 TO 27: PRINT fna$(z); ". "; ar$(z); TAB(30); fna$(ap(z)); " GP": IF z = 23 THEN INPUT "Press ENTER for more"; a$
7910 NEXT z: PRINT : INPUT "Press ENTER to continue"; a$: GOTO 7440
8000 OPEN "exit" FOR INPUT AS #1: INPUT #1, ux, uy: CLOSE 1
8010 OPEN "lev 1" FOR INPUT AS #1: FOR y = 1 TO 20: FOR x = 1 TO 20: INPUT #1, d%(x, y): NEXT x, y: CLOSE 1
8020 px = ux: py = uy: pz = 1
8100 eb = 0: FOR z = 1 TO np: IF (po(z) AND 64) THEN eb = eb + .03
8101 NEXT z: IF RND(1) > .88 + (pz / 1000) - eb AND sc = 0 THEN GOSUB 10000: IF fl = 1 THEN 8540
8102 CLS : sc = 0: a = d%(px, py) AND 15: a$ = "type " + dr$(a): SHELL a$: IF cm = 1 AND RND(1) > .97 THEN cm = 0
8110 IF d%(px, py) AND 16 THEN PRINT "A ladder leads UP from here."
8120 IF d%(px, py) AND 32 THEN PRINT "A ladder descends into the depths from here."
8130 IF d%(px, py) > 63 THEN PRINT "A fountain splashes cool water into a pool here."
8135 GOSUB 9330: GOSUB 8550: IF fl = 1 THEN 8540
8136 FOR z = 1 TO 8: IF tf(z) < 1 THEN IF tx(z) = px AND ty(z) = py AND tl(z) = pz THEN PRINT "You find the "; tr$(z); " and stash it in your pack.": tf(z) = 1
8137 NEXT z: IF am = 1 THEN IF RND(1) > .75 THEN am = 0
8138 IF pz = 20 AND px = 4 AND py = 20 THEN PRINT "You see 'Highway 420' scratched on the wall."
8140 PRINT
8150 INPUT "command, or ? for help"; a$
8155 IF a$ = "?" THEN 8840
8160 IF (a$ = "N" OR a$ = "n") AND (d%(px, py) AND 1) THEN py = py - 1: GOTO 8100
8170 IF (a$ = "S" OR a$ = "s") AND (d%(px, py) AND 2) THEN py = py + 1: GOTO 8100
8180 IF (a$ = "E" OR a$ = "e") AND (d%(px, py) AND 4) THEN px = px + 1: GOTO 8100
8190 IF (a$ = "W" OR a$ = "w") AND (d%(px, py) AND 8) THEN px = px - 1: GOTO 8100
8195 IF a$ = "n" OR a$ = "s" OR a$ = "e" OR a$ = "w" OR a$ = "N" OR a$ = "S" OR a$ = "E" OR a$ = "W" THEN 8101
8200 IF (a$ = "U" OR a$ = "u") AND (d%(px, py) AND 16) THEN pz = pz - 1: GOSUB 9070: GOTO 8260
8202 IF a$ = "camp" OR a$ = "CAMP" THEN 9250
8203 IF a$ = "use" OR a$ = "USE" THEN cs = 0: GOTO 8720
8204 IF a$ = "cast" OR a$ = "CAST" THEN 17000
8210 IF (a$ = "D" OR a$ = "d") AND (d%(px, py) AND 32) THEN pz = pz + 1: GOSUB 9000: GOTO 8280
8220 IF a$ = "STATS" OR a$ = "stats" THEN 8300
8230 IF LEFT$(a$, 5) = "drink" OR LEFT$(a$, 5) = "DRINK" THEN 8400
8240 IF a$ = "save" OR a$ = "SAVE" THEN 8610
8244 IF a$ = "free" OR a$ = "FREE" THEN 9500
8245 IF a$ = "q" OR a$ = "Q" THEN 9200
8250 PRINT "A command entered was not understood. Type ? for a list.": GOTO 8140
8260 IF fl = 1 THEN fl = 0: GOTO 7000
8270 GOTO 8100
8280 IF fl = 0 THEN 8100
8290 PRINT "You get about halfway down the ladder but a force field will not let you pass.": pz = pz - 1: fl = 0: GOTO 8140
8300 FOR zs = 1 TO np: PRINT zs; ". "; N$(zs): NEXT zs
8400 IF d%(px, py) < 64 THEN PRINT "There's no water here to drink!": GOTO 8140
8410 FOR z = 1 TO np: PRINT z; ". "; N$(z): NEXT z
8420 PRINT
8430 INPUT "Who will drink? (0=exit)"; wd
8440 IF wd < 1 OR wd > np THEN 8140
8450 IF hp(wd) = 0 THEN PRINT N$(wd); " is dead.": GOTO 8140
8460 IF d%(px, py) AND 64 THEN 8590
8470 IF d%(px, py) AND 128 THEN 8570
8480 IF d%(px, py) AND 256 THEN 8510
8485 IF d%(px, py) AND 512 THEN 8601
8490 PRINT N$(wd); " drinks the black, stagnant water.": PRINT "Suddenly he collapses to the ground!": hp(wd) = 1: GOTO 8140
8510 PRINT N$(wd); " drinks the yellowish, acrid water.": PRINT "Suddenly he starts screaming in pain!": PRINT "The acid does 75 points of damage!": hp(wd) = hp(wd) - 75: IF hp(wd) < 0 THEN hp(wd) = 0
8520 GOSUB 8550
8530 IF fl = 0 THEN 8140
8540 SHELL "type death.txt": END
8550 fl = 0: cs = 0: FOR z = 1 TO np: cs = cs - (hp(z) > 0): NEXT z: IF cs = 0 THEN fl = 1
8560 RETURN
8570 PRINT N$(wd); " scrapes away some scum and drinks the water underneath.": po(wd) = po(wd) OR 1
8580 PRINT "A few moments later, he feels kind of sick.": GOTO 8140
8590 PRINT N$(wd); " drinks some of the clear, cool water.": IF (po(wd) AND 1) + (po(wd) AND 16) + (po(wd) AND 256) + (po(wd) AND 512) > 0 THEN PRINT "No effect!": GOTO 8140
8600 hp(wd) = h2(wd): PRINT N$(wd); " recovers all of his lost hit points!": GOTO 8140
8601 PRINT N$(wd); " drinks some of the water then immediately collapses to the ground!": hp(wd) = 1: GOTO 8140
8610 PRINT "Saving the game...";
8620 OPEN "doomsave" FOR OUTPUT AS 1
8630 PRINT #1, px; ","; py; ","; pz
8640 PRINT #1, gp&
8650 FOR z = 1 TO 8: PRINT #1, tf(z); ","; tl(z); ","; tx(z); ","; ty(z): NEXT z
8831 IF a = 14 AND hp(b) > 0 THEN PRINT N$(b); " is alive and well. No effect!": si(14) = si(14) - 1: GOTO 8140
IF a = 14 THEN PRINT N$(b); " is treated with the Revival Balm!": PRINT N$(b); " is revived!": hp(b) = INT(h2(b) * RND(1)) + 1: si(14) = si(14) - 1: GOTO 8140
8832 IF a = 13 THEN 8836
8833 IF hp(b) = 0 THEN PRINT N$(b); " is dead!": GOTO 8780
8840 CLS : PRINT "Commands available in the dungeon": PRINT
8850 PRINT "N,S,E,W,U,D are directional commands to allow you to move from room"
8860 PRINT "to room, and up or down levels, as appropriate.": PRINT
8870 PRINT "STATS will show character, party, or inventory status."
8880 PRINT "USE will allow you to use apothecary items to cure abnormal status."
8888 PRINT "CAST will allow you to cast a field spell."
8890 PRINT "CAMP will allow you to camp for a night to regain HP and MP."
8900 PRINT "DRINK will allow you to drink water from fountains in the rooms."
8910 PRINT "SAVE saves the game so that you can continue later."
8920 PRINT "Q will let you quit the game gracefully.": PRINT
8930 GOTO 8140
9000 fl = 0: IF tf(1) < 3 AND pz = 11 THEN fl = 1: RETURN
9010 IF tf(2) < 3 AND pz = 21 THEN fl = 1: RETURN
9020 IF tf(3) < 3 AND pz = 31 THEN fl = 1: RETURN
9030 IF tf(4) < 3 AND pz = 41 THEN fl = 1: RETURN
9040 IF tf(5) < 3 AND pz = 51 THEN fl = 1: RETURN
9050 IF tf(6) < 3 AND pz = 61 THEN fl = 1: RETURN
9060 IF tf(7) < 3 AND pz = 70 THEN fl = 1: RETURN
9070 IF pz = 0 THEN fl = 1: RETURN
9080 OPEN "lev" + STR$(pz) FOR INPUT AS #1
9090 FOR y = 1 TO 20: FOR x = 1 TO 20: INPUT #1, d%(x, y): NEXT x, y
9100 CLOSE 1
9110 RETURN
9200 PRINT "You have chosen to quit.": PRINT
9210 INPUT "Type Y to confirm, or anything else to abort "; a$
9220 IF a$ <> "Y" AND a$ <> "y" THEN PRINT "Aborted!": PRINT : GOTO 8140
9230 PRINT "Game Ended."
9240 END
9250 PRINT "You have chosen to camp for a night.": PRINT : IF cm = 1 THEN PRINT N$(INT(np * RND(1)) + 1); " opposes camping right now, says he's not tired.": GOTO 9321
9251 IF np = 1 THEN PRINT N$(1); " lies down on the cold stone floor and tries to get some sleep.": GOTO 9265
9252 IF am = 1 THEN PRINT "It is too dangerous to camp right now.": GOTO 9321
10621 IF (po(cp) AND 1) THEN hp(cp) = hp(cp) - (INT(3 * RND(1)) + 1): IF hp(cp) < 1 THEN hp(cp) = 0: PRINT N$(cp); " collapses from the effect of the poison!"
10622 IF (po(cp) AND 128) THEN hp(cp) = hp(cp) - (INT(10 * RND(1)) + 1): IF hp(cp) < 1 THEN hp(cp) = 0: PRINT N$(cp); " dies from the parasites in his body!"
10623 IF (po(cp) AND 256) THEN hp(cp) = hp(cp) - (INT(25 * RND(1)) + 1): IF hp(cp) < 1 THEN hp(cp) = 0: PRINT N$(cp); " dies from the holy disease!"
10625 IF hp(cp) = 0 THEN cp = cp + 1: GOTO 10620
10626 IF (po(cp) AND 2) + (po(cp) AND 8) + (po(cp) AND 512) + (po(cp) AND 1024) > 0 THEN cp = cp + 1: GOTO 10620
10627 IF (po(cp) AND 32) THEN GOSUB 14000: cp = cp + 1: GOTO 10635
10628 IF cs(cp) > 0 THEN 19000
10629 IF pa(cp) = 0 THEN GOSUB 10800: cp = cp + 1: GOTO 10635
10630 GOSUB 11000
10631 cp = cp + 1
10635 IF fl = 1 THEN 11100
10636 IF fl = 2 THEN 8540
10640 IF cm > nm AND cp > np THEN 10680
10650 IF cm > nm THEN 10620
10655 IF mp(cm) = 0 THEN cm = cm + 1: GOTO 10650
10660 GOSUB 12000: cm = cm + 1: IF fl = 1 THEN 8540
10670 GOTO 10620
10680 PRINT : PRINT "Press Enter to continue"; : INPUT "", a$: GOTO 10280
10690 FOR y = 1 TO 15: PRINT y; "."; TAB(7); si$(y); TAB(23); " inv:"; si(y); TAB(37); "cures:"; as$(y): NEXT y
10700 PRINT : INPUT "Use which item (0 to abort)"; a: IF a < 1 OR a > 15 THEN 10500
10710 IF si(a) = 0 THEN PRINT "You do not have this in your inventory!": GOTO 8740
10720 FOR y = 1 TO np
10730 PRINT y; ". "; N$(y); TAB(30);
FOR q = 1 TO 12: IF po(y) AND (2 ^ (q - 1)) THEN PRINT as$(q); : cs = cs + 1
NEXT q: IF hp(y) = 0 THEN PRINT " DEAD"; : cs = 1
IF cs = 0 THEN PRINT " Normal" ELSE cs = 0: PRINT
10740 NEXT y
10750 PRINT : INPUT "Use this on who?"; b
10760 IF b < 1 OR b > np THEN 10700
10770 IF hp(b) = 0 AND a <> 14 THEN PRINT N$(b); " is dead.": GOTO 10750
17000 CLS : FOR z = 1 TO fnb(a): PRINT z; "."; sp$(sb(z)): NEXT z
17010 PRINT : INPUT "cast which spell"; a
17020 IF a < 1 OR a > fnb(z) THEN 8140
17030 IF sb(a) = 0 THEN PRINT "The page you selected is blank.": PRINT : GOTO 8140
17040 a = sb(a)
17050 IF sf(a) = 0 THEN PRINT sp$(a); " can only be cast in combat.": PRINT : GOTO 8140
17070 FOR y = 1 TO np: cs = 0
17080 PRINT y; ". "; N$(y); TAB(30);
FOR q = 1 TO 12: IF po(y) AND (2 ^ (q - 1)) THEN PRINT as$(q); : cs = cs + 1
NEXT q: IF hp(y) = 0 THEN PRINT " DEAD"; : cs = 1
IF cs = 0 THEN PRINT " Normal" ELSE cs = 0: PRINT
17090 NEXT y
17100 PRINT : INPUT "Who will cast this spell"; c
17105 IF c < 1 OR c > np THEN PRINT : GOTO 8140
17110 IF hp(c) = 0 THEN PRINT N$(c); " is dead.": GOTO 17100
17120 IF (po(c) AND 2) OR (po(c) AND 8) OR (po(c) AND 512) OR (po(c) AND 1024) OR (po(c) AND 2048) THEN PRINT N$(c); " cannot cast spells.": GOTO 17100
17130 IF pm(c) < sp(a) THEN PRINT N$(c); " does not have enough magic points.": PRINT : GOTO 8140
17140 IF a = 18 OR a = 22 OR a = 23 THEN 17440
17145 IF a = 32 THEN 20000
17150 FOR y = 1 TO np: cs = 0
17160 PRINT y; ". "; N$(y); TAB(30);
FOR q = 1 TO 12: IF po(y) AND (2 ^ (q - 1)) THEN PRINT as$(q); : cs = cs + 1
NEXT q: IF hp(y) = 0 THEN PRINT " DEAD"; : cs = 1
IF cs = 0 THEN PRINT " Normal" ELSE cs = 0: PRINT
17170 NEXT y
17180 PRINT : INPUT "Cast this on whom"; b
17190 IF b < 1 OR b > np THEN 8140
17200 IF a = 4 THEN pu = 1: po = 16: c$ = " DIS": GOTO 17350
17210 IF a = 5 THEN pu = 1: po = 8: c$ = " PAR": GOTO 17350
17220 IF a = 7 THEN pu = 1: po = 2: c$ = " ZZZ": GOTO 17350
17230 IF a = 8 THEN pu = 1: po = 4: c$ = " CNF": GOTO 17350
17240 IF a = 10 THEN pu = 1: po = 128: c$ = " WRM": GOTO 17350
17250 IF a = 14 THEN pu = 1: po = 1024: c$ = " BLI": GOTO 17350
17260 IF a = 15 THEN pu = 1: po = 64: c$ = " EVL": GOTO 17350
17270 IF a = 19 THEN 17370
17280 IF a = 20 THEN pu = 1: po = 256: c$ = " HOL": GOTO 17350
17290 IF a = 24 THEN 17400
17300 IF a = 26 THEN pu = 1: po = 32: c$ = " CHR": GOTO 17350
17310 IF a = 28 THEN pu = 1: po = 1: c$ = " POI": GOTO 17350
17320 IF a = 29 THEN 17420
17330 IF a = 30 THEN pu = 1: po = 512: c$ = " STN": GOTO 17350
17340 GOTO 8140
17350 PRINT N$(c); " casts "; sp$(a); " on "; N$(b); ", "; : IF po(b) AND po = 0 THEN PRINT "with no effect!": pm(c) = pm(c) - pu: GOTO 8140
17380 IF hp(b) > 0 THEN PRINT "without effect!": GOTO 8140
17390 hp(b) = INT(h2(b) * RND(1)) + 1: PRINT "reviving him from the dead!": GOTO 8140
17400 PRINT N$(c); " casts Restore on "; N$(b); ","; : pm(c) = pm(c) - 5: IF po(b) = 0 THEN PRINT "without effect!": GOTO 8140
17410 po(b) = 0: PRINT "curing all abnormalities!": GOTO 8140
17420 PRINT N$(c); " casts Heal on "; N$(b); ", "; : pm(c) = pm(c) - 5: IF (po(b) AND 8) OR (po(b) AND 16) OR (po(b) AND 512) THEN PRINT "No effect!": GOTO 8140
17670 cs = 0: FOR z = 1 TO np: cs = cs - (hp(z) = 0): NEXT z: IF cs = 0 THEN PRINT "No effect!": GOTO 8140
17680 FOR z = 1 TO np: IF hp(z) = 0 THEN hp(z) = h2(z): PRINT N$(z); " has been revived!": po(z) = 0
17690 NEXT z: GOTO 8140
17700 PRINT N$(c); " casts Escape!": pm(c) = pm(c) - 8: FOR z = 1 TO 10000: NEXT z
17710 pz = 0: GOTO 7000
18000 IF (po(z) AND 4) OR (po(z) AND 2048) THEN PRINT "This character cannot cast spells.": GOTO 10500
18011 CLS : FOR zq = 1 TO fnb(a): PRINT zq; "."; sp$(sb(zq)): NEXT zq
18010 PRINT : INPUT "cast which spell"; a
18020 IF a < 1 OR a > fnb(z) THEN 10500
18030 IF sb(a) = 0 THEN PRINT "The page you selected is blank.": PRINT : GOTO 10500
18040 a = sb(a)
18050 IF sc(a) = 0 THEN PRINT sp$(a); " cannot be cast in combat.": PRINT : GOTO 10500
18060 IF pm(z) < sp(a) THEN PRINT "Not enough MP to cast this spell.": GOTO 18010
18070 cs(z) = a: IF a = 1 OR a = 4 OR a = 5 OR a = 7 OR a = 8 OR a = 10 OR a = 14 OR a = 15 OR a = 19 OR a = 20 OR a = 24 OR a = 25 OR a = 26 OR a = 28 OR a = 29 OR a = 30 THEN 18110
18080 IF a = 2 OR a = 11 OR a = 12 OR a = 31 THEN 18100
18090 pa(z) = 0: GOTO 10580
18100 PRINT "Spell set. Select monster to attack from list.": PRINT : GOTO 10510
18110 FOR y = 1 TO np: cs = 0
18120 PRINT y; ". "; N$(y); TAB(30);
FOR q = 1 TO 12: IF po(y) AND (2 ^ (q - 1)) THEN PRINT as$(q); : cs = cs + 1