-+-+-+-+-+-+-+-+ START OF PART 11 -+-+-+-+-+-+-+-+ X`09`09`09 case randint(10) of X1 : msg_print('Uh oh...it looks like the '+squash+' is in need of first aid. V'); X2 : msg_print('*splat* *crunch* *gobble* *BUUUUUUURP*'); X3 : msg_print('Look out! The '+squash+' is going to-- Eeeeew...never mind.' V); X4 : msg_print('Ick...the '+doesit+' has '+squash+' all over his toes.'); X5 : msg_print('The nice '+doesit+' took out the '+squash+' for you.'); X6 : msg_print('WoWEE, Auggie Ben-Doggie! The '+squash+' just got blatted!') V; X7 : msg_print('The '+squash+' Society will not appreciate this. . .'); X8 : msg_print('The '+squash+' is not amused.'); X9 : msg_print('The '+doesit+' pauses to clean the '+squash+' off.'); X10: msg_print('Aw, darn. There goes '+itos(c_list`5Bm_list`5Bcptr`5D.mptr`5 VD.mexp)+' experience!'); X`09`09`09 end; X`09`09`09 end; X`09`09`09 delete_monster(cptr); X`09`09`09 end X`09`09`09 else X`09`09`09 tflag := false; X`09`09 end; X`09`09`7B Creature has been allowed move... `7D X`09`09 if (tflag) then X`09`09 with m_list`5Bmonptr`5D do X`09`09`09begin X`09`09`7B Pick up or eat an object `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`09if (t_list`5Btptr`5D.tval < valuable_metal) then X`09`09`09`09 delete_object(newy,newx); X`09`09`7B Move creature record `7D X`09`09`09 move_rec(fy,fx,newy,newx); X`09`09`09 fy := newy; X`09`09`09 fx := newx; X`09`09`09 flag := true; X`09`09`09 make_move := true; X`09`09`09end X`09`09 end; X`09 i1 := i1 + 1; X`09`09`7B Up to 5 attempts at moving, then give up... `7D X`09 until ((flag) or (i1 > 5)); X`09 end; X X`09function move_confused(monptr : integer; var mm : mm_type) : boolean;`20 X`09 begin X`09`09mm`5B1`5D := randint(9); X`09`09mm`5B2`5D := randint(9); X`09`09mm`5B3`5D := randint(9); X`09`09mm`5B4`5D := randint(9); X`09`09mm`5B5`5D := randint(9); X`09`09move_confused := make_move(monptr,mm); X`09 end; X 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 `7D X`09`7B took_turn := true if creature casts a spell `7D X`09function cast_spell( monptr : integer; X`09`09`09`09var took_turn : boolean) : boolean; X`09 var X`09`09i1 : unsigned; X`09`09i2,i3,y,x,chance2 : integer; X`09`09chance,thrown_spell : integer; X`09`09r1 : real; X`09`09spell_choice : array `5B1..31`5D of integer; X`09`09cdesc,ddesc,outval : vtype; X`09`09stop_player`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 chance2 := int(uand(spells,%X'80000000')); X`09`09`7B 1 in x chance of casting spell `7D X`09`09`7B if chance2 is true then 1 in x of not casting `7D X`09`09 if (((chance2 = 0) and (randint(chance) <> 1)) or X`09`09`09((chance2 <> 0) and (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 `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 `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 `7B Creature is going to cast a spell `7D X`09`09 begin X`09`09 took_turn := true; X`09`09 cast_spell := false; X`09`09`7B Describe the attack `7D X`09`09 find_monster_name( cdesc, monptr, true ); X`09`09 cdesc := cdesc + ' '; X`09`09 `7B For 'DIED_FROM' string `7D X`09`09 if (uand(%X'80000000',cmove) <> 0) then X`09`09`09ddesc := 'The ' + name X`09`09 else X`09`09`09ddesc := '& ' + name; X`09`09 inven_temp`5E.data.name := ddesc; X`09`09 inven_temp`5E.data.number := 1; X`09`09 objdes(ddesc,inven_temp,true); X`09`09`7B End DIED_FROM `7D X`09`09`7B Extract all possible spells into spell_choice `7D X`09`09 i1 := uand(spells,%X'0FFFFFF0'); 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 `7D X`09`09 thrown_spell := spell_choice`5Brandint(i3)`5D; X`09`09`7B Cast the spell... `7D X`09`09 stop_player := false; X`09`09 case thrown_spell of X`7BTeleport Short`7D 5 : teleport_away(monptr,5); X`7BTeleport Long `7D 6 : teleport_away(monptr,max_sight); X`7BTeleport To `7D 7 : begin X`09`09`09 stop_player := true; 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 : begin X`09`09`09 stop_player := true; X`09`09`09 if (index(cdesc,'Bard') <> 0) or X`09`09`09 (index(cdesc,'Ranger') <> 0) or X`09`09`09 (index(cdesc,'Master Bard') <> 0) then X`09`09`09 cdesc := cdesc + 'shoots an arrow.' X`09`09`09 else cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_spell_saves) then X`09`09`09 msg_print('You resist the effects of the spell.') X`09`09`09 else X`09`09`09 take_hit(damroll('3d8'),ddesc); X`09`09`09end; X`7BSerious Wound `7D 9 : begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_spell_saves) 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 : begin X`09`09`09 stop_player := true; 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 or (py.flags.free_time>0)) then X`09`09`09 msg_print('You are unaffected...') X`09`09`09 else if (player_spell_saves) then X`09`09`09 msg_print('You resist the affects of the spell.') X`09`09`09 else X`09`09`09 begin X`09`09`09 msg_print('You can''t move!'); X`09`09 `09 if (py.flags.paralysis > 0) then X`09`09`09`09py.flags.paralysis:=py.flags.paralysis+2 X`09`09`09 else X`09`09`09`09py.flags.paralysis:=randint(5)+4; X`09`09`09 end X`09`09`09end; X`7BCause Blindnes`7D11 : begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_spell_saves) 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 := 12+randint(3); X`09`09`09 msg_print(' '); X`09`09`09 end; X`09`09`09end; X`7BCause Confuse `7D12 : begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_spell_saves) 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; X`7BCause Fear `7D13 : begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_spell_saves) 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; X`7BSummon Monster`7D14 : begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'magically summons a monster!'; X`09`09`09 msg_print(cdesc); X`09`09`09 y := char_row; X`09`09`09 x := char_col; X`09`09`09 if (cave`5By,x`5D.fval in water_set) then X`09`09`09 summon_water_monster(y,x,false) X`09`09`09 else X`09`09`09 summon_land_monster(y,x,false); X`09`09`09 check_mon_lite(y,x); X`09`09`09end; X`7BSummon Undead`7D 15 : begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'magically summons an undead!'; X`09`09`09 msg_print(cdesc); X`09`09`09 y := char_row; X`09`09`09 x := char_col; X`09`09`09 summon_undead(y,x); X`09`09`09 check_mon_lite(y,x); X`09`09`09end; X`7BSlow Person `7D 16 : with py.flags do X`09`09`09 begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (free_act or (free_time>0)) then X`09`09`09 msg_print('You are unaffected...') X`09`09`09 else if (player_spell_saves) then X`09`09`09 msg_print('You resist the affects of the spell.') X`09`09`09 else if (slow > 0) then X`09`09`09 slow := slow + 2 X`09`09`09 else X`09`09`09 slow := randint(5) + 3; X`09`09`09 end; X`7BDrain Mana `7D 17 : if (trunc(py.misc.cmana) > 0) then X`09`09`09 begin X`09`09`09 stop_player := true; X`09`09`09 outval := cdesc+'draws psychic energy from you!'; X`09`09`09 msg_print(outval); X`09`09`09 outval := cdesc+'appears healthier...'; X`09`09`09 msg_print(outval); X`09`09`09 r1 := ( randint(level) div 2 ) + 1; X`09`09`09 if (r1 > py.misc.cmana) then r1 := py.misc.cmana; X`09`09`09 py.misc.cmana := py.misc.cmana - r1; X`09`09`09 hp := hp + 6*trunc(r1); X`09`09`09 end; X`7BBreath Evil `7D 18 : begin X `09`09`09 stop_player := true; X if index(cdesc,'High Priest')<>0`20 X then cdesc := cdesc + 'throws a cloud of black vapors at you!' X else cdesc := cdesc + 'breathes black vapors around you!'; X`09`09`09 msg_print(cdesc); X`09`09`09 i1 := (py.misc.exp div 100)*mon$drain_life; X`09`09`09 breath(7,char_row,char_col,1,ddesc); X end; X`7BBreath Petrify `7D19:`09begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'breathes petrifying gas at you!'; X`09`09`09 msg_print(cdesc); X`09`09`09 breath(9,char_row,char_col,1,ddesc); X`09`09`09end; X`7BBreath Light `7D 20 : begin X`09`09`09 stop_player := true; X`09`09`09 if (index(cdesc,'Druid') <> 0) or X`09`09`09 (index(cdesc,'Titan') <> 0) then X`09`09`09 cdesc := cdesc + 'casts a spell.' X`09`09`09 else X`09`09`09 cdesc := cdesc + 'breathes lightning.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (index(cdesc,'Druid') <> 0) or X`09`09`09 (index(cdesc,'Titan') <> 0) then X`09`09`09 breath(1,char_row,char_col,32,ddesc) X`09`09`09 else X`09`09`09 breath(1,char_row,char_col,trunc(hp/4.0),ddesc); X`09`09`09end; X`7BBreath Gas `7D 21 : begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'breathes gas.'; X`09`09`09 msg_print(cdesc); X`09`09`09 breath(2,char_row,char_col,trunc(hp/3.0),ddesc); X`09`09`09end; X`7BBreath Acid `7D 22 : begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'breathes acid.'; X`09`09`09 msg_print(cdesc); X`09`09`09 breath(3,char_row,char_col,trunc(hp/3.0),ddesc); X`09`09`09end; X`7BBreath Frost `7D 23 : begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'breathes frost.'; X`09`09`09 msg_print(cdesc); X`09`09`09 breath(4,char_row,char_col,trunc(hp/3.0),ddesc); X`09`09`09end; X`7BBreath Fire `7D 24 : begin X`09`09`09 stop_player := true; X`09`09`09 if (index(cdesc,'Heirophant Druid') <> 0) then X`09`09`09 cdesc := cdesc + 'casts a spell.' X`09`09`09 else X`09`09`09 cdesc := cdesc + 'breathes fire.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (index(cdesc,'Heirophant Druid') <> 0) then X`09`09`09 breath(5,char_row,char_col,48,ddesc) X`09`09`09 else X`09`09`09 breath(5,char_row,char_col,trunc(hp/3.0),ddesc); X`09`09`09end; X`7BCast Illusion `7D25 :`09begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'casts a spell.'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_spell_saves) then X`09`09`09 msg_print('You resist the affects of the spell.') X`09`09`09 else if (py.flags.image > 0) then X`09`09`09 py.flags.image := py.flags.image + 2 X`09`09`09 else X`09`09`09 py.flags.image := randint(20) + 10; X`09`09`09end;`09`09`09 `20 X `7BSummon Demon`7D`0926 :`09begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'magically summons a demon!'; X`09`09`09 msg_print(cdesc); X`09`09`09 y := char_row; X`09`09`09 x := char_col; X`09`09`09 summon_demon(y,x); X`09`09`09 check_mon_lite(y,x); X`09`09`09end; X`7BSummon Breed `7D 27 : begin X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'magically summons a monster!'; X`09`09`09 msg_print(cdesc); X`09`09`09 y := char_row; X`09`09`09 x := char_col; X`09`09`09 summon_breed(y,x); X`09`09`09 check_mon_lite(y,x); X`09`09`09end; X`7BStoning Gaze`7D`0928 :`09begin `20 X`09`09`09 stop_player := true; X`09`09`09 cdesc := cdesc + 'gazes at you!'; X`09`09`09 msg_print(cdesc); X`09`09`09 if (player_spell_saves) then X`09`09`09 msg_print('You resist the affects!') X`09`09`09 else petrify(hp); X`09`09`09end; X`09`09otherwise begin X`09`09`09 stop_player := true; X`09`09`09 msg_print('Creature cast unknown spell.'); X`09`09`09 cdesc := ''; X`09`09`09 end; X`09`09 end; X`09`09`7B End of spells `7D X`09`09`7B Stop player if in find mode`09-DCJ/KRC-`09`7D X`09`09 if (find_flag and stop_player) then X`09`09`09begin X`09`09`09 find_flag := false; X`09`09`09 move_char(5); X`09`09`09end; X`09`09 end; X`09`09end; X`09 end; X X X`09`7B Main procedure for monster movement (MON_MOVE)`09-RAK-`09`7D X`09begin X`09 mon_move := false; X`09 with c_list`5Bm_list`5Bmonptr`5D.mptr`5D do X`09 begin X`09`09`7B Does the creature regenerate?`09`09`09`09`7D X`09 if (uand(cdefense,%X'8000') <> 0) then X`09`09m_list`5Bmonptr`5D.hp := m_list`5Bmonptr`5D.hp + randint(4); X`09 if (m_list`5Bmonptr`5D.hp > max_hp(hd) ) then X`09`09m_list`5Bmonptr`5D.hp := max_hp(hd); +-+-+-+-+-+-+-+- END OF PART 11 +-+-+-+-+-+-+-+-