-+-+-+-+-+-+-+-+ START OF PART 66 -+-+-+-+-+-+-+-+ X BEGIN X flag := false; X i1 := muptr; X if (i1<>0) then X repeat X with m_list`5Bi1`5D do X if (panel_contains(fy,fx)) then X if (uand(%X'10000',c_list`5Bmptr`5D.cmove) = 0) then X BEGIN X ml := true; X print(c_list`5Bmptr`5D.cchar,fy,fx); X flag := true X END; X i1 := m_list`5Bi1`5D.nptr; X until(i1 = 0); X if (flag) then X BEGIN X msg_print('You detect life forms nearby...'); X msg_print(' '); X msg_flag := false; X detect_monsters := true X END; X detect_monsters := flag X END; X`20 X`20 X`7B Leave a line of light in given dir, blue light can sometimes hurt creatu Vres.`7D X`5Bpsect(misc6$code)`5D function light_line(dir,y,x,dmg : integer; X`09`09`09`09`09 laser : boolean) : boolean; X BEGIN X light_line := true; X while (cave`5By,x`5D.fopen) do X BEGIN X with cave`5By,x`5D do X BEGIN X if (panel_contains(y,x)) then X BEGIN X if (not((tl) or (pl))) then X lite_spot(y,x); X if (cptr > 1) then X with m_list`5Bcptr`5D, c_list`5Bmptr`5D do X if (uand(%X'0100',cdefense) <> 0) then X begin X msg_print('The ' + name + ' wails out in pain!'); X i1 := mon_take_hit(cptr,dmg); X if (i1 > 0) then X msg_print('The ' + name + ' buys the proverbial farm.') V; X end X`09 else if (laser) then X`09 begin X msg_print('The ' + name + ' is zapped by the laser!'); X i1 := mon_take_hit(cptr,dmg); X if (i1 > 0) then X msg_print('The ' + name + ' sizzles and melts away.'); X`09`09 end; X END; X pl := true X END; X move(dir,y,x); X END X END; X`20 X`20 X`7B Light line in all directions `7D X`5Bpsect(misc6$code)`5D function starlite(y,x : integer) : boolean; X VAR X i1 : integer; X BEGIN X msg_print('The end of the device bursts into a blue shimmering light. V'); X starlite := true; X for i1 := 1 to 9 do X if (i1 <> 5) then X light_line(i1,y,x,damroll('2d8'),false); X END; X`20 X`20 X`7B Disarms all traps/chests in a given direction `7D X`5Bpsect(misc6$code)`5D function disarm_all(dir,y,x : integer) : boolean; X VAR X i1,oldy,oldx : integer; X BEGIN X disarm_all := false; X repeat X with cave`5By,x`5D do X BEGIN X if (tptr > 0) then X with t_list`5Btptr`5D do X if (tval in `5B101,102`5D) then X BEGIN X if (delete_object(y,x)) then disarm_all := true; X END X else X if (tval = 105) then X BEGIN X p1 := 0 X END X else X if (tval = 109) then X BEGIN X fval := corr_floor3.ftval; X change_trap(y,x); X fm := true; X disarm_all := true X END X else X if (tval = 2) then X if (flags > 0) then X BEGIN X msg_print('Click!'); X flags := 0; X disarm_all := true; X i1 := index(name,' ('); X if (i1 > 0) then X name := substr(name,1,i1-1); X name := name + ' (Unlocked)'; X known2(name) X END X END; X oldy := y; X oldx := x; X move(dir,y,x); X until(not(cave`5Boldy,oldx`5D.fopen)) X X END; X`20 X`7B Return flags for given type area affect `7D X`5Bpsect(misc6$code)`5D procedure get_flags ( X typ : integer; VAR weapon_type,harm_type : integer; X VAR destroy : obj_set ); X BEGIN X CASE typ of X`7B Lightning `7D1 : BEGIN X weapon_type := %X'00080000'; X harm_type := %X'0100'; X destroy := `5B45,60,65`5D X END; X`7B Gas `7D 2 : BEGIN X weapon_type := %X'00100000'; X harm_type := %X'0040'; X destroy := `5B`5D X END; X`7B Acid `7D 3 : BEGIN X weapon_type := %X'00200000'; X harm_type := %X'0080'; X destroy := `5B12,20,21,22,30,31,32,33,34,35,36,55,70,71,80,104 V,105`5D X END; X`7B Frost `7D 4 : BEGIN X weapon_type := %X'00400000'; X harm_type := %X'0010'; X destroy := `5B75,76`5D X END; X`7B Fire `7D 5 : BEGIN X weapon_type := %X'00800000'; X harm_type := %X'0020'; X destroy := `5B12,20,21,22,30,31,32,36,55,70,71,75,76,80,104,1 V05`5D X END; X`7B Anti-Mut `7D 6 : BEGIN X weapon_type := %X'00000000'; X harm_type := %X'0004'; X destroy := `5B`5D X END; X otherwise BEGIN X weapon_type := 0; X harm_type := 0; X destroy := `5B`5D X END X END X END; X`20 X`20 X`7B Shoot a bolt in a given direction `7D X`5Bpsect(misc6$code)`5D function fire_bolt ( X typ,dir,y,x,dam : integer; X bolt_typ : ctype ) : boolean; X VAR X i1,oldy,oldx,dist,weapon_type,harm_type : integer; X flag : boolean; X mwkchar: char; X dummy : obj_set; X diestr: vtype; X BEGIN X fire_bolt := true; X flag := false; X get_flags(typ,weapon_type,harm_type,dummy); X oldy := y; X oldx := x; X dist := 0; X repeat X move(dir,y,x); X if (test_light(oldy,oldx)) then X lite_spot(oldy,oldx) X else X unlite_spot(oldy,oldx); X dist := dist + 1; X if (dist > obj$bolt_range ) then X flag := true X else X BEGIN X with cave`5By,x`5D do X BEGIN X if (fopen) then X BEGIN X if (cptr > 1) then X BEGIN X flag := true; X with m_list`5Bcptr`5D, c_list`5Bmptr`5D do X BEGIN X msg_print('The '+bolt_typ+' strikes the '+ c_list`5Bmptr`5D. Vname); X if (uand(harm_type,cdefense) <> 0) then X dam := dam*2 X else if (uand(weapon_type,spells) <> 0) then X dam := trunc(dam/4.0); X i1 := mon_take_hit(cptr,dam); X if (i1 > 0) then X`09`09 begin X`09`09 case (randint(5)) of X 1: diestr := ' ceases to live.'; X`09`09`09 2: diestr := ' is no longer.'; X`09`09`09 3: diestr := ' dies agonizingly.'; X`09`09`09 4: diestr := ' expires with a sigh.'; X`09`09`09 5: diestr := ' collapses in a heap.'; X`09`09`09 end; X msg_print('The '+c_list`5Bi1`5D.name + diestr); X`09`09`09end X else X BEGIN X if (panel_contains(y,x)) then X BEGIN X print(c_list`5Bmptr`5D.cchar,y,x); X m_list`5Bcptr`5D.ml := true X END X END X END X END X else if (panel_contains(y,x)) then X BEGIN X CASE dir of X 1,9: mwkchar:='/'; X 2,8: mwkchar:='`7C'; X 3,7: mwkchar:='\'; X 4,6: mwkchar:='-' X END; X print(mwkchar,y,x) X END X END X else X flag := true X END; X oldy := y; X oldx := x X END; X until (flag) X END; X X `7BDeclared forward in Main.inc`7D X `7BBlow up a certain (y,x) Painful is true when it hurts the player.`7D X`7B`5Bpsect(misc6$code)`5D`7D procedure explosion; `7B(typ,y,x,dam_hp,radius V : integer; X`09`09`09`09`09 painful`09 : boolean; X`09`09`09`09 descrip`09 : ctype);`7D X VAR X i1,i2,i3,dam,thit,tkill`09`09: integer; X weapon_type,harm_type`09`09: integer; X flag`09`09`09`09: boolean; X destroy`09`09`09`09: obj_set; X BEGIN X thit := 0; X`09tkill := 0; X`09get_flags(typ,weapon_type,harm_type,destroy); X for i1 := y-radius to y+radius do X for i2 := x-radius to x+radius do X if (in_bounds(i1,i2)) then X if (distance(y,x,i1,i2) <= radius) then X`09 if (los(y,x,i1,i2)) then X with cave`5Bi1,i2`5D do X BEGIN X if (tptr > 0) then X if (t_list`5Btptr`5D.tval in destroy) then X`09`09`09 delete_object(i1,i2); X if (fopen) then X`09`09`09 BEGIN X`09`09`09 if (panel_contains(i1,i2)) then`20 X`09`09`09 print('*',i1,i2); X if ((painful) and (cptr = 1)) then X BEGIN X dam := trunc(dam_hp/(distance(i1,i2,y,x)+1)) V; X CASE typ of X`09`09`09`09 0 : take_hit(dam,descrip); X 1 : light_dam(dam,descrip); X`09`09`09`09 2 : poison_gas(dam,descrip); X`09`09`09`09 3 : acid_dam(dam,descrip); X`09`09`09`09 4 : cold_dam(dam,descrip); X`09`09`09`09 5 : fire_dam(dam,descrip) X`09`09`09`09 END; X`09`09`09 END; X`09`09`09 if (cptr > 1) then X`09`09`09 with m_list`5Bcptr`5D, c_list`5Bmptr`5D do X`09`09`09`09BEGIN X`09`09`09`09 thit := thit + 1; X`09`09`09`09 dam := dam_hp; X`09`09`09`09 if (uand(harm_type,cdefense) <> 0) then X`09`09`09`09 dam := dam*2 X`09`09`09`09 else if (uand(weapon_type,spells) <> 0) then X`09`09`09`09 dam := dam div 2; X`09`09`09`09 dam := trunc(dam/(distance(i1,i2,y,x)+1)); X`09`09`09`09 i3 := mon_take_hit(cptr,dam); X`09`09`09`09 if (i3 > 0) then X`09`09`09`09 tkill := tkill + 1 X`09`09`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`09 print(cchar,i1,i2); X`09`09`09`09`09 ml := true X`09`09`09`09 end X`09`09`09`09 END X`09`09`09`09 END X END X END; X for i1 := (y - radius) to (y + radius) do X`09 for i2 := (x - radius) to (x + radius) 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) <= radius) then X`09`09 BEGIN X`09`09 with cave`5Bi1,i2`5D do X`09`09 if (test_light(i1,i2)) then X`09`09 lite_spot(i1,i2) X`09`09 else if (cptr = 1) then X lite_spot(i1,i2) X else if (cptr > 1) then X if (m_list`5Bcptr`5D.ml) then X lite_spot(i1,i2) X else X unlite_spot(i1,i2) X else X unlite_spot(i1,i2); X`09 END; X if (thit = 1) then X msg_print('The ' + descrip + ' envelopes a creature!') X else if (thit > 1) then X msg_print('The ' + descrip + ' envelopes several creatures!'); X if (tkill = 1) then X msg_print('The ' + descrip + ' kills a creature!') X else if (tkill > 1) then X msg_print('Several monsters expire in the attack!'); X END; X`20 X`20 X`7B Shoot a ball in a given direction. Note that balls have an area affect. V `7D X`5Bpsect(misc6$code)`5D function fire_ball (typ,dir,y,x : integer; X`09`09`09`09 dam_hp,radius`09: integer; X`09`09`09`09 painful`09`09: boolean; X`09`09`09`09 descrip`09`09: ctype ) : boolean; X VAR X dam,oldy,oldx,dist`09: integer; X flag`09`09`09: boolean; X BEGIN X fire_ball := true; X`09flag := false; X`09oldy := y; X`09oldx := x; X`09dist := 0; X`09repeat X`09 move(dir,y,x); X`09 dist := dist + 1; 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 if (dist > obj$bolt_range) then X`09 flag := true X`09 else X`09 BEGIN X`09 with cave`5By,x`5D do X`09 BEGIN X`09`09 if ((not(fopen)) or (cptr > 1)) then X`09`09 begin X`09`09 flag := true; X`09`09 if (not(fopen)) then X`09`09 begin X`09`09 y := oldy; X`09`09`09x := oldx X`09`09 end; X`09`09 explosion(typ,y,x,dam_hp,2,painful,descrip); X`09`09 end X else if (panel_contains(y,x)) then X print('*',y,x) X END; X oldy := y; X`09 oldx := x X END; X until (flag) X END; X`20 X`20 X`7B Recharge a wand, staff, or rod. Sometimes the item breaks. `7D X`5Bpsect(misc6$code)`5D function recharge(num : integer) : boolean; X VAR X item_val :integer; X redraw : boolean; X BEGIN X recharge := false; X redraw := false; X if (get_item(item_val,'Recharge which item?',redraw,1,inven_ctr)) th Ven X with inventory`5Bitem_val`5D do X if (tval in `5B55,60,65`5D) then X if (randint(8) = 1) then X BEGIN X recharge := true; X msg_print('The item melts in your hand...'); X inven_destroy(item_val) X END X else X BEGIN X recharge := true; X num := trunc(num/(level+2)); X p1 := p1 + 2 + randint(num); +-+-+-+-+-+-+-+- END OF PART 66 +-+-+-+-+-+-+-+-