(This is the "Dungeon Designs" column from the December 1994 issue of the Eamon Adventurer's Guild newsletter. Copyright 1994 Eamon Adventurer's Guild, 7625 Hawkhaven Dr., Clemmons, NC 27012-9408. You may reproduce this freely as long as this credit remains attached to the article.) CORRECTION: The DEC'90 article on how to make a 10-direction had a bug in the small program that modifies EAMON.NAME. Here is the correct program: 10 D$ = CHR$(4) 20 PRINT D$"OPEN EAMON.NAME" 30 PRINT D$"READ EAMON.NAME" 40 INPUT AN$: INPUT ND$: INPUT DV$ 50 PRINT D$"CLOSE" 60 PRINT D$"OPEN EAMON.NAME" 70 PRINT D$"WRITE EAMON.NAME" 80 PRINT AN$: PRINT "10": PRINT DV$ 90 PRINT D$"CLOSE" ________________________________________________ A Tour of the MAIN PGM 7.1 (Part II) 7000-7370 ATTACK routine 7010 check for Ready Weapon, abort if none 7020 check to see if object of attack is named; search for match to monster; if match proceed to line 7300 7030 check to see if object of attack is an artifact in the room; if no match then abort to print error message at 94 7040-7080 perform attack on artifact 7040 if object is not door or container then abort attack; exit routine 7050 set "dice" and "sides" to weapon stats; if attacking through BLAST spell then set "dice" to 2 and "sides" to 5 7060 set up database variables for door; if object is container then set variables for container 7070 perform attack on object; if object strength is reduced to zero then print SHATTERS message and open it 7075 if object is hidden door then unhide it 7080 print WHAM!!! message 7300-7370 perform attack on monster 7300 define attacker (OF) and defender (DF); proceed to DO BATTLE routine 7310 if successful hit then check to see if weapon ability should be increased; increase weapon ability 7360 if defender was enemy or self then exit to PICK FOE routine 7370 if defender was friend or neutral then calculate whether alignment changes and update group totals; exit to PICK FOE 7400-7450 MONSTER PICKS UP WEAPON subroutine 7410 find artifact number of weapon that monster had dropped; if available then go to 7440 7420 search room for available weapons; identify best weapon found 7440 if weapon found then pick up and assign as monster's ready weapon 7450 exit to calling routine by way of screen pause check 7500-7900 DO BATTLE routine 7505 reset "Hit" flag; set W to Artifact number of attacker's weapon; if no weapon then go to PICKS UP WEAPON routine 7507 compute percent odds of scoring hit (WM) 7510 select correct attack verb. Print attack 7511 check line count; generate random number RL in 1-100 range; if RL is less than 5 or the computed odds WM and also less than 97 (3% chance of fumble) then set Hit flag and proceed to damage computation 7515 if defender is carrying a real weapon then set A2 to weapon type, or set to 0 if natural weapon 7520 if RL < 97 or the attacker is using natural weapons, then print a "Miss" verb and exit through screen pause routine (97% chance) 7525 print "A FUMBLE" (3% chance) and generate random number R; if R < 41 (40% chance) then print FUMBLE RECOVERED and exit through screen pause routine 7530 if R < 81 (40% chance) then drop attacker's weapon; adjust Weight Carried; put weapon in Room; set attacker's weapon to None; exit through screen pause routine 7532 if attacker's weapon is magical then print SPARKS FLY message and exit through screen pause routine 7535 if R > 95 then proceed to WEAPON HITS USER (5% chance) 7537 if R < 91 (90% chance) then print WEAPON DAMAGED and lower weapon sides by 1; if sides is greater than zero then exit through screen pause routine 7540 if sides equals zero then print WEAPON BROKEN; lower Weight Carried by weapon weight; set weapon location to zero; set weapon carried to None; generate random number; if more than .5 then exit through screen pause routine (50% chance) 7545 print WEAPON HITS USER; check screen pause; set DF to attacker for damage computation; proceed to damage computation unless R = 100 then proceed to WELL STRUCK computation 7600 if player is attacker then compute possible increase in weapon and armor expertise 7605 set Dice and Sides to monster's stats; if carrying weapon then use weapon stats 7607 set Defender's armor factor to 1; Print "** A HIT" if defender is player or "++ A HIT" if monster; if RL > 5 then proceed to damage computation (95% chance) 7610 print WELL STRUCK! (5% chance); check screen pause; generate random number R2; if R2 < 51 then set Defender's armor factor to zero (50% chance); proceed to damage computation 7615 set RL to 1.5 (85% chance); if R2 > 85 and RL < 95 then set Rl to 2 (10% chance) 7620 if R2 < 100 then set RL to 3 (4% chance) 7625 set RL to Defender's Hardiness (a sure Death Blow; 1% chance) 7630 multiply Sides by RL to increase damage 7633 check for screen pause; compute hit damage D2; reduce D2 by defender's armor multiplied by armor factor set in 7607-7610; if D2 is not positive number then no damage; if defender not wearing armor then print BLOW TURNED and exit through screen pause routine 7635 if D2 is not positive then print BLOW BOUNCES OFF ARMOR; exit through screen pause routine 7636 print blank line 7637 check for screen pause; if defender is multiple-monster then print ONE 7638 print monster's name and IS 7640 compute hit damage to defender and defender's room-group total; if hits equal or exceed defender hardiness then proceed to MONSTER DIES routine 7650 proceed to appropriate damage report 7652-7675 damage reports; exit through screen pause routine 7700 MONSTER DIES routine 7710 print DEAD!; remove dead monster from room group total; if multiple-monster then reduce monster count by one and set hits to zero for next member of multiple- monster and exit through screen pause routine 7720 remove dead monster from room; if multiple- monster then reset total to original value; place all artifacts carried by dead monster in room 7730 set dead monster's weapon to None 7735 inactive line that is used for optional dead bodies; if activated, places dead monster's body artifact in room 7740 if Defender is player then set DIe flag; remove DO BATTLE subroutine from stack with POP; proceed to DONE routine 7750 if room group hits equals or exceeds room group hardiness then all foes have been killed; reset group hardiness to zero to indicate there are no hostiles in room 7900 exit through screen pause routine 8000 FLEE routine 8010 if no hostiles in room then print NOTHING TO FLEE FROM and exit to YOU SEE routine 8020 if no exits then print NO PLACE TO GO and exit to YOU SEE routine 8030 if no direction specified to flee to then proceed to flee in random direction 8040 find direction specified 8050 proceed to MOVE routine 8500 find random direction to flee 8510 proceed to GO routine 9000-9900 GIVE routine 9010 run object through PARSE routine to see if it parses into full command (GIVE XX TO YY) 9040 if not full command then ask GIVE WHAT? 9050 if artifact given has no numeric value, then it's not gold; check to see if is carried by player; if not, then exit through error message at 91 9060 if not full command, then ask TO WHOM? 9070 check to see if named monster is in room; if not, exit through error message at 96 9080 print OKAY; if gold is being given then proceed to GOLD routine 9090 if artifact is player's weapon then mark player as unarmed 9095 if artifact is drinkable and monster is wounded and artifact has swallows left and is open then proceed to MONSTER HEAL routine 9100 reduce weight carried by weight of artifact given; mark artifact as carried by monster it was given to 9110 if monster was unarmed and artifact is weapon then mark artifact as monster's ready weapon 9115 if monster not Friendly then redefine monster's original potential Friendliness in terms of artifact's value 9120 reassess monster's Friendliness; jump into DROP routine to check for effects on player of losing artifact 9300-9320 HEAL MONSTER routine 9300 print that monster drinks and returns artifact to player; check for screen pause; if not Friendly then redefine monster's potential friendliness; reduce "swallows left" by one 9320 heal/poison monster; print health report; return to GIVE routine 9500-9550 GOLD routine 9500 find amount of gold to be given; if more than player carries then exit through error message at 91 9540 reduce player's gold; redefine monster's potential Friendliness in terms of amount of gold given 9550 return to GIVE routine 9800-9820 PARSE routine 9810 try to break command object into artifact and monster names (eg: GIVE XX TO YY will break into artifact XX and monster YY) 9820 return to GIVE routine 10000-10150 INVENTORY routine 10010 if no object named then inventory self 10020 if no light then abort to YOU SEE routine 10030 search for match to monster name; if no match then abort to error message 10040 If named monster is not Friend then exit through SMILE routine to give response 10050 set X to location of named monster's stuff and jump to do inventory 10060 search for worn artifacts; if none found then bypass "worn" code 10070 print "IS WEARING" line and check for screen pause 10080 print worn artifact name 10090 check for more; set X to location of player's stuff 10100 print "IS CARRYING" line and check for screen pause 10110 search for carried artifacts; if none found then skip to "(NOTHING)" line 10120 print artifact name; if ready weapon then print "(READY WEAPON)" 10130 check for screen pause; check for more; if no artifacts were found then print "(NOTHING)"; check for screen pause 10140 if player being inventoried then print gold; check for screen pause; print player's health condition 10150 exit to PICK FOE routine 11000-11050 BLAST routine 11010 set S to BLAST; go execute spellcast; check if spell object is named; search for match to monster name; if no match then proceed to ATTACK routine to try for artifact match 11050 print DIRECT HIT message; increment line counter; set "sides" to 5 and "dice" to 2; use code in DO BATTLE routine to compute and print hit damage; exit to PICK FOE routine 11500-11540 SPELLCAST subroutine 11500 if player has ability for cast spell, use random number RL to determine result 11505 if RL = 100 (1% chance) then print SPELL BACKLASH! message; diminish current spell ability by 90%; exit through screen pause check to PICK FOE routine 11510 if spellcast unsuccessful, then print NOTHING HAPPENED message and exit through screen pause to PICK FOE routine 11520 use random number to determine if permanent spell ability is increased by 2 11530 diminish current spell ability by 20% 11540 exit to calling spell routine