' CHARACTER GENERATOR FOR EAMON UNIVERSE
' ORIGINAL VERSION FOR APPLE II BY DONALD BROWN
' MICROSOFT VERSION BY JON WALKER FOR MS-DOS & CP/M
'
' (Fixed to run under QBASIC by Frank Black, 2/97)
'
'    ENJOY!
'
' CNAME$: CHARACTER NAME      HD: HARDINESS  AG: AGILITY  CH: CHARISMA
'
' SA(1)-SA(4):SPELL ABILITIES
' WA(1)-WA(5):WEAPON ABILITIES
'
' AE: AMROUR EXPERT.  SEX$: M OR F  GOLD: ON PERSON  BANK: GOLD IN BANK
' AC: ARMOUR CLASS
'
' WEAPON INFO:
'  WNAME$: WEAPON NAME
'  WTYPE: TYPE   WODDS:ODDS OF HIT   WDICE:# OF DICE  WSIDE:# OF SIDES
'
RANDOMIZE VAL(RIGHT$(TIME$, 2))
'
DEF FNR (X) = INT(X * RND(1) + 1)
DEF FNA (X) = FNR(X) + FNR(X) + FNR(X)
q$ = CHR$(34)
OPEN "ADVENTUR.ER" FOR INPUT AS #1: INPUT #1, cname$, rec: CLOSE
COLOR 7: PRINT : PRINT
'
GetSex:
PRINT "The Irishman says, "; q$; "First I must know whether ye be male or female.  Which are"
PRINT "ye?"; q$; " (Hit 'M' for male, 'F' for female) "; : GOSUB GetKey1
PRINT : sex$ = a$: IF a$ <> "M" AND a$ <> "F" THEN GOTO GetSex
'
PRINT "The Irishman walks away and in walks a tall man of possibly Elvish descent.  He"
PRINT "studies you for a moment and says, "; q$; "Here is a booklet of instruction for"
PRINT "you to read, and your prime attributes are --": PRINT
'
hd = FNA(8): ag = FNA(8): ch = FNA(8)
PRINT "  HARDINESS--"; hd: PRINT "  AGILITY --"; ag:
PRINT "  CHARISMA --"; RTRIM$(STR$(ch)); q$
Instructions:
PRINT : PRINT "(Hit 'R' to read instructions, 'T' to give them back) ";
GOSUB GetKey1: IF a$ <> "T" AND a$ <> "R" THEN PRINT : GOTO Instructions:
IF a$ = "T" THEN GOTO Done
'
CLS
PRINT "You read the instructions and they say:": PRINT : COLOR 7
PRINT SPC(17); "INFORMATION ABOUT THE WORLD OF EAMON": COLOR 7: PRINT
PRINT "You will have to buy a weapon.  Your chance to hit with it will be the weapon"
PRINT "complexity, plus your ability in that class, plus twice your agility.  The five"
PRINT "classes of weapons (and your current abilities with each) are--"
PRINT
PRINT "   Club/Mace..20%": PRINT "   Spear......10%"
PRINT "   Axe.........5%": PRINT "   Sword.......0%"
PRINT "   Bow.......-10%"
PRINT
PRINT "Every time you score a hit in battle, your ability in the weapon class may go"
PRINT "up by 2%, if a random number from 1-100 is less than your chance to miss."
GOSUB GetKey: CLS : PRINT
'
PRINT "There are four armor types, and you may also carry a shield if you do not use"
PRINT "a two handed weapon.  These protections will absorb hits placed upon you (ALMOST"
PRINT "ALWAYS) But they lower your chance to hit.  The protections are--"
PRINT : PRINT "ARMOUR"; TAB(15); "hits protect   odds adjust"
PRINT " none"; TAB(18); 0; TAB(35); "-0%"
PRINT " leather"; TAB(18); 1; TAB(35); "-10%"
PRINT " chain"; TAB(18); 2; TAB(35); "-20%"
PRINT " plate"; TAB(18); 5; TAB(35); "-60%"
PRINT " shield"; TAB(18); 1; TAB(35); "-5%"
PRINT : PRINT
PRINT "You will develop an armour expertise, which will go up when you hit a blow"
PRINT "wearing armour and your expertise is less than the armour you are wearing.  No"
PRINT "matter how high your armour expertise is, however, the net effect will never"
PRINT "increase your chance to hit."
GOSUB GetKey: CLS : LOCATE 5
'
PRINT "You can carry weights up to ten times your hardiness or ";
PRINT LTRIM$(RTRIM$(STR$(hd * 10))); " gronds.  (A"
PRINT "measure of weight, one grond=10 dos)"
PRINT
PRINT "Additionally, your hardiness tells how many points of damage you can survive."
PRINT "Therefore, you can be hit with "; LTRIM$(RTRIM$(STR$(hd)));
PRINT " 1-point blows before you die."
PRINT
PRINT "However, you will not be told how many blows you have taken.  You will be merely"
PRINT "told things such as "; q$; "WOW, that one hurt!"; q$;
PRINT " or "; q$; "You don't feel very well"; q$; "."
PRINT
GOSUB GetKey: CLS : LOCATE 5
'
PRINT "Your charisma ("; LTRIM$(RTRIM$(STR$(ch)));
PRINT ") affects how citizens of Eamon react to you.  You affect a"
PRINT "monster's friendliness rating by your charisma less ten, differnce times two,"
PRINT "or ("; LTRIM$(RTRIM$(STR$((ch - 10) * 2))); "%)."
PRINT
PRINT "You start off with 200 gold pieces, which you will want to spend on supplies for"
PRINT "your first adventure.  You will get a lower price if your charisma is high."
PRINT
PRINT "After you begin to acumulate wealth, you may want to put some of your money into"
PRINT "the bank, where it cannot be stolen.  However, it is a good idea to carry some"
PRINT "gold with you for use in bargaining and ransom situations."
GOSUB GetKey: CLS : LOCATE 5
'
PRINT "You may also hire a wizard to teach you some magic spells.  There are four"
PRINT "spells that you may buy:"
PRINT
PRINT "BLAST....Hurt your enemies from a distance."
PRINT "HEAL.....Remove damage from your body."
PRINT "SPEED....Double your dexterity for a time."
PRINT "POWER....Effect is unpredictable."
PRINT : PRINT
PRINT "Other types of magic may work in various adventures, and may have special"
PRINT "properties.  However, thse will not nescessarly work in other adventures than"
PRINT "where they were found.  Thus it is best (and you have no choice but to) sell all"
PRINT "items found in adventures, except for weapons and armour."
GOSUB GetKey
'----------------------------------------------------------------------------
' End of instructions
'
Done:
CLS : LOCATE 5
PRINT "The man behind the desk takes back the instructions and says, "; q$; "It is now time"
PRINT "for you to start your life."; q$; "  He makes an odd sign with his hand and says, "; q$; "Live"
PRINT "long and prosper."; q$: PRINT
PRINT "You now wander into the Main Hall."
GOSUB GetKey: CLS : LOCATE 5
'----------------------------------------------------------------------------
' Save the new character to character file
'
wa(1) = 5: wa(2) = -10: wa(3) = 20: wa(4) = 10
gold = 200
FOR I = 1 TO 4
   wname$(I) = "NONE": wdice(I) = 0: wodds(I) = 0
   wside(I) = 0: wtype(I) = 0
NEXT
'
' Pack the array with commas
'
a$ = cname$ + "," + STR$(hd) + "," + STR$(ag) + "," + STR$(ch) + ","
FOR I = 1 TO 4: a$ = a$ + STR$(sa(I)) + ",": NEXT
FOR I = 1 TO 5: a$ = a$ + STR$(wa(I)) + ",": NEXT
a$ = a$ + STR$(ae) + "," + sex$ + "," + STR$(gold) + ","
a$ = a$ + STR$(bank) + "," + STR$(ac)
FOR I = 1 TO 4
   a$ = a$ + "," + wname$(I) + ","
   a$ = a$ + STR$(wtype(I)) + "," + STR$(wodds(I)) + ","
   a$ = a$ + STR$(wdice(I)) + "," + STR$(wside(I))
NEXT
'
' Put him in the file
'
OPEN "CHARACTE.RS" FOR RANDOM AS #2 LEN = 255
FIELD 2, 255 AS C$
GET #2, 1: NC = VAL(C$)
'
FOR r = 1 TO NC
   GET #2, r + 1
   IF LEFT$(C$, 1) = "," THEN 1480
NEXT
r = NC + 1
'
1480 LSET C$ = a$
PUT #2, r + 1
'---------------------------------------------------------------------------
' Put # of characters into file
'
LSET C$ = STR$(r): PUT #2, 1: CLOSE #2
'---------------------------------------------------------------------------
' Put him in adventurer file for main hall
'
OPEN "ADVENTUR.ER" FOR OUTPUT AS #1
PRINT #1, cname$: PRINT #1, r: CLOSE
RUN "MAINHALL"
'---------------------------------------------------------------------------
' Get one keypress Subroutine
'
GetKey:
LOCATE 23: PRINT "Press any key to continue...";
GetKey1:
DO
   a = RND
   BS = POS(0)
   CC = CC + 1                           ' CC = Cursor Counter
   IF CC = 180 THEN PRINT "/": LOCATE CSRLIN - 1, BS
   IF CC = 280 THEN PRINT CHR$(179): LOCATE CSRLIN - 1, BS
   IF CC = 380 THEN
      PRINT "\": LOCATE CSRLIN - 1, BS
      CC = 0
      END IF
   a$ = UCASE$(INKEY$)
LOOP UNTIL a$ <> ""
PRINT a$: RETURN


