-+-+-+-+-+-+-+-+ START OF PART 69 -+-+-+-+-+-+-+-+ X prt_intelligence X END X else X msg_print('You become dizzy for a moment, then it passes.') X END; X`20 X`7B Lose a wisdom point. `7D X`5Bpsect(misc6$code)`5D function lose_wis : boolean; X BEGIN X lose_wis := true; X if (not(py.flags.sustain_wis)) then X BEGIN X with py.stat do X cwis := de_statp(cwis); X msg_print('You feel more naive.'); X prt_wisdom X END X else X msg_print('You feel senseless for a moment, then it passes.') X END; X`20 X`7B Lose a dexterity point.`7D X`5Bpsect(misc6$code)`5D function lose_dex : boolean; X BEGIN X lose_dex := true; X if (not(py.flags.sustain_dex)) then X BEGIN X with py.stat do X cdex := de_statp(cdex); X msg_print('You feel like a klutz.'); X prt_dexterity X END X else X msg_print('You feel like a klutz for a moment, then it passes.') X END; X`20 X`7B Lose a constitution point.`7D X`5Bpsect(misc6$code)`5D function lose_con : boolean; X BEGIN X lose_con := true; X if (not(py.flags.sustain_con)) then X BEGIN X with py.stat do X ccon := de_statp(ccon); X msg_print('You feel very sick.'); X prt_constitution X END X else X msg_print('You feel sick for a moment, then it passes.') X END; X`20 X`7B Lose a charisma point.`7D X`5Bpsect(misc6$code)`5D function lose_chr : boolean; X BEGIN X lose_chr := true; X if (not(py.flags.sustain_chr)) then X BEGIN X with py.stat do X cchr := de_statp(cchr); X msg_print('You get a bad case of acne.'); X prt_charisma X END X else X msg_print('Your skin starts to itch, but feels better now.') X END; X`20 X`7B Lose experience `7D X`5Bpsect(misc6$code)`5D procedure lose_exp(amount : integer); X var X i1,i2,av_hp,lose_hp,av_mn,lose_mn : integer; X flag : boolean; X BEGIN X if (py.misc.lev > 40) then`20 X msg_print('But the feeling is only temporary!') X else with py.misc do X BEGIN X if (amount > exp) then X exp := 0 X else X exp := exp - amount; X i1 := 1; X while (trunc(player_exp`5Bi1`5D*expfact) <= exp) do X i1 := i1 + 1; X i2 := lev - i1; X while (i2 > 0) do X BEGIN X av_hp := trunc(mhp/lev); X av_mn := trunc(mana/lev); X lev := lev - 1; X i2 := i2 - 1; X lose_hp := randint(av_hp*2-1); X lose_mn := randint(av_mn*2-1); X mhp := mhp - lose_hp; X mana := mana - lose_mn; X if (mhp < 1) then mhp := 1; X if (mana < 0) then mana := 0; X if (pskill <> 0) then X BEGIN X i1 := max_skills; X flag := false; X repeat X i1 := i1 - 1; `20 X`09`09 flag := skill_list`5Bi1`5D.learned; X until((flag) or (i1 < 2)); X if (flag) then X BEGIN X`09`09 begin X`09`09 skill_list`5Bi1`5D.learned := false; X if (pskill in `5B1,2,7`5D) then X msg_print('You have forgotten a tech skill!') X else if (pskill in `5B3,4`5D) then X msg_print('You have forgotten a prayer!') X`09`09`09else if (pskill in `5B5,6`5D) then X`09`09`09 msg_print ('You have forgotten a trick'); X`09`09 end; X END; X END; X END; X if (chp > mhp) then chp := mhp; X if (cmana > mana) then cmana := mana; X title := player_title`5Bpclass,lev`5D; X prt_experience; X prt_mhp; X prt_chp; X prt_mana; X prt_level; X prt_title X END X END; X`20 X`7B Slow Poison `7D X`5Bpsect(misc6$code)`5D function slow_poison : boolean; X BEGIN X slow_poison := false; X with py.flags do X if (poisoned > 0) then X BEGIN X poisoned := trunc(poisoned/2.0); X if (poisoned < 1) then poisoned := 1; X slow_poison := true; X msg_print('The effects of the poison has been reduced.') X END X END; X`20 X`7B Bless`7D X`5Bpsect(misc6$code)`5D function bless(amount : integer) : boolean; X BEGIN X bless := true; X with py.flags do X blessed := blessed + amount X END; X`20 X`7B Detect Invisible for period of time `7D X`5Bpsect(misc6$code)`5D function detect_inv2(amount : integer) : boolean; X BEGIN X detect_inv2 := true; X with py.flags do X detect_inv := detect_inv + amount X END; X`20 X`7B The spell of destruction.`7D X`5Bpsect(misc6$code)`5D function destroy_area(y,x : integer) : boolean; X VAR X i1,i2,i3 : integer; X`20 X PROCEDURE replace_spot(y,x,typ : integer); X BEGIN X with cave`5By,x`5D do X BEGIN X CASE typ of X 1,2,3 : BEGIN X fval := corr_floor1.ftval; X fopen := corr_floor1.ftopen X END; X 4,7,10 : BEGIN X fval := rock_wall1.ftval; X fopen := rock_wall1.ftopen X END; X 5,8,11 : BEGIN X fval := rock_wall2.ftval; X fopen := rock_wall2.ftopen X END; X 6,9,12 : BEGIN X fval := rock_wall3.ftval; X fopen := rock_wall3.ftopen X END X END; X pl := false; X fm := false; X if (tptr > 0) then X delete_object(y,x); X if (cptr > 1) then X delete_monster(cptr) X END X END; X`20 X BEGIN X destroy_area := true; X if (dun_level > 0) then X BEGIN X for i1 := (y-15) to (y+15) do X for i2 := (x-15) to (x+15) do X if (in_bounds(i1,i2)) then X if (cave`5Bi1,i2`5D.fval <> 15) then X BEGIN X i3 := distance(i1,i2,y,x); X if (i3 < 13) then X replace_spot(i1,i2,randint(6)) X else if (i3 < 16) then X replace_spot(i1,i2,randint(9)) X END X END; X msg_print('There is a searing blast of light!'); X py.flags.blind := py.flags.blind + 10 + randint(10) X END; X`20 X`20 X`7B Enchants a plus onto an item.`7D X`5Bpsect(misc6$code)`5D function enchant(var pluses : worlint) : boolean; X VAR X chance : integer; X BEGIN X chance := 0; X enchant := false; X if (pluses > 0) then X CASE pluses of X 1 : chance := 040; X 2 : chance := 100; X 3 : chance := 200; X 4 : chance := 400; X 5 : chance := 600; X 6 : chance := 700; X 7 : chance := 800; X 8 : chance := 900; X 9 : chance := 950; X otherwise chance := 995 X END; X if (randint(1000) > chance) then X BEGIN X pluses := pluses + 1; X enchant := true X END X END; X`20 X`20 X`7B Removes curses from items in equipment`7D X`5Bpsect(misc6$code)`5D function remove_curse : boolean; X VAR X i1 : integer; X BEGIN X remove_curse := false; X for i1 := 23 to 34 do X with equipment`5Bi1`5D do X if (uand(%X'80000000',flags) <> 0) then X BEGIN X flags := uand(%X'7FFFFFFF',flags); X py_bonuses(blank_treasure,0); X remove_curse := true X END X END; X`20 X`20 X`7B Restores any drained experience `7D X`5Bpsect(misc6$code)`5D function restore_level : boolean; X BEGIN X restore_level := false; X with py.misc do X if (max_exp > exp) then X BEGIN X restore_level := true; X msg_print('You feel your life energies returning...'); X while (exp < max_exp) do X BEGIN X exp := max_exp; X prt_experience X END X END X END; X X`7BComplex routine to handle modifications on a player's wielded weapon`7D X`5Bpsect(misc6$code)`5D function enchant_weapon(how : dtype) : boolean; X X VAR X out_val`09: vtype; X`09 failure`09: boolean; `20 X X BEGIN X enchant_weapon := true; X failure := true; X with equipment`5B23`5D do X if (tval > 0) then X `09 if (how = 'curse') then X begin X temporary_slot := equipment`5B23`5D; X objdes(out_val,23,false,'e'); X msg_print('Your ' + out_val + ' glows black, then fades.'); X`09`09if (tohit > 0) then X`09`09 tohit := 0 X`09`09else X`09`09 tohit := tohit-1; X`09`09if (todam > 0) then X`09`09 todam := 0 X`09`09else X`09`09 todam := todam-1; X py_bonuses(temporary_slot,-1); X end X`09 else`09 `20 X begin `20 X objdes(out_val,23,false,'e'); X msg_print('Your ' + out_val + ' glows faintly!'); X`09`09if ((how = 'tohit') or (how = 'both')) then X if (enchant(tohit)) then X begin X flags := uand(%X'7FFFFFFF',flags); X py_bonuses(blank_treasure,0); X`09`09 failure := false;`20 X end; X`09`09if ((how = 'todam') or (how = 'both')) then X if (enchant(todam)) then X begin X flags := uand(%X'7FFFFFFF',flags); X py_bonuses(blank_treasure,0); X`09`09 failure := false; X end; X if (failure) then X msg_print('It appears to be unaffected...'); X end; X END; X X X`5Bpsect(misc6$code)`5D function enchant_armor(how : dtype) : boolean; X X VAR X `09 tmp`09`09: array `5B1..6`5D of integer; X `09 i3,i4`09: integer; X out_val`09: vtype; X`09 failure`09: boolean; `20 X X BEGIN X enchant_armor := true; X i3 := 0; X i4 := 0; X if (equipment`5B26`5D.tval > 0) then X begin X i3 := i3 + 1; X tmp`5Bi3`5D := 26; X end; X if (equipment`5B27`5D.tval > 0) then X begin X i3 := i3 + 1; X tmp`5Bi3`5D := 27; X end; X if (equipment`5B31`5D.tval > 0) then X begin X i3 := i3 + 1; X tmp`5Bi3`5D := 31; X end; X if (equipment`5B32`5D.tval > 0) then X begin X i3 := i3 + 1; X tmp`5Bi3`5D := 32; X end; X if (equipment`5B28`5D.tval > 0) then X begin X i3 := i3 + 1; X tmp`5Bi3`5D := 28; X end; X if (equipment`5B24`5D.tval > 0) then X begin X i3 := i3 + 1; X tmp`5Bi3`5D := 24; X end; X if (i3 > 0) then i4 := tmp`5Brandint(i3)`5D; X`09if (how <> 'curse') then X`09 begin X if (uand(%X'80000000',equipment`5B26`5D.flags) <> 0) then X i4 := 26 X else if (uand(%X'80000000',equipment`5B27`5D.flags) <> 0) then X i4 := 27 X else if (uand(%X'80000000',equipment`5B31`5D.flags) <> 0) then X i4 := 31 X else if (uand(%X'80000000',equipment`5B32`5D.flags) <> 0) then X i4 := 32 X else if (uand(%X'80000000',equipment`5B24`5D.flags) <> 0) then X i4 := 24 X else if (uand(%X'80000000',equipment`5B28`5D.flags) <> 0) then X i4 := 28; X`09 end; X if (i4 > 0) then X with equipment`5Bi4`5D do X`09 if (how = 'curse') then X`09`09begin X temporary_slot := equipment`5Bi3`5D; X objdes(out_val,i3,false,'e'); X msg_print('Your ' + out_val + ' glows black, then fades.') V; X flags := %X'80000000'; X toac := -randint(5) - randint(5); X py_bonuses(temporary_slot,-1); X`09`09end X`09 else X begin X objdes(out_val,i4,false,'e'); X msg_print('Your ' + out_val + ' glows faintly!'); X if (enchant(toac)) then X begin X flags := uand(%X'7FFFFFFF',flags); X py_bonuses(blank_treasure,0); X end X else X msg_print('It appears unaffected...'); X end; X END; X X X $ CALL UNPACK [.INC]SKILLS.INC;1 826452391 $ create 'f' X`7B Returns the value for any given object `7D X`5Bpsect(store$code)`5D function item_value(item : treasure_type) : integer; X`20 X function search_list(x1,x2 : integer) : integer; X var X i1,i2 : integer; X BEGIN X i1 := 0; X i2 := 0; X repeat X i1 := i1 + 1; X with object_list`5Bi1`5D do X if ((tval = x1) and (subval = x2)) then X i2 := cost; X until ((i1 = max_objects) or (i2 > 0)); X search_list := i2 X END; X`20 X BEGIN X with item do X BEGIN X item_value := cost; X if (tval in `5B19,20,21,23,30,31,32,33,34,35,36`5D) then X BEGIN `7B Weapons and armor `7D X if (index(name,'`5E') > 0) then X item_value := search_list(tval,subval)*number X else if (tval in `5B20,21,22,23`5D) then X BEGIN X if (tval in `5B21,22,23`5D) then X item_value := (cost+(tohit+todam+toac)*100)*number +-+-+-+-+-+-+-+- END OF PART 69 +-+-+-+-+-+-+-+-