-+-+-+-+-+-+-+-+ START OF PART 45 -+-+-+-+-+-+-+-+ 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 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 - 1; 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 dun_level := dun_level + 1; X moria_flag := true; X msg_print('You enter a maze of down staircases.'); X msg_print('You pass through a one-way door.'); 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 BEGIN 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) then X BEGIN X fval := corr_floor2.ftval; X fopen := corr_floor2.ftopen; X END X else X BEGIN X fval := corr_floor1.ftval; X fopen := corr_floor1.ftopen; X END; 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 (inventory`5B23`5D.tval > 0) then X with inventory`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`20 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 i2 := m_list`5Bcptr`5D.mptr; 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 inventory`5Binven_max`5D := t_list`5Btptr`5D; X objdes(out_val,inven_max,true); X msg_print('You see ' + out_val); X flag := true; X END; X if (not(fopen)) then X BEGIN X flag := true; X CASE fval of X 10 : msg_print('You see a granite wall.'); X 11 : msg_print('You see some dark rock.'); X 12 : msg_print('You see a quartz vein.'); X 15 : msg_print('You see a granite wall.'); X otherwise ; X END; X END; X END; X END; X i1 := i1 + 1; X until ((not cave`5By,x`5D.fopen) or (i1 > max_sight)); X if (not flag) then X msg_print('You see nothing of interest in that direction.'); X END X else X msg_print('You can''t see a damn thing!'); X END; X`20 X`20 X`7B Add to the players food time `7D X procedure add_food(num : integer); X BEGIN X with py.flags do X BEGIN X if (food < 0) then food := 0; X food := food + num; X if (food > player_food_full) then msg_print('You are full.'); X if (food > player_food_max) then X BEGIN X msg_print('You''re getting fat from eating so much.'); X food := player_food_max X END X END X END; X`20 X`20 X`7B Describe number of remaining charges.`7D X procedure desc_charges(item_val : integer); X var X rem_num : integer; X out_val : vtype; X BEGIN X if (index(inventory`5Bitem_val`5D.name,'`5E') = 0) then X BEGIN X rem_num := inventory`5Bitem_val`5D.p1; X writev(out_val,'You have ',rem_num:1,' charges remaining.'); X msg_print(out_val) X END X END; X`20 X`20 X`7B Describe amount of item remaining.`7D X procedure desc_remain(item_val : integer); X var X out_val : vtype; X BEGIN +-+-+-+-+-+-+-+- END OF PART 45 +-+-+-+-+-+-+-+-