-+-+-+-+-+-+-+-+ START OF PART 52 -+-+-+-+-+-+-+-+ X`09`09 if (m_list`5Bcptr`5D.ml) then X`09`09 clone_monster := true; X`09`09flag := true; X`09 end X`09until ((not(cave`5By,x`5D.fopen)) or (flag)); X end; X X`09`7B Move the creature record to a new location`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function teleport_away(monptr,dis : integer) : boole Van; X var X`09`09yn,xn,ctr`09`09: integer; X begin X`09with m_list`5Bmonptr`5D do X`09 begin X`09 ctr := 0; X`09 repeat X`09 repeat X`09 yn := fy + (randint(2*dis+1) - (dis + 1)); X`09 xn := fx + (randint(2*dis+1) - (dis + 1)); X`09 until(in_bounds(yn,xn)); X`09 ctr := ctr + 1; X`09 if (ctr > 9) then X`09`09begin X`09`09 ctr := 0; X`09`09 dis := dis + 5; X`09`09end; X`09 until ((cave`5Byn,xn`5D.fopen) and (cave`5Byn,xn`5D.cptr = 0)); X`09 move_rec(fy,fx,yn,xn); X`09 if (test_light(fy,fx)) then X`09 lite_spot(fy,fx); X`09 fy := yn; X`09 fx := xn; X`09 ml := false; X`09 teleport_away := true; X`09 end; X end; X X`09`7B Teleport player to spell casting creature`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function teleport_to(ny,nx : integer) : boolean; X var X`09dis,ctr,y,x,i1,i2`09`09: integer; X begin X`09teleport_to := true; X`09dis := 1; X`09ctr := 0; X`09repeat X`09 y := ny + (randint(2*dis+1) - (dis + 1)); X`09 x := nx + (randint(2*dis+1) - (dis + 1)); X`09 ctr := ctr + 1; X`09 if (ctr > 9) then X`09 begin X`09 ctr := 0; X`09 dis := dis + 1; X`09 end; X until ((cave`5By,x`5D.fopen) and (cave`5By,x`5D.cptr < 2)); X`09move_rec(char_row,char_col,y,x); 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 begin X`09`09tl := false; X`09`09if (not(test_light(i1,i2))) then X`09`09 unlite_spot(i1,i2); X`09 end; X`09if (test_light(char_row,char_col)) then X`09 lite_spot(char_row,char_col); X`09char_row := y; X`09char_col := x; X`09move_char(5); X`09creatures(false); X end; X X`09`7B Teleport all creatures in a given direction away`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function teleport_monster(dir,y,x : integer) : boole Van; X var X`09`09yn,xn`09`09`09: integer; X`09`09flag`09`09`09: boolean; X begin X`09flag := false; X`09teleport_monster := false; X`09repeat X`09 move(dir,y,x); X`09 with cave`5By,x`5D do X`09 if (cptr > 1) then X`09 begin X`09 teleport_away(cptr,max_sight); X`09`09teleport_monster := true; X`09 end; X`09until ((not(cave`5By,x`5D.fopen)) or (flag)); X end; X X`09`7B Delete all creatures within MAX_SIGHT distance`09-RAK-`09`7D X`09`7B NOTE : Winning creatures cannot be genocided`09`09`09`7D X`5Bpsect(misc6$code)`5D function mass_genocide : boolean; X var X`09`09i1,i2`09`09: integer; X begin X`09mass_genocide := false; X`09i1 := muptr; X`09while i1 <> 0 do X`09begin X`09 with m_list`5Bi1`5D do X`09 with c_list`5Bmptr`5D do X`09 begin X`09 i2 := nptr; X`09 if (cdis <= max_sight) then X`09`09 if (uand(cdefense,%X'80000000') = 0) then X`09`09 begin X`09`09 delete_monster(i1); X`09`09 mass_genocide := true; X`09`09 end; X`09 end; X`09 i1 := i2; X`09end; X end; X X`09`7B Delete all creatures of a given type from level.`09-RAK-`09`7D X`09`7B This does not keep creatures of type from appearing later.`09`7D X`09`7B NOTE : Winning creatures that are genocided will be considered`7D X`09`7B as teleporting to another level. Genocide will NOT win`7D X`09`7B the game...`09`09`09`09`09`09`7D X`5Bpsect(misc6$code)`5D function genocide : boolean; X var X`09`09i1,i2`09`09: integer; X`09`09typ`09`09: char; X begin X`09genocide := true; X`09i1 := muptr; X`09if (get_com('Which type of creature do wish exterminated?',typ)) then X`09 while i1 <> 0 do X`09 begin X`09 with m_list`5Bi1`5D do X`09 with c_list`5Bmptr`5D do X`09 begin X`09 i2 := nptr; X`09 if (typ = c_list`5Bmptr`5D.cchar) then X`09`09 if (uand(cdefense,%X'80000000') = 0) then X`09`09 delete_monster(i1) X`09`09 else X`09`09 msg_print('The ' + name + ' is unaffected.'); X`09 end; X`09 i1 := i2; X`09 end; X end; X X`09`7B Change speed of any creature player can see....`09-RAK-`09`7D X`09`7B NOTE: cannot slow a winning creature (BALROG)`09`09`09`7D X`5Bpsect(misc6$code)`5D function speed_monsters(spd : integer) : boolean; X var X`09`09i1,i2`09`09: integer; X begin X`09i1 := muptr; X`09speed_monsters := false; X`09while i1 <> 0 do X`09begin X`09 with m_list`5Bi1`5D do X`09 begin X`09 i2 := nptr; X`09 if (ml) then X`09`09with c_list`5Bmptr`5D do X`09`09 if (spd > 0) then X`09`09 begin X`09`09 cspeed := cspeed + spd; X`09`09 csleep := 0; X`09`09 speed_monsters := true; X`09`09 end X`09`09 else if (randint(max_mons_level) > level) then X`09`09 begin X`09`09 cspeed := cspeed + spd; X`09`09 csleep := 0; X`09`09 speed_monsters := true; X`09`09 end X`09`09 else X`09`09 msg_print('The ' + name + ' is unaffected.'); X`09 end; X`09 i1 := i2; X`09end; X end; X X`09`7B Sleep any creature that player can see`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function sleep_monsters2 : boolean; X var X`09`09i1,i2`09`09: integer; X begin X`09i1 := muptr; X`09sleep_monsters2 := false; X`09while i1 <> 0 do X`09begin X`09 with m_list`5Bi1`5D do X`09 begin X`09 i2 := nptr; X`09 if (ml) then X`09`09begin X`09 csleep := 500; X`09`09 sleep_monsters2 := true; X`09`09end; X`09 end; X`09 i1 := i2; X`09end; X end; X X`09`7B Polymorph any creature that player can see...`09`09-RAK-`09`7D X`09`7B NOTE: cannot polymorph a winning creature (BALROG)`09`09`7D X`5Bpsect(misc6$code)`5D function mass_poly : boolean; X var X`09`09i1,i2,y,x`09: integer; X begin X`09i1 := muptr; X`09mass_poly := false; X`09while i1 <> 0 do X`09 begin X`09 with m_list`5Bi1`5D do X`09 begin X`09 i2 := nptr; X`09 if (cdis < max_sight) then X`09`09with c_list`5Bmptr`5D do X`09`09 if (uand(cdefense,%X'80000000') = 0) then X`09`09 begin X`09`09 y := fy; X`09`09 x := fx; X`09`09 delete_monster(i1); X`09`09 place_monster(y,x,randint(m_level`5Bmax_mons_level`5D) X`09`09`09`09`09`09`09+ m_level`5B0`5D,false); X`09`09 mass_poly := true; X`09`09 end; X`09 end; X`09 i1 := i2; X`09end; X end; X X`09`7B Display evil creatures on current panel`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function detect_evil : boolean; X var X`09`09i1`09`09: integer; X`09`09dummy`09`09: char; 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'0004',c_list`5Bmptr`5D.cdefense) <> 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 presence of evil!'); X`09 msg_print(' '); X`09 msg_flag := false; X`09 end; X`09detect_evil := flag; X end; X X`09`7B Change players hit points in some manner`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function hp_player(num : integer; kind : vtype) : bo Volean; X begin X`09hp_player := false; X`09with py.misc do X`09 begin X`09 if (num < 0) then X`09 begin X`09`09take_hit(num,kind); X`09`09if (chp < 0) then X`09`09 msg_print('You feel your life slipping away!'); X`09`09hp_player := true; X`09 end X`09 else if (chp < mhp) then X`09 begin X`09`09chp := chp + num; X`09`09if (chp > mhp) then X`09`09 chp := mhp; X`09`09prt_chp; X`09`09case trunc(num/5) of X`09`09 0 :`09msg_print('You feel a little better.'); X`09`09 1,2 :`09msg_print('You feel better.'); X`09`09 3,4,5,6 :`09msg_print('You feel much better.'); X`09`09 otherwise`09msg_print('You feel very good.'); X`09`09end; X`09`09hp_player := true; X`09 end; X`09 end; X end; X X`09`7B Cure players confusion`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function cure_confusion : boolean; X begin X`09cure_confusion := false; X`09with py.flags do X`09 if (confused > 1) then X`09 begin X`09 confused := 1; X`09 cure_confusion := true; X`09 end; X end; X X`09`7B Cure players blindness`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function cure_blindness : boolean; X begin X`09cure_blindness := false; X`09with py.flags do X`09 if (blind > 1) then X`09 begin X`09 blind := 1; X`09 cure_blindness := true; X`09 end; X end; X X`09`7B Cure poisoning`09`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function cure_poison : boolean; X begin X`09cure_poison := false; X`09with py.flags do X`09 if (poisoned > 1) then X`09 begin X`09 poisoned := 1; X`09 cure_poison := true; X`09 end; X end; X X`09`7B Cure the players fear`09`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function remove_fear : boolean; X begin X`09remove_fear := false; X`09with py.flags do X`09 if (afraid > 1) then X`09 begin X`09 afraid := 1; X`09 remove_fear := true; X`09 end; X end; X X`09`7B This is a fun one. In a given block, pick some walls and`09`7D X`09`7B turn them into open spots. Pick some open spots and turn`09`7D X`09`7B them into walls. An "Earthquake" effect...`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function earthquake : boolean; X var X`09`09i1,i2`09`09: integer; X begin X`09earthquake := true; X`09for i1 := char_row-8 to char_row+8 do X`09 for i2 := char_col-8 to char_col+8 do X`09 if ((i1 <> char_row) or (i2 <> char_col)) then X`09 if (in_bounds(i1,i2)) then X`09 if (randint(8) = 1) then X`09 begin X`09`09 with cave`5Bi1,i2`5D do X`09`09 begin X`09`09 if (tptr > 0) then X`09`09 delete_object(i1,i2); X`09`09 if (cptr > 1) then X`09`09`09 mon_take_hit(cptr,damroll('2d8')); X`09`09 if (fval in wall_set) then X`09`09`09 begin X`09`09`09 if (next_to4(i1,i2,`5B1,2`5D) > 0) then X`09`09`09 begin X`09`09`09`09fval := corr_floor2.ftval; X`09`09`09`09fopen := corr_floor2.ftopen; X`09`09`09 end X`09`09`09 else X`09`09`09 begin X`09`09`09`09fval := corr_floor1.ftval; X`09`09`09`09fopen := corr_floor1.ftopen; X`09`09`09 end; X`09`09`09 if (test_light(i1,i2)) then unlite_spot(i1,i2); X`09`09`09 pl := false; X`09`09`09 fm := false; X`09`09`09 if (tl) then lite_spot(i1,i2); X`09`09`09 end X`09`09 else if (fval in floor_set) then X`09`09`09 begin X`09`09`09 case randint(10) of X`09`09`09 1,2,3,4,5 : begin X`09`09`09`09`09 fval := rock_wall3.ftval; X`09`09`09`09`09 fopen := rock_wall3.ftopen; X`09`09`09`09`09 end; X`09`09`09 6,7,8`09: begin X`09`09`09`09`09 fval := rock_wall2.ftval; X`09`09`09`09`09 fopen := rock_wall2.ftopen; X`09`09`09`09`09 end; X`09`09`09 9,10`09: begin X`09`09`09`09`09 fval := rock_wall1.ftval; X`09`09`09`09`09 fopen := rock_wall1.ftopen; X`09`09`09`09`09 end; X`09`09`09 end; X`09`09`09 fm := false; X`09`09`09 end; X`09`09 end; X`09`09 if (test_light(i1,i2)) then X`09`09 lite_spot(i1,i2); X`09 end; X end; X X`09`7B Evil creatures don't like this...`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function protect_evil : boolean; X begin X`09protect_evil := true; X`09with py.flags do X`09 protevil := protevil + randint(25) + 3*py.misc.lev; X end; X X`09`7B Create some high quality mush for the player.`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function create_food : boolean; X begin X`09create_food := true; X`09with cave`5Bchar_row,char_col`5D do X`09 begin X`09 if (tptr > 0) then X`09 delete_object(char_row,char_col); X`09 place_object(char_row,char_col); X`09 t_list`5Btptr`5D := mush; X`09 end; X end; X X X`09`7B Attempts to destroy a type of creature. Success depends on`09`7D X`09`7B the creatures level VS. the player's level`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function dispell_creature( X`09`09`09`09cflag`09: integer; X`09`09`09`09damage : integer) : boolean; X var X`09i1,m_next`09`09: integer; X begin X`09i1 := muptr; X`09dispell_creature := false; X`09while i1 <> 0 do X`09begin X`09 m_next := m_list`5Bi1`5D.nptr; X`09 with m_list`5Bi1`5D do X`09 if (ml) then X`09 if (uand(cflag,c_list`5Bmptr`5D.cdefense) <> 0) then X`09`09 begin X`09`09 hp := hp - randint(damage); X`09`09 csleep := 0; X`09`09 if (hp < 0) then X`09`09 begin X`09`09`09msg_print('The ' + c_list`5Bmptr`5D.name + ' dissolves!'); X`09`09 monster_death(fy,fx,c_list`5Bmptr`5D.cmove); X`09`09 with c_list`5Bmptr`5D do X`09`09`09 with py.misc do X`09`09`09 exp := exp + round(mexp*(level/lev)); X`09`09 delete_monster(i1); X`09`09 end X`09`09 else X`09`09 msg_print('The ' + c_list`5Bmptr`5D.name + ' shudders.'); X`09`09 dispell_creature := true; X`09`09 end; X`09 i1 := m_next; X`09end; X end; X X`09`7B Attempt to turn (confuse) undead creatures...`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function turn_undead : boolean; X var X`09`09i1`09`09: integer; X begin X`09i1 := muptr; X`09turn_undead := false; 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 (ml) then X`09 if (uand(%X'0008',c_list`5Bmptr`5D.cdefense) <> 0) then X`09`09 begin X`09`09 if (((py.misc.lev+1) > c_list`5Bmptr`5D.level) or X`09`09`09(randint(5) = 1)) then X`09`09 begin X`09`09`09msg_print('The ' + c_list`5Bmptr`5D.name +`20 X`09`09`09`09`09`09' runs frantically!'); X`09`09`09confused := true; X`09`09 end X`09`09 else X`09`09 msg_print('The ' + c_list`5Bmptr`5D.name +`20 X`09`09`09`09`09`09' is unaffected.'); X`09`09 turn_undead := true; X`09`09 end; X`09 i1 := m_list`5Bi1`5D.nptr; X`09end; X end; X X`09`7B Leave a glyph of warding... Creatures will not pass over! -RAK-`7D +-+-+-+-+-+-+-+- END OF PART 52 +-+-+-+-+-+-+-+-