-+-+-+-+-+-+-+-+ START OF PART 21 -+-+-+-+-+-+-+-+ X`09`09`09 else X`09`09`09 msg_print('You failed to pick the lock.'); X`09`09`09end X`09`09 else if (p1 < 0) then `7B It's stuck `7D X`09`09`09msg_print('It appears to be stuck.'); X`09`09 if (p1 = 0) then X`09`09`09begin X`09`09`09 t_list`5Btptr`5D := door_list`5B1`5D; X`09`09`09 fopen := true; X`09`09`09 lite_spot(y,x); X`09`09`09end; X`09`09 end X`09`09`09`7B Open a closed chest... `7D X`09`09else if (t_list`5Btptr`5D.tval = chest) then X`09`09 begin X`09`09 with py.misc do X`09`09 tmp := disarm + lev + 2*todis_adj + spell_adj(iq); X`09`09 with t_list`5Btptr`5D do X`09`09 begin X`09`09`09flag := false; X`09`09`09if (uand(%X'00000001',flags) <> 0) then X`09`09`09 if (py.flags.confused > 0) then X`09`09`09 msg_print('You are too confused to pick the lock.') X`09`09`09 else if ((tmp-(2*level)) > randint(100)) then X`09`09`09 begin X`09`09`09 msg_print('You have picked the lock.'); X`09`09`09 flag := true; X`09`09`09 py.misc.exp := py.misc.exp + level; X`09`09`09 prt_experience; X`09`09`09 end X`09`09`09 else X`09`09`09 msg_print('You failed to pick the lock.') X`09`09`09else X`09`09`09 flag := true; X`09`09`09if (flag) then X`09`09`09 begin X`09`09`09 flags := uand(%X'FFFFFFFE',flags); X`09`09`09 tmp := index(name,' ('); X`09`09`09 if (tmp > 0) then X`09`09`09 name := substr(name,1,tmp-1); X`09`09`09 name := name + ' (Empty)'; X`09`09`09 known2(name); X`09`09`09 cost := 0; X`09`09`09 end; X`09`09`09flag := false; X`09`09`09`7B Was chest still trapped? (Snicker) `7D X`09`09`09if (uand(%X'00000001',flags) = 0) then X`09`09`09 begin X`09`09`09 chest_trap(y,x); X`09`09`09 if (tptr > 0) then X`09`09`09 flag := true X`09`09`09 end; X`09`09 end; X`09`09`09`7B Chest treasure is allocted as if a creature `7D X`09`09`09`7B had been killed... `7D X`09`09 if (flag) then X`09`09 begin X`09`09`09monster_death(y,x,t_list`5Btptr`5D.flags); X`09`09`09t_list`5Btptr`5D.flags := 0; X`09`09 end; X`09`09 end X`09`09else X`09`09 msg_print('I do not see anything you can open there.') X`09 else X`09`09msg_print('I do not see anything you can open there.') X`09 end; X end; X X X`09`7B Closes an open door...`09`09`09`09-RAK-`09`7D X procedure closeobject; X var X`09`09y,x,tmp : integer; X`09`09m_name`09`09: vtype ; X begin X`09y := char_row; X`09x := char_col; X`09if (get_dir('Which direction?',tmp,tmp,y,x)) then X`09 begin X`09 with cave`5By,x`5D do X`09 if (tptr > 0) then X`09`09if (t_list`5Btptr`5D.tval = Open_door) then X`09`09 if (cptr = 0) then X`09`09 if (t_list`5Btptr`5D.p1 = 0) then X`09`09 begin X`09`09`09t_list`5Btptr`5D := door_list`5B2`5D; X`09`09`09fopen := false; X`09`09`09lite_spot(y,x); X`09`09 end X`09`09 else X`09`09 msg_print('The door appears to be broken.') X`09`09 else X`09`09 begin X`09`09 find_monster_name ( m_name, cptr, true ) ; X`09`09 msg_print( m_name + ' is in your way!') X`09`09 end X`09`09else X`09`09 msg_print('I do not see anything you can close there.') X`09 else X`09`09msg_print('I do not see anything you can close there.') X`09 end; X end; X X`09`7B Go up one level`09`09`09`09`09-RAK-`09`7D X`09`7B Or several, with a steep staircase`09`09`09-DMF-`09`7D X procedure go_up; X begin X`09with cave`5Bchar_row,char_col`5D do X`09if (tptr > 0) then X`09 if (t_list`5Btptr`5D.tval = Up_staircase) then X`09 begin X`09 dun_level := dun_level - 1; X`09 moria_flag := true; X`09 msg_print('You enter a maze of up staircases.'); X`09 msg_print('You pass through a one-way door.'); X`09 end X`09 else if (t_list`5Btptr`5D.tval = Up_steep_staircase) then X`09 begin X`09 dun_level := dun_level - randint(3) - 1; X`09 if (dun_level < 0) then dun_level := 0; X`09 moria_flag := true; X`09 msg_print('You enter a long maze of up staircases.'); X`09 msg_print('You pass through a one-way door.'); X`09 end X`09 else X`09 msg_print('I see no up staircase here.') X`09else X`09 msg_print('I see no up staircase here.'); X end; X X X`09`7B Go down one level`09`09`09`09`09-RAK-`09`7D X`09`7B Or several, with a steep staircase`09`09`09-DMF-`09`7D X procedure go_down; X begin X`09with cave`5Bchar_row,char_col`5D do X`09if (tptr > 0) then X`09 if (t_list`5Btptr`5D.tval = Down_staircase) then X`09 begin X`09 dun_level := dun_level + 1; X`09 moria_flag := true; X`09 msg_print('You enter a maze of down staircases.'); X`09 msg_print('You pass through a one-way door.'); X`09 end X`09 else if (t_list`5Btptr`5D.tval = Down_steep_staircase) then X`09 begin X`09 dun_level := dun_level + randint(3) + 1; X`09 moria_flag := true; X`09 msg_print('You enter a long maze of down staircases.'); X`09 msg_print('You pass through a one-way door.'); X`09 end X`09 else X`09 msg_print('I see no down staircase here.') X`09else X`09 msg_print('I see no down staircase here.'); X end; X X X`09`7B Tunnels through rubble and walls`09`09`09-RAK-`09`7D X`09`7B Must take into account: secret doors, special tools `7D X procedure tunnel; X var X`09`09y,x,i1,i2,tabil : integer; X begin X`09y := char_row; X`09x := char_col; X`09if (get_dir('Which direction?',i1,i1,y,x)) then X`09 with cave`5By,x`5D do X`09 begin X`09`7B Compute the digging ability of player; based on `7D X`09`7B strength, and type of tool used `7D X`09 tabil := (py.stat.c`5Bsr`5D + 20) div 5; X`09 if (equipment`5BEquipment_primary`5D.tval > 0) then X`09`09with equipment`5BEquipment_primary`5D do X`09`09 if (uand(tunneling_worn_bit,flags) <> 0) then X`09`09 tabil := tabil + 25 + p1*50; X`09`7B Regular walls; Granite, magma intrusion, quartz vein `7D X`09`7B Don't forget the boundry walls, made of titanium (255)`7D X`09 case fval of X`09`0910 : begin X`09`09`09i1 := randint(1200) + 80; X`09`09`09if (twall(y,x,tabil,i1)) then X`09`09`09 msg_print('You have finished the tunnel.') X`09`09`09else X`09`09`09 msg_print('You tunnel into the granite wall.'); X`09`09 end; X`09`0911 : begin X`09`09`09i1 := randint(600) + 10; X`09`09`09if (twall(y,x,tabil,i1)) then X`09`09`09 msg_print('You have finished the tunnel.') X`09`09`09else X`09`09`09 msg_print('You tunnel into the magma intrusion.'); X`09`09 end; X`09`0912 : begin X`09`09`09i1 := randint(400) + 10; X`09`09`09if (twall(y,x,tabil,i1)) then X`09`09`09 msg_print('You have finished the tunnel.') X`09`09`09else X`09`09`09 msg_print('You tunnel into the quartz vein.'); X`09`09 end; X`09`0915 : msg_print('This seems to be permanent rock.'); X`09`0916 : msg_print('You can''t tunnel through water!'); X`09`09otherwise begin X`09`7B Is there an object in the way? (Rubble and secret doors)`7D X`09`09 if (tptr > 0) then X`09`09 begin X`09`09`7B Rubble... `7D X`09`09 if (t_list`5Btptr`5D.tval = Rubble) then X`09`09`09begin X`09`09`09 if (tabil > randint(180)) then X`09`09`09 begin X`09`09`09 pusht(tptr); X`09`09`09 tptr := 0; X`09`09`09 fm := false; X`09`09`09 fopen := true; X`09`09`09 msg_print('You have removed the rubble.'); X`09`09`09 if (randint(10) = 1) then X`09`09`09`09begin X`09`09`09`09 place_object(y,x); X`09`09`09`09 if (test_light(y,x)) then X`09`09`09`09 msg_print('You have found something!'); X`09`09`09`09end; X`09`09`09 lite_spot(y,x); X`09`09`09 end X`09`09`09 else X`09`09`09 msg_print('You dig in the rubble...'); X`09`09`09end X`09`09`7B Secret doors...`7D X`09`09 else if (t_list`5Btptr`5D.tval = Secret_door) then X`09`09`09begin X`09`09`09 msg_print('You tunnel into the granite wall.'); X`09`09`09 search(char_row,char_col,py.misc.srh); X`09`09`09end X`09`09 else X`09`09`09msg_print('You can''t tunnel through that.'); X`09`09 end X`09`09 else X`09`09 msg_print('Tunnel through what? Empty air???'); X`09`09end; X`09 end; X`09 end; X end; X X X`09`7B Disarms a trap`09`09`09`09`09-RAK-`09`7D X procedure disarm_trap; X var X`09y,x,i1,tdir : integer; X`09tot,t1,t2,t3,t4,t5 : integer; X begin X`09y := char_row; X`09x := char_col; X`09if (get_dir('Which direction?',tdir,i1,y,x)) then X`09 with cave`5By,x`5D do X`09 begin X`09 if (tptr > 0) then X`09`09begin X`09`09 t1 := py.misc.disarm; `7B Ability to disarm `7D X`09`09 t2 := py.misc.lev; `7B Level adjustment `7D X`09`09 t3 := 2*todis_adj; `7B Dexterity adjustment `7D X`09`09 t4 := spell_adj(iq); `7B Intelligence adjustment`7D X`09`09 tot := t1 + t2 + t3 + t4; X`09`09 if (py.flags.blind > 0) then X`09`09 tot := trunc(tot/5.0) X`09`09 else if (no_light) then X`09`09 tot := trunc(tot/2.0); X`09`09 if (py.flags.confused > 0) then X`09`09 tot := trunc(tot/3.0); X`09`09 i1 := t_list`5Btptr`5D.tval; X`09`09 t5 := t_list`5Btptr`5D.level; X`09`09 if (i1 = Seen_trap) then `7B Floor trap `7D X`09`09 with t_list`5Btptr`5D do X`09`09 begin X`09`09`09if ((tot - t5) > randint(100)) then X`09`09`09 begin X`09`09`09 msg_print('You have disarmed the trap.'); X`09`09`09 py.misc.exp := py.misc.exp + p1; X`09`09`09 fm := false; X`09`09`09 pusht(tptr); X`09`09`09 tptr := 0; X`09`09`09 move_char(tdir); X`09`09`09 lite_spot(y,x); X`09`09`09 prt_experience; X`09`09`09 end X`09`09`09else if (randint(tot) > 5) then X`09`09`09 msg_print('You failed to disarm the trap.') X`09`09`09else X`09`09`09 begin X`09`09`09 msg_print('You set the trap off!'); X`09`09`09 move_char(tdir); X`09`09`09 end; X`09`09 end X`09`09 else if (i1 = 2) then `7B Chest trap `7D X`09`09 with t_list`5Btptr`5D do X`09`09 begin X`09`09`09if (index(name,'`5E') > 0) then X`09`09`09 msg_print('I don''t see a trap...') X`09`09`09else if (uand(%X'000001F0',flags) <> 0) then X`09`09`09 begin X`09`09`09 if ((tot - t5) > randint(100)) then X`09`09`09 begin X`09`09`09`09flags := uand(%X'FFFFFE0F',flags); X`09`09`09`09i1 := index(name,' ('); X`09`09`09`09if (i1 > 0) then X`09`09`09`09 name := substr(name,1,i1-1); X`09`09`09`09if (uand(%X'00000001',flags) <> 0) then X`09`09`09`09 name := name + ' (Locked)' X`09`09`09`09else X`09`09`09`09 name := name + ' (Disarmed)'; X`09`09`09`09msg_print('You have disarmed the chest.'); X`09`09`09`09known2(name); X`09`09`09`09py.misc.exp := py.misc.exp + t5; X`09`09`09`09prt_experience; X`09`09`09 end X`09`09`09 else if (randint(tot) > 5) then X`09`09`09 msg_print('You failed to disarm the chest.') X`09`09`09 else X`09`09`09 begin X`09`09`09`09msg_print('You set a trap off!'); X`09`09`09`09known2(name); X`09`09`09`09chest_trap(y,x); X`09`09`09 end; X`09`09`09 end X`09`09`09else X`09`09`09 msg_print('The chest was not trapped.'); X`09`09 end X`09`09 else X`09`09 msg_print('I do not see anything to disarm there.'); X`09`09end X`09 else X`09`09msg_print('I do not see anything to disarm there.'); X`09 end X end; X X X`09`7B Look at an object, trap, or monster`09`09`09-RAK-`09`7D X`09`7B Note: Looking is a free move, see where invoked... `7D X procedure look; X var X`09`09i1,i2,y,x : integer; X`09`09dir,dummy : integer; X`09`09flag : boolean; X`09`09fchar : char; X begin X`09flag := false; X`09y := char_row; X`09x := char_col; X`09if (get_dir('Look which direction?',dir,dummy,y,x)) then X`09 if (py.flags.blind < 1) then X`09 begin X`09 y := char_row; X`09 x := char_col; X`09 i1 := 0; X`09 repeat X`09`09move(dir,y,x); X`09`09with cave`5By,x`5D do X`09`09 begin X`09`09 if (cptr > 1) then X`09`09 if (m_list`5Bcptr`5D.ml) then X`09`09`09begin X`09`09`09 i2 := m_list`5Bcptr`5D.mptr; X`09`09`09 fchar := c_list`5Bi2`5D.name`5B1`5D; X`09`09`09 if (fchar in vowel_set) then X`09`09`09 writev(out_val,'You see an ',c_list`5Bi2`5D.name,'.') X`09`09`09 else X`09`09`09 writev(out_val,'You see a ',c_list`5Bi2`5D.name,'.'); X`09`09`09 msg_print(out_val); X`09`09`09 flag := true; X`09`09`09end; X`09`09 if ((tl) or (pl) or (fm)) then X`09`09 begin X`09`09`09if (tptr > 0) then X`09`09`09 if (t_list`5Btptr`5D.tval = Secret_door) then X`09`09`09 msg_print('You see a granite wall.') X`09`09`09 else if (t_list`5Btptr`5D.tval <> Unseen_trap) then X`09`09`09 begin X`09`09`09 inven_temp`5E.data := t_list`5Btptr`5D; X`09`09`09 inven_temp`5E.data.number := 1; X`09`09`09 objdes(out_val,inven_temp,true); X`09`09`09 msg_print('You see ' + out_val + '.'); X`09`09`09 flag := true; X`09`09`09 end; X`09`09`09if (not(fopen)) then X`09`09`09 begin X`09`09`09 flag := true; X`09`09`09 case fval of X`09`09`09 10 : msg_print('You see a granite wall.'); X`09`09`09 11 : msg_print('You see some dark rock.'); X`09`09`09 12 : msg_print('You see a quartz vein.'); X`09`09`09 15 : msg_print('You see a granite wall.'); X`09`09`09 otherwise ; X`09`09`09 end; X`09`09`09 end X`09`09`09else X`09`09`09 case fval of X`09`09`09 16,17 : begin X`09`09`09`09 flag := true; X`09`09`09`09 msg_print('You see some water.'); X`09`09`09`09 end; X`09`09`09 otherwise ; X`09`09`09 end; X`09`09 end; X`09`09 end; X`09`09i1 := i1 + 1; X`09 until ((not cave`5By,x`5D.fopen) or (i1 > max_sight)); X`09 if (not flag) then X`09`09msg_print('You see nothing of interest in that direction.'); X`09 end X`09 else X`09 msg_print('You can''t see a damn thing!'); X end; X X X`09`7B Add to the players food time`09`09`09`09-RAK-`09`7D X procedure add_food(num : integer); X begin X`09with py.flags do X`09 begin X`09 if (food < 0) then food := 0; X`09 food := food + num; X`09 if (food > player_food_full) then msg_print('You are full.'); X`09 if (food > player_food_max) then X`09 begin X`09`09msg_print('You''re getting fat from eating so much.'); X`09`09food := player_food_max; X`09`09py.misc.wt := py.misc.wt + trunc(py.misc.wt*0.1); +-+-+-+-+-+-+-+- END OF PART 21 +-+-+-+-+-+-+-+-