-+-+-+-+-+-+-+-+ START OF PART 19 -+-+-+-+-+-+-+-+ X`09`09msg_print('You feel your memories fading...'); X`09`09`09`09 py.stat.cint:=de_statp(py.stat.cint); X`09`09`09`09 prt_intelligence; X`09`09`09`09 end; X`09`09`09`09 prt_chp; X`09`09`09`09 end; X`7BLose wisdom `7D 18 :`09with py.flags do X`09`09`09`09 begin X`09`09`09`09 take_hit(damroll(damstr),ddesc); X`09`09`09`09 if (sustain_wis) then X`09`09`09`09 msg_print('Your wisdom is sustained.') X`09`09`09`09 else X`09`09`09`09 begin X`09`09`09`09`09msg_print('Your wisdom is drained.'); X`09`09`09`09 py.stat.cwis := de_statp(py.stat.cwis); X`09`09`09`09 prt_wisdom; X`09`09`09`09 end; X`09`09`09`09 prt_chp; X`09`09`09`09 end; X`7BLose experience `7D 19:`09begin X`09`09`09`09msg_print('You feel your life draining away!'); X`09`09`09`09 lose_exp(max_hp(damstr)); X`09`09`09`09end; X`7BAggravate monster`7D`09 20:`09aggravate_monster(5); X`7BDisenchant`09 `7D`09 21:`09begin X`09`09`09`09 flag := false; X`09`09`09`09 case randint(6) of X`09`09`09`09 1 : i1 := 23; X`09`09`09`09 2 : i1 := 26;`20 X`09`09`09`09 3 : i1 := 27; X`09`09`09`09 4 : i1 := 32; X`09`09`09`09 5 : i1 := 28; X`09`09`09`09 6 : i1 := 24; X`09`09`09`09 end; X`09`09`09`09 with inventory`5Bi1`5D do X`09`09`09`09 begin X`09`09`09`09 if (tohit > 0) then X`09`09`09`09`09begin X`09`09`09`09`09 tohit := tohit - randint(2); X`09`09`09`09`09 flag := true; X`09`09`09`09`09end; X`09`09`09`09 if (todam > 0) then X`09`09`09`09`09begin X`09`09`09`09`09 todam := todam - randint(2); X`09`09`09`09`09 flag := true; X`09`09`09`09`09end; X`09`09`09`09 if (toac > 0) then X`09`09`09`09`09begin X`09`09`09`09`09 toac := toac - randint(2); X`09`09`09`09`09 flag := true; X`09`09`09`09`09end; X`09`09`09`09 end; X`09`09`09`09 if (flag) then X`09`09`09`09 begin X`09`09 msg_print('There is a static feeling in the air...'); X`09`09`09`09 py_bonuses(blank_treasure,1); X`09`09`09`09 end; X`09`09`09`09end; X`7BEat food`09 `7D`09 22:`09begin X`09`09`09`09 if (find_range(`5B80`5D,i1,i2)) then X`09`09`09`09 inven_destroy(i1); X`09`09`09`09end; X`7BEat light`09 `7D`09 23:`09begin X`09`09`09`09 with inventory`5B33`5D do X`09`09`09`09 if (p1 > 0) then X`09`09`09`09 begin X`09`09`09`09`09p1 := p1 - 250 - randint(250); X`09`09`09`09`09if (p1 < 1) then p1 := 1; X`09`09`09`09`09msg_print('Your light dims...'); X`09`09`09`09 end; X`09`09`09`09end; X`09`09`09 99:`09; X`09`09`09 otherwise ; X`09 `09end X`09`09 end X`09`09 else X`09`09 case adesc of X`09`09`09 1,2,3,6 : msg_print(cdesc + 'misses you.'); X`09`09`09 otherwise ; X`09`09 end X`09 end X`09 end X`09 end; X X X`09`7B Make the move if possible, five choices`09`09-RAK-`09`7D X function make_move(monptr : integer; mm : mm_type) : boolean; X`09 var X`09`09i1,i2,newy,newx`09`09: integer; X`09`09movebits`09`09: unsigned; X`09`09flag,tflag`09`09: boolean; X`09 begin X`09 i1 := 1; X`09 flag := false; X`09 make_move := false; X`09 movebits := c_list`5Bm_list`5Bmonptr`5D.mptr`5D.cmove; X`09 repeat X`09`09`7B Get new positon`09`09`7D X`09 newy := m_list`5Bmonptr`5D.fy; X`09 newx := m_list`5Bmonptr`5D.fx; X`09 move(mm`5Bi1`5D,newy,newx); X`09 with cave`5Bnewy,newx`5D do X`09 if (fval <> 15) then X`09`09 begin X`09`09 tflag := false; X`09`09`7B Floor is open?`09`09`7D X`09`09 if (fopen) then X`09`09 tflag := true X`09`09`7B Creature moves through walls?`09`7D X`09`09 else if (uand(movebits,%X'40000') <> 0) then X`09`09 tflag := true X`09`09`7B Creature can open doors?`09`7D X`09`09 else if (tptr > 0) then X`09with t_list`5Btptr`5D do X`09 with m_list`5Bmonptr`5D do X`09 if (uand(movebits,%X'20000') <> 0) then X`09 begin`09`7B Creature can open doors...`09`09`09`7D X`09`09case tval of X`09`09 105 : begin`09`7B Closed doors...`09`7D X`09`09`09 if (p1 = 0) then`09`09`7B Closed doors`09`7D X`09`09`09 begin X`09`09`09 tflag := true; X`09`09`09 if (fm) then X`09`09`09`09if (los(char_row,char_col,newy,newx)) then X`09`09`09`09 begin X`09`09`09`09 t_list`5Btptr`5D := door_list`5B1`5D; X`09`09`09`09 fopen := true; X`09`09`09`09 lite_spot(newy,newx); X`09`09`09`09 tflag := false; X`09`09`09`09 end; X`09`09`09 end X`09`09`09 else if (p1 > 0) then`09`09`7B Locked doors`09`7D X`09`09`09 begin X`09`09`09 if (randint(100-level) < 5) then X`09`09`09`09p1 := 0; X`09`09`09 end X`09`09`09 else if (p1 < 0) then`09`09`7B Stuck doors`09`7D X`09`09`09 begin X`09`09`09 if (randint(hp) > (10+abs(p1))) then X`09`09`09`09p1 := 0; X`09`09`09 end; X`09`09`09end; X`09`09 109 : begin`09`7B Secret doors...`09`7D X`09`09`09 tflag := true; X`09`09`09 if (fm) then X`09`09`09 if (los(char_row,char_col,newy,newx)) then X`09`09`09 begin X`09`09`09`09t_list`5Btptr`5D := door_list`5B1`5D; X`09`09`09`09fopen := true; X`09`09`09`09lite_spot(newy,newx); X`09`09`09`09tflag := false; X`09`09`09 end; X`09`09`09end; X`09`09 otherwise ; X`09`09end; X`09 end X`09 else X`09 begin`09`7B Creature can not open doors, must bash them`09`7D X`09`09case tval of X`09`09 105 : begin`09`7B Closed doors...`09`7D X`09`09`09 i2 := abs(p1) + 20; X`09`09`09 if (randint(hp) > i2) then X`09`09`09 begin X`09`09`09 tflag := true; X`09`09`09 if (fm) then X`09`09`09 if (los(char_row,char_col,newy,newx)) then X`09`09`09`09 begin X`09`09`09`09 t_list`5Btptr`5D := door_list`5B1`5D; X`09`09`09`09 t_list`5Btptr`5D.p1 := randint(2) - 1; X`09`09`09`09 fopen := true; X`09`09`09`09 lite_spot(newy,newx); X`09`09`09`09 tflag := false; X`09`09`09`09 end; X`09`09`09 end X`09`09`09end; X`09`09 109 : ;`09`7B Secret doors...`09`7D X`09`09 otherwise ; X`09`09end; X`09 end; X`09`09`7B Glyph of warding present?`09`7D X`09`09 if (tflag) then`09`09`7B Scare Monster trap`09`7D X`09`09 if (tptr > 0) then X`09`09`09if (t_list`5Btptr`5D.tval = 102) then X`09`09`09 if (t_list`5Btptr`5D.subval = 99) then X`09`09`09 tflag := false; X`09`09`7B Creature has attempted to move on player?`09`7D X`09`09 if (tflag) then X`09`09 if (cptr = 1) then X`09`09 begin X`09`09`09 if (not (m_list`5Bmonptr`5D.ml)) then X`09`09`09 update_mon(monptr); X`09`09`09 if (find_flag) then X`09`09`09 begin X`09`09`09 find_flag := false; X`09`09`09 move_char(5); X`09`09`09 end; X`09`09 make_attack(monptr); X`09`09`7B Player has read a Confuse Monster?`09`7D X`09`09`7B Monster gets a saving throw...`09`7D X`09`09`09 if (py.flags.confuse_monster) then X`09`09`09 with m_list`5Bmonptr`5D do X`09`09`09 with c_list`5Bmptr`5D do X`09`09`09 begin X`09`09`09 msg_print('Your hands stop glowing.'); X`09`09`09`09 if ((randint(max_mons_level) < level) or X`09`09`09`09 (uand(%X'1000',cdefense) <> 0)) then X`09`09msg_print('The ' + name + ' is unaffected.') X`09`09`09`09 else X`09`09`09`09 begin X`09`09msg_print('The ' + name + ' appears confused.'); X`09`09`09`09 confused := true; X`09`09`09`09 py.flags.confuse_monster := false; X`09`09`09`09 end; X`09`09`09 end; X`09`09`09 tflag := false; X`09`09`09 flag := true; X`09`09 end X`09`09`7B Creature is attempting to move on other creature?`09`7D X`09`09 else if ((cptr > 1) and`20 X`09`09`09((newy <> m_list`5Bmonptr`5D.fy) or`20 X`09`09`09 (newx <> m_list`5Bmonptr`5D.fx))) then X`09`09 begin X`09`09`7B Creature eats other creatures?`09`7D X`09`09 if (uand(movebits,%X'80000') <> 0) then X`09`09`09 delete_monster(cptr) X`09`09`09 else X`09`09`09 tflag := false; X`09`09 end; X`09`09`7B Creature has been allowed move...`09`7D X`09`09 if (tflag) then X`09`09 with m_list`5Bmonptr`5D do X`09`09 begin X`09`09`7B Pick up or eat an object`09`09`7D X`09`09`09 if (uand(movebits,%X'100000') <> 0) then X`09`09`09 with cave`5Bnewy,newx`5D do X`09`09`09 if (tptr > 0) then X`09`09`09 if (t_list`5Btptr`5D.tval < 100) then X`09`09`09 delete_object(newy,newx); X`09`09`7B Move creature record`09`09`09`7D X`09`09 move_rec(fy,fx,newy,newx); X`09`09 fy := newy; X`09`09 fx := newx; X`09`09`09 flag := true; X`09`09`09 make_move := true; X`09`09 end X`09`09 end; X`09 i1 := i1 + 1; X`09`09`7B Up to 5 attempts at moving, then give up...`09`7D X`09 until ((flag) or (i1 > 5)); X`09 end; X X X`09`7B Creatures can cast spells too. (Dragon Breath)`09-RAK-`09`7D X`09`7B cast_spell := true if creature changes position`09`7D X`09`7B took_turn := true if creature casts a spell`09`09`7D X`09function cast_spell(`09monptr `09`09: integer;`20 X`09`09`09`09var took_turn `09: boolean) : boolean; X`09 var X`09`09i1`09`09`09: unsigned; X`09`09i2,i3,y,x`09`09: integer; X`09`09chance,thrown_spell`09: integer; X`09`09spell_choice`09`09: array `5B1..31`5D of integer; X`09`09cdesc,ddesc`09`09: vtype; X`09`09flag`09`09`09: boolean; X`09 begin X`09 with m_list`5Bmonptr`5D do X`09 with c_list`5Bmptr`5D do X`09`09begin X`09`09 chance := int(uand(spells,%X'0000000F')); X`09`09`7B 1 in x chance of casting spell`09`09`7D X`09`09 if (randint(chance) <> 1) then X`09`09 begin X`09`09 cast_spell := false; X`09`09 took_turn := false; X`09`09 end X`09`09`7B Must be within certain range`09`09`09`7D X`09`09 else if (cdis > max_spell_dis) then X`09`09 begin X`09`09 cast_spell := false; X`09`09 took_turn := false; X`09`09 end X`09`09`7B Must have unobstructed Line-Of-Sight`09`09`7D X`09`09 else if (not(los(char_row,char_col,fy,fx))) then X`09`09 begin X`09`09 cast_spell := false; X`09`09 took_turn := false; X`09`09 end X`09`09 else`09`7B Creature is going to cast a spell`09`7D X`09`09 begin X`09`09 took_turn := true; X`09`09 cast_spell := false; X`09`09`7B Describe the attack`09`09`09`09`7D X`09`09 flag := true; X`09`09 if (not(ml)) then X`09`09`09flag := false X`09`09 else if ((uand(%X'10000',c_list`5Bmptr`5D.cmove) <> 0) and X`09`09`09 (not(py.flags.see_inv))) then X`09`09`09flag := false X`09`09 else if (py.flags.blind > 0) then X`09`09`09flag := false; X`09`09 if (flag) then X`09`09 cdesc := 'The ' + name + ' ' X`09`09 else X`09`09`09cdesc := 'It '; X`09`09 `7B For 'DIED_FROM' string`09`7D X`09`09 if (uand(%X'80000000',cmove) <> 0) then X`09`09 ddesc := 'The ' + name X`09`09 else X`09`09 ddesc := '& ' + name; X`09`09 inventory`5Binven_max`5D.name := ddesc; X`09`09 inventory`5Binven_max`5D.number := 1; X`09`09 objdes(ddesc,inven_max,true); X`09`09`7B End DIED_FROM`09`09`09`7D X`09`09`7B Extract all possible spells into spell_choice`09`7D X`09`09 i1 := uand(spells,%X'FFFFFFF0'); X`09`09 i3 := 0; X`09`09 while (i1 <> 0) do X`09`09`09begin X`09`09`09 i2 := bit_pos(i1); X`09`09`09 i3 := i3 + 1; X`09`09`09 spell_choice`5Bi3`5D := i2; X`09`09`09end; X`09`09`7B Choose a spell to cast`09`09`09`7D X`09`09 thrown_spell := spell_choice`5Brandint(i3)`5D; X`09`09`7B Cast the spell...`09`09`09`09`7D X`09`09 case thrown_spell of X`7BTeleport Short`7D 5 :`09teleport_away(monptr,4); X`7BTeleport Long `7D 6 :`09teleport_away(monptr,max_sight); X`7BTeleport To `7D 7 :`09begin X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 msg_print(' '); X`09`09`09 teleport_to(fy,fx); X`09`09`09end; X`7BLight Wound `7D 8 :`09begin X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_saves(wis_adj+py.misc.lev)) then X`09`09`09 msg_print('You resist the affects of the spell.') X`09`09`09 else X`09`09`09 take_hit(damroll('2d8'),ddesc); X`09`09`09end; X`7BSerious Wound `7D 9 :`09begin X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_saves(wis_adj+py.misc.lev)) then X`09`09`09 msg_print('You resist the affects of the spell.') X`09`09`09 else X`09`09`09 take_hit(damroll('8d8'),ddesc); X`09`09`09end; X`7BHold Person `7D10 :`09begin X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (py.flags.free_act) then X`09`09`09 msg_print('You are unaffected...') X`09`09`09 else if (player_saves(wis_adj+py.misc.lev)) then X`09`09`09 msg_print('You resist the affects of the spell.') X`09`09`09 else if (py.flags.paralysis > 0) then X`09`09`09 py.flags.paralysis:=py.flags.paralysis+2 X`09`09`09 else X`09`09`09 py.flags.paralysis:=randint(5)+4; X`09`09`09end; X`7BCause Blindnes`7D11 :`09begin X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_saves(wis_adj+py.misc.lev)) then X`09`09`09 msg_print('You resist the affects of the spell.') X`09`09`09 else if (py.flags.blind > 0) then X `09`09`09 py.flags.blind := py.flags.blind + 6 X`09`09`09 else X`09`09`09 begin X`09`09`09 py.flags.blind := py.flags.blind+12+randint(3); X`09`09`09 msg_print(' '); X`09`09`09 end; X`09`09`09end; X`7BCause Confuse `7D12 :`09begin X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_saves(wis_adj+py.misc.lev)) then X`09`09`09 msg_print('You resist the affects of the spell.') X`09`09`09 else if (py.flags.confused > 0) then X`09`09`09 py.flags.confused := py.flags.confused + 2 X`09`09`09 else X`09`09`09 py.flags.confused := randint(5) + 3; X`09`09`09end;`09`09`09 `20 X`7BCause Fear `7D13 :`09begin X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_saves(wis_adj+py.misc.lev)) then X`09`09`09 msg_print('You resist the affects of the spell.') X`09`09`09 else if (py.flags.afraid > 0) then X`09`09`09 py.flags.afraid := py.flags.afraid + 2 X`09`09`09 else X`09`09`09 py.flags.afraid := randint(5) + 3; X`09`09`09end;`09`09`09 `20 X`7BSummon Monster`7D14 :`09begin X`09`09`09 cdesc := cdesc + 'magically summons a monster!'; X`09`09`09 msg_print(cdesc); X`09`09`09 y := char_row;`09 X`09`09`09 x := char_col; X`09`09`09 summon_monster(y,x,false); X`09`09`09 check_mon_lite(y,x); X`09`09`09end; X`7BSummon Undead`7D 15 :`09begin +-+-+-+-+-+-+-+- END OF PART 19 +-+-+-+-+-+-+-+-