-+-+-+-+-+-+-+-+ START OF PART 16 -+-+-+-+-+-+-+-+ X BEGIN X msg_print('Your joints feel stiff.'); X py.misc.chp := -1; prt_chp; X msg_print('You have been turned to stone.') V; X msg_print(''); X take_hit(0,ddesc) X END;`20 X`7BMind Flayer `7D 27 : `7BNeed to check for dexterity`7D X if (randint(50) > 47) then X BEGIN X msg_print('The Mind Flayer''s tentacles touch you. V'); X py.misc.chp := -1; prt_chp; X msg_print('Your brain has been sucked out.' V); X msg_print(''); X take_hit(0,ddesc) X END;`20 X`7BHell Horse/Nightmare`7D 28 : begin X with py.flags do X begin X blind := blind + randint(5); X end; X msg_print('Your eyes sting.'); X take_hit(damroll(damstr),ddesc); X end;`20 X`7BVargouillian Attack-NBT`7D 29 : BEGIN X`09`09`09`09 `7B Lose Max H.P. by 1d6 `7D X take_hit(damroll(damstr),ddesc); X if (py.flags.sustain_str) then X X`7B I fails save vs poison, nail the muther `7D X `20 X msg_print('You feel weaker for a moment, then it passes.') X else if (randint(3) > 1) then X BEGIN X `09`09`09msg_print('Your hit points are drained!'); X`09`09`09`09`09with py.misc do X`09`09`09`09`09BEGIN X`09`09`09`09`09 mhp := mhp - randint(6); X`09`09`09`09`09 if (mhp < chp) then X`09`09`09`09`09 chp := mhp; X`09`09`09`09`09 prt_mhp; X`09`09`09`09`09 prt_chp; X`09`09`09`09`09END; X END; X prt_chp X END; X 99 : ; X OTHERWISE X END X END X else X CASE adesc of X 1,2,3,6 : msg_print(cdesc + 'misses you.'); X OTHERWISE X END X END X END X END; X`20 X`20 X`7B Make the move if possible, five choices `7D X FUNCTION make_move(monptr : integer; mm : mm_type) : boolean; X VAR X i1,i2,newy,newx : integer; X movebits : unsigned; X flag,tflag : boolean; X BEGIN X i1 := 1; X flag := false; X make_move := false; X movebits := c_list`5Bm_list`5Bmonptr`5D.mptr`5D.cmove; X repeat X`7B Get new positon `7D X newy := m_list`5Bmonptr`5D.fy; X newx := m_list`5Bmonptr`5D.fx; X move(mm`5Bi1`5D,newy,newx); X with cave`5Bnewy,newx`5D do X if (fval <> 15) then X BEGIN X tflag := false; X`7B Floor is open? `7D X if (fopen) then X tflag := true X`7B Creature moves through walls? `7D X else if (uand(movebits,%X'40000') <> 0) then X tflag := true X`7B Creature can open doors? `7D X else if (tptr > 0) then X with t_list`5Btptr`5D do X with m_list`5Bmonptr`5D do X if (uand(movebits,%X'20000') <> 0) then X BEGIN `20 X`7B Creature can open doors. `7D X CASE tval of X 105 : BEGIN `20 X`7B Closed doors. `7D if (p1 = 0) then X BEGIN X tflag := true; X if (fm) then X if (los(char_row,char_col,newy,newx)) then X BEGIN X t_list`5Btptr`5D := door_list`5B1`5D; X fopen := true; X lite_spot(newy,newx); X tflag := false X END X END X`7B Locked door `7D else if (p1 > 0) then`20 X BEGIN X if (randint(100-level) < 5) then X p1 := 0 X END X`7B Stuck doors `7D else if (p1 < 0) then X BEGIN X if (randint(hp) > (10+abs(p1))) then X p1 := 0 X END X END; X`7B Secret doors..`7D 109 : BEGIN X tflag := true; X if (fm) then X if (los(char_row,char_col,newy,newx)) then X BEGIN X t_list`5Btptr`5D := door_list`5B1`5D; X fopen := true; X lite_spot(newy,newx); X tflag := false X END X END; X OTHERWISE X END X END X else X BEGIN `7B Creature can not open doors, must bash them `7D X CASE tval of X 105 : BEGIN X i2 := abs(p1) + 20; X if (randint(hp) > i2) then X BEGIN X tflag := true; X if (fm) then X if (los(char_row,char_col,newy,newx)) then X BEGIN X t_list`5Btptr`5D := door_list`5B1`5D; X t_list`5Btptr`5D.p1 := randint(2) - 1; X fopen := true; X lite_spot(newy,newx); X tflag := false X END X END X END; X 109 : ; X OTHERWISE X END X END; X`7B Glyph of warding present? XScare Monster trap`7D if (tflag) then X if (tptr > 0) then X if (t_list`5Btptr`5D.tval = 102) then X if (t_list`5Btptr`5D.subval = 99) then X tflag := false; X`7B Creature has attempted to move on player? `7D X if (tflag) then X if (cptr = 1) then X BEGIN X if (not (m_list`5Bmonptr`5D.ml)) then X update_mon(monptr); X if (find_flag) then X BEGIN X find_flag := false; X move_char(5) X END; X make_attack(monptr); X`7B Player has read a Confuse Monster. Monster gets a saving throw... `7D X if (py.flags.confuse_monster) then X with m_list`5Bmonptr`5D do X with c_list`5Bmptr`5D do X BEGIN X msg_print('Your hands stop glowing.'); X py.flags.confuse_monster := false; X if ((randint(max_mons_level) < level) or X (uand(%X'1000',cdefense) <> 0)) then X BEGIN X msg_print('The ' + name + ' is unaffected.') X END X else X BEGIN X msg_print('The ' + name + ' appears confused.'); X confused := true X END X END; X tflag := false; X flag := true X END X`7B Creature is attempting to move on other creature? `7D X else if ((cptr > 1) and X ((newy <> m_list`5Bmonptr`5D.fy) or X (newx <> m_list`5Bmonptr`5D.fx))) then X BEGIN X`7B Creature eats other creatures? `7D X if (uand(movebits,%X'80000') <> 0) then X delete_monster(cptr) X else X tflag := false X END; X`7B Creature has been allowed move `7D X if (tflag) then X with m_list`5Bmonptr`5D do X BEGIN X`7B Pick up or eat an object `7D X if (uand(movebits,%X'100000') <> 0) then X with cave`5Bnewy,newx`5D do X if (tptr > 0) then X if (t_list`5Btptr`5D.tval < 100) then X delete_object(newy,newx); X`7B Move creature record `7D X move_rec(fy,fx,newy,newx); X fy := newy; X fx := newx; X flag := true; X make_move := true X END X END; X i1 := i1 + 1; X`7B Up to 5 attempts at moving, then give up `7D X until ((flag) or (i1 > 5)) X END; X`20 X`20 X`7B Creatures can cast spells too.`20 Xcast_spell := true if creature changes position Xtook_turn := true if creature casts a spell `7D X FUNCTION cast_spell( monptr : integer; VAR took_turn : boolean) : bool Vean; X VAR X i1 : unsigned; X i2,i3,y,x,chance,thrown_spell : integer; X r1 : real; X spell_choice : array `5B1..31`5D of integer; X cdesc,ddesc,outval : vtype; X flag : boolean; X BEGIN X with m_list`5Bmonptr`5D do X with c_list`5Bmptr`5D do X BEGIN X chance := int(uand(spells,%X'0000000F')); X`7B 1 in x chance of casting spell `7D X if (randint(chance) <> 1) then X BEGIN X cast_spell := false; X took_turn := false X END X`7B Must be within certain range `7D X else if (cdis > max_spell_dis) then X BEGIN X cast_spell := false; X took_turn := false X END X`7B Must have unobstructed Line-Of-Sight `7D X else if (not(los(char_row,char_col,fy,fx))) then X BEGIN X cast_spell := false; X took_turn := false X END X else `20 X`7B Creature is going to cast a spell `7D X BEGIN X took_turn := true; X cast_spell := false; X`7B Describe the attack `7D X flag := true; X if (not(ml)) then X flag := false X else if ((uand(%X'10000',c_list`5Bmptr`5D.cmove) <> 0) V and X (not(py.flags.see_inv))) then X flag := false X else if (py.flags.blind > 0) then X flag := false; X if (flag) then X cdesc := 'The ' + name + ' ' X else X cdesc := 'It '; X`7B For 'DIED_FROM' string `7D X if (uand(%X'80000000',cmove) <> 0) then X ddesc := 'The ' + name X else X ddesc := '& ' + name; X inventory`5Binven_max`5D.name := ddesc; X inventory`5Binven_max`5D.number := 1; X objdes(ddesc,inven_max,true); X`7B End DIED_FROM. Extract all possible spells into spell_choice `7D X i1 := uand(spells,%X'FFFFFFF0'); X i3 := 0; X while (i1 <> 0) do X BEGIN X i2 := bit_pos(i1); X i3 := i3 + 1; X spell_choice`5Bi3`5D := i2 X END; X`7B Choose a spell to cast `7D X thrown_spell := spell_choice`5Brandint(i3)`5D; X`7B Cast the spell... `7D X CASE thrown_spell of X`7BTeleport Short`7D 5 : teleport_away(monptr,4); X`7BTeleport Long `7D 6 : teleport_away(monptr,max_sight); X`7BTeleport To `7D 7 : BEGIN X cdesc := cdesc + 'casts a spell.'; X msg_print(cdesc); X msg_print(' '); X teleport_to(fy,fx) X END; X`7BLight Wound `7D 8 : BEGIN X cdesc := cdesc + 'casts a spell.'; X msg_print(cdesc); X if (player_saves(wis_adj+py.misc.lev)) then X msg_print('You resist the affects of the spell.' V) X else X take_hit(damroll('2d8'),ddesc) X END; X`7BSerious Wound `7D 9 : BEGIN X cdesc := cdesc + 'casts a spell.'; X msg_print(cdesc); `20 X if (player_saves(wis_adj+py.misc.lev)) then X msg_print('You resist the affects of the spell.' V) X else X take_hit(damroll('8d8'),ddesc) X END; X`7BHold Person `7D10 : BEGIN +-+-+-+-+-+-+-+- END OF PART 16 +-+-+-+-+-+-+-+-