-+-+-+-+-+-+-+-+ START OF PART 59 -+-+-+-+-+-+-+-+ X %ref mtc_str : varying`5Bb`5D of char; X %ref insert_str : varying`5Bc`5D of char X ); X external; X`20 X`20 X`7B Inserts a number into a string `7D X`5Bpsect(misc1$code)`5D procedure insert_num( X var object_str : varying`5Ba`5D of char; X mtc_str : varying`5Bb`5D of char; X number : integer; X show_sign : boolean X ); X var X pos,olen,mlen : integer; X str1,str2 : vtype; X begin X pos := index(object_str,mtc_str); X if (pos > 0) then X begin X olen := length(object_str); X mlen := length(mtc_str); X object_str := object_str + ' '; X str1 := substr(object_str,1,pos-1); X str2 := substr(object_str,pos+mlen,olen-(pos+mlen-1)); X if ((number >= 0) and (show_sign)) then X writev(object_str,str1,'+',number:1,str2) X else X writev(object_str,str1,number:1,str2); X end X end; X`20 X`7B Weapon weight VS strength and dexterity `7D X`5Bpsect(moria$code)`5D function attack_blows( X weight : integer; X var wtohit : integer X ) : integer; X var X adj_weight,blows : integer; X begin X blows := 1; X wtohit := 0; X with py.stat do X begin X if ((cstr*15) < weight) then X wtohit := -weight X else X begin X if (cdex < 10) then blows := 1 X else if (cdex < 20) then blows := 2 X else if (cdex < 25) then blows := 3 X else if (cdex < 30) then blows := 4 X else if (cdex < 40) then blows := 5 X else if (cdex < 50) then blows := 6 X else blows := 7; X adj_weight := trunc((cstr*10)/weight); X if (adj_weight < 2) then blows := 1 X else if (adj_weight < 3) then blows := trunc(blows/3.0) X else if (adj_weight < 4) then blows := trunc(blows/2.5) X else if (adj_weight < 5) then blows := trunc(blows/2.25) X else if (adj_weight < 7) then blows := trunc(blows/2.00) X else if (adj_weight < 9) then blows := trunc(blows/1.75) X else if (adj_weight <11) then blows := trunc(blows/1.50) X else if (adj_weight <14) then blows := blows X else blows := blows + 1; X end; X end; X attack_blows := blows; X end; X`20 X`20 X`7B Critical hits, Nasty way to die... `7D X`5Bpsect(moria$code)`5D function critical_blow(weight,plus,dam : integer) : V integer; X begin X critical_blow := dam; X`7B Weight of weapon, pluses to hit, and character level all X contribute to the chance of a critical `7D X if (py.misc.tclass = 'Ninja') then weight := 8*weight; X if (randint(5000) <= (weight+5*plus+3*py.misc.lev)) then X begin X if (py.misc.tclass = 'Ninja') then weight := weight div 7; X weight := weight + randint(650); X if (weight < 400) then X begin X critical_blow := 2*dam + 5; X msg_print('It was a good hit! (x2 damage)'); X end X else if (weight < 700) then X`20 X begin X critical_blow := 3*dam + 10; X msg_print('It was an excellent hit! (x3 damage)'); X end X else if (weight < 900) then X begin X critical_blow := 4*dam + 15; X msg_print('It was a superb hit! (x4 damage)'); X end X else X begin X critical_blow := 5*dam + 20; X msg_print('It was a *GREAT* hit! (x5 damage)'); X end X end; X end; X`20 X`20 X`7B Given direction 'dir', returns new row, column location `7D X`5Bpsect(misc1$code)`5D function move(dir : integer; var y,x : integer) : bo Volean; X var X new_row,new_col : integer; X begin X case dir of X 1 : begin X new_row := y + 1; X new_col := x - 1; X end; X 2 : begin X new_row := y + 1; X new_col := x; X end; X 3 : begin X new_row := y + 1; X new_col := x + 1; X end; X 4 : begin X new_row := y; X new_col := x - 1; X end; X 5 : begin X new_row := y; X new_col := x; X end; X 6 : begin X new_row := y; X new_col := x + 1; X end; X 7 : begin X new_row := y - 1; X new_col := x - 1; X end; X 8 : begin X new_row := y - 1; X new_col := x; X end; X 9 : begin X new_row := y - 1; X new_col := x + 1; X end; X end; X move := false; X if ((new_row >= 1) and (new_row <= cur_height)) then X if ((new_col >= 1) and (new_col <= cur_width)) then X begin X y := new_row; X x := new_col; X move := true; X end X end; X`20 X`20 X`7B Saving throws for player character... `7D X`5Bpsect(moria$code)`5D function player_saves(adjust : integer) : boolean; X begin X if (randint(120) <= (py.misc.save + adjust)) then X player_saves := true X else X player_saves := false; X end; X`20 X`20 X`7B Init players with some belongings, and also clear the kill_list record. V `7D X`5Bpsect(setup$code)`5D procedure char_inven_init; X var X i1,i2,dummy : integer; X begin X for i1 := 1 to max_char_inven_init do X begin X i2 := player_init`5Bpy.misc.pclass,i1`5D; X temporary_slot := inventory_init`5Bi2`5D; X`09 magic_treasure(temporary_slot,777); X inven_carry(dummy); X end; X`09for i1 := 23 to equip_max do X`09 equipment`5Bi1`5D := blank_treasure; X`09for i1 := 1 to max_creatures do X`09 kill_list`5Bi1`5D := 0; X end; X`20 X`7B Blanks out entire cave `7D X`5Bpsect(generate$code)`5D procedure blank_cave; X var X i1,i2 : integer; X BEGIN X for i1 := 1 to max_height do X for i2 := 1 to max_width do X begin X cave`5Bi1,i2`5D := blank_floor; X cave`5Bi1,i2`5D.fopen := true; X end; X END; X`20 X`20 X`7B Places indestructable rock around edges of dungeon `7D X X`5Bpsect(generate$code)`5D procedure place_boundry; X var X i1: integer; X BEGIN X for i1 := 1 to cur_height do X BEGIN X cave`5Bi1,1`5D.fval := boundry_wall.ftval; X cave`5Bi1,1`5D.fopen := boundry_wall.ftopen; X cave`5Bi1,cur_width`5D.fval := boundry_wall.ftval; X cave`5Bi1,cur_width`5D.fopen := boundry_wall.ftopen; X END; X for i1 := 1 to cur_width do X BEGIN X cave`5B1,i1`5D.fval := boundry_wall.ftval; X cave`5B1,i1`5D.fopen := boundry_wall.ftopen; X cave`5Bcur_height,i1`5D.fval := boundry_wall.ftval; X cave`5Bcur_height,i1`5D.fopen := boundry_wall.ftopen; X END; X END; X X`5Bpsect(misc4$code)`5D procedure mess_with_mind; `7B -jeb`7D Xvar X special : boolean; XBEGIN X if (username = 'CLOISTER') then X begin X py.misc.name := 'Cloister Bell'; X special := true; X end; X if(username = 'THREE') then X begin X py.misc.name := 'Three'; X py.misc.race := 'LPMud Wizard'; X special := true; X end; X`7B if(not special) then`20 X begin X py.misc.name := 'We''re onto you, dude.'; X py.misc.race := 'Thumbs Down'; `20 X end; `7D XEND; X X`5Bpsect(misc4$code)`5D procedure Opusii_vomit(percentage:integer); XBEGIN X if (randint(100) < percentage) then X with py.flags do X begin X food := food - 500; X paralysis := randint(4); X msg_print('You yak all over the tunnel floor!'); X end XEND; $ CALL UNPACK [.INC]MISC.INC;1 2133741467 $ create 'f' X value X X`7B Residual objects. Main object list is now in an external file! -RLG `7D X X`7B traplista are hidden, traplistb are detected`7D X`7B Traps are just Nasty treasures... `7D X trap_lista := ( X('an open pit',101,' ',%X'00000000',0,0,1,0,0,0,0,0,0,'2d6',-50), X('an arrow trap',101,'.',%X'00000000',0,0,2,0,0,0,0,0,0,'1d8',0), X('a covered pit',101,'.',%X'00000000',0,0,3,0,0,0,0,0,0,'2d6',0), X('a trap door',101,'.',%X'00000000',0,0,4,0,0,0,0,0,0,'2d8',0), X('a gas trap' ,101,'.',%X'00000000',0,0,5,0,0,0,0,0,0,'1d4',0), X('a loose rock' ,101,'.',%X'00000000',0,0,6,0,0,0,0,0,0,'0d0',0), X('a dart trap',101,'.',%X'00000000',0,0,7,0,0,0,0,0,0,'1d4',0), X('a strange rune',101,'.',%X'00000000',0,0,8,0,0,0,0,0,0,'0d0',0), X('some loose rock' ,101,'.',%X'00000000',0,0,9,0,0,0,0,0,0,'2d6',0), X('a gas trap' ,101,'.',%X'00000000',0,0,10,0,0,0,0,0,0,'1d4',0), X('a strange rune',101,'.',%X'00000000',0,0,11,0,0,0,0,0,0,'0d0',0), X('a blackened spot',101,'.',%X'00000000',0,0,12,0,0,0,0,0,0,'4d6',0), X('some corroded rock',101,'.',%X'00000000',0,0,13,0,0,0,0,0,0,'4d6',0), X('a gas trap',101,'.',%X'00000000',0,0,14,0,0,0,0,0,0,'2d6',0), X('a gas trap',101,'.',%X'00000000',5,0,15,0,0,0,0,0,0,'1d4',10), X('a bomb',101,'.',%X'00000000',5,0,16,0,0,0,0,0,0,'5d6',5), X('a dart trap',101,'.',%X'00000000',5,0,17,0,0,0,0,0,0,'1d8',10), X('a dart trap',101,'.',%X'00000000',5,0,18,0,0,0,0,0,0,'1d8',10), X('a teleport trap',101,'.',%X'00000000',5,0,20,0,0,0,0,0,0,'0d0',10)); X`20 X`7B Traps: Level represents the difficulty of disarming; X and P1 represents the experienced gained when disarmed`7D X`20 X trap_listb := ( X('an open pit',102,' ',%X'00000000',1,0,1,0,0,0,0,0,0,'2d6',-50), X('an arrow trap',102,'`5E',%X'00000000',3,0,2,0,0,0,0,0,0,'1d8',-10), X('a covered pit',102,'`5E',%X'00000000',2,0,3,0,0,0,0,0,0,'2d6',-40), X('a trap door',102,'`5E',%X'00000000',5,0,4,0,0,0,0,0,0,'2d8',-25), X('a gas trap' ,102,'`5E',%X'00000000',3,0,5,0,0,0,0,0,0,'1d4',5), X('a loose rock' ,102,';',%X'00000000',0,0,6,0,0,0,0,0,0,'0d0',-90), X('a dart trap',102,'`5E',%X'00000000',5,0,7,0,0,0,0,0,0,'1d4',10), X('a strange rune',102,'`5E',%X'00000000',5,0,8,0,0,0,0,0,0,'0d0',-10), X('some loose rock' ,102,'`5E',%X'00000000',5,0,9,0,0,0,0,0,0,'2d6',-10), X('a gas trap',102,'`5E',%X'00000000',10,0,10,0,0,0,0,0,0,'1d4',5), X('a strange rune' ,102,'`5E',%X'00000000',5,0,11,0,0,0,0,0,0,'0d0',-10), X('a blackened spot',102,'`5E',%X'00000000',10,0,12,0,0,0,0,0,0,'4d6',10), X('some shattered rock',102,'`5E',%X'00000000',10,0,13,0,0,0,0,0,0,'4d6',10), X('a gas trap',102,'`5E',%X'00000000',5,0,14,0,0,0,0,0,0,'2d6',5), X('a gas trap',102,'`5E',%X'00000000',5,0,15,0,0,0,0,0,0,'1d4',10), X('a bomb',102,'`5E',%X'00000000',25,0,16,0,0,0,0,0,0,'5d6',25), X('a dart trap',102,'`5E',%X'00000000',5,0,17,0,0,0,0,0,0,'1d8',10), X('a dart trap',102,'`5E',%X'00000000',5,0,18,0,0,0,0,0,0,'1d8',10), X`20 X`7B SPECIAL CASE,see DOOR_LIST below (SUBVALS MUST AGREE) `7D X('a closed door',105,'+',%X'00000000',0,0,19,0,0,0,0,0,0,'1d1',0), X('a teleport trap',102,'`5E',%X'00000000',0,0,20,0,0,0,0,0,0,'0d0',50)); X`20 Xblk_mkt_trap := X('a Black Market Store',111,'B',%X'00000000',5,0,107,0,0,0,0,0,0,'1d1',5); X`20 X`20 X`7B Stores are just special traps `7D X`20 X store_door := ( X('The entrance to a K-Mart',110,'K',%X'00000000', X0,0,101,0,0,0,0,0,0,'0d0',0), X('The entrance to Leather and Chains',110,'L',%X'00000000', X0,0,102,0,0,0,0,0,0,'0d0',0), X('The entrance to a Weapon Shop',110,'W',%X'00000000', X0,0,103,0,0,0,0,0,0,'0d0',0), X('The entrance to a Temple',110,'T',%X'00000000', X0,0,104,0,0,0,0,0,0,'0d0',0), X('The entrance to a Bar and Grill',110,'+',%X'00000000', X0,0,105,0,0,0,0,0,0,'0d0',0), X('The entrance to an Alien Artifact Shop',110,'A',%X'00000000', X0,0,106,0,0,0,0,0,0,'0d0',0), X('The entrance to a Black Market',110,'B',%X'00000000', X0,0,107,0,0,0,0,0,0,'0d0',1), X('The entrance to a Gun Shop',110,'G',%X'00000000', X0,0,108,0,0,0,0,0,0,'0d0',0), X('The entrance to a Pro Shop',110,'P',%X'00000000', X0,0,109,0,0,0,0,0,0,'0d0',0), X('The entrance to a Computer Store',110,'C',%X'00000000', X0,0,110,0,0,0,0,0,0,'0d0',0), X('a granite wall with the vague outline of a door.',110,'#',%X'00000000', X0,0,111,0,0,0,0,0,0,'0d0',0), X('The entrance to a tall building',110,'<',%X'00000000', X0,0,112,0,0,0,0,0,0,'0d0',0)); X`20 X building_door := ( X('the hotel front desk',120,'`5D',%X'00000000', X0,0,201,0,0,0,0,0,0,'0d0',0), X('the bank teller window',120,'`5B',%X'00000000', X0,0,202,0,0,0,0,0,0,'0d0',0), X('the medical clinic entrance',120,'`5D',%X'00000000', X0,0,203,0,0,0,0,0,0,'0d0',0), X('NewsInc, Ltd.',120,'`5B',%X'00000000', X0,0,204,0,0,0,0,0,0,'0d0',0) X); X`09 X X scare_monster := X('a strange rune',102,'`5E',%X'00000000',0,0,99,0,0,0,0,0,0,'0d0',-90); X`20 Xrubble := ('some rubble',103,':',%X'00000000',0,0,1,0,0,0,0,0,0,'0d0',0); X`20 X`7B Secret door must have same subval as closed door in TRAP_LISTB. X See CHANGE_TRAP`7D X door_list := ( X('an open door',104,'''',%X'00000000',0,0,1,0,0,0,0,0,0,'1d1',0), X('a closed door',105,'+',%X'00000000',0,0,19,0,0,0,0,0,0,'1d1',0), X('a secret door',109,'#',%X'00000000',0,0,19,0,0,0,0,0,0,'1d1',0)); X`20 X up_stair := ( X('an staircase going up',107,'<',%X'00000000', X0,0,1,0,0,0,0,0,0,'1d1',0), X('a steep staircase leading upwards',107,'<',%X'00000000', X0,0,2,0,0,0,0,0,0,'1d1',0), X('a *very* steep staircase leading way, way up',107,'<',%X'00000000', X0,0,4,0,0,0,0,0,0,'1d1',0)); X`20 X down_stair := ( X('a staircase going downwards',108,'>',%X'00000000', X0,0,1,0,0,0,0,0,0,'1d1',0), X('a steep staircase leading downwards',108,'>',%X'00000000', X0,0,2,0,0,0,0,0,0,'1d1',0), +-+-+-+-+-+-+-+- END OF PART 59 +-+-+-+-+-+-+-+-