-+-+-+-+-+-+-+-+ START OF PART 19 -+-+-+-+-+-+-+-+ X`5Bpsect(setup$code)`5D procedure magic_init(random_seed : unsigned); X var X i1,tmpv : integer; X tmps : vtype; X BEGIN X seed := random_seed; X randes; X for i1 := 1 to max_objects do X BEGIN X tmpv := int(uand(%X'FF',object_list`5Bi1`5D.subval)); X case object_list`5Bi1`5D.tval of X 75,76 : if (tmpv <= max_colors) then X insert_str(object_list`5Bi1`5D.name,'%C',colors`5Btmp Vv`5D); X 70,71 : BEGIN X rantitle(tmps); X insert_str(object_list`5Bi1`5D.name,'%T',tmps); X END; X 45 : if (tmpv <= max_colors) then X insert_str(object_list`5Bi1`5D.name,'%R',rocks`5Btmpv V`5D); X 40 : if (tmpv <= max_rocks) then X insert_str(object_list`5Bi1`5D.name,'%A',amulets`5Btm Vpv`5D); X 65 : if (tmpv <= max_amulets) then X insert_str(object_list`5Bi1`5D.name,'%M',metals`5Btmp Vv`5D); X 55 : if (tmpv <= max_woods) then X insert_str(object_list`5Bi1`5D.name,'%W',woods`5Btmpv V`5D); X 80 : if (tmpv <= max_mush) then X insert_str(object_list`5Bi1`5D.name,'%M',mushrooms`5B Vtmpv`5D); X 60 : `7Bif (tmpv <= max_rods) then X insert_str(object_list`5Bi1`5D.name,'%D',rods`5Btmpv` V5D)`7D; X otherwise ; X END X END X END; X`20 X`20 X`7B Remove 'Secret' symbol for identity of object `7D X`5Bpsect(misc1$code)`5D procedure known1 ( var object_str : varying`5Ba`5D V of char ); X var X pos,olen : integer; X str1,str2 : vtype; X BEGIN X pos := index(object_str,'`7C'); X if (pos > 0) then X BEGIN X olen := length(object_str); X str1 := substr(object_str,1,pos-1); X str2 := substr(object_str,pos+1,olen-pos); X writev(object_str,str1,str2); X END; X END; X`20 X`20 X`7B Remove 'Secret' symbol for identity of pluses `7D X`5Bpsect(misc1$code)`5D procedure known2 (var object_str : varying`5Ba`5D of V char ); X var X pos,olen : integer; X str1,str2 : vtype; X BEGIN X pos := index(object_str,'`5E'); X if (pos > 0) then X BEGIN X olen := length(object_str); X str1 := substr(object_str,1,pos-1); X str2 := substr(object_str,pos+1,olen-pos); X writev(object_str,str1,str2); X END; X END; X`20 X`20 X`7B Return string without quoted portion `7D X`5Bpsect(misc1$code)`5D procedure unquote (var object_str : varying`5Ba`5D o Vf char ); X var X pos0,pos1,pos2,olen : integer; X str1,str2 : vtype; X BEGIN X pos0 := index(object_str,'"'); X if (pos0 > 0) then X BEGIN X pos1 := index(object_str,'`7E'); X pos2 := index(object_str,'`7C'); X olen := length(object_str); X str1 := substr(object_str,1,pos1); X str2 := substr(object_str,pos2+1,olen-pos2); X writev(object_str,str1,str2); X END X END; X`20 X`20 X`20 X`7B Somethings been identified `7D X`5Bpsect(misc1$code)`5D procedure identify(item : treasure_type); X var X i1,x1,x2 : integer; X BEGIN X x1 := item.tval; X x2 := item.subval; X if (index(item.name,'`7C') > 0) then X BEGIN X for i1 := 1 to max_talloc do X with t_list`5Bi1`5D do X if ((tval = x1) and (subval = x2)) then X BEGIN X unquote(name); X known1(name); X END; X for i1 := 1 to inven_max do X with inventory`5Bi1`5D do X if ((tval = x1) and (subval = x2)) then X BEGIN X unquote(name); X known1(name); X END; X i1 := 0; X repeat `20 X i1 := i1 + 1; X with object_list`5Bi1`5D do X if ((tval = x1) and (subval = x2)) then X if (index(name,'%T') > 0) then X BEGIN X insert_str(name,' %T`7C',''); X object_ident`5Bi1`5D := true; X END X else X BEGIN X unquote(name); X known1(name); X object_ident`5Bi1`5D := true; X END; X until (i1 = max_objects); X END; X END; X`20 X`20 X`7B Returns a description of item for inventory `7D X`5Bpsect(misc1$code)`5D procedure objdes( X var out_val : varying`5Ba`5D of char; X ptr : integer; X pref : boolean); X var X pos : integer; X tmp_val : vtype; X BEGIN X with inventory`5Bptr`5D do X BEGIN X tmp_val := name; X pos := index(tmp_val,'`7C'); X if (pos > 0) then X tmp_val := substr(tmp_val,1,pos-1); X pos := index(tmp_val,'`5E'); X if (pos > 0) then X tmp_val := substr(tmp_val,1,pos-1); X if (not(pref)) then X BEGIN X pos := index(tmp_val,' ('); X if (pos > 0) then X tmp_val := substr(tmp_val,1,pos-1); X END; X insert_num(tmp_val,'%P1',p1,true); X insert_num(tmp_val,'%P2',tohit,true); X insert_num(tmp_val,'%P3',todam,true); X insert_num(tmp_val,'%P4',toac,true); X insert_num(tmp_val,'%P5',p1,false); X insert_num(tmp_val,'%P6',ac,false); X if (number <> 1) then X BEGIN X insert_str(tmp_val,'ch`7E','ches'); X insert_str(tmp_val,'`7E','s'); X END X else X insert_str(tmp_val,'`7E',''); X if (pref) then X BEGIN X if (index(tmp_val,'&') > 0) then X BEGIN X insert_str(tmp_val,'&',''); X if (number > 1) then X writev(out_val,number:1,tmp_val) X else if (number < 1) then X writev(out_val,'no more',tmp_val) X else if (tmp_val`5B2`5D in vowel_set) then X writev(out_val,'an',tmp_val) X else X writev(out_val,'a',tmp_val); X END X else `20 X out_val := tmp_val; X out_val := out_val + '.'; X END X else X BEGIN X insert_str(tmp_val,'& ',''); X out_val := tmp_val X END; X END X END; $ CALL UNPACK [.SOURCE.INCLUDE]DESC.INC;1 139464587 $ create 'f' X`7B Eat some food.`7D X`5Bpsect(misc2$code)`5D procedure eat; X var X i1 : unsigned; X i2,i3,item_val : integer; X out_val : vtype; X redraw,ident : boolean; X BEGIN X reset_flag := true; X if (inven_ctr > 0) then X BEGIN X if (find_range(`5B80`5D,i2,i3)) then X BEGIN X redraw := false; X if (get_item(item_val,'Eat what?',redraw,i2,i3)) then X with inventory`5Bitem_val`5D do X BEGIN X if (redraw) then draw_cave; X reset_flag := false; X i1 := flags; X ident := false; X while (i1 > 0) do X BEGIN X i2 := bit_pos(i1); X`7B Foods `7D X CASE (i2) of X 1 : with py.flags do X BEGIN X poisoned := poisoned + randint(10) + level; X Opusii_vomit(35); X ident := true; X END; X 2 : with py.flags do X BEGIN X blind := blind + randint(250) + 10*level + 100; X draw_cave; X msg_print('A veil of darkness surrounds you.'); X ident := true; X END; X 3 : with py.flags do X BEGIN X afraid := afraid + randint(10) + level; X msg_print('You feel terrified!'); X ident := true; X END; X 4 : with py.flags do X BEGIN X confused := confused + randint(10) + level; X msg_print('You feel drugged.'); X END; X 5 : with py.flags do X image := image + randint(200) + 25*level + 200; X 6 : ident := cure_poison; X 7 : ident := cure_blindness; X 8 : with py.flags do X if (afraid > 1) then X BEGIN X afraid := 1; X ident := true; X END; X 9 : ident := cure_confusion; X 10 : ident := lose_str; X 11 : ident := lose_con; X 12 : ident := lose_int; X 13 : ident := lose_wis; X 14 : ident := lose_dex; X 15 : ident := lose_chr; X 16 : with py.stat do X if (str > cstr) then X BEGIN X cstr := str; X msg_print('You feel your strength returning.'); X prt_strength; X ident := true; X END; X 17 : with py.stat do X if (con > ccon) then X BEGIN X ccon := con; X msg_print('You feel your health returning.'); X prt_constitution; X ident := true; X END; X 18 : with py.stat do X if (py.stat.int > cint) then X BEGIN X cint := py.stat.int; X msg_print('Your head spins a moment.'); X prt_intelligence; X ident := true; X END; X 19 : with py.stat do X if (wis > cwis) then X BEGIN X cwis := wis; X msg_print('You feel your wisdom returning.'); X prt_wisdom; X ident := true; X END; X 20 : with py.stat do X if (dex > cdex) then X BEGIN X cdex := dex; X msg_print('You feel more dextrous.'); X prt_dexterity; X ident := true; X END; X 21 : with py.stat do X if (chr > cchr) then X BEGIN X cchr := chr; X msg_print('Your skins starts itching.'); X prt_charisma; X ident := true; X END; X 22 : ident := hp_player(randint(3),'poisonous food.'); X 23 : ident := hp_player(randint(6),'poisonous food.'); X 24 : ident := hp_player(randint(12),'poisonous food.'); X 25 : ident := hp_player(damroll('3d6'),'poisonous food.'); X 26 : ident := hp_player(damroll('3d12'),'poisonous food.'); X 27 : ident := hp_player(-randint(4),'poisonous food.'); X 28 : ident := hp_player(-randint(8),'poisonous food.'); X 29 : ident := hp_player(-damroll('2d8'),'poisonous food.'); X 30 : ident := hp_player(-damroll('3d8'),'poisonous food.'); X 31 : with py.misc do X BEGIN X mhp := mhp - 1; X if (mhp < chp) then X chp := mhp; X take_hit(1,'poisonous food.'); X prt_mhp; X prt_chp; X ident := true; X END; X otherwise ; X END; X`7B End of food actions.`7D X END; X if (ident) then X identify(inventory`5Bitem_val`5D); X if (flags <> 0) then X with py.misc do X BEGIN X exp := exp + round(level/lev); X prt_experience; X END; X add_food(p1); X py.flags.status := uand(%X'FFFFFFFC',py.flags.status); X prt_hunger; X prt_cur_weight; X desc_remain(item_val); X inven_destroy(item_val); X END X else X if (redraw) then draw_cave; X END X else `20 X msg_print('You are not carrying any food.'); X END X else X msg_print('But you are not carrying anything.'); X END; $ CALL UNPACK [.SOURCE.INCLUDE]EAT.INC;1 520537146 $ create 'f' X`7B Throw a magic spell `7D`20 X`5Bpsect(misc2$code)`5D procedure extra_cast; X var X i1,i2,item_val,dir : integer; X choice,chance : integer; X dumy,y_dumy,x_dumy : integer; X redraw : boolean; X BEGIN X reset_flag := true; X if (py.flags.blind > 0) then X msg_print('You can''t see to read your spell book!') X else if (no_light) then X msg_print('You have no light to read by.') X else if (py.flags.confused > 0) then X msg_print('You are too confused...') X else if (class`5Bpy.misc.pclass`5D.espell) then X if (inven_ctr > 0) then X BEGIN X if (find_range(`5B92`5D,i1,i2)) then X BEGIN X redraw := false; X if (get_item(item_val,'Use which spell-book?', X redraw,i1,i2)) then X BEGIN X if (cast_spell('Cast which spell?',item_val, X choice,chance,redraw)) then X with extra_spell`5Bpy.misc.pclass,choice`5D do X BEGIN +-+-+-+-+-+-+-+- END OF PART 19 +-+-+-+-+-+-+-+-