-+-+-+-+-+-+-+-+ START OF PART 53 -+-+-+-+-+-+-+-+ X`5Bpsect(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`09`7B Lose a strength point.`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function lose_str : boolean; X begin X`09lose_str := true; X`09if (not(py.flags.sustain_str)) then X`09 begin X`09 with py.stat do X`09 cstr := de_statp(cstr); X`09 msg_print('You feel very sick.'); X`09 prt_strength; X`09 end X`09else X`09 msg_print('You feel sick for a moment, then it passes.'); X end; X X`09`7B Lose an intelligence point.`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function lose_int : boolean; X begin X`09lose_int := true; X`09if (not(py.flags.sustain_int)) then X`09 begin X`09 with py.stat do X`09 cint := de_statp(cint); X`09 msg_print('You become very dizzy.'); X`09 prt_intelligence; X`09 end X`09else X`09 msg_print('You become dizzy for a moment, then it passes.'); X end; X X`09`7B Lose a wisdom point.`09`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function lose_wis : boolean; X begin X`09lose_wis := true; X`09if (not(py.flags.sustain_wis)) then X`09 begin X`09 with py.stat do X`09 cwis := de_statp(cwis); X`09 msg_print('You feel very naive.'); X`09 prt_wisdom; X`09 end X`09else X`09 msg_print('You feel naive for a moment, then it passes.'); X end; X X`09`7B Lose a dexterity point.`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function lose_dex : boolean; X begin X`09lose_dex := true; X`09if (not(py.flags.sustain_dex)) then X`09 begin X`09 with py.stat do X`09 cdex := de_statp(cdex); X`09 msg_print('You feel very sore.'); X`09 prt_dexterity; X`09 end X`09else X`09 msg_print('You feel sore for a moment, then it passes.'); X end; X X`09`7B Lose a constitution point.`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function lose_con : boolean; X begin X`09lose_con := true; X`09if (not(py.flags.sustain_con)) then X`09 begin X`09 with py.stat do X`09 ccon := de_statp(ccon); X`09 msg_print('You feel very sick.'); X`09 prt_constitution; X`09 end X`09else X`09 msg_print('You feel sick for a moment, then it passes.'); X end; X X`09`7B Lose a charisma point.`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function lose_chr : boolean; X begin X`09lose_chr := true; X`09if (not(py.flags.sustain_chr)) then X`09 begin X`09 with py.stat do X`09 cchr := de_statp(cchr); X`09 msg_print('Your skin starts to itch.'); X`09 prt_charisma; X`09 end X`09else X`09 msg_print('Your skin starts to itch, but feels better now.'); X end; X X`09`7B Lose experience`09`09`09`09`09-RAK-`09`7D X`5Bpsect(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 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)) then X`09`09 begin X`09`09 i1 := 32; X`09`09 flag := false; X`09`09 repeat X`09`09 i1 := i1 - 1; X`09`09 if (magic_spell`5Bpclass,i1`5D.learned) then X`09`09`09flag := true; X`09`09 until((flag) or (i1 < 2)); X`09`09 if (flag) then X`09`09 begin X`09`09`09magic_spell`5Bpclass,i1`5D.learned := false; X`09`09`09if (mspell) then X`09`09`09 msg_print('You have forgotten a magic spell!') X`09`09`09else X`09`09`09 msg_print('You have forgotten a prayer!'); X`09`09 end; X`09`09 end; X`09 end; X`09 if (chp > mhp) then chp := mhp; X`09 if (cmana > mana) then cmana := mana; X`09 title := player_title`5Bpclass,lev`5D; X`09 prt_experience; X`09 prt_mhp; X`09 prt_chp; X`09 prt_cmana; X`09 prt_level; X`09 prt_title; X`09end; X end; X X`09`7B Slow Poison`09`09`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function slow_poison : boolean; X begin X slow_poison := false; X with py.flags do X`09if (poisoned > 0) then X`09 begin X`09 poisoned := trunc(poisoned/2.0); X`09 if (poisoned < 1) then poisoned := 1; X`09 slow_poison := true; X`09 msg_print('The effects of the poison has been reduced.'); X`09 end; X end; X X`09`7B Bless`09`09`09`09`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function bless(amount : integer) : boolean; X begin X bless := true; X with py.flags do X`09blessed := blessed + amount; X end; X X`09`7B Detect Invisible for period of time`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function detect_inv2(amount : integer) : boolean; X begin X detect_inv2 := true; X with py.flags do X`09detect_inv := detect_inv + amount; X end; X X`09`7B The spell of destruction...`09`09`09`09-RAK-`09`7D X`09`7B NOTE : Winning creatures that are deleted will be considered`09`7D X`09`7B as teleporting to another level. This will NOT win the`7D X`09`7B game...`09`09`09`09`09`09`7D X`5Bpsect(misc6$code)`5D function destroy_area(y,x : integer) : boolean; X var X`09i1,i2,i3`09`09`09: integer; X X procedure replace_spot(y,x,typ : integer); X begin X`09with cave`5By,x`5D do X`09 begin X`09 case typ of X`09 1,2,3 :`09begin X`09`09`09 fval := corr_floor1.ftval; X`09`09`09 fopen := corr_floor1.ftopen; X`09`09`09end; X`09 4,7,10 :`09begin X`09`09`09 fval := rock_wall1.ftval; X`09`09`09 fopen := rock_wall1.ftopen; X`09`09`09end; X`09 5,8,11 :`09begin X`09`09`09 fval := rock_wall2.ftval; X`09`09`09 fopen := rock_wall2.ftopen; X`09`09`09end; X`09 6,9,12 :`09begin X`09`09`09 fval := rock_wall3.ftval; X`09`09`09 fopen := rock_wall3.ftopen; X`09`09`09end; X end; X`09 pl := false; X`09 fm := false; X`09 if (tptr > 0) then X`09 delete_object(y,x); X`09 if (cptr > 1) then X`09 delete_monster(cptr); X`09 end; X end; X X begin X destroy_area := true; X if (dun_level > 0) then X`09begin X for i1 := (y-15) to (y+15) do X`09 for i2 := (x-15) to (x+15) do X`09 if (in_bounds(i1,i2)) then X`09 if (cave`5Bi1,i2`5D.fval <> 15) then X`09 begin X`09 i3 := distance(i1,i2,y,x); X`09 if (i3 < 13) then X`09`09 replace_spot(i1,i2,randint(6)) X`09 else if (i3 < 16) then X`09`09 replace_spot(i1,i2,randint(9)); X`09 end; X`09end; X msg_print('There is a searing blast of light!'); X py.flags.blind := py.flags.blind + 10 + randint(10); X end; X X X`09`7B Enchants a plus onto an item...`09`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function enchant(var pluses : worlint) : boolean; X var X`09chance`09`09`09: integer; X begin X chance := 0; X enchant := false; X if (pluses > 0) then X case pluses of X`09 1 :`09chance := 040; X`09 2 :`09chance := 100; X`09 3 :`09chance := 200; X`09 4 :`09chance := 400; X`09 5 :`09chance := 600; X`09 6 :`09chance := 700; X`09 7 :`09chance := 800; X`09 8 :`09chance := 900; X`09 9 :`09chance := 950; X`09 otherwise chance := 995; X`09end; X if (randint(1000) > chance) then X`09begin X`09 pluses := pluses + 1; X`09 enchant := true; X`09end; X end; X X X`09`7B Removes curses from items in inventory`09`09-RAK-`09`7D X`5Bpsect(misc6$code)`5D function remove_curse : boolean; X var X`09i1`09`09`09: integer; X begin X remove_curse := false; X for i1 := 23 to 32 do X`09with inventory`5Bi1`5D do X`09 if (uand(%X'80000000',flags) <> 0) then X`09 begin X`09 flags := uand(%X'7FFFFFFF',flags); X`09 py_bonuses(blank_treasure,0); X`09 remove_curse := true; X`09 end; X end; $ CALL UNPACK [.SOURCE.INCLUDE]SPELLS.INC;1 1074664841 $ create 'f' X`09`7B Use a staff...`09`09`09`09`09-RAK-`09`7D X`5Bpsect(misc2$code)`5D procedure use; X var X`09`09i1`09`09`09`09: unsigned; X`09`09i2,i3,item_val,chance`09`09: integer; X`09`09out_val`09`09`09`09: vtype; X`09`09redraw,ident`09`09`09: boolean; X begin X`09reset_flag := true; X`09if (inven_ctr > 0) then X`09 begin X`09 if (find_range(`5B55`5D,i2,i3)) then X`09 begin X`09`09redraw := false; X`09`09if (get_item(item_val,'Use which staff?',redraw,i2,i3)) then X`09`09 with inventory`5Bitem_val`5D do X`09`09 begin X`09`09 if (redraw) then draw_cave; X`09`09`09reset_flag := false; X`09`09`09with py.misc do X`09`09`09 chance := save + lev + int_adj - level - 5; X`09`09`09if (py.flags.confused > 0) then X`09`09`09 chance := trunc(chance/2.0); X`09`09`09if (chance < 0) then chance := 0; X`09`09`09if (randint(chance) < use_device) then X`09`09`09 msg_print('You failed to use the staff properly.') X`09`09`09else if (p1 > 0) then X`09`09`09 begin X`09`09`09 i1 := flags; X`09`09`09 ident := false; X`09`09`09 p1 := p1 - 1; X`09`09 while (i1 > 0) do X`09`09`09 begin X`09`09`09`09i2 := bit_pos(i1); X`09`7B Staffs...`09`09`09`09`09`09`7D X`09case (i2) of X`09 1 :`09ident := light_area(char_row,char_col); X`09 2 :`09ident := detect_sdoor; X`09 3 :`09ident := detect_trap; X`09 4 :`09ident := detect_treasure; X`09 5 :`09ident := detect_object; X`09 6 :`09begin X`09`09 teleport(100); X`09`09 ident := true; X`09`09end; X`09 7 :`09ident := earthquake; X`09 8 :`09begin X`09`09 for i3 := 1 to randint(4) do X`09`09 begin X`09`09 y := char_row; X`09`09 x := char_col; X`09`09 summon_monster(y,x,false); X`09`09 end; X`09`09 ident := true; X`09`09end; X`09 9 :`09ident := genocide; X`09 10 :`09ident := destroy_area(char_row,char_col); X`09 11 :`09ident := starlite(char_row,char_col); X`09 12 :`09ident := speed_monsters(+1); X`09 13 :`09ident := speed_monsters(-1); X`09 14 :`09ident := sleep_monsters2; X`09 15 :`09ident := hp_player(randint(8),'a staff.'); X`09 16 :`09ident := detect_invisible; X`09 17 :`09begin X`09`09 py.flags.fast := py.flags.fast + randint(30) + 15; X`09`09 ident := true; X`09`09end; X`09 18 :`09begin X`09`09 py.flags.slow := py.flags.slow + randint(30) + 15; X`09`09 ident := true; X`09`09end; X`09 19 :`09ident := mass_poly; X`09 20 :`09if (remove_curse) then X`09`09 begin X`09`09 msg_print('The staff glows blue for a moment...'); X`09`09 ident := true; X`09`09 end; X`09 21 :`09ident := detect_evil; X`09 22 :`09if ((cure_blindness) or (cure_poison) or (cure_confusion)) then X`09`09 ident := true; X`09 23 :`09ident := dispell_creature(%X'0004',60); X`09 24 :`09ident := mass_genocide; X`09 25 :`09ident := unlight_area(char_row,char_col); X`09 otherwise ; X`09end; X`09`7B End of staff actions...`09`09`09`09`7D X`09`09`09 end; X`09`09`09 if (ident) then X`09`09`09 identify(inventory`5Bitem_val`5D); X`09`09`09 if (flags <> 0) then X`09`09`09 with py.misc do X`09`09`09`09begin X`09`09`09`09 exp := exp + round(level/lev); X`09`09`09`09 prt_experience; X`09`09`09`09end; X`09`09`09 desc_charges(item_val); X`09`09`09 end X`09`09 end X`09`09else X`09`09 if (redraw) then draw_cave; X`09 end X`09 else X`09 msg_print('You are not carrying any staffs.'); X`09 end X`09else X`09 msg_print('But you are not carrying anything.'); X end; $ CALL UNPACK [.SOURCE.INCLUDE]STAFFS.INC;1 101128510 $ create 'f' X`09`7B Returns the value for any given object`09`09-RAK-`09`7D X`5Bpsect(store$code)`5D function item_value(item : treasure_type) : integer; X X function search_list(x1,x2 : integer) : integer; X`09var X`09 i1,i2`09`09: integer; X`09begin X`09 i1 := 0; X`09 i2 := 0; X`09 repeat X`09 i1 := i1 + 1; X`09 with object_list`5Bi1`5D do X`09 if ((tval = x1) and (subval = x2)) then X`09`09i2 := cost; X`09 until ((i1 = max_objects) or (i2 > 0)); X`09 search_list := i2; X`09end; X X begin X`09with item do X`09 begin X`09 item_value := cost; X`09 if (tval in `5B20,21,22,23,30,31,32,33,34,35,36`5D) then X`09 begin`09`7B Weapons and armor`09`7D X`09`09if (index(name,'`5E') > 0) then X`09`09 item_value := search_list(tval,subval)*number X`09`09else if (tval in `5B20,21,22,23`5D) then X`09`09 begin X`09`09 if (tohit < 0) then X`09`09 item_value := 0 X`09`09 else if (todam < 0) then X`09`09 item_value := 0 X`09`09 else if (toac < 0) then X`09`09 item_value := 0 X`09`09 else X`09`09 item_value := (cost+(tohit+todam+toac)*100)*number; X`09`09 end X`09`09else X`09`09 begin X`09`09 if (toac < 0) then X`09`09 item_value := 0 X`09`09 else X`09`09 item_value := (cost+toac*100)*number; X`09`09 end; X`09 end X`09 else if (tval in `5B10,11,12,13`5D) then X`09 begin`09`7B Ammo`09`09`09`7D X`09`09if (index(name,'`5E') > 0) then X`09`09 item_value := search_list(tval,1)*number X`09`09else X`09`09 begin X`09`09 if (tohit < 0) then X`09`09 item_value := 0 X`09`09 else if (todam < 0) then X`09`09 item_value := 0 X`09`09 else if (toac < 0) then X`09`09 item_value := 0 X`09`09 else X`09`09 item_value := (cost+(tohit+todam+toac)*10)*number; X`09`09 end; X`09 end X`09 else if (tval in `5B70,71,75,76,80`5D) then X`09 begin`09`7B Potions, Scrolls, and Food`09`7D X`09`09if (index(name,'`7C') > 0) then X`09`09 case tval of X`09`09 70,71 : item_value := 20; X`09`09 75,76 : item_value := 20; X`09`09 80 : item_value := 1; X`09`09 otherwise ; X`09`09 end X`09 end X`09 else if (tval in `5B40,45`5D) then +-+-+-+-+-+-+-+- END OF PART 53 +-+-+-+-+-+-+-+-