-+-+-+-+-+-+-+-+ START OF PART 17 -+-+-+-+-+-+-+-+ X most_damage := plr`5Bnow`5D.target`5Bi`5D.damage; X slot := i; X find_enemy := true; X end; X find_enemy := (most_damage <> 0); Xend; X X`5Basynchronous`5D Xfunction bump_someone(x,y,dir:integer):boolean; Xvar X i,log,slot:integer; Xbegin X bump_someone := false; X log := people_map`5Bx,y`5D; X if log <> 0 then X if human then X begin X if not pl`5Bnow`5D.sts`5Bps_dead`5D.on and X person`5Blog`5D.alive and X person`5Blog`5D.here and X (pl`5Bnow`5D.attrib_ex`5Bst_base`5D = person`5Blog`5D.feet) then X begin X bump_someone := true; X wl('You bump into '+name`5Bna_player`5D.id`5Blog`5D+'.'); X act_out(plr`5Bnow`5D.log,e_bump,x,y,bell(pl`5Bnow`5D.attrib`5Bat_size` V5D,2),dir); X if not indx`5Bi_npc`5D.on`5Blog`5D then X freeze(0.1 + pl`5Bnow`5D.attrib`5Bat_mv_delay`5D / 100); X end; X end X else X if person`5Blog`5D.alive and person`5Blog`5D.here and X (pl`5Bnow`5D.attrib_ex`5Bst_base`5D = person`5Blog`5D.feet) then X begin X bump_someone := true; X if find_enemy(slot) then X if slot = plr`5Bnow`5D.target`5Bslot`5D.log then X begin X act_out(plr`5Bnow`5D.log,e_bump,x,y,bell(pl`5Bnow`5D.attrib`5Bat_size` V5D,2),dir); X freeze(0.1 + pl`5Bnow`5D.attrib`5Bat_mv_delay`5D / 100); X end; X end; Xend; X X`5Basynchronous`5D Xfunction step_up(x,y:integer; max_step:integer := -1; X`09`09step_minimum,do_act:boolean := false):boolean; Xvar X i:integer := 1; X difference,mask:integer; X ok:boolean := false; Xbegin X`7BIf you can climb here and walkthrough, it'll climb up max_step or max_alt Vitude X if you can't walkthrough, you have to be able to get to the top`7D X if max_step = -1 then max_step := pl`5Bnow`5D.attrib`5Bat_size`5D * 2; X while (not ok) and (i <= fg_layers) do X if fg.map`5Bx,y,i`5D <> 0 then X if fg.effect`5Bfg.map`5Bx,y,i`5D`5D.on then X with fg.effect`5Bfg.map`5Bx,y,i`5D`5D do X begin X difference := base + altitude - pl`5Bnow`5D.attrib_ex`5Bst_base`5D; X if walk_through then X begin X`09if step_minimum and (base > pl`5Bnow`5D.attrib_ex`5Bst_base`5D) then X`09difference := base - pl`5Bnow`5D.attrib_ex`5Bst_base`5D X`09else difference := min(difference,max_step); X end; X if (difference >= 1) and (difference <= max_step) and climb then X begin X if not brief then X`09if pl`5Bnow`5D.attrib`5Bat_size`5D = 0 then wl('How did you manage that?' V) X`09else X`09case (100 * difference) div pl`5Bnow`5D.attrib`5Bat_size`5D of X`09 0..20:wl('You casually step up.'); X`09 21..50:wl('You step up.'); X`09 51..100:wl('You jump up.'); X`09101..200:wl('You climb up.'); X`09 otherwise wl('You fly into the air.'); X`09end; X ok := true; X change_stat_ex(st_base,pl`5Bnow`5D.attrib_ex`5Bst_base`5D + difference V); X mask := do_mask(not pl`5Bnow`5D.sts`5Bps_dead`5D.on,m_alive,human,m_hu Vman, X pl`5Bnow`5D.sts`5Bps_invisible`5D.on,m_invisible); X if not pl`5Bnow`5D.sts`5Bps_invisible`5D.on then X act_out(plr`5Bnow`5D.log,e_move,pl`5Bnow`5D.where.x,pl`5Bnow`5D.where. Vy, X pl`5Bnow`5D.attrib_ex`5Bst_base`5D,pl`5Bnow`5D.attrib`5Bat_size`5D,,ma Vsk); X end X else i := i + 1; X end X else i := i + 1 X else i := i + 1; X step_up := ok; Xend; X X`5Basynchronous`5D Xprocedure do_fall(x,y:integer); Xvar X old_height,slot,map_type:integer; Xbegin X old_height := pl`5Bnow`5D.attrib_ex`5Bst_base`5D; X change_stat_ex(st_base,highest_priority(x,y,pl`5Bnow`5D.attrib_ex`5Bst_bas Ve`5D,slot,map_type)); X if pl`5Bnow`5D.attrib_ex`5Bst_base`5D < old_height then X case (100 * (old_height - pl`5Bnow`5D.attrib_ex`5Bst_base`5D)) div (pl`5Bn Vow`5D.attrib`5Bat_size`5D + 1) of X0..9:; X10..30: Xbegin X if not brief then wl('You step down.'); X act_out(plr`5Bnow`5D.log,e_msg,,,pl`5Bnow`5D.attrib`5Bat_noise`5D,,,,name` V5Bna_player`5D.id`5Bplr`5Bnow`5D.log`5D+' steps down.'); Xend; X31..100: Xbegin X if not brief then wl('You jump down.'); X act_out(plr`5Bnow`5D.log,e_msg,,,pl`5Bnow`5D.attrib`5Bat_noise`5D,,,,name` V5Bna_player`5D.id`5Bplr`5Bnow`5D.log`5D+' makes a '+adverb+' jump down.'); Xend; X101..200: Xbegin X if not brief then wl('You crash down.'); X act_out(plr`5Bnow`5D.log,e_msg,,,pl`5Bnow`5D.attrib`5Bat_noise`5D,,,,name` V5Bna_player`5D.id`5Bplr`5Bnow`5D.log`5D+' crashes down with a '+adverb+' noi Vse.'); Xend; X201..300: Xbegin X if not brief then wl('You plummet to the ground.'); X act_out(plr`5Bnow`5D.log,e_msg,,,pl`5Bnow`5D.attrib`5Bat_noise`5D,,,,name` V5Bna_player`5D.id`5Bplr`5Bnow`5D.log`5D+' plummets down with a '+adverb+' no Vise.'); Xend; Xotherwise Xbegin X if not brief then wl('Gravity rips your hapless body out of the air.'); X act_out(plr`5Bnow`5D.log,e_msg,,,pl`5Bnow`5D.attrib`5Bat_noise`5D,,,,name` V5Bna_player`5D.id`5Bplr`5Bnow`5D.log`5D+' makes a '+adverb+' dent in the gro Vund.'); Xend; X X end; Xend; X X`5Basynchronous`5D Xfunction bump_foreground(x,y:integer):boolean; Xvar X i:integer; X ok,blocked:boolean := false; Xbegin X for i := 1 to fg_layers do X if fg.map`5Bx,y,i`5D <> 0 then X if fg.effect`5Bfg.map`5Bx,y,i`5D`5D.on then X with fg.effect`5Bfg.map`5Bx,y,i`5D`5D do X begin X if`09((pl`5Bnow`5D.attrib_ex`5Bst_base`5D >= base) and X`09(pl`5Bnow`5D.attrib_ex`5Bst_base`5D <= base+altitude) and X`09(not walk_through)) or (( pl`5Bnow`5D.sts`5Bps_dead`5D.on) and (kind = fg V_nodead)) X`09then blocked := true; X if`09((pl`5Bnow`5D.attrib_ex`5Bst_base`5D = base + altitude) and walk_on V) or X`09((pl`5Bnow`5D.attrib_ex`5Bst_base`5D = base) and walk_through) or X`09((pl`5Bnow`5D.attrib_ex`5Bst_base`5D >= base) and (pl`5Bnow`5D.attrib_ex` V5Bst_base`5D <= X`09base + altitude) and climb and walk_through) then ok := true; X end; X X if (not ok) or blocked then ok := step_up(x,y,,true); X if (not ok) and (not blocked) then X begin X do_fall(x,y); X ok := true; X end; X if (not brief) and blocked and (not ok) then wl('Blocked!'); X bump_foreground := (not ok) and (not checkprivs(2)); Xend; X X`5Basynchronous`5D Xfunction can_move(x,y,dir:integer; move_delay:boolean := true):boolean; Xbegin X if (x < 1) or (y < 1) or (x > here.size.x) or (y > here.size.y) then X`09can_move := false X else if (bump_background(x,y,move_delay) and not pl`5Bnow`5D.sts`5Bps_dead V`5D.on) or X`09bump_someone(x,y,dir) then can_move := false X else if bump_foreground(x,y) then can_move := false X else can_move := true; Xend; X X`5Basynchronous`5D Xprocedure new_coords(old_x,old_y:integer; var tempx,tempy:integer; dir:integ Ver); Xbegin X tempx := old_x; X tempy := old_y; X if dir in `5B1,4,7`5D then tempx := old_x - 1; X if dir in `5B7,8,9`5D then tempy := old_y - 1; X if dir in `5B3,6,9`5D then tempx := old_x + 1; X if dir in `5B1,2,3`5D then tempy := old_y + 1; Xend; X X`5Basynchronous`5D Xprocedure do_die(theirlog:integer); Xvar X i:integer; Xbegin X wl('You''re dead.'); X pl`5Bnow`5D.sts`5Bps_dead`5D.on := true; X pl`5Bnow`5D.sts`5Bps_dead`5D.time := getticks + bell(3600,2); X X scatter_objects; X drop_gold(pl`5Bnow`5D.attrib`5Bat_wealth`5D,false); X pl`5Bnow`5D.attrib_ex`5Bst_killed`5D := pl`5Bnow`5D.attrib_ex`5Bst_killed` V5D + 1; X act_out(plr`5Bnow`5D.log,e_died,theirlog,pl`5Bnow`5D.attrib_ex`5Bst_experi Vence`5D, X pl`5Bnow`5D.attrib_max`5Bat_points`5D,pl`5Bnow`5D.attrib_ex`5Bst_kills`5 VD, X pl`5Bnow`5D.attrib_ex`5Bst_killed`5D,,'weapon',name`5Bna_player`5D.id`5B Vplr`5Bnow`5D.log`5D); X getplayer(plr`5Bnow`5D.log); X hack_stats; X with pl`5Bnow`5D do X begin X attrib_max`5Bat_points`5D`09:= 0; X attrib_max`5Bat_size`5D`09`09:= 0; X attrib_max`5Bat_health`5D`09:= attrib_max`5Bat_health`5D div 2; X attrib_max`5Bat_mana`5D`09`09:= attrib_max`5Bat_mana`5D div 2; X attrib_max`5Bat_mv_delay`5D`09:= attrib_max`5Bat_mv_delay`5D div 2; X attrib_max`5Bat_heal_speed`5D`09:= attrib_max`5Bat_heal_speed`5D div 2; X attrib_max`5Bat_mana_speed`5D`09:= attrib_max`5Bat_mana_speed`5D div 2; X attrib_max`5Bat_noise`5D`09:= attrib_max`5Bat_noise`5D div 2; X attrib_max`5Bat_perception`5D`09:= attrib_max`5Bat_perception`5D div 2; X for i := 1 to el_max do X pl`5Bnow`5D.proficiency`5Bi`5D := pl`5Bnow`5D.proficiency`5Bi`5D div 2; X for i := 1 to indx`5Bi_spell`5D.top do X if rnum(3) = 1 then pl`5Bnow`5D.spell`5Bi`5D := false; X end; X player := pl`5Bnow`5D; X putplayer; X if plr`5Bnow`5D.npc then dispossess_someone X else stats; X if window_name = name`5Bna_player`5D.id`5Bplr`5Bnow`5D.log`5D then show_st Vats; X plr`5Bnow`5D.awake := getticks; Xend; X X`5Basynchronous`5D Xfunction modify_hit(p1,p2:integer; attack_type:integer):integer; Xvar X damage:integer; Xbegin X damage := bell(p1,p2); X modify_hit := damage; X if (attack_type <> 0) and (p1 > 0) then X if rnd100 < plr`5Bnow`5D.armor`5Battack_type`5D.chance then X modify_hit := damage * (100 - plr`5Bnow`5D.armor`5Battack_type`5D.magnitud Ve) div 100; Xend; X X`5Basynchronous`5D Xprocedure get_attack(sendlog,x,y,p1,p2,attack_type:integer; X`09`09`09weaponname:string); Xvar X damage:integer; Xbegin X if not pl`5Bnow`5D.sts`5Bps_dead`5D.on then X begin X damage := modify_hit(p1,p2,attack_type); X if sendlog <> 0 then X begin X lasthitstring := name`5Bna_player`5D.id`5Bsendlog`5D+'''s '+weaponname V; X wr(lasthitstring+' ',not brief); X case damage of X-maxint div 2..0:wl('heals you nicely.',not brief); X 1..10:wl('barely hits you.',not brief); X 11..20:wl('hits you good.',not brief); X 21..50:wl('bonks you hard.',not brief); X 51..100:wl('pummels you severly.',not brief); X 101..200:wl('creams your poor little body!',not brief); X otherwise wl('bashes you into who-hash!',not brief); X end; X end X else lasthitstring := weaponname; X change_stat(at_health,pl`5Bnow`5D.attrib`5Bat_health`5D - damage); X if pl`5Bnow`5D.attrib`5Bat_health`5D < 0 then do_die(sendlog); X end; Xend; X X`5Basynchronous`5D Xprocedure add_event(theevent:actrec; duration:integer); Xvar X i:integer := 1; X found:boolean := false; Xbegin X while (i <= event_max) and (not found) do X if event`5Bi`5D.action = 0 then X begin X event`5Bi`5D := theevent; X event_time`5Bi`5D := getticks + (duration * 10); X found := true; X end X else i := i + 1; Xend; `20 X X`5Basynchronous`5D Xprocedure poof_prime(toroom:loc); Xvar X sameroom:boolean; Xbegin X sameroom := (pl`5Bnow`5D.where.r = toroom.r); `20 X if not sameroom then leave_room X else fix_scenery(pl`5Bnow`5D.where.x,pl`5Bnow`5D.where.y); X enter_room(toroom,,,sameroom); Xend; X X`5Basynchronous`5D Xprocedure get_bump(theirlog,force,dir:integer; sendname,weaponname:string); Xbegin X change_stat(at_health,pl`5Bnow`5D.attrib`5Bat_health`5D - force); X remember_attack(theirlog,force); X wr(sendname+' '); X case force of X 0..3:wl('bumps into you.'); X 4..9:wl('runs you over.'); X10..20:wl('bashes you severly.'); Xotherwise wl('pummels you into the ground.'); X end;`20 X if (force div 2) + rnum(force) > pl`5Bnow`5D.attrib`5Bat_size`5D then do_g Vo(dir,false); X if pl`5Bnow`5D.attrib`5Bat_health`5D < 0 then do_die(theirlog); Xend; X X`5Basynchronous`5D Xprocedure handle_spell(an_act:actrec); Xvar X duration,damage,x,y,geometry,geo1,geo2,moron,fg_slot, X p1,p2,p3,p4,rend,sp_effect,sp_element:integer; X a_loc:loc; X X procedure add_foreground; X begin X g_plot(geometry,x,y,geo1,geo2,0,10,an_act.msg`5B1`5D,rend); X fg_slot := empty_foreground; X fg.name`5Bfg_slot`5D := 'x'; X with fg.effect`5Bfg_slot`5D do X begin X icon := an_act.msg`5B1`5D; X rendition := rend; X base := 0; X altitude := 10; X case sp_effect of Xsp_hurt:begin X`09 kind := fg_hurt; X`09 fparm2 := p1; X`09 fparm3 := p2; X`09end; X end; X fparm1 := sp_element; X on := true; X walk_through := true; X walk_on := false; X climb := false; X end; X map_foreground(fg_slot,geometry,x,y,geo1,geo2,true); X an_act.parm4 := fg_slot; X add_event(an_act,duration); X end; X Xbegin X with an_act do X begin X decompress(parm4,duration,rend,moron); X decompress(xloc,x,y,moron); X decompress(yloc,geometry,geo1,geo2); X decompress(parm1,sp_effect,sp_element,moron); X decompress(parm2,p1,p2,moron); X decompress(parm3,p3,p4,moron); X if duration > 0 then add_foreground X else special_effect(geometry,geo1,geo2,person`5Bsender`5D.loc.x, X person`5Bsender`5D.loc.y,x,y,msg`5B1`5D,rend); X if hit_me(geometry,geo1,geo2,x,y) then X begin X case sp_effect of Xsp_hurt:get_attack(sender,x,y,p1,p2,sp_element,note); Xsp_invisible: X begin X`09 if not pl`5Bnow`5D.sts`5Bps_invisible`5D.on then X`09 begin X`09 pl`5Bnow`5D.sts`5Bps_invisible`5D.on := true; X`09 pl`5Bnow`5D.sts`5Bps_invisible`5D.time := getticks; X end; X`09 pl`5Bnow`5D.sts`5Bps_invisible`5D.time := X`09 pl`5Bnow`5D.sts`5Bps_invisible`5D.time + 10 * bell(p1,p2); X`09 act_out(plr`5Bnow`5D.log,e_disappear); X end; Xsp_freeze: X`09begin X`09 damage := modify_hit(p1,p2,sp_element); X`09 freeze(damage); X`09 wl('You have been frozen!'); X`09end; Xsp_teleport: X`09begin X`09 a_loc.r := here.valid; X`09 moron := 0; X`09 with a_loc do X`09 repeat X`09 moron := moron + 1; X`09 repeat X`09 x := pl`5Bnow`5D.where.x + 2 * rnum(p1) - p1; X`09 y := pl`5Bnow`5D.where.y + 2 * rnum(p1) - p1; X`09 until good_coordinates(x,y); X`09 until not foreground_found(x,y,pl`5Bnow`5D.attrib_ex`5Bst_base`5D, X`09`09pl`5Bnow`5D.attrib_ex`5Bst_base`5D + pl`5Bnow`5D.attrib`5Bat_size`5D, X`09`09fg_no_teleport,fg_slot) or (moron = 1000); X`09 if good_coordinates(x,y) and (moron < 1000) then poof_prime(a_loc); X`09end; X end; X remember_attack(sender,damage); X end; X end; Xend; X X`5Basynchronous`5D Xprocedure do_view(short_range:boolean := false); Xvar X head_alt:integer; Xbegin X`7B if checkprivs(2,false) then X begin X grab_num('Enter "head" altitude ',head_alt,,,pl`5Bnow`5D.attrib`5Bat_siz Ve`5D); X myview := head_alt - pl`5Bnow`5D.attrib_ex`5Bst_base`5D; X end X`7D X if myview <> 99 then myview := 99 X else myview := pl`5Bnow`5D.attrib`5Bat_size`5D; X if (not brief) and (not short_range) then wl('View toggled.'); +-+-+-+-+-+-+-+- END OF PART 17 +-+-+-+-+-+-+-+-