-+-+-+-+-+-+-+-+ START OF PART 50 -+-+-+-+-+-+-+-+ 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`5Bpsect(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 for 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 pl := true X`09`09 else if (tptr > 0) then X`09`09 if (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`5Bpsect(misc6$code)`5D function ident_spell : boolean; X var X`09`09item_val`09`09: integer; 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`09if (get_item(item_val,'Item you wish identified?', X`09`09`09`09`09`09redraw,1,inven_ctr)) then X`09 with inventory`5Bitem_val`5D do X`09 begin X`09 ident_spell := true; X`09 identify(inventory`5Bitem_val`5D); X`09 known2(name); X`09 objdes(out_val,item_val,true); X`09 msg_print(chr(item_val+96) + cur_char2(item_val)+' ' + 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`5Bpsect(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`09while i1 <> 0 do X`09begin 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`09end; X end; X X`09`7B Surround the fool with traps (chuckle)`09`09-RAK-`09`7D X`5Bpsect(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`5Bpsect(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 if (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`5Bpsect(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 `5B101,102,104,105,109`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`09`7B Display all creatures on the current panel`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function detect_monsters : boolean; X var X`09`09i1,i2`09`09: integer; X`09`09flag`09`09: boolean; X begin X`09flag := false; X`09i1 := muptr; X`09while (i1 <> 0) do X`09begin X`09 with m_list`5Bi1`5D do X`09 if (panel_contains(fy,fx)) then X`09 if (uand(%X'10000',c_list`5Bmptr`5D.cmove) = 0) then X`09`09begin X`09`09 ml := true; X`09`09 print(c_list`5Bmptr`5D.cchar,fy,fx); X`09`09 flag := true; X`09`09end; X`09 i1 := m_list`5Bi1`5D.nptr; X`09end; X`09if (flag) then X`09 begin X`09 msg_print('You sense the presense of monsters!'); X`09 msg_print(' '); X`09 msg_flag := false; X`09 detect_monsters := true; X`09 end; X`09detect_monsters := flag; 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`5Bpsect(misc6$code)`5D function light_line(dir,y,x : integer) : boolean; 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 light_room(y,x) X`09`09 else X`09`09 lite_spot(y,x); X`09 if (cptr > 1) then X`09 with m_list`5Bcptr`5D do X`09`09 with c_list`5Bmptr`5D do X`09 if (uand(%X'0100',cdefense) <> 0) then X`09`09 begin X`09`09 msg_print('The ' + name + ' wails out in pain!'); X`09`09 i1 := mon_take_hit(cptr,damroll('2d8')); X`09`09 if (i1 > 0) then X`09`09`09 msg_print('The ' + name + X`09`09`09`09`09`09' dies in a fit of agony.'); X`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`5Bpsect(misc6$code)`5D function starlite(y,x : integer) : boolean; X var X`09i1`09`09`09: integer; X begin X`09msg_print('The end of the staff bursts into a blue shimmering light.'); X`09starlite := true; X`09for i1 := 1 to 9 do X`09 if (i1 <> 5) then X`09 light_line(i1,y,x); X end; X X X`09`7B Disarms all traps/chests in a given direction`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function disarm_all(dir,y,x : integer) : boolean; X var X`09i1,oldy,oldx`09`09: integer; X begin X`09disarm_all := false; X`09while `09cave`5Boldy,oldx`5D.fopen do X`09begin 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 `5B101,102`5D) then X`09`09 begin X`09`09 if (delete_object(y,x)) then X`09`09 disarm_all := true; X`09`09 end X`09`09 else if (tval = 105) then X`09`09 begin X`09`09 p1 := 0; X`09`09 end X`09`09 else if (tval = 109) 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 = 2) 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`09end; X end; X X`09`7B Return flags for given type area affect`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D procedure get_flags`09( X`09`09`09typ `09`09`09`09: integer;`20 X`09`09`09var weapon_type,harm_type `09: integer;`20 X`09`09`09var destroy`09`09`09: obj_set X `09`09`09`09`09); X begin X case typ of X`091 : begin`09`7B Lightning`09`7D X`09`09weapon_type := %X'00080000'; X`09`09harm_type := %X'0100'; X`09`09destroy := `5B45,60,65`5D; X`09 end; X`092 : begin`09`7B Poison Gas`09`7D X`09`09weapon_type := %X'00100000'; X`09`09harm_type := %X'0040'; X`09`09destroy := `5B`5D; X`09 end; X`093 : begin`09`7B Acid`09`09`7D X`09`09weapon_type := %X'00200000'; X`09`09harm_type := %X'0080'; X`09`09destroy := X`09`09`09`5B12,20,21,22,30,31,32,33,34,35,36,55,70,71,80,104,105`5D; X`09 end; X`094 : begin`09`7B Frost`09`09`7D X`09`09weapon_type := %X'00400000'; X`09`09harm_type := %X'0010'; X`09`09destroy := `5B75,76`5D; X`09 end; X`095 : begin`09`7B Fire`09`09`7D X`09`09weapon_type := %X'00800000'; X`09`09harm_type := %X'0020'; X`09`09destroy :=`20 X`09`09`09`5B12,20,21,22,30,31,32,36,55,70,71,75,76,80,104,105`5D; X`09 end; X`096 : begin`09`7B Holy Orb`09`7D X`09`09weapon_type := %X'00000000'; X`09`09harm_type := %X'0004'; X`09`09destroy := `5B`5D; X`09 end; X`09otherwise begin X`09`09 weapon_type := 0; X`09`09 harm_type := 0; X`09`09 destroy := `5B`5D; X`09`09 end; X end; X end; X X X`09`7B Shoot a bolt in a given direction`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function fire_bolt`09( X`09`09`09typ,dir,y,x,dam`09: integer; X`09`09`09bolt_typ `09: ctype X`09`09`09`09`09) : boolean; X var X`09i1,oldy,oldx`09`09`09: integer; X`09weapon_type,harm_type`09`09: integer; X`09flag`09`09`09`09: boolean; X`09dummy`09`09`09`09: obj_set; X begin X`09fire_bolt := true; X`09flag := false; X`09get_flags(typ,weapon_type,harm_type,dummy); X`09oldy := y; X`09oldx := x; X`09repeat X`09 move(dir,y,x); X`09 if (test_light(oldy,oldx)) then X`09 lite_spot(oldy,oldx) X`09 else X`09 unlite_spot(oldy,oldx); X`09 with cave`5By,x`5D do X`09 begin X`09 if (fopen) then X`09`09begin X`09`09 if (cptr > 1) then X`09`09 begin X`09`09 flag := true; X`09`09 with m_list`5Bcptr`5D do X`09`09`09with c_list`5Bmptr`5D do X`09`09`09 begin X`09`09`09 msg_print('The ' + bolt_typ + ' strikes the ' +`20 X`09`09`09`09`09`09c_list`5Bmptr`5D.name + '.'); X`09`09`09 if (uand(harm_type,cdefense) <> 0) then X`09`09`09 dam := dam*2 X`09`09`09 else if (uand(weapon_type,spells) <> 0) then X`09`09`09 dam := trunc(dam/4.0); X`09`09`09 i1 := mon_take_hit(cptr,dam); X`09`09`09 if (i1 > 0) then X`09`09`09 msg_print('The ' + c_list`5Bi1`5D.name + X`09`09`09`09`09`09' dies in a fit of agony.') X`09`09`09 else X`09`09`09 begin X`09`09`09 if (panel_contains(y,x)) then X`09`09`09`09 begin X`09`09`09 print(c_list`5Bmptr`5D.cchar,y,x); X`09`09`09 m_list`5Bcptr`5D.ml := true; X`09`09`09`09 end; X`09`09`09 end X`09`09`09 end X`09`09 end X`09`09 else if (panel_contains(y,x)) then X`09`09 print('*',y,x); X`09`09end X`09 else X`09`09flag := true; X end; X`09 oldy := y; X`09 oldx := x; X`09until (flag); X end; X X X`09`7B Shoot a ball in a given direction. Note that balls have an`09`7D X`09`7B area affect....`09`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function fire_ball`09`09( X`09`09`09typ,dir,y,x,dam_hp`09:`09integer; X`09`09`09descrip`09`09`09:`09ctype X`09`09`09`09`09`09) : boolean; X var X`09i1,i2,i3`09`09`09: integer; X`09dam,max_dis,thit,tkill`09`09: integer; X`09oldy,oldx`09`09`09: integer; X`09weapon_type,harm_type`09`09: integer; X`09flag`09`09`09`09: boolean; X`09destroy`09`09`09`09: obj_set; X begin X`09fire_ball := true; X thit := 0; X tkill := 0; X`09max_dis := 2; X`09get_flags(typ,weapon_type,harm_type,destroy); X`09flag := false; X`09oldy := y; X`09oldx := x; X`09repeat X`09 move(dir,y,x); X`09 if (test_light(oldy,oldx)) then X`09 lite_spot(oldy,oldx) X`09 else X`09 unlite_spot(oldy,oldx); X`09 with cave`5By,x`5D do X`09 begin X`09 if ((not(fopen)) or (cptr > 1)) then X`09`09begin X`09`09 flag := true; X`09`7B The ball hits and explodes...`09`09`09`7D X`09`7B The explosion...`09`09`09`7D X`09for i1 := y-2 to y+2 do X`09 for i2 := x-2 to x+2 do X`09 if (in_bounds(i1,i2)) then X`09 if (distance(y,x,i1,i2) <= max_dis) then X`09`09with cave`5Bi1,i2`5D do X`09`09 begin X`09`09 if (tptr > 0) then X`09`09 if (t_list`5Btptr`5D.tval in destroy) then X`09`09 delete_object(i1,i2); X`09`09 if (fopen) then X`09`09 begin X`09`09`09if (panel_contains(i1,i2)) then X`09`09 print('*',i1,i2); X`09`09 if (cptr > 1) then X`09`09`09 with m_list`5Bcptr`5D do X`09`09`09 with c_list`5Bmptr`5D do X`09`09`09 begin X`09`09`09 thit := thit + 1; X`09`09`09 dam := dam_hp; X`09`09`09 if (uand(harm_type,cdefense) <> 0) then X`09`09`09`09 dam := dam*2 X`09`09`09`09else if (uand(weapon_type,spells) <> 0) then X`09`09`09`09 dam := trunc(dam/4.0); X`09`09`09`09dam := trunc(dam/(distance(i1,i2,y,x)+1)); X`09`09`09 i3 := mon_take_hit(cptr,dam); X`09 `09 if (i3 > 0) then X`09`09 `09`09 tkill := tkill + 1 X`09 `09 else X`09`09 `09`09 begin X`09`09 `09`09 if (panel_contains(i1,i2)) then X`09`09 `09`09 begin X`09`09 `09 print(cchar,i1,i2); X`09`09 `09 ml := true; X`09`09 `09`09 end X`09`09 `09`09 end; X`09`09`09 end; X`09`09 end; X`09`09 end; X for i1 := (y - 2) to (y + 2) do X`09 for i2 := (x - 2) to (x + 2) do X`09 if (in_bounds(i1,i2)) then X`09 if (panel_contains(i1,i2)) then X`09 if (distance(y,x,i1,i2) <= max_dis) then X`09`09 begin X`09`09 with cave`5Bi1,i2`5D do +-+-+-+-+-+-+-+- END OF PART 50 +-+-+-+-+-+-+-+-