-+-+-+-+-+-+-+-+ START OF PART 80 -+-+-+-+-+-+-+-+ 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`09until(i1 = 0); X end; X X`09`7B Display evil creatures on current panel`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function detect_creatures(typ : integer) : bo Volean; X var X`09`09i1`09`09: integer; X`09`09dummy`09`09: char; X`09`09flag,found`09: boolean; X begin X`09flag := false; X`09i1 := muptr; X`09repeat X`09 with m_list`5Bi1`5D do X`09 if (panel_contains(fy,fx)) then X`09 begin X`09 case (typ) of X`09c_evil : found := uand(%X'0004',c_list`5Bmptr`5D.cdefense)<>0; X`09c_monster : found := uand(%X'10000',c_list`5Bmptr`5D.cmove)=0; X`09c_invisible : found := uand(%X'10000',c_list`5Bmptr`5D.cmove)<>0; X`09otherwise ; X`09 end; X`09 if (found) 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 end; X`09 i1 := m_list`5Bi1`5D.nptr; X`09until(i1 = 0); X`09if (flag) then X`09 begin X`09 case (typ) of X`09`09c_evil : msg_print('You sense the presence of evil!'); X`09`09c_monster : msg_print('You sense the presence of monsters!'); Xc_invisible : msg_print('You sense the presence of invisible creatures!'); X`09 end; X`09 msg_print(' '); X`09 msg_flag := false; X`09 end; X`09detect_creatures := flag; X end; X X`09`7B Change players hit points in some manner`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function hp_player(num : integer; kind : vtyp Ve) : boolean; 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 begin X`09`09 msg_print('You feel your life slipping away!'); X`09`09 msg_print(' '); X`09`09 end;`09`09 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_hp; X`09`09case trunc(num/5) of X`09`09 0`09 :`09msg_print('You feel a little better.'); X`09`09 1,2`09 :`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`7Bpy.flags: confused, blind, poisoned, hoarse, afraid`7D X`5Bglobal,psect(misc6$code)`5D function cure_me(var what_flag : integer) : b Voolean; X begin X`09cure_me := false; X`09if (what_flag > 1) then X`09 begin X`09 what_flag := 1; X`09 cure_me := true; X`09 end; X end; X 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`5Bglobal,psect(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`09if (randint(8) = 1) then X`09`09 begin X`09`09 with cave`5Bi1,i2`5D do X`09`09 begin X`09`09`09if (tptr > 0) then X`09`09`09 delete_object(i1,i2); X`09`09`09if (cptr > 1) and (not mon_resists(cptr)) then X`09`09`09 mon_take_hit(cptr,damroll('2d8')); X`09`09`09if (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`09else 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`09 end; X end; X X`09`7B Evil creatures don't like this...`09`09`09-RAK-`09`7D X`5Bglobal,psect(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 food for the player.`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function create_food(t0,t1,t2,t3,t4 : integer V) : boolean; X var i1,i2,i3,this_one,dist`09: integer; X begin X`09create_food := true; X`09for i1 := char_row-2 to char_row+2 do X`09 for i2 := char_col-2 to char_col+2 do X`09 with cave`5Bi1,i2`5D do X`09 begin X`09`09dist := abs(i1-char_row)+abs(i2-char_col); X`09`09if ((abs(i1-char_row)=2) or (abs(i2-char_col)=2)) then X`09`09 dist := dist + 1; X`09 if ((fopen) and (tptr=0) and (dist<5)) then X`09`09 begin X`09`09 case (dist) of X`09`09`090 : this_one := t0;`09`7Bfood types dep. on dist = `7D X`09`09`091 : this_one := t1;`09`7BX434X`7D X`09`09`092 : this_one := t2;`09`7B42124`7D X`09`09`093 : this_one := t3;`09`7B31013`7D X`09`09`094 : this_one := t4;`09`7B42124`7D X`09`09 end;`09`09`09`7BX434X`7D X`09`09 if (this_one <> 0) then X`09`09 begin X`09`09 place_object(i1,i2); X`09`09 if (this_one < 0) then`09`7Bjunk food.`7D X`09`09 begin X`09`09`09i3 := store_choice`5B11,(store$choices*(-this_one) X`09`09`09 +randint(store$choices)+3) div 5`5D; X`09`09`09t_list`5Btptr`5D := inventory_init`5Bi3`5D; X`09`09 end X`09`09 else`09`7Bgood food`7D X`09`09 t_list`5Btptr`5D := yums`5Bthis_one`5D; X`09`09 if (test_light(i1,i2)) then`09lite_spot(i1,i2); X`09`09 end; X`09`09 end; X`09 end; X end; X X`7B cflag is guys that CAN be affected; damage is speed change for c_speed. X cflag only applies for special hp_damage monsters; others handled X individually. `7D X`5Bglobal,psect(misc6$code)`5D function zap_area(cflag,dmge,typ : integer):b Voolean; X var X`09i1,m_next,i2`09: integer; X X function did_it_work : boolean; X var hmm : boolean; X`09begin X`09 hmm := false; X`09 with m_list`5Bi1`5D do X`09 with c_list`5Bmptr`5D do X`09 begin X`09 case (typ) of X`09`09c_confuse,c_sleep,c_joke : hmm:=not mon_save(i1,0,c_sc_mental); X`09`09c_hold,c_thunder : hmm := do_stun(i1,0,dmge); X`09`09c_speed : hmm := not mon_save(level,0,c_null) or (dmge>0); X`09`09c_turn : hmm := uand(cdefense,%X'0008')<>0; X`09`09c_drain : hmm := uand(cdefense,%X'0008')=0; X`09`09c_hp : hmm := uand(cdefense,cflag)<>0; X`09`09otherwise hmm := true; X`09 end; X`09 did_it_work := hmm and (not mon_resists(i1)); X`09 end; X`09end; X X procedure yes_it_did; X`09var t1 : integer; X`09begin X`09 with m_list`5Bi1`5D do X`09 case (typ) of X`09 c_confuse,c_turn : begin X`09`09msg_print('The '+c_list`5Bmptr`5D.name+' runs frantically!'); X`09`09confused := true; X`09 end; X`09 c_sleep : csleep := 500; X`09 c_speed : begin X`09`09cspeed := cspeed + dmge; X`09`09csleep := 0; X`09 end; X`09 c_hold : ; `7Bdone in do_stun in did_it_work already`7D X`09 c_thunder : confused := true; X`09 c_hp,c_joke,c_drain,c_holy_word : with c_list`5Bmptr`5D do X`09 if (mon_take_hit(i1,randint(dmge))>0) then X`09`09 if (typ=c_joke) then X`09`09 msg_print('The '+name+' dies laughing!') X`09`09 else X`09`09 msg_print('The '+name+' dissolves!') X`09 else X`09`09if (typ=c_joke) then X`09`09 begin X`09`09 msg_print('The '+name+' chuckles.'); X`09`09 confused := true; X`09`09 end X`09`09else X`09`09 begin X`09`09 msg_print('The '+name+' shudders.'); X`09`09 if (typ=c_holy_word) then X`09`09`09if (do_stun(i1,-4,4+randint(4))) then X`09`09`09 confused := true; X`09`09 end; X`09 end; X end; X X function no_it_didnt : boolean; X`09begin X`09 with m_list`5Bi1`5D do X`09 if (typ in `5Bc_confuse,c_sleep,c_speed,c_hold,c_joke`5D) then X`09 begin X`09 no_it_didnt := true; X`09 if (typ=c_joke) then X`09`09begin Xmsg_print('The '+c_list`5Bmptr`5D.name+' appears offended...'); X`09`09 if (mon_take_hit(i1,randint(dmge) div 4) > 0) then Xmsg_print('and dies from disgust!!!'); X`09 end X`09 else X`09`09msg_print('The '+c_list`5Bmptr`5D.name+' is unaffected.'); X`09 end; X`09end; X X begin X`09i1 := muptr; X`09zap_area := false; X`09repeat X`09 m_next := m_list`5Bi1`5D.nptr; X`09 with m_list`5Bi1`5D do X`09 with c_list`5Bmptr`5D do X`09 if (ml) then X`09`09if (did_it_work) then X`09`09 begin X`09`09 yes_it_did; X`09`09 zap_area := true; X`09`09 end X`09`09else if (no_it_didnt) then X`09`09 zap_area := true; X`09 i1 := m_next; X`09until (i1 = 0); X end; X X`09`7B Leave a glyph of warding... Creatures will not pass over! -RAK-`7D X`5Bglobal,psect(misc6$code)`5D function warding_glyph : boolean; X var X`09`09i1`09`09`09: integer; X begin X`09warding_glyph := true; X`09with cave`5Bchar_row,char_col`5D do X`09 if (tptr = 0) then X`09 begin X`09 popt(i1); X`09 tptr := i1; X`09 t_list`5Bi1`5D := scare_monster; X`09 end; X end; X X X`5Bglobal,psect(misc6$code)`5D procedure lower_stat(tstat : stat_set; msg1 : V vtype); X var X`09i1 : byteint; X begin X`09with py.stat do X`09 begin X`09 l`5Btstat`5D := l`5Btstat`5D + de_statp(p`5Btstat`5D - l`5Btstat`5D); X`09 update_stat(tstat); X`09 if (msg1 = 'X') then X`09 case tstat of X`09`09sr : msg_print('You feel very sick.'); X`09`09iq : msg_print('You become very dizzy.'); X`09`09ws : msg_print('You feel very naive.'); X`09`09dx : msg_print('You feel very sore.'); X`09`09cn : msg_print('You feel very sick.'); X`09`09ca : msg_print('Your skin starts to itch.'); X`09 end X`09 else if (length(msg1) <> 0) then X`09 msg_print(msg1); X`09 prt_a_stat(tstat); X`09 end; X end; X X`5Bglobal,psect(misc6$code)`5D function lose_stat(tstat : stat_set; X`09`09`09`09msg1,msg2 : vtype) : boolean; X begin X`09lose_stat := true; X`09if (not(py.flags.sustain`5Btstat`5D)) then X`09 lower_stat(tstat,msg1) X`09else X`09 if (msg2 = 'X') then X`09 case tstat of X`09sr : msg_print('You feel sick for a moment, then it passes.'); X`09iq : msg_print('You become dizzy for a moment, then it passes.'); X`09ws : msg_print('You feel naive for a moment, then it passes.'); X`09dx : msg_print('You feel sore for a moment, then it passes.'); X`09cn : msg_print('You feel sick for a moment, then it passes.'); X`09ca : msg_print('Your skin starts to itch, but feels better now.'); X`09 end X`09 else if (length(msg2) <> 0) then X`09 msg_print(msg2); X end; X X`5Bglobal,psect(misc6$code)`5D function restore_stat(tstat : stat_set; X`09`09`09msg1 : vtype) : boolean; X var i1 : byteint; `7Bstat adjusted by magic worn only`7D X begin X`09restore_stat := true; X`09with py.stat do X`09 if (l`5Btstat`5D > 0) then X`09 begin X`09 l`5Btstat`5D := 0; X`09 update_stat(tstat); X`09 if (msg1`5B1`5D = 'X') then X`09`09case tstat of X`09`09 sr : msg_print('You feel warm all over.'); X`09`09 iq : msg_print('You have a warm feeling.'); X`09`09 ws : msg_print('You feel your wisdom returning.'); X`09`09 dx : msg_print('You feel less clumsy.'); X`09`09 cn : msg_print('You feel your health returning.'); X`09`09 ca : msg_print('You feel your looks returning.'); X`09`09end X`09 else if (length(msg1) <> 0) then X`09`09msg_print(msg1); X`09 prt_a_stat(tstat); X`09 end; X end; X X`5Bglobal,psect(misc6$code)`5D function gain_stat(tstat : stat_set; X`09`09`09msg1 : vtype) : boolean; X begin X`09gain_stat := true; X`09with py.stat do begin X`09 i1 := in_statp(p`5Btstat`5D - l`5Btstat`5D); X`09 if (i1 < l`5Btstat`5D) then X`09 l`5Btstat`5D := l`5Btstat`5D - i1 X`09 else begin X`09 l`5Btstat`5D := 0; X`09 p`5Btstat`5D := squish_stat(p`5Btstat`5D - l`5Btstat`5D + i1); X`09 end; X`09 update_stat(tstat); X`09 if (msg1 = 'X') then X`09 case tstat of X`09`09sr : msg_print('Wow! What bulging muscles!'); X`09`09iq : msg_print('Aren''t you brilliant!'); X`09`09ws : msg_print('You suddenly have a profound thought!'); X`09`09dx : msg_print('You feel more limber!'); X`09`09cn : msg_print('You feel tingly for a moment.'); X`09`09ca : msg_print('Gee ain''t you cute!'); X`09 end X`09 else if (length(msg1) <> 0) then X`09 msg_print(msg1); X`09 prt_a_stat(tstat); X`09end; X end; X X`09`7B Lose experience`09`09`09`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D procedure lose_exp(amount : integer); X var X`09i1,i2`09`09`09`09: integer; X`09av_hp,lose_hp`09`09`09: integer; X`09av_mn,lose_mn`09`09`09: integer; X`09flag`09`09`09`09: boolean; X X begin X with py.misc do X`09begin X`09 if (amount > exp) then X`09 exp := 0 X`09 else X`09 exp := exp - amount; X`09 i1 := 1; X`09 while (trunc(player_exp`5Bi1`5D*expfact) <= exp) do X`09 i1 := i1 + 1; X`09 i2 := lev - i1; X`09 while (i2 > 0) do X`09 begin X`09 av_hp := trunc(mhp/lev); X`09 av_mn := trunc(mana/lev); X`09 lev := lev - 1; X`09 i2 := i2 - 1; X`09 lose_hp := randint(av_hp*2-1); X`09 lose_mn := randint(av_mn*2-1); X`09 mhp := mhp - lose_hp; X`09 mana := mana - lose_mn; X`09 if (mhp < 1) then mhp := 1; X`09 if (mana < 0) then mana := 0; X`09 with class`5Bpclass`5D do X`09`09if ((mspell) or (pspell) or (dspell) or (bspell)) then X`09`09 begin X`09`09 i1 := 32; +-+-+-+-+-+-+-+- END OF PART 80 +-+-+-+-+-+-+-+-