-+-+-+-+-+-+-+-+ START OF PART 56 -+-+-+-+-+-+-+-+ 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 Holy Orb `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,Opusii_range : integer; X flag : boolean; X mwkchar: char; X dummy : obj_set; X BEGIN X Opusii_range:=18; 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 > Opusii_range ) then `7B max bolt range -Opusii`7D 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 do X with 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 msg_print('The '+c_list`5Bi1`5D.name+' dies in a fit of V agony') 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`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 ( X typ,dir,y,x,dam_hp : integer; X descrip : ctype ) : boolean; X VAR X i1,i2,i3,dam,max_dis,thit,tkill,oldy,oldx,dist, X weapon_type,harm_type,Opusii_range : integer; X flag : boolean; X destroy : obj_set; X BEGIN X Opusii_range := 18; X fire_ball := true; X thit := 0; X tkill := 0; X max_dis := 2; X get_flags(typ,weapon_type,harm_type,destroy); X flag := false; X oldy := y; X oldx := x; X dist := 0; X repeat X move(dir,y,x); X dist := dist + 1; X if (test_light(oldy,oldx)) then X lite_spot(oldy,oldx) X else X unlite_spot(oldy,oldx); X if (dist > Opusii_range) then X flag := true X else X BEGIN X with cave`5By,x`5D do X BEGIN X if ((not(fopen)) or (cptr > 1)) then X BEGIN X flag := true; X if (not(fopen)) then X BEGIN X y := oldy; X x := oldx X END; X`7B The ball hits and explodes. `7D X for i1 := y-max_dis to y+max_dis do X for i2 := x-max_dis to x+max_dis do X if (in_bounds(i1,i2)) then X if (distance(y,x,i1,i2) <= max_dis) then X`7B FIXED BUG V4.5 `7D 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 delete_object(i1,i2); X if (fopen) then X BEGIN X if (panel_contains(i1,i2)) then print('*',i1,i2); X if (cptr > 1) then X with m_list`5Bcptr`5D do X with c_list`5Bmptr`5D do X BEGIN X thit := thit + 1; X dam := dam_hp; X if (uand(harm_type,cdefense) <> 0) then X dam := dam*2 X else if (uand(weapon_type,spells) <> 0) then X dam := dam div 4; X dam := trunc(dam/(distance(i1,i2,y,x)+1)); X i3 := mon_take_hit(cptr,dam); X if (i3 > 0) then X tkill := tkill + 1 X else X BEGIN X if (panel_contains(i1,i2)) then X BEGIN X print(cchar,i1,i2); X ml := true X END X END X END X END X END; X for i1 := (y - 2) to (y + 2) do X for i2 := (x - 2) to (x + 2) do X if (in_bounds(i1,i2)) then X if (panel_contains(i1,i2)) then X if (distance(y,x,i1,i2) <= max_dis) then X BEGIN X with cave`5Bi1,i2`5D do X if (test_light(i1,i2)) then X lite_spot(i1,i2) X 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 END; X`7B END explosion `7D 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('There is a scream of agony!') X else if (tkill > 1) then X msg_print('There are several screams of agony!') X`7B END ball hitting `7D X END X else if (panel_contains(y,x)) then X print('*',y,x) X END; X oldy := y; X oldx := x X END; X until (flag) X END; X`20 X`20 X`7B Breath weapon works like a fire_ball, but affects the player. `7D X`5Bpsect(misc6$code)`5D function breath ( X typ,y,x,dam_hp : integer; X ddesc : vtype ) : boolean; X VAR X i1,i2,i3,dam,max_dis,weapon_type,harm_type : integer; X flag : boolean; X destroy : obj_set; X BEGIN X breath := true; X max_dis := 2; X get_flags(typ,weapon_type,harm_type,destroy); X for i1 := y-2 to y+2 do X for i2 := x-2 to x+2 do X if (in_bounds(i1,i2)) then X if (distance(y,x,i1,i2) <= max_dis) 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 delete_object(i1,i2); X if (fopen) then X BEGIN X if (panel_contains(i1,i2)) then X print('*',i1,i2); X if (cptr > 1) then X with m_list`5Bcptr`5D do X with c_list`5Bmptr`5D do X BEGIN X dam := dam_hp; 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 dam := trunc(dam/(distance(i1,i2,y,x)+1)); X hp := hp - dam; X csleep := 0; X if (hp < 0) then X BEGIN X monster_death(fy,fx,cmove); X delete_monster(cptr) X END X END X else if (cptr = 1) then X BEGIN X dam := trunc(dam_hp/(distance(i1,i2,y,x)+1)); X CASE typ of X 1 : light_dam(dam,ddesc); X 2 : poison_gas(dam,ddesc); X 3 : acid_dam(dam,ddesc); X 4 : cold_dam(dam,ddesc); X 5 : fire_dam(dam,ddesc) X END X END X END X END; X for i1 := (y - 2) to (y + 2) do X for i2 := (x - 2) to (x + 2) do X if (in_bounds(i1,i2)) then X if (panel_contains(i1,i2)) then X if (distance(y,x,i1,i2) <= max_dis) then X BEGIN X with cave`5Bi1,i2`5D do X if (test_light(i1,i2)) then X lite_spot(i1,i2) X 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 END 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('There is a bright flash of light...'); 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); X if (index(name,'`5E') = 0) then `7Bobj already identified` V7D X insert_str(name,' (%P1',' (%P1') X`7Bobj not ident'd`7D else X insert_str(name,'`5E (%P1','`5E (%P1') X END; X if (redraw) then X BEGIN X msg_print(' '); X draw_cave X END X END; X`20 X`7B Increase or decrease a creatures hit points `7D X`5Bpsect(misc6$code)`5D function hp_monster(dir,y,x,dam : integer) : boolean V; X VAR X i1 : integer; X flag : boolean; X BEGIN X hp_monster := false; X flag := false; X repeat X move(dir,y,x); 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 do X with c_list`5Bmptr`5D do X BEGIN X hp_monster := true; +-+-+-+-+-+-+-+- END OF PART 56 +-+-+-+-+-+-+-+-