-+-+-+-+-+-+-+-+ START OF PART 47 -+-+-+-+-+-+-+-+ X END; X flag := false; X`7B Was chest still trapped? (Snicker) `7D X if (uand(%X'00000001',flags) = 0) then X BEGIN X chest_trap(y,x); X if (tptr > 0) then X flag := true X END; X END; X`7B Chest treasure is allocted as if a creature had been killed.`7D X if (flag) then X BEGIN X monster_death(y,x,t_list`5Btptr`5D.flags); X t_list`5Btptr`5D.flags := 0; X END; X END X else X msg_print('I do not see anything you can open there.') X else X msg_print('I do not see anything you can open there.') X END; X END; X`20 X`7B Closes an open door.`7D X procedure closeobject; X var X y,x,tmp: integer; X BEGIN X y := char_row; X x := char_col; X if (get_dir('Which direction?',tmp,tmp,y,x)) then X BEGIN X with cave`5By,x`5D do X if (tptr > 0) then X if (t_list`5Btptr`5D.tval = 104) then X if (cptr = 0) then X if (t_list`5Btptr`5D.p1 = 0) then X BEGIN X t_list`5Btptr`5D := door_list`5B2`5D; X fopen := false; X lite_spot(y,x); X END X else X msg_print('The door appears to be broken.') X else X msg_print('The ' + c_list`5Bm_list`5Bcptr`5D.mptr`5D.nam Ve + X ' is in your way!') X else X msg_print('I do not see anything you can close there.') X else X msg_print('I do not see anything you can close there.') X END; X END; X`20 X`20 X`7B Go up one level `7D X procedure go_up; X`20 X BEGIN X with cave`5Bchar_row,char_col`5D do X if (tptr > 0) then X if (t_list`5Btptr`5D.tval = 107) then X BEGIN X dun_level := dun_level - t_list`5Btptr`5D.subval; X if (dun_level < 0) then dun_level := 0; X moria_flag := true; X msg_print('You enter a maze of up staircases.'); X msg_print('You pass through a one-way door.'); X END X else X msg_print('I see no up staircase here.') X else X msg_print('I see no up staircase here.'); X END; X`20 X`20 X`7B Go down one level `7D X procedure go_down; X BEGIN X with cave`5Bchar_row,char_col`5D do X if (tptr > 0) then X if (t_list`5Btptr`5D.tval = 108) then X BEGIN X`09 if (dun_level < 0) then X`09 begin X`09 dun_level := dun_level + 1; X`09`09 msg_print('You go down the stairs'); X`09`09end X else X`09 begin X`09 dun_level := dun_level + t_list`5Btptr`5D.subval; X`09 if (dun_level > townlist`5Btown_num`5D.max_depth) then X`09 dun_level := townlist`5Btown_num`5D.max_depth; X msg_print('You enter a maze of down staircases.'); X msg_print('You pass through a one-way door.'); X`09`09end; X moria_flag := true; X END X else X msg_print('I see no down staircase here.') X else X msg_print('I see no down staircase here.'); X END; X`20 X`20 X`7B Tunneling through real wall: 10,11,12 X Used by TUNNEL and WALL_TO_MUD `7D X function twall(y,x,t1,t2 : integer) : boolean; X var`20 X`09 new_floor : floor_type; X BEGIN X`09 if (dun_level in open_cave_set) then `7Bfix for the new dungeon `7D X`09 new_floor := dopen_floor`09`09`7Blevels and light skill -jeb`7D X`09 else X`09 new_floor := corr_floor1; X twall := false; X with cave`5By,x`5D do X if (t1 > t2) then X BEGIN X if ((next_to4(y,x,`5B1,2`5D) > 0) and`20 X`09`09 (new_floor.ftval = corr_floor1.ftval)) then X new_floor.ftval := new_floor.ftval+1; X fval := new_floor.ftval; X fopen := new_floor.ftopen; X if (test_light(y,x)) then X if (panel_contains(y,x)) then X BEGIN X if (tptr > 0) then X msg_print('You have found something!'); X lite_spot(y,x); X END; X fm := false; X pl := false; X twall := true; X END; X END; X`20 X`20 X`7B Tunnels through rubble and walls X Must take into account: secret doors, special tools `7D X procedure tunnel; X var X y,x,i1,i2,tabil: integer; X BEGIN X y := char_row; X x := char_col; X if (get_dir('Which direction?',i1,i1,y,x)) then X with cave`5By,x`5D do X BEGIN X`7B Compute the digging ability of player; based on strength, and type of to Vol used `7D X tabil := py.stat.cstr; X if (equipment`5B23`5D.tval > 0) then X with equipment`5B23`5D do X if (uand(%X'20000000',flags) <> 0) then X tabil := tabil + 25 + p1*50; X`7B Regular walls; Granite, magma intrusion, quartz vein X Don't forget the boundry walls, made of titanium (255)`7D X CASE fval of X 10 : BEGIN X i1 := randint(1200) + 80; X if (twall(y,x,tabil,i1)) then X msg_print('You have finished the tunnel.') X else X msg_print('You tunnel into the granite wall.'); X END; X 11 : BEGIN X i1 := randint(600) + 10; X if (twall(y,x,tabil,i1)) then X msg_print('You have finished the tunnel.') X else X msg_print('You tunnel into the magma intrusion.'); X END; X 12 : BEGIN X i1 := randint(400) + 10; X if (twall(y,x,tabil,i1)) then X msg_print('You have finished the tunnel.') X else X msg_print('You tunnel into the quartz vein.'); X END; X 15 : msg_print('This seems to be permanent rock.'); X otherwise BEGIN X`7B Is there an object in the way? (Rubble and secret doors)`7D X if (tptr > 0) then X BEGIN X`7B Rubble.`7D if (t_list`5Btptr`5D.tval = 103) then X BEGIN X if (tabil > randint(180)) then X BEGIN X pusht(tptr); X tptr := 0; X fm := false; X fopen := true; X msg_print('You have removed the rubble.'); X if (randint(10) = 1) then X BEGIN X place_object(y,x); X if (test_light(y,x)) then X msg_print('You have found something!'); X END; X lite_spot(y,x); X END X else X msg_print('You dig in the rubble...'); X END X`7B Secret doors...`7D else if (t_list`5Btptr`5D.tval = 109) then X BEGIN X msg_print('You tunnel into the granite wall.'); X search(char_row,char_col,py.misc.srh); X END X else X msg_print('You can''t tunnel through that.'); X END X else X msg_print('Tunnel through what? Empty air???') X END X END X END X END; X`20 X`20 X`7B Disarms a trap `7D X procedure disarm_trap; X var X y,x,i1,tdir : integer; X tot,t1,t2,t3,t4,t5 : integer; X BEGIN X y := char_row; X x := char_col; X if (get_dir('Which direction?',tdir,i1,y,x)) then X with cave`5By,x`5D do X BEGIN X if (tptr > 0) then X BEGIN X t1 := py.misc.disarm; `7B Ability to disarm `7D X t2 := py.misc.lev; `7B Level adjustment `7D X t3 := 2*todis_adj; `7B Dexterity adjustment `7D X t4 := int_adj; `7B Intelligence adjustment`7D X tot := t1 + t2 + t3 + t4; X if (py.flags.blind > 0) then X tot := trunc(tot/5.0) X else if (no_light) then X tot := trunc(tot/2.0); X if (py.flags.confused > 0) then X tot := trunc(tot/3.0); X i1 := t_list`5Btptr`5D.tval; X t5 := t_list`5Btptr`5D.level; X if (i1 = 102) then `7B Floor trap `7D X with t_list`5Btptr`5D do X BEGIN X if ((tot - t5) > randint(100)) then X BEGIN X msg_print('You have disarmed the trap.'); X py.misc.exp := py.misc.exp + p1; X fm := false; X pusht(tptr); X tptr := 0; X move_char(tdir); X lite_spot(y,x); X prt_experience; X END X else if (randint(tot) > 5) then X msg_print('You failed to disarm the trap.') X else X BEGIN X msg_print('You set the trap off!'); X move_char(tdir); X END; X END X else if (i1 = 2) then `7B Chest trap `7D X with t_list`5Btptr`5D do X BEGIN X if (index(name,'`5E') > 0) then X msg_print('I don''t see a trap...') X else if (uand(%X'000001F0',flags) <> 0) then X BEGIN X if ((tot - t5) > randint(100)) then X BEGIN X flags := uand(%X'FFFFFE0F',flags); X i1 := index(name,' ('); X if (i1 > 0) then X name := substr(name,1,i1-1); X if (uand(%X'00000001',flags) <> 0) then X name := name + ' (Locked)' X else X name := name + ' (Disarmed)'; X msg_print('You have disarmed the chest.'); X known2(name); X py.misc.exp := py.misc.exp + t5; X prt_experience; X END X else if (randint(tot) > 5) then X msg_print('You failed to disarm the chest.') X else X BEGIN X msg_print('You set a trap off!'); X known2(name); X chest_trap(y,x); X END; X END X else X msg_print('The chest was not trapped.'); X END X else X msg_print('I do not see anything to disarm there.'); X END X else X msg_print('I do not see anything to disarm there.'); X END X END; X`20 X`20 X`7B Look at an object, trap, or monster X Note: Looking is a free move, see where invoked.`7D X procedure look; X var X i1,i2,y,x : integer; X dir,dummy : integer; X flag: boolean; X BEGIN X flag := false; X y := char_row; X x := char_col; X if (get_dir('Look which direction?',dir,dummy,y,x)) then X if (py.flags.blind < 1) then X BEGIN X y := char_row; X x := char_col; X i1 := 0; X repeat X move(dir,y,x); X with cave`5By,x`5D do X BEGIN X if (cptr > 1) then X if (m_list`5Bcptr`5D.ml) then X begin X`09`09`09 i2 := m_list`5Bcptr`5D.mptr; X`09`09`09 if (wizard) then X`09 writev(out_val, X 'You see a ',c_list`5Bi2`5D.name,'. (',m_list`5Bcptr`5D.hp: V2,' hps.)') X`09`09`09 else `20 X writev(out_val,'You see a ',c_list`5Bi2`5D.name, V'. '); X msg_print(out_val); X flag := true; X end; X if ((tl) or (pl) or (fm)) then X BEGIN X if (tptr > 0) then X if (t_list`5Btptr`5D.tval = 109) then X msg_print('You see a granite wall.') X else if (t_list`5Btptr`5D.tval <> 101) then X BEGIN X temporary_slot := t_list`5Btptr`5D; X objdes(out_val,1,true,'t'); X msg_print('You see ' + out_val); X flag := true; X END; X if (not(fopen)) then X BEGIN +-+-+-+-+-+-+-+- END OF PART 47 +-+-+-+-+-+-+-+-