-+-+-+-+-+-+-+-+ START OF PART 22 -+-+-+-+-+-+-+-+ X get_sex := false X end; X otherwise X end; X until (exit_flag) X end; X`20 X X`7BGets a character class `7D X function get_class : boolean; X var X i1,i2,i3,i4,i5 : integer; X cl : array `5B0..max_class`5D of integer; X s : char; X exit_flag : boolean; `20 X begin X for i2 := 1 to max_class do cl`5Bi2`5D := 0; X i1 := py.misc.prace; `20 X i2 := 1; X i3 := 0; X i4 := 3; X i5 := 22; X clear(21,1); X prt('Choose a class (? for Help):',21,3); X repeat X `7Bif (uand(race`5Bi1`5D.tclass,bit_array`5Bi2`5D) <> 0) then`7D X begin X i3 := i3 + 1; X put_buffer (chr(i3+96)+') '+class`5Bi2`5D.title,i5,i4); X cl`5Bi3`5D := i2; X i4 := i4 + 15; X if (i4 > 70) then X begin X i4 := 3; X i5 := i5 + 1 X end; X end; X i2 := i2 + 1; X until (i2 > max_class); X py.misc.pclass := 0; X put_buffer('',21,31); X exit_flag := false; X repeat X inkey_flush(s); X i2 := index('abcdefghijklmnopqrstuvwxyz',s); X if ((i2 <= i3) and (i2 >= 1)) then X begin X py.misc.tclass := class`5Bcl`5Bi2`5D`5D.title; X py.misc.pclass := cl`5Bi2`5D; X exit_flag := true; X get_class := true; X clear(21,1); X put_buffer(py.misc.tclass,6,11); X with py.misc do X begin X`09 pskill := class`5Bpclass`5D.skill_no; X `09`09get_skill_data(pskill); `7B located in datafiles.inc -RLG `7D X hitdie := hitdie + class`5Bpclass`5D.adj_hd; X bth := bth + class`5Bpclass`5D.mbth; X bthb := bthb + class`5Bpclass`5D.mbthb; X srh := srh + class`5Bpclass`5D.msrh; X disarm := disarm + class`5Bpclass`5D.mdis; X perc := perc + class`5Bpclass`5D.mperc; X stl := stl + class`5Bpclass`5D.mstl; X`09`09wierd := wierd + class`5Bpclass`5D.mwierd; X save := save + class`5Bpclass`5D.msav; X title := player_title`5Bpclass,1`5D; X expfact:= expfact + class`5Bpclass`5D.m_exp; X end; X`7B Adjust the stats for the class adjustment `7D X with py do X begin X stat.str := change_stat(stat.str,class`5Bmisc.pclass`5D.mad Vj_str); X stat.int := change_stat(stat.int,class`5Bmisc.pclass`5D.mad Vj_int); X stat.wis := change_stat(stat.wis,class`5Bmisc.pclass`5D.mad Vj_wis); X stat.dex := change_stat(stat.dex,class`5Bmisc.pclass`5D.mad Vj_dex); X stat.con := change_stat(stat.con,class`5Bmisc.pclass`5D.mad Vj_con); X stat.chr := change_stat(stat.chr,class`5Bmisc.pclass`5D.mad Vj_chr); X end X end X else if (s = '?') then X begin X moria_help('Character Classes'); X exit_flag := true; X get_class := false; X`09 clear(1,1); X end; X until(exit_flag); X end; X `20 X`7BNew method to adjust a new character's skills and stats!!! -RLG`7D X procedure skill_adjust; X var `20 X y,x,crtpts : integer; X out_val`09 : vtype; X command`09 : char; X exit_flag`09 : boolean; X X procedure spot(a,b : integer); X begin X put_buffer('*',a,b); X put_buffer('',a,b); X end; X X procedure unspot(a,b : integer); X begin X put_buffer(' ',a,b); X end; X X X function modif_st(y,x,dir,stat,max,min,amt,upp : integer) : integer; X var X out_val : vtype; X X begin X modif_st := stat; X case dir of X 1: `7BRaise Stat/Lower Points`7D X if ((stat < max-upp+1) and (crtpts >= amt)) then X begin X`09 stat := stat + upp; X`09 crtpts := crtpts - amt X`09 end; X`09 2: `7BRaise Stat/Raise Points`7D X`09 if (stat < max-upp+1) then X`09 begin X`09 stat := stat + upp; X`09 crtpts := crtpts + amt; X`09 end; X`09-1: `7BLower Stat/Raise Points`7D X`09 if (stat > min+upp-1) then X begin X`09 stat := stat - upp; X `09 crtpts := crtpts + amt X`09 end; X`09-2: `7BLower Stat/Lower Points`7D X`09 if ((stat > min+upp-1) and (crtpts >= amt)) then X`09 begin X`09 stat := stat - upp; X `09 crtpts := crtpts - amt; X`09 end; X`09otherwise; X end; X if (y+x <> 83) then X prt_num('',stat,y,x) X else X`09 begin X`09 writev(out_val,0.1*sngl(stat):2:1); X`09 prt(out_val,10,73); X`09 end; X prt_num('',crtpts,14,45); X modif_st := stat; X end;`09 `20 X X procedure alter_stat(dir,num : integer); X begin X case num of X 9: py.stat.str := modif_st(7,22,dir,py.stat.str,50,3,10,1); X 10: py.stat.int := modif_st(8,22,dir,py.stat.int,50,3,10,1); X 11: py.stat.wis := modif_st(9,22,dir,py.stat.wis,50,3,10,1); X 12: py.stat.dex := modif_st(10,22,dir,py.stat.dex,50,3,10,1); X 13: py.stat.con := modif_st(11,22,dir,py.stat.con,50,3,10,1); X 14: py.stat.chr := modif_st(12,22,dir,py.stat.chr,50,3,10,1); X 34: py.misc.bth := modif_st(7,48,dir,py.misc.bth,200,1,1,4); X 35: py.misc.bthb := modif_st(8,48,dir,py.misc.bthb,200,1,1,4); X 36: py.misc.save := modif_st(9,48,dir,py.misc.save,100,1,2,5); X 37: py.misc.stl := modif_st(10,48,dir,py.misc.stl,10,1,20,1); X 38: py.misc.disarm := modif_st(11,48,dir,py.misc.disarm,100,1,2,5); X 39: py.misc.wierd := modif_st(12,48,dir,py.misc.wierd,100,1,2,5); X 59: py.misc.perc := modif_st(7,73,dir,py.misc.perc,100,1,2,5); X 60: py.misc.srh := modif_st(8,73,dir,py.misc.srh,100,1,2,5); X 61: py.flags.see_infra :=`20 X`09 modif_st(9,73,dir,py.flags.see_infra,20,0,20,1); X 62: py.misc.expfact := X`09 0.1 * modif_st(10,73,2*dir,trunc(py.misc.expfact*10),30,10,40,1); X 63: py.misc.hitdie := modif_st(11,73,dir,py.misc.hitdie,30,4,40,1); X 64: py.misc.au := modif_st(12,73,dir,py.misc.au,5000,0,1,20); X otherwise; `20 X end;`20 X end; X X BEGIN X y := 7; X x := 2; X crtpts := 100; X clear(1,1); X prt('Move the cursor keys to the attribute that you wish to change.',2,5); X prt('Then use ''>'' to increase, or ''<'' to decrease that attribute.',3,5 V); X prt('The numbers in paratheses are the amount of change and cost.',4,5); X prt('When you are finished hit the escape key.',5,5); X with py.stat do X begin X prt_stat('Strength (1/10)',str,7,3); X prt_stat('Intelligence (1/10)',int,8,3); X prt_stat('Wisdom (1/10)',wis,9,3); X prt_stat('Dexterity (1/10)',dex,10,3); X prt_stat('Constitution (1/10)',con,11,3); X prt_stat('Charisma (1/10)',chr,12,3); X end; X with py.misc do X begin X prt_num('Melee Fighting (5/1)',bth,7,28); X`09 prt_num('Gun & Grenades (5/1)',bthb,8,28); X`09 prt_num('Saving Throw (5/2)',save,9,28); X`09 prt_num('Stealth (1/20)',stl,10,28); X`09 prt_num('Disarming (5/2)',disarm,11,28); X`09 prt_num('Wierd Device (5/2)',wierd,12,28); X`09 prt_num('Perception (5/2)',perc,7,53); X`09 prt_num('Searching (5/2)',srh,8,53); X`09 prt_num('Infravision (1/20)',py.flags.see_infra,9,53); X writev(out_val,'Expr. Factor (.1/40)',expfact:2:1); X`09 prt(out_val,10,53); X`09 prt_num('Hit Die (1/40)',hitdie,11,53); X`09 prt_num('Starting Cash (20/1)',au,12,53); X`09 prt_num('Creation Points Left : ',crtpts,14,22); X`09 print_history; X`09 prt('Note: Experience Factor is a multiplier of the amount of experience V',23,5); X`09 prt('points your character will need to advance levels.',24,11); X end; X spot(y,x); X repeat X inkey(command); X case ord(command) of X 27: begin X`09 exit_flag := true; X`09 end; X`09 50: begin `7Bdown`7D X`09 unspot(y,x); X`09 y := y + 1; X`09 if (y = 13) then y := 7;`09 `20 X`09 spot(y,x); X`09 end; X`09 52: if (x <> 2) then `7Bleft`7D X`09 begin X`09`09 unspot(y,x); X`09`09 x := x - 25; X`09`09 spot(y,x); X`09 end; X`09 54: if (x <> 52) then `7Bright`7D X`09 begin X`09 unspot(y,x); X`09`09 x := x + 25; X`09`09 spot(y,x); X`09 end; X`09 56: begin `7Bup`7D X`09 unspot(y,x); X`09 y := y - 1; X`09 if (y = 6) then y := 12; X`09 spot(y,x); X`09 end; X 60,44 : `7B < (decrease) `7D alter_stat(-1,x+y); X 62,46 : `7B > (increase) `7D alter_stat( 1,x+y); X`09 otherwise; X end; X X until(exit_flag); X py.misc.au := py.misc.au + 20*crtpts; `7BLeftover points turn into mon Vey`7D X with py.stat do X begin X cstr := str; X cint := int; X cwis := wis; X cdex := dex; X ccon := con; X cchr := chr; X end; X with py.misc do X begin X mhp := con_adj + hitdie; X chp := mhp; X`7B Real `7D ptodam := todam_adj; X ptohit := tohit_adj; X ptoac := toac_adj; X pac := 0; X`7BDisplay`7Ddis_th := ptohit; X dis_td := ptodam; X dis_tac:= ptoac; X dis_ac := pac X end; X END; X X`7Bbegin create procedure`7D X begin X `09put_character; X repeat until(choose_race); X repeat until(get_sex); X get_history; X race_base(py.misc.prace); X get_class; X`09skill_adjust; X put_character; X put_stats; X put_misc1; X put_misc2; X put_misc3; X get_name; X pause_exit(24); X`09clear(1,1); X`09draw_the_bus; X end; $ CALL UNPACK [.INC]CREATE.INC;1 1276089223 $ create 'f' X`7B Creatures movement and attacking are done from here `7D X procedure creatures; X VAR X i1,i2,i3,moldy,moldx : integer; X`20 X`20 X`7B Updates screen when monsters move about `7D X PROCEDURE update_mon(monptr : integer); X VAR X flag : boolean; X BEGIN X with m_list`5Bmonptr`5D do X with cave`5Bfy,fx`5D do X BEGIN X flag := false; X if (cdis <= max_sight) then `7B all this stuff means: can V you `7D X if (py.flags.blind < 1) then `7B see the monster? V `7D X if (panel_contains(fy,fx)) then X if (los(char_row,char_col,fy,fx)) then X with c_list`5Bmptr`5D do X BEGIN`09`09 `09`7Bwe can see him? cool! `7D X`7B Normal sight. `7D X if ((pl) or (tl)) then X BEGIN X if (py.flags.see_inv) then X flag := true X else if (uand(%X'10000',cmove) = 0) then X flag := true X END X`7B Infra vision. `7D X else if (py.flags.see_infra > 0) then X if (cdis <= py.flags.see_infra) then X if (uand(%X'2000',cdefense) <> 0) then X flag := true X END; X`7B Light it up. `7D X if (flag) then X BEGIN X if (not(ml)) then X BEGIN X print(c_list`5Bmptr`5D.cchar,fy,fx); X ml := true; X if (search_flag) then X search_off; X if (py.flags.rest > 0) then X rest_off; X flush; X if (find_flag) then X BEGIN X find_flag := false; X move_char(5) X END X END X END X`7B Turn it off.`7D X else if (ml) then X BEGIN X ml := false; X if ((tl) or (pl)) then X lite_spot(fy,fx) X else X unlite_spot(fy,fx) X END X END X END; X`20 X`20 X`7B Move the critters about the dungeon `7D X FUNCTION mon_move(monptr : integer) : boolean; X TYPE X mm_type = array `5B1..5`5D of integer; X VAR X i1,i2,i3 : integer; X mm : mm_type; X out_val : vtype; X move_test : boolean; X`20 X`7B Choose correct directions for monster movement `7D X PROCEDURE get_moves(monptr : integer; var mm : mm_type); X VAR X y,ay,x,ax,move_val : integer; X BEGIN X y := m_list`5Bmonptr`5D.fy - char_row; X x := m_list`5Bmonptr`5D.fx - char_col; X ay := abs(y); X ax := abs(x); X if (y < 0) then X move_val := 8 X else X move_val := 0; X if (x > 0) then X move_val := move_val + 4; X if (ay > (ax*1.7321)) then `7B pi/2, in case you were wonderin Vg `7D X move_val := move_val + 2 X else if (ax > (ay*1.7321)) then X move_val := move_val + 1; X CASE move_val of X 0 : BEGIN X mm`5B1`5D := 9; X if (ay > ax) then X BEGIN X mm`5B2`5D := 8; X mm`5B3`5D := 6; X mm`5B4`5D := 7; X mm`5B5`5D := 3 X END X else X BEGIN X mm`5B2`5D := 6; X mm`5B3`5D := 8; X mm`5B4`5D := 3; X mm`5B5`5D := 7 +-+-+-+-+-+-+-+- END OF PART 22 +-+-+-+-+-+-+-+-