-+-+-+-+-+-+-+-+ START OF PART 77 -+-+-+-+-+-+-+-+ X`09`09 show_it := t_list`5Btptr`5D.tval in X`09`09`09`5Bvaluable_metal,valuable_gems,valuable_jewelry`5D X`09`09 else X`09`09 show_it := t_list`5Btptr`5D.tval < valuable_metal; X`09`09 if (show_it) then X`09`09 if (not (test_light(i1,i2))) then X`09`09 begin X`09`09 lite_spot(i1,i2); X`09`09 tl := true; X`09`09 detect_item := true; X`09`09 end; X`09`09end; X end; X X X`09`7B Locates and displays traps on current panel`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function detect_trap : boolean; X var X`09`09i1,i2`09`09: integer; X begin X`09detect_trap := false; X`09for i1 := panel_row_min to panel_row_max do X`09 for i2 := panel_col_min to panel_col_max do X`09 with cave`5Bi1,i2`5D do X`09 if (tptr > 0) then X`09`09if (t_list`5Btptr`5D.tval = Unseen_trap) then X`09`09 begin X`09`09 change_trap(i1,i2); X`09`09 fm := true; X`09`09 detect_trap := true; X`09`09 end X`09`09else if (t_list`5Btptr`5D.tval = chest) then X`09`09 with t_list`5Btptr`5D do X`09`09 known2(name); X end; X X`09`7B Locates and displays all secret doors on current panel -RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function detect_sdoor : boolean; X var X`09`09i1,i2`09`09: integer; X begin X`09detect_sdoor := false; X`09for i1 := panel_row_min to panel_row_max do X`09 for i2 := panel_col_min to panel_col_max do X`09 with cave`5Bi1,i2`5D do X`09 if (tptr > 0) then X`09`09`7B Secret doors`09`7D X`09`09if (t_list`5Btptr`5D.tval = Secret_door) then X`09`09 begin X`09`09 fval := corr_floor3.ftval; X`09`09 change_trap(i1,i2); X`09`09 fm := true; X`09`09 detect_sdoor := true; X`09`09 end X`09`09`7B Staircases`09`7D X`09`09else if (t_list`5Btptr`5D.tval in `5BUp_staircase,Down_staircase, X`09`09`09`09up_steep_staircase,down_steep_staircase`5D) then X`09`09 if (not(fm)) then X`09`09 begin X`09`09 fm := true; X`09`09 lite_spot(i1,i2); X`09`09 detect_sdoor := true; X`09`09 end; X end; X X`09`7B Light an area: 1. If corridor then light immediate area -RAK-`7D X`09`7B`09`09 2. If room then light entire room.`09`09`7D X`5Bglobal,psect(misc6$code)`5D function light_area(y,x : integer) : boolean; X var X`09`09i1,i2`09`09: integer; X begin X`09msg_print('You are surrounded by a white light.'); X`09light_area := true; X`09if ((cave`5By,x`5D.fval in `5B1,2,17,18`5D) and (dun_level > 0)) then X`09 light_room(y,x) X`09else X`09 for i1 := y-1 to y+1 do X`09 for i2 := x-1 to x+1 do X`09 if (in_bounds(i1,i2)) then X`09`09begin X`09`09 if (not (test_light(i1,i2))) then X`09`09 lite_spot(i1,i2); X`09`09 cave`5Bi1,i2`5D.pl := true; X`09`09end; X end; X X`09`7B Darken an area, opposite of light area`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function unlight_area(y,x : integer) : boolea Vn; X var X`09i1,i2,i3,tmp1,tmp2`09`09: integer; X`09start_row,start_col`09`09: integer; X`09end_row,end_col`09`09`09: integer; X`09flag`09`09`09`09: boolean; X begin X`09flag := false; X`09if ((cave`5By,x`5D.fval in `5B1,2,17,18`5D) and (dun_level > 0)) then X`09 begin X`09 tmp1 := trunc(screen_height/2); X`09 tmp2 := trunc(screen_width /2); X`09 start_row := trunc(y/tmp1)*tmp1 + 1; X`09 start_col := trunc(x/tmp2)*tmp2 + 1; X`09 end_row := start_row + tmp1 - 1; X`09 end_col := start_col + tmp2 - 1; X`09 for i1 := start_row to end_row do X`09 begin X`09`09out_val := ''; X`09`09i3 := 0; X`09`09for i2 := start_col to end_col do X`09`09 with cave`5Bi1,i2`5D do X`09`09 if (fval in `5B1,2,17,18`5D) then X`09`09 begin X`09`09`09pl := false; X`09`09`09fval := 1; X`09`09`09if (not(test_light(i1,i2))) then X`09`09`09 begin X`09`09`09 if (i3 = 0) then X`09`09`09 i3 := i2; X`09`09`09 out_val := out_val + ' '; X`09`09`09 end X`09`09`09else if (i3 > 0) then X`09`09`09 begin X`09`09`09 flag := true; X`09`09`09 print(out_val,i1,i3); X`09`09`09 out_val := ''; X`09`09`09 i3 := 0; X`09`09`09 end; X`09`09 end X`09`09 else if (i3 > 0) then X`09`09 begin X`09`09`09flag := true; X`09`09`09print(out_val,i1,i3); X`09`09`09out_val := ''; X`09`09`09i3 := 0; X`09`09 end; X`09`09if (i3 > 0) then X`09`09 begin X`09`09 flag := true; X`09`09 print(out_val,i1,i3); X`09`09 end; X`09 end; X`09 end X`09else X`09 for i1 := y-1 to y+1 do X`09 for i2 := x-1 to x+1 do X`09 if (in_bounds(i1,i2)) then X`09`09with cave`5Bi1,i2`5D do X`09`09 if (fval in `5B4,5,6`5D) then X`09`09 if (pl) then X`09`09 begin X`09`09`09pl := false; X`09`09`09flag := true; X`09`09 end; X`09if (flag) then X`09 begin X`09 msg_print('Darkness surrounds you...'); X`09 unlight_area := true; X`09 end X`09else X`09 unlight_area := false; X end; X X`09`7B Map the current area plus some`09`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function map_area : boolean; X var X`09`09i1,i2,i3,i4,i5,i6,i7,i8`09`09: integer; X begin X`09map_area := true; X`09i1 := panel_row_min - randint(10); X`09i2 := panel_row_max + randint(10); X`09i3 := panel_col_min - randint(20); X`09i4 := panel_col_max + randint(20); X`09for i5 := i1 to i2 do X`09 for i6 := i3 to i4 do X`09 if (in_bounds(i5,i6)) then X`09 if (cave`5Bi5,i6`5D.fval in floor_set) then X`09`09for i7 := i5-1 to i5+1 do X`09`09 for i8 := i6-1 to i6+1 do X`09`09 with cave`5Bi7,i8`5D do X`09`09 if (fval in pwall_set) then X`09`09`09pl := true X`09`09 else if (tptr > 0) then X`09`09`09if (t_list`5Btptr`5D.tval in light_set) then X`09`09`09 fm := true; X`09prt_map; X end; X X`09`7B Identify an object`09`09`09`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function ident_spell : boolean; X var X`09`09item_ptr`09`09: treas_ptr; X`09`09out_val`09`09`09: vtype; X`09`09redraw`09`09`09: boolean; X begin X`09ident_spell := false; X`09redraw := false; X`09change_all_ok_stats(true,true); X`09if (get_item(item_ptr,'Item you wish identified?', X`09`09`09`09redraw,inven_ctr,trash_char,false)) then X`09 with item_ptr`5E.data do X`09 begin X`09 ident_spell := true; X`09 identify(item_ptr`5E.data); X`09 known2(name); X`09 objdes(out_val,item_ptr,true); X`09 msg_print(out_val); X`09 end; X`09if (redraw) then X`09 begin X`09 msg_print(' '); X`09 draw_cave; X`09 end; X end; X X`09`7B Get all the monsters on the level pissed off...`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function aggravate_monster`09( X`09`09`09dis_affect`09`09:`09integer X`09`09`09`09`09`09) : boolean; X var X`09`09i1`09`09: integer; X begin X`09aggravate_monster := true; X`09i1 := muptr; X`09repeat X`09 with m_list`5Bi1`5D do X`09 begin X`09 csleep := 0; X`09 if (cdis <= dis_affect) then X`09`09if (cspeed < 2) then X`09`09 cspeed := cspeed + 1; X`09 end; X`09 i1 := m_list`5Bi1`5D.nptr; X`09until(i1 = 0); X end; X X`09`7B Surround the fool with traps (chuckle)`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function trap_creation : boolean; X var X`09`09i1,i2`09`09: integer; X begin X`09trap_creation := true; X`09for i1 := char_row-1 to char_row+1 do X`09 for i2 := char_col-1 to char_col+1 do X`09 with cave`5Bi1,i2`5D do X`09 if (fval in floor_set) then X`09`09begin X`09`09 if (tptr > 0) then X`09`09 delete_object(i1,i2); X`09`09 place_trap(i1,i2,1,randint(max_trapa)); X`09`09end; X end; X X`09`7B Surround the player with doors...`09`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function door_creation : boolean; X var X`09`09i1,i2,i3`09: integer; X begin X`09door_creation := true; X`09for i1 := char_row-1 to char_row+1 do X`09 for i2 := char_col-1 to char_col+1 do X`09 if ((i1 <> char_row) or (i2 <> char_col)) then X`09 with cave`5Bi1,i2`5D do X`09`09if (fval in floor_set) then X`09`09 begin X`09`09 popt(i3); X`09`09 if (tptr > 0) then X`09`09 delete_object(i1,i2); X`09`09 fopen := false; X`09`09 tptr := i3; X`09`09 t_list`5Bi3`5D := door_list`5B2`5D; X`09`09 if (test_light(i1,i2)) then X`09`09 lite_spot(i1,i2); X`09`09 end; X end; X X`09`7B Destroys any adjacent door(s)/trap(s)`09`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function td_destroy : boolean; X var X`09`09i1,i2`09`09: integer; X begin X`09td_destroy := false; X`09for i1 := char_row-1 to char_row+1 do X`09 for i2 := char_col-1 to char_col+1 do X`09 with cave`5Bi1,i2`5D do X`09 if (tptr > 0) then X`09`09if (t_list`5Btptr`5D.tval in `5BUnseen_trap,Seen_trap,Open_door, X`09`09`09`09`09 Closed_door,Secret_door`5D) then X`09`09 begin X`09`09 if (delete_object(i1,i2)) then X`09`09 td_destroy := true; X`09`09 end; X end; X X X`09`7B Leave a line of light in given dir, blue light can sometimes`09`7D X`09`7B hurt creatures...`09`09`09`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function light_line(dir,y,x,power:integer):bo Volean; X begin X`09light_line := true; X`09while (cave`5By,x`5D.fopen) do X`09 begin X`09 with cave`5By,x`5D do X`09 begin X`09`09if (panel_contains(y,x)) then X`09`09 begin X`09`09 if (not((tl) or (pl))) then X`09`09 if (fval = 2) then X`09`09`09light_room(y,x) X`09`09 else X`09`09`09lite_spot(y,x); X`09`09 if (cptr > 1) then X`09`09 with m_list`5Bcptr`5D do X`09`09`09with c_list`5Bmptr`5D do X`09`09`09 if (not mon_resists(cptr)) then X`09`09`09 if (uand(%X'0100',cdefense) <> 0) then X`09`09`09 begin X`09`09`09 msg_print('The ' + name + ' wails out in pain!'); X`09`09`09 i1 := 0; X`09`09`09 for i2 := 1 to power do X`09`09`09`09i1 := i1 + mon_take_hit(cptr,damroll('2d8')); X`09`09`09 if (i1 > 0) then X`09`09`09`09msg_print('The ' + name + X`09`09`09`09`09`09' dies in a fit of agony.'); X`09`09`09 end; X`09`09 end; X`09`09pl := true; X`09 end; X`09 move(dir,y,x); X`09 end; X end; X X X`09`7B Light line in all directions`09`09`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function starlite(y,x : integer) : boolean; X var X`09i1`09: integer; X begin X`09starlite := true; X`09for i1 := 1 to 9 do X`09 if (i1 <> 5) then X`09 light_line(i1,y,x,2); X end; X X X`09`7B Disarms all traps/chests in a given direction`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function disarm_all(dir,y,x : integer) : bool Vean; X var X`09i1,oldy,oldx`09`09: integer; X begin X`09disarm_all := false; X`09repeat X`09 with cave`5By,x`5D do X`09 begin X`09 if (tptr > 0) then X`09`09with t_list`5Btptr`5D do X`09`09 if (tval in `5BUnseen_trap,Seen_trap`5D) then X`09`09 begin X`09`09 if (delete_object(y,x)) then X`09`09`09disarm_all := true; X`09`09 end X`09`09 else if (tval = Closed_door) then X`09`09 p1 := 0 X`09`09 else if (tval = Secret_door) then X`09`09 begin X`09`09 fval := corr_floor3.ftval; X`09`09 change_trap(y,x); X`09`09 fm := true; X`09`09 disarm_all := true; X`09`09 end X`09`09 else if (tval = Chest) then X`09`09 if (flags > 0) then X`09`09 begin X`09`09`09msg_print('Click!'); X`09`09`09flags := 0; X`09`09`09disarm_all := true; X`09`09`09i1 := index(name,' ('); X`09`09`09if (i1 > 0) then X`09`09`09 name := substr(name,1,i1-1); X`09`09`09name := name + ' (Unlocked)'; X`09`09`09known2(name); X`09`09 end; X`09 end; X`09 oldy := y; X`09 oldx := x; X`09 move(dir,y,x); X`09until(not(cave`5Boldy,oldx`5D.fopen)) X end; X Xfunction am_i_dumb : boolean; X begin X`09am_i_dumb := py.misc.lev < randint(randint(50)); X end; X`09`7B Looks to see if item is cursed`09`09`09-Cap'n-`09`7D X`5Bglobal,psect(misc6$code)`5D function detect_curse : boolean; X var X`09`09item_ptr`09: treas_ptr; X`09`09redraw`09`09: boolean; X begin X`09detect_curse := false; X`09redraw := false; X`09change_all_ok_stats(true,true); X`09if (get_item(item_ptr,'Item you wish to examine?', X`09`09`09redraw,inven_ctr,trash_char,false)) then X`09 begin X`09 with item_ptr`5E.data do X`09 if (uand(cursed_worn_bit,flags) <> 0) then X`09 begin X`09`09 flags2 := uor(flags2,known_cursed_bit); X`09`09 msg_print('The item is cursed!'); X`09 end X`09 else X`09 msg_print('This item is not cursed.'); X`09 detect_curse := true; X`09 end; X`09if (redraw) then X`09 begin X`09 msg_print(' '); X`09 draw_cave; X`09 end; X end; X X`09`7B Return flags for given type area affect`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D procedure get_flags ( X`09`09`09typ`09`09`09`09: integer; X`09`09`09var weapon_type,harm_type`09: integer; X`09`09`09var destroy`09`09`09: obj_set X`09`09`09`09`09); X begin X`09 case typ of X`09c_lightning : begin `7B1`7D X`09`09weapon_type := %X'00080000'; X`09`09harm_type := %X'0100'; X`09`09destroy`09 := `5Bring,rod,wand`5D; X`09 end; X`09c_gas : begin`09`7B2`7D X`09`09weapon_type := %X'00100000'; X`09`09harm_type := %X'0040'; X`09`09destroy`09 := `5B`5D; X`09 end; X`09c_acid : begin `7B3`7D X`09`09weapon_type := %X'00200000'; X`09`09harm_type := %X'0080'; X`09`09destroy`09 := `5Barrow,bow_crossbow_or_sling,hafted_weapon, X`09`09`09`09pole_arm,boots,gloves_and_gauntlets,cloak,helm, X`09`09`09`09gem_helm,staff,shield,hard_armor,soft_armor, X`09`09`09`09scroll1,scroll2,food,Open_door,Closed_door`5D; X`09 end; X`09c_cold : begin `7B4`7D X`09`09weapon_type := %X'00400000'; X`09`09harm_type := %X'0010'; X`09`09destroy`09 := `5Bpotion1,potion2`5D; X`09 end; X`09c_fire : begin `7B5`7D X`09`09weapon_type := %X'00800000'; X`09`09harm_type := %X'0020'; X`09`09destroy`09 := `5Barrow,bow_crossbow_or_sling,hafted_weapon, X`09`09`09`09pole_arm,boots,gloves_and_gauntlets,cloak, X`09`09`09`09soft_armor,staff,scroll1,scroll2, X`09`09`09`09potion1,potion2,food,Open_door,Closed_door`5D; X`09 end; X`09c_good : begin `7B6`7D X`09`09weapon_type := %X'00000000'; X`09`09harm_type := %X'0004'; X`09`09destroy`09 := `5B`5D; X`09 end; X`09c_evil : begin `7B7`7D X`09`09weapon_type := %X'00000000'; X`09`09harm_type := %X'0000'; X`09`09destroy`09 := `5B`5D; X`09 end; X`09c_petrify : begin `7B8`7D +-+-+-+-+-+-+-+- END OF PART 77 +-+-+-+-+-+-+-+-