-+-+-+-+-+-+-+-+ START OF PART 81 -+-+-+-+-+-+-+-+ 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 if (pspell) then X`09`09`09 msg_print('You have forgotten a prayer!') X`09`09`09else X`09`09`09 msg_print('You have forgotten a song!') 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_hp; X`09 if (is_magii) then prt_mana; 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`5Bglobal,psect(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`5Bglobal,psect(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`5Bglobal,psect(misc6$code)`5D function detect_inv2(amount : integer) : bool Vean; 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`09 as teleporting to another level. This will NOT win the`7D X`09`7B`09 game...`09`09`09`09`09`09`7D X`5Bglobal,psect(misc6$code)`5D function destroy_area(y,x : integer) : boolea Vn; 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`09:= 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`09:= 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`09:= 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`09:= rock_wall3.ftval; X`09`09`09 fopen := rock_wall3.ftopen; X`09`09`09end; X`09 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) and (not mon_resists(cptr)) 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`09 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`09if (cave`5Bi1,i2`5D.fval <> 15) then X`09`09 begin X`09`09 i3 := distance(i1,i2,y,x); X`09`09 if (i3 < 13) then X`09`09 replace_spot(i1,i2,randint(6)) X`09`09 else if (i3 < 16) then X`09`09 replace_spot(i1,i2,randint(9)); X`09`09 end; 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`5Bglobal,psect(misc6$code)`5D function enchant(var pluses : worlint) : bool Vean; X var X`09chance`09`09`09: integer; X begin X chance := 0; X enchant := false; X if (pluses > 0) then X`09case 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`5Bglobal,psect(misc6$code)`5D function remove_curse : boolean; X var X`09i1`09`09`09: integer; X begin X remove_curse := false; X for i1 := Equipment_primary to Equipment_cloak do X`09with equipment`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; X X X`09`7B Restores any drained experience`09`09`09-RAK-`09`7D X`5Bglobal,psect(misc6$code)`5D function restore_level : boolean; X`09var X`09 max_level`09`09: byteint; X X begin X restore_level := false; X max_level := 1; X while (trunc(player_exp`5Bmax_level`5D * py.misc.expfact) X`09`09<= py.misc.max_exp) do max_level := max_level + 1; X`09if (randint(100) > (max_level - py.misc.lev)*2.25) then X`09begin X`09 with py.misc do X`09 begin X`09 restore_level := true; X`09 msg_print('You feel your life energies returning...'); X`09 while (exp < max_exp) do X`09 begin X`09`09exp := max_exp; X`09`09prt_experience; X`09 end; X`09 end; X`09end X`09else X`09 msg_print('The restoring fails!'); X end; X`20 X `20 $ CALL UNPACK SPELLS.INC;1 1768193032 $ 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`09i3,chance,i4`09`09`09: integer; X`09`09i2,item_ptr`09`09`09: treas_ptr; 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(`5BStaff`5D,false,i2,i3)) then X`09 begin X`09`09redraw := false; X`09`09if (get_item(item_ptr,'Use which staff?',redraw,i3,trash_char,false)) V then X`09`09 with item_ptr`5E.data 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 + spell_adj(iq) - 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`09i4 := bit_pos(i1); X`09`7B Staffs...`09`09`09`09`09`09`7D X`09case (i4) 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_item(c_treasure); X`09 5 :`09ident := detect_item(c_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 if (cave`5By,x`5D.fval in water_set) then X`09`09`09summon_water_monster(y,x,false) X`09`09 else X`09`09`09summon_land_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 :`09begin X`09`09 msg_print('The end of the staff bursts into a blue shimmering light. V'); X`09`09 ident := starlite(char_row,char_col); X`09`09end; X`09 12 :`09ident := zap_area(0,1,c_speed); `7Bhaste`7D X`09 13 :`09ident := zap_area(0,-1,c_speed); `7Bslow`7D X`09 14 :`09ident := zap_area(0,0,c_sleep); X`09 15 :`09ident := hp_player(randint(8),'a staff.'); X`09 16 :`09ident := detect_creatures(c_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_creatures(c_evil); X`09 22 :`09with py.flags do X`09`09 ident := cure_me(blind) or cure_me(poisoned) or X`09`09`09cure_me(confused); X`09 23 :`09ident := zap_area(%X'0004',60,c_hp); X`09 24 :`09ident := mass_genocide; X`09 25 :`09ident := unlight_area(char_row,char_col); X`09 26 : ident := ident_spell; 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 identify(item_ptr`5E.data); X`09`09`09 if (ident) then 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_ptr); 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 STAFFS.INC;1 409802933 $ create 'f' X`5Binherit('moria.env','dungeon.env')`5D module store; X X`09`7B Comments vary...`09`09`09`09`09-RAK-`09`7D X`09`7B Comment one : Finished haggling`09`09`09`09`7D X`5Bglobal,psect(store$code)`5D procedure prt_comment1; X begin X`09msg_flag := false; X`09case randint(15) of X`09 1 : msg_print('Done!'); X`09 2 : msg_print('Accepted!'); X`09 3 : msg_print('Fine...'); X`09 4 : msg_print('Agreed!'); X`09 5 : msg_print('Ok...'); X`09 6 : msg_print('Taken!'); X`09 7 : msg_print('You drive a hard bargain, but taken...'); X`09 8 : msg_print('You''ll force me bankrupt, but it''s a deal...'); X`09 9 : msg_print('Sigh... I''ll take it...'); X`09 10 : msg_print('My poor sick children may starve, but done!'); X`09 11 : msg_print('Finally! I accept...'); X`09 12 : msg_print('Robbed again...'); X`09 13 : msg_print('A pleasure to do business with you!'); X`09 14 : msg_print('My spouse shall skin me, but accepted.'); X`09 15 : msg_print('Fine! Just be that way!'); X`09end; X end; X X`09`7B %A1 is offer, %A2 is asking...`09`09`7D X`5Bglobal,psect(store$code)`5D procedure prt_comment2(offer,asking,final :in Vteger); X var X`09comment`09`09`09`09: vtype; X begin X`09if (final > 0) then X`09 case randint(3) of X`09 1 : comment := '%A2 is my final offer; take it or leave it...'; X`09 2 : comment := 'I''ll give you no more than %A2.'; X`09 3 : comment := 'My patience grows thin... %A2 is final.'; X`09 end X`09else X`09 case randint(16) of X`09 1 : comment := '%A1 for such a fine item? HA! No less than %A2.'; X`09 2 : comment := '%A1 is an insult! Try %A2 gold pieces...'; X`09 3 : comment := '%A1??? Thou would rob my poor starving children?'; X`09 4 : comment := 'Why I''ll take no less than %A2 gold pieces.'; X`09 5 : comment := 'Ha! No less than %A2 gold pieces.'; X`09 6 : comment := 'Thou blackheart! No less than %A2 gold pieces.'; X`09 7 : comment := '%A1 is far too little, how about %A2?'; X`09 8 : comment := 'I paid more than %A1 for it myself, try %A2.'; X`09 9 : comment := '%A1? Are you mad??? How about %A2 gold pieces?'; X`09 10 : comment := 'As scrap this would bring %A1. Try %A2 in gold.'; X`09 11 : comment := 'May fleas of a 1000 orcs molest you. I want %A2.'; X`09 12 : comment := 'My mother you can get for %A1, this costs %A2.'; X`09 13 : comment := 'May your chickens grow lips. I want %A2 in gold!'; X`09 14 : comment := 'Sell this for such a pittance. Give me %A2 gold.'; X`09 15 : comment := 'May the Balrog find you tasty! %A2 gold pieces?'; X`09 16 : comment := 'Your mother was a Troll! %A2 or I''ll tell...'; X`09 end; X`09insert_num(comment,'%A1',offer,false); X`09insert_num(comment,'%A2',asking,false); X`09msg_print(comment); X end; X X`5Bglobal,psect(store$code)`5D procedure prt_comment3(offer,asking,final :in Vteger); X var X`09comment`09`09`09`09: vtype; X begin X`09if (final > 0) then X`09 case randint(3) of X`09 1 : comment := 'I''ll pay no more than %A1; take it or leave it.'; X`09 2 : comment := 'You''ll get no more than %A1 from me...'; X`09 3 : comment := '%A1 and that''s final.'; X`09 end X`09else X`09 case randint(15) of X`09 1 : comment := '%A2 for that piece of junk? No more than %A1'; X`09 2 : comment := 'For %A2 I could own ten of those. Try %A1.'; X`09 3 : comment := '%A2? NEVER! %A1 is more like it...'; X`09 4 : comment :='Let''s be reasonable... How about %A1 gold pieces?'; X`09 5 : comment := '%A1 gold for that junk, no more...'; X`09 6 : comment := '%A1 gold pieces and be thankful for it!'; X`09 7 : comment := '%A1 gold pieces and not a copper more...'; X`09 8 : comment := '%A2 gold? HA! %A1 is more like it...'; X`09 9 : comment := 'Try about %A1 gold...'; X`09 10 : comment := 'I wouldn''t pay %A2 for your children, try %A1.'; X`09 11 : comment := '*CHOKE* For that!? Let''s say %A1.'; X`09 12 : comment := 'How about %A1.'; X`09 13 : comment := 'That looks war surplus! Say %A1 gold.'; X`09 14 : comment := 'I''ll buy it as scrap for %A1.'; X`09 15 : comment := '%A2 is too much, let us say %A1 gold.'; X`09 end; X`09insert_num(comment,'%A1',offer,false); X`09insert_num(comment,'%A2',asking,false); X`09msg_print(comment); X end; X X`09`7B Kick 'da bum out...`09`09`09`09`09-RAK-`09`7D X`5Bglobal,psect(store$code)`5D procedure prt_comment4; X begin X`09msg_flag := false; X`09case randint(5) of X`09 1 :`09begin X`09`09 msg_print('ENOUGH! Thou hath abused me once too often!'); X`09`09 msg_print('Out of my place!'); X`09`09 msg_print(' '); X`09`09end; X`09 2 :`09begin X`09`09 msg_print('THAT DOES IT! You shall waste my time no more!'); X`09`09 msg_print('out... Out... OUT!!!'); X`09`09 msg_print(' '); X`09`09end; X`09 3 :`09begin +-+-+-+-+-+-+-+- END OF PART 81 +-+-+-+-+-+-+-+-