WARLOCK by Hugh Walker from ZX Computing Apr/May.1984 Danger, magic, monsters and gold await you in Hugh Walker's super Spectrum game. In the Aug/Sept issue of ZX Computing we printed a program called House of Horror for the ZX81 by Chris Cox. Hugh Walker has modified it for the Spectrum and added many new items which turn it into a totally different program! One of the problems with adventure games is that you can often complete the game from the knowledge gained by entering it. Hugh has adopted two methods to prevent this from spoiling your pleasure. Firstly he has not REMmed the listing and has laid it out in an illogical way, and secondly he has used random elements to provide surprises without losing too much player skill. You are a 'novice-hero' whose task is to raid the Warlock's mansion and find all his gold, using the keys which you find to unlock any doors and fighting off his pet monsters with your sword and shield. Each key may he used once only, but not all the doors are locked. The questionable ethics of a young hero turning thief are satisfied by the fact that the Warlock's treasure has been extorted from the oppressed peasants in his locality. Should you be successful, you will, no doubt, restore the gold to its rightful owners. The hero- rating which you acquire directly reflects the amount of gold you have found, and no one, except the Warlock, can take this from you. (Indeed, it is possible that, in some future program, you will return as a wiser, stronger hero to deal with the Warlock permanently!) To find the treasure and the keys you must open doors, explore hallways and defeat monsters whenever the opportunity arises. However, you may not find anything and be given an opportunity to rest and build up your strength. This strength is limited and it is reduced by fighting, so the opportunity to rest is useful. The Warlock is away at the start of the game, but he may return and catch you. If he does he will either fight you, proving difficult to chase away, or he will use his magic to turn you into a small creature, robbing you of your hero status (hero- rating). When you have collected all the treasure you will be congratulated and told to find your way out "... if you can!" The way out is through a door on level 0 so you are also told which level you are on. You then have to make your way to level 0, open the door (which may be locked) and leave, triumphantly. Whenever you are confronted by a monster or the Warlock himself in a fighting mood, you will be given the option to "hit it (him)" or to "run away". You cannot kill the monsters (you are only a young hero) but you can chase them away. However, some are difficult to defeat and each blow you deliver uses up some of your strength. If you use up all your strength, then you have lost! Nevertheless, if you choose to run away you will be called a COWARD and lose some of your HQ (hero- quotient), and you MAY lose some treasure ... or, you MAY be trapped by the monster. Your HQ is a factor in calculating your 'Hero- rating' ... so your honour is at stake! If your attempt to hit the monster, or Warlock, fails to chase it away or your attempt to run away has been unsuccessful, you will be given the option to "hit it" or "run away" again. As you move around the mansion you will find one of three locations: 'Door', 'Hallway' and 'Stairway'. Oh! By the way, only the computer knows what the total amount of treasure to be found is and it won't tell you until you have reached that amount (it will be between 1500 and 2500 coins). Good luck! 1. Door: (may be locked): you have two options : 'Open' or 'Leave'. If you open the door, you may find a reward ... or a monster ... or nothing, and have to leave. If the door is locked and you have no key, then you have to leave ... each time you leave a location, whether by choice or not, you risk meeting a monster, which may result in loss of treasure. 2. Hallway: three options : 'Move', 'Explore', or 'Status'. Move: moving backwards or sideways may result in a bump on the head from a low beam, causing some loss of strength; moving forwards is safe because you would see the low beam in front of you! Explore: you may find treasure, a key, a rest, a monster or another location or nothing and have to leave ... with the same risk as above. Status: Lists your possessions, what level you are on and returns you to the options 'Move, Explore or Status' when you are ready. 3 Stairway: three options : 'Up', 'Down' or 'Leave'. You will not know if the stairway goes up or down until you try. If you make the wrong choice you will have to leave. Variables 1. The following are DIMensioned arrays, READ from DATA. m$(9,9) : The name of each monster (and Warlock). a$(3,9) : The three locations found (door, hallway, stairway). k$(3,6) : The three small creatures into which the Warlock may turn you. m(9) : The resistance of each monster to your blows. n(9) : The endurance of each monster to withstand successful blows. g(9) : The value by which your Hero-quotient is increased when you beat each monster and the length of each monster's name (for tabulation in lines 3090 and 3110). z(11) : The length of the BEEPs in line 4000. y(11) : The pitch of the BEEPs in line 4000. 2. The following are 'single' variables. hi : High Score, carried forward to successive games ('hi' = 'hr') *hr : Hero-rating; ie. overall score in each game. hq : Hero-quotient, increased by defeating monsters (by a randomly-adjusted value of 'g'). ded : The number of monsters beaten. ht : The force of your blow when you hit a monster (randomly selected). blo : The value by which a successful blow reduces the monster's endurance. mn : Random value (1 to 9) to select monster from m$ (array), and associated values of 'm', 'n', and 'g'. str : Your strength, initially 500: reduced by fighting or bumping your head: increased by resting. wl : The value by which 'str' is reduced when you bump your head (randomly selected). tres : The maximum amount of treasure to find (between 1500 and 2500; randomly selected). tr : A logic variable to change course of program when 'tres' has been reached. It prevents more treasure being found and allows you to leave from line 1630 if you're on level 0. csh : The amount of treasure you possess. cn : The amount of treasure found each time. ky : The number of keys in your possession. wy : Random value (1 to 3) to select a$ and direct GO SUB in line 140. fl : The level (floor) which you are on. bp : Used in lines 400 to 460; 'bp' = +1 for 'Up' and bp = -1 for 'Down'; it alters 'fl' and the pitch of the BEEP routine (line 460). (* Your hero-rating is calculated by adding 'csh' + ('ky'*5) + 'hq' and is uprated each time you change your location). In the course of the program 'f', 'i' and 'h' are used as FOR- NEXT variables for various purposes. Please note: 1 Unlabeled Random-values are used to direct some of the 'GO TOs'. 2 INKEY$ is used for your responses to the various options offered you. This allows single-key entries to speed up operation of the game. However, PAUSEs and BEEPs have to be used to slow down the display. Program description Line 20 : Initialise High Score for successive games. Lines 50-60 : Initialise each game (routine completed by calling subroutine 5000 to 5500). Lines 100-150 : 'Core-routine' to which all other routines return. Selects and PRINTs locations and directs GO SUB for each. Location: (lines 200 to 460) Lines 200-220 : 'Hallway' PRINTs and acts on options, using 'GO TO' : 500, 600, or 700. Lines 300-330 : 'Door' PRINTS and acts on options using 'GO TO': 800 or 8200. Lines 400-460 : 'Stairway' PRINTs and acts on options, routine complete. Response to 'Hallway' routine: (lines 500 to 780) Lines 500-520 : Move selected by INKEY$ "1" in line 220; PRINTs etc options (complete). Line 600 : 'Explore' selected by INKEY$ "2" in line 220; uses 'GO TO' line 1650. Lines 700-780 : 'Status' selected by INKEY$ "3" in line 220, PRINTs possession, score, what level you are on and returns to line 200 when you are ready. Response to 'Door' routine: Line 800 : 'Open' selected by INKEY$ "1" in line 320. Random chance of: (GO TO 1500 door locked) or (GO TO 1600 door open). Responses to 'Explore' and 'Door' opens': (lines 1000 to 1460) Lines 1000-1800 : 'Meet Monster' routine; Selects monster, (from 1650) PRINTS and acts on options to fight (GO TO line 3000) (or 8200) or run away (GO TO line 8500) or random chance of monster stealing gold instead of fighting and if Warlock is met, random chance of Warlock using magic (GO TO line 1700). Lines 1100-1150 : 'Find gold' routine, from line 1650 (also from line 3130). If maximum amount has not been found, calculates amount of each find (amount reduces in proportion to total already found), PRINTs amount found and increments gold score, then checks gold score against maximum. Lines 1200-1220 : 'Find key' routine from line 1650 (also from line 3130). Random chance of finding a key, or another location. If a key is found, PRINTs and increments one key to key score. Line 1300 : 'Find nothing' routine; uses lines (from 1650) 8000 to 8210 to complete routine. Lines 1400-1460 : 'Find rest' routine; random chance of (from 1650) finding rest or another location. If rest, then PRINTs, BEEPs and increments strength score. Continuation of 'Door' routine: (lines 1500 to 1650) from line 800 Lines 1500-1550 : 'Door locked' routine; checks if you have a key (if not then GO TO 6500). If you have a key, then asks if you want to use it. (If "No" GO TO 6500). If "Yes" then decrements one from key-score and carries on to line 1600. Lines 1600-1650 : 'Door opens' routine; (from line 1550 or line 800). PRINTs, uses 4100 for BEEPs, checks if you have finished and randomly selects 'GO TO': lines 1000, or 1100 or 1200 or 1300 or 1400. END routines: (Lines 1700 to 2050) Lines 1700-1770 : 'Bitter End' routine; (Warlock 'uses magic') from line 1030. PRINTs, selecting k$ from array, uses line 1900 to 1950 to complete. Lines 1800-1880 : 'Successful End' routine; from line 1630. PRINTs scores and uses 1900 to 1950 to complete. Lines 1900-1950 : 'Hi score' and 'Play again' routines; from lines 1770, 1880 or 2050. Increments High Score and asks if you want to try again. If "Yes" then goes to line 50; if "No" then STOPs. Lines 2000-2050 : 'Out of Strength' routine; from line 3010. PRINTs and uses lines 1850 to 1950 to complete. Lines 2500-2570 : 'All treasure found' routine; from line 1140. PRINTs, sets logic variable tr to 1, returns to 'core-routine' (L 100). Fight Routine: (lines 3000 to 3130), from line 1080 Lines 3000-3040 : Calculates the force of your blow, decrements strength, checks to see if you injured the monster; if you did, then 'GO TO' line 3050; if you did not, then goes to line 1050 for another try. Lines 3050-3130 : Calculates how badly you hurt the monster, decrements monster's endurance; if monster is still fit to fight, then returns to line 1050, if monster is not fit to continue then PRINTs, increments 'hero-quotient', uses 'GO TO': 1100 or 1200 for reward. Line 3500 : 'Title' subroutine: PRINTs title, used by various parts of program to which it returns. Lines 4000-4500 : BEEP routines (subroutines). Returns to 'core-routine' if 'GO TO 4000' etc. is used. Lines 5000-5190 : 'Initialise routine' subroutine called by line 60. DIMs arrays, READs arrays from DATA (lines 7500 to 7800), PRINTs instructions and initialises variables, uses line 5500 to continue. Line 5500 : 'CONTINUE' routine; from various parts of program, returns to 'Core-routine' (1200). Lines 6000-6050 : 'Monster steals gold' routine; from line 1040. PRINTs, decrements gold-score, PRINTs new gold- score, checks if new gold-score is below maximum and resets tr if necessary. Line 6500 : "No!" routine from lines 1510, 1540; uses GO TO 8000 to continue. Line 8000 : 'Leave' routine from lines: 320, 430, 1300, 1460 and 6500 - carries on to L 8200. Lines 8200-8210 : Random chance of meeting another monster. From lines 330, 420 and 8000. Lines 8500-8530 : 'Run away' routine; from line 1070. PRINTs "Coward" and decrements 'hero-quotient' then random chance of: Line 8520 : (a) Dropping gold uses GO TO 6010 to decrement gold-score and return to 'core-routine'. Line 8540 : (b) being trapped; returns to line 1050 for another try. Lines 9000-9050 : 'SAVE' routine; accessed by 'BREAK', 'GO TO 9000'. Further developments 1. A lateral dimension could be added to this program so that the 'Move' routine translates sideways, forwards or backwards; within a 2-dimensional array from a fixed entry point to a fixed exit point, maintaining the vertical dimension ('fl') requirements to qualify for successful exit at line 1630. This exit point could be randomly generated in each game and added to the exit requirements at line 1630. 2. A random value could be generated (say between 0 and 10) as the vertical dimension which 'fl' would have to equal to qualify for successful exit at line 1630. -- Another Fine Product transcribed by: Jim Grimwood (jimg@globalnet.co.uk), Weardale, England --