-+-+-+-+-+-+-+-+ START OF PART 22 -+-+-+-+-+-+-+-+
X`09`09if py.misc.wt > max_allowable_weight then
X`09`09  begin
X`09`09    msg_print ( 'Oh no...  Now you''ve done it.' ) ;
X`09`09    death := true ;
X`09`09    moria_flag := true ;
X`09`09    total_winner := false ;
X`09`09    died_from := 'gluttony.'
X`09`09  end
X`09`09else
X`09`09  begin
X`09`09    case randint(3) of
X`09`09`091 : msg_print ( 'Buuurrrppppp !' ) ;
X`09`09`092 : msg_print ( 'Remember, obesity kills.' ) ;
X`09`09`093 : msg_print ( 'Your armor doesn''t seem to fit too well anymore.'
V ) ;
X`09`09    end ;`09
X`09`09  end ;`09
X`09      end;
X`09  end;
X      end;
X
X
X`09`7B Describe number of remaining charges...`09`09-RAK-`09`7D
X    procedure desc_charges(item_ptr : treas_ptr);
X      var
X`09rem_num                 : integer;
X`09out_val                 : vtype;
X      begin
X`09if (index(item_ptr`5E.data.name,'`5E') = 0) then
X`09  begin
X`09    rem_num := item_ptr`5E.data.p1;
X`09    writev(out_val,'You have ',rem_num:1,' charges remaining.');
X`09    msg_print(out_val);
X`09  end;
X      end;
X
X
X`09`7B Describe amount of item remaining...`09`09`09-RAK-`09`7D
X    procedure desc_remain(item_ptr : treas_ptr);
X      var
X`09out_val                 : vtype;
X
X      begin
X`09inven_temp`5E.data := item_ptr`5E.data;
X`09with inven_temp`5E.data do
X`09  number := number - 1;
X`09objdes(out_val,inven_temp,true);
X`09out_val := 'You have ' + out_val + '.';
X`09msg_print(out_val);
X      end;
X
X
X`09`7B Throw an object across the dungeon... `09`09-RAK-`09`7D
X`09`7B Note: Flasks of oil do fire damage                            `7D
X`09`7B Note: Extra damage and chance of hitting when missles are used`7D
X`09`7B       with correct weapon.  I.E.  wield bow and throw arrow.  `7D
X    procedure throw_object(to_be_fired : boolean);
X      var
X`09item_val,tbth,tpth,tdam,tdis,crit_mult`09: integer;
X`09y_dumy,x_dumy,dumy`09                : integer;
X`09y,x,oldy,oldx,dir,cur_dis,count         : integer;
X`09redraw,flag`09`09`09        : boolean;
X`09out_val, m_name`09`09`09`09: vtype;
X`09item_ptr,i7`09`09`09`09: treas_ptr;
X
X      procedure inven_throw(item_ptr : treas_ptr);
X`09begin
X`09  inven_temp`5E.data := item_ptr`5E.data;
X`09  inven_temp`5E.data.number := 1;
X`09  with item_ptr`5E.data do
X`09    begin
X`09      if ((number > 1) and (subval > 511)) then
X`09`09begin
X`09`09  number := number - 1;
X`09`09  inven_weight := inven_weight - weight;
X`09`09end
X`09      else
X`09`09inven_destroy(item_ptr);
X`09    end;
X`09    prt_weight;
X`09end;
X
X
X      function poink : obj_set;
X        begin
X`09  with equipment`5Bequipment_primary`5D do
X`09    if (tval = bow_crossbow_or_sling) then
X`09      case p1 of
X`09`091 : poink := `5Bsling_ammo`5D;
X`09        2,3,4 : poink := `5Barrow`5D;
X`09        5,6 : poink := `5Bbolt`5D
X`09      end
X`09    else
X`09      poink := `5B`5D
X`09end;
X
X      procedure facts(var tbth,tpth,tdam,tdis : integer);
X`09var
X`09`09tmp_weight                      : integer;
X`09begin
X`09  with inven_temp`5E.data do
X`09    begin
X`09      if (weight < 1) then
X`09`09tmp_weight := 1
X`09      else
X`09`09tmp_weight := weight;
X`09`09`7B Throwing objects`09`09`09`7D
X`09      tdam := damroll(damage) + todam;
X`09      tbth := trunc(py.misc.bthb*0.75);
X`09      tpth := py.misc.ptohit  + tohit;
X`09      tdis := trunc((py.stat.c`5Bsr`5D+100)*200/tmp_weight);
X`09      if (tdis > 10) then tdis := 10;
X`09`09`7B Using Bows, slings, or crossbows`09`7D
X`09      if (to_be_fired) then`09`7B checks for correct wpn in poink `7D
X`09`09begin
X`09`09 case equipment`5BEquipment_primary`5D.p1 of
X`09`09  1 : `09begin       `7B Sling and Bullet  `7D
X`09`09`09  tdam := tdam + 2;
X`09`09`09  tdis := 20;
X`09`09`09end;
X`09`09  2 :   begin       `7B Short Bow and Arrow    `7D
X`09`09`09  tdam := tdam + 2;
X`09`09`09  tdis := 25;
X`09`09`09end;
X`09`09  3 :   begin       `7B Long Bow and Arrow     `7D
X`09`09`09  tdam := tdam + 3;
X`09`09`09  tdis := 30;
X`09`09`09end;
X`09`09  4 :   begin       `7B Composite Bow and Arrow`7D
X`09`09`09  tdam := tdam + 4;
X`09`09`09  tdis := 35;
X`09`09`09end;
X`09`09  5 :   begin       `7B Light Crossbow and Bolt`7D
X`09`09`09  tdam := tdam + 2;
X`09`09`09  tdis := 25;
X`09`09`09end;
X`09`09  6 :   begin       `7B Heavy Crossbow and Bolt`7D
X`09`09`09  tdam := tdam + 4;
X`09`09`09  tdis := 35;
X`09`09`09end;
X`09`09 end;
X`09`09 tbth := py.misc.bthb;
X`09`09 tpth := tpth + equipment`5BEquipment_primary`5D.tohit;
X`09`09 weight := weight + equipment`5BEquipment_primary`5D.weight + 5000;
X`09`09end;
X`09    end;
X`09end;
X
X      procedure drop_throw(y,x : integer);
X`09var
X`09`09i1,i2,i3,cur_pos                : integer;
X`09`09flag                            : boolean;
X`09`09out_val                         : vtype;
X`09begin
X`09  flag := false;
X`09  i1 := y;
X`09  i2 := x;
X`09  i3 := 0;
X`09  if (randint(10) > 1) then
X`09    repeat
X`09      if (in_bounds(i1,i2)) then
X`09`09with cave`5Bi1,i2`5D do
X`09`09  if (fopen) then
X`09`09    if (tptr = 0) then
X`09`09      flag := true;
X`09      if (not(flag)) then
X`09`09begin
X`09`09  i1 := y + randint(3) - 2;
X`09`09  i2 := x + randint(3) - 2;
X`09`09  i3 := i3 + 1;
X`09`09end;
X`09    until((flag) or (i3 > 9));
X`09  if (flag) then
X`09    begin
X`09      popt(cur_pos);
X`09      cave`5Bi1,i2`5D.tptr := cur_pos;
X`09      t_list`5Bcur_pos`5D := inven_temp`5E.data;
X`09      if (test_light(i1,i2)) then
X`09`09lite_spot(i1,i2);
X`09    end
X`09  else
X`09    begin
X`09      objdes(out_val,inven_temp,false);
X`09      msg_print('The ' + out_val + ' disappears.');
X`09    end;
X`09end;
X
X      begin
X`09redraw := false;
X        if to_be_fired then
X`09  find_range(poink,false,i7,count)
X        else
X`09  begin
X`09    count := change_all_ok_stats(true,false);
X`09    item_ptr := inventory_list;
X`09    while (item_ptr <> nil) do
X`09      begin
X`09        if (uand(item_ptr`5E.data.flags2,holding_bit) <> 0) and
X`09          (item_ptr`5E.insides > 0) then
X`09        count := count - 1;
X`09        item_ptr := item_ptr`5E.next;
X`09      end;
X`09  end;
X`09reset_flag := true;
X`09if to_be_fired then
X`09  writev(out_val,'Fire which one?')
X`09else
X`09  writev(out_val,'Hurl which item?');
X`09if (count = 0) then
X`09  if to_be_fired then
X`09    msg_print('You have nothing to fire!')
X`09  else
X`09    msg_print('But you have nothing to throw.')
X`09else
X`09 if (get_item(item_ptr,out_val,redraw,count,trash_char,false)) then
X`09   begin
X`09    if (redraw) then
X`09      draw_cave;
X`09    y_dumy := char_row;
X`09    x_dumy := char_col;
X`09    if (get_dir('Which direction?',dir,dumy,y_dumy,x_dumy)) then
X`09      begin
X`09`09reset_flag := false;
X`09`09desc_remain(item_ptr);
X`09`09if (py.flags.confused > 0) then
X`09`09  begin
X`09`09    msg_print('You are confused...');
X`09`09    repeat
X`09`09      dir := randint(9);
X`09`09    until(dir <> 5);
X`09`09  end;
X`09`09inven_throw(item_ptr);
X`09`09facts(tbth,tpth,tdam,tdis);
X`09`09with inven_temp`5E.data do
X`09`09  begin
X`09`09    flag := false;
X`09`09    y := char_row;
X`09`09    x := char_col;
X`09`09    oldy := char_row;
X`09`09    oldx := char_col;
X`09`09    cur_dis := 0;
X`09`09    repeat
X`09`09      move(dir,y,x);
X`09`09      cur_dis := cur_dis + 1;
X`09`09      if (test_light(oldy,oldx)) then
X`09`09`09lite_spot(oldy,oldx);
X`09`09      if (cur_dis > tdis) then flag := true;
X`09`09      with cave`5By,x`5D do
X`09`09`09begin
X`09`09`09  if ((fopen) and (not(flag))) then
X`09`09`09    begin
X`09`09`09      if (cptr > 1) then
X`09`09`09`09begin
X`09`09`09`09  flag := true;
X`09`09`09`09  with m_list`5Bcptr`5D do
X`09`09`09`09    begin
X`09`09`09`09      tbth := tbth - cur_dis;
X`09`09`09`09      if (player_test_hit(tbth,py.misc.lev,tpth,c_list`5Bmptr`5D
V.ac,to_be_fired)) then
X`09`09`09`09`09begin
X`09`09`09`09`09  i1 := mptr;
X`09`09`09`09`09  objdes(out_val,inven_temp,false);
X`09find_monster_name ( m_name, cptr, false ) ;
X`09msg_print('The ' + out_val + ' hits ' + m_name + '.');
X`09tdam := tot_dam(inven_temp`5E.data,tdam,c_list`5Bi1`5D);
X`09with inven_temp`5E.data do
X`09  begin
X`09    crit_mult := critical_blow(weight,tpth,(uand(equipment`5Bequipment_pr
Vimary`5D.flags2,sharp_worn_bit) <> 0),to_be_fired);
X`09    tdam := tdam + (5 + tdam) * crit_mult
X`09  end;
X`09if ( mon_take_hit(cptr,tdam) > 0) then
X`09  msg_print('You have killed ' + m_name + '.');
X`09`09`09`09`09end
X`09`09`09`09      else
X`09`09`09`09`09drop_throw(oldy,oldx);
X`09`09`09`09    end;
X`09`09`09`09end
X`09`09`09      else
X`09`09`09`09begin
X`09`09`09`09  if (panel_contains(y,x)) then
X`09`09`09`09    if (test_light(y,x)) then
X`09`09`09`09      print(tchar,y,x);
X`09`09`09`09end;
X`09`09`09    end
X`09`09`09  else
X`09`09`09    begin
X`09`09`09      flag := true;
X`09`09`09      drop_throw(oldy,oldx);
X`09`09`09    end;
X`09`09`09end;
X`09`09      oldy := y;
X`09`09      oldx := x;
X`09`09    until (flag);
X`09`09  end;
X`09      end
X`09    end
X`09  else
X`09      if (redraw) then draw_cave;
X      end;
X
X
X`09`7B Bash open a door or chest`09`09`09`09-RAK-`09`7D
X`09`7B Note: Affected by strength and weight of character            `7D
X    procedure bash;
X      var
X`09y,x,tmp                                 : integer;
X`09old_ptodam,old_ptohit,old_bth           : integer;
X`09m_name`09`09`09`09`09: vtype ;
X      begin
X`09y := char_row;
X`09x := char_col;
X`09if (get_dir('Which direction?',tmp,tmp,y,x)) then
X`09  begin
X`09    with cave`5By,x`5D do
X`09      if (cptr > 1) then
X`09`09begin
X`09`09  if (py.flags.afraid > 0) then
X`09`09    msg_print('You are afraid!')
X`09`09  else
X`09`09    begin
X`09`09`09`7B Save old values of attacking  `7D
X`09`09      inven_temp`5E.data := equipment`5BEquipment_primary`5D;
X`09`09      old_ptohit := py.misc.ptohit;
X`09`09      old_ptodam := py.misc.ptodam;
X`09`09      old_bth    := py.misc.bth;
X`09`09`09`7B Use these values              `7D
X`09`09      equipment`5BEquipment_primary`5D := blank_treasure;
X`09`09      with equipment`5BEquipment_primary`5D do
X`09`09`09begin
X`09`09`09  damage := equipment`5BEquipment_shield`5D.damage;
X`09`09`09  weight := (py.stat.c`5Bsr`5D + 20) * 100;
X`09`09`09  tval   := 1;
X`09`09`09end;
X`09`09      with py do
X`09`09`09begin
X`09`09`09  misc.bth    := trunc(((stat.c`5Bsr`5D+20) div 5+misc.wt)/6.0);
X`09`09`09  misc.ptohit := 0;
X`09`09`09  misc.ptodam := trunc(misc.wt/75.0) + 1;
X`09`09`09end;
X`09`09      if (py_attack(y,x)) then
X`09`09`09do_stun(cptr,-10,2);
X`09`09`09`7B Restore old values            `7D
X`09`09      equipment`5BEquipment_primary`5D := inven_temp`5E.data;
X`09`09      py.misc.ptohit := old_ptohit;
X`09`09      py.misc.ptodam := old_ptodam;
X`09`09      py.misc.bth    := old_bth;
X`09`09      if (randint(300) > py.stat.c`5Bdx`5D) then
X`09`09`09begin
X`09`09`09  msg_print('You are off-balance.');
X`09`09`09  py.flags.paralysis := randint(3);
X`09`09`09end;
X`09`09    end;
X`09`09end
X`09      else if (tptr > 0) then
X`09`09with t_list`5Btptr`5D do
X`09`09  if (tval = Closed_door) then
X`09`09    begin
X`09`09      with py do
X`09`09`09if (test_hit(misc.wt+(stat.c`5Bsr`5D*stat.c`5Bsr`5D) div 500,0,0,ab
Vs(p1)+150)) then
X`09`09`09  begin
X`09`09`09    msg_print('You smash into the door! ' +
X`09`09`09`09'The door crashes open!');
X`09`09`09    t_list`5Btptr`5D := door_list`5B1`5D;
X`09`09`09    p1 := 1;
X`09`09`09    fopen := true;
X`09`09`09    lite_spot(y,x);
X`09`09`09  end
X`09`09`09else
X`09`09`09  begin
X`09`09`09    msg_print('You smash into the door! ' +
X`09`09`09`09'The door holds firm.');
X`09`09`09    py.flags.paralysis := 2;
X`09`09`09  end;
X`09`09    end
X`09`09  else if (tval = chest) then
X`09`09    begin
X`09`09      if (randint(10) = 1) then
X`09`09`09begin
X`09`09`09  msg_print('You have destroyed the chest...');
X`09`09`09  msg_print('and its contents!');
X`09`09`09  name := '& ruined chest';
X`09`09`09  flags := 0;
X`09`09`09end
X`09`09      else if (uand(%X'00000001',flags) <> 0) then
X`09`09`09if (randint(10) = 1) then
X`09`09`09  begin
X`09`09`09    msg_print('The lock breaks open!');
X`09`09`09    flags := uand(%X'FFFFFFFE',flags);
X`09`09`09  end;
X`09`09    end
X`09`09  else
X`09`09    msg_print('I do not see anything you can bash there.')
X`09      else
X`09`09msg_print('I do not see anything you can bash there.');
X`09  end;
X      end;
X
X
X`09`7B Jam a closed door`09`09`09`09`09-RAK-`09`7D
X    procedure jamdoor;
X      var
X`09`09i1`09`09: treas_ptr;
X`09`09y,x,tmp         : integer;
X`09`09m_name`09`09: vtype ;
X      begin
X`09y := char_row;
X`09x := char_col;
X`09if (get_dir('Which direction?',tmp,tmp,y,x)) then
X`09  begin
X`09    with cave`5By,x`5D do
X`09      if (tptr > 0) then
X`09`09with t_list`5Btptr`5D do
X`09`09  if (tval = Closed_door) then
X`09`09    if (cptr = 0) then
X`09`09      begin
X`09`09`09if (find_range(`5Bspike`5D,false,i1,i2)) then
X`09`09`09  begin
X`09`09`09    msg_print('You jam the door with a spike.');
X`09`09`09    with i1`5E.data do
X`09`09`09      if (number > 1) then
X`09`09`09`09number := number - 1
X`09`09`09      else
X`09`09`09`09inven_destroy(i1);
X`09`09`09    prt_weight ;
X`09`09`09    p1 := -abs(p1) - 20;
X`09`09`09  end
X`09`09`09else
X`09`09`09  msg_print('But you have no spikes...');
X`09`09      end
X`09`09    else
X`09`09      begin
X`09`09`09find_monster_name ( m_name, cptr, true ) ;
X`09`09        msg_print( m_name + ' is in your way!' ) ;
X`09`09      end
X`09`09  else if (tval = Open_door) then
X`09`09    msg_print('The door must be closed first.')
X`09`09  else
X`09`09    msg_print('That isn''t a door!')
X`09      else
X`09`09msg_print('That isn''t a door!');
X`09  end;
X      end;
X
X
X`09`7B Refill the players lamp`09`09`09`09-RAK-`09`7D
X    procedure refill_lamp;
X      var
X`09i2,i3`09`09`09`09: integer;
X`09i1`09`09`09`09: treas_ptr;
X`09out_val                         : vtype;
X      begin
X`09i3 := equipment`5BEquipment_light`5D.subval;
X`09if ((i3 > 0) and (i3 < 10)) then
X`09  if (find_range(`5Bflask_of_oil`5D,false,i1,i2)) then
X`09    begin
X`09      msg_print('Your lamp is full.');
X`09      with equipment`5BEquipment_light`5D do
X`09`09begin
X`09`09  p1 := p1 + i1`5E.data.p1;
+-+-+-+-+-+-+-+-  END  OF PART 22 +-+-+-+-+-+-+-+-
