 /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  @+  .------------. .------------. .------..------. SOH (South OF HEAVEN)  @
  @ / |+- -         \|+- --        \|+-    ||      | +--------------------+ @
  @ | ||             |:             ||     ||      | The following code is  @
  @ | |:             |.             |:     ||      | created to function    @
  @ | |.      _______|  _____.      |.     ||      | primarily on SOH MUD   @
  @ | |              |      ||      |      ||      | tho it can be modified @
  @ | |______        |      ||      |      :|      | to work on most Diku,  @
  @ |/|+-    |       |      ||      |      .:      | Merc, Envy, ROM MUDs   @
  @ | |:     |       |      ||      |              | +--------------------+ @
  @ | |      |       |      ||      |       .      | All these functions    @
  @ | |      |       |      :|      |      :|      | by whiplash@armory.com @
  @ | |      |       |      .|      |      ||      | and may not be used    @
  @ | |      :       |       :      |      ||      | unless credit is given @
  @ | |              |              |      ||      | somewhere in your MUD  @
  @ | |______________|______________:______||______| that all can see.      @
  @ |/______________/_______________/_____//______/  (ie: HELP SOH, etc)    @
  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/


/* Okay here's the THROW command we use on SOH, it DOESN'T require you to
   have any *skill* to throw an item and hit the person/monster in the 
   same room (you can change that if you like.) The player must have an
   item of the ITEM_THROWN type in their HAND to throw anything, the 
   thrown item has spells on it, so this can be a blast if you get in
   a creative mood.
*/

/* in merc.h add amongst the others: */

#define ITEM_THROWN         (whatever int you can use)


/* in interp.c amongst all the other commands add: */

{ "throw",      do_throw,   POS_FIGHTING,  LOG_NORMAL, 1 },

/* in interp.h amongst all the other declare_do_funs add: */

DECLARE_DO_FUN( do_throw           );

/* add the following in fight.c */
/* 
 * Throw command, allows semi-ranged combat 10-13 
 */ 
void do_throw( CHAR_DATA *ch, char *argument) 
 { 
  CHAR_DATA *victim; 
  OBJ_DATA *obj; 
  char arg[MAX_INPUT_LENGTH]; 
   int chance; 

   one_argument(argument, arg ); 

  if( argument == '\0' || arg[0] == '\0' )
  { 
  send_to_char("Throw what at whom?\n\r",ch); 
  return; 
  } 

  if (( victim = get_char_room(ch, arg) ) == NULL ) /* anyone home? */
  { 
  send_to_char("They are not here.\n\r",ch); 
  return; 
  } 
  
  if (is_safe(ch,victim)) /* check for legal target */
  return; 

  if (victim == ch )
  { 
  send_to_char("How could you throw something at yourself dimwit?\n\r",ch); 
  return; 
  } 

  if (( obj = get_eq_char(ch,WEAR_HOLD) ) == NULL ) /* item held? */
  { 
  send_to_char("You aren't holding anything.\n\r",ch); 
  return; 
  } 

 if ( obj->item_type != ITEM_THROWN ) /* make sure you can throw t! */
 { 
 send_to_char("You can't throw that.\n\r",ch); 
 return; 
 }

 /* now get rid of the bloody thing!! */
/* we don't use this as a skill, if you do, add the success check here */
 chance = number_range( 1, 100 );  /* alter this to your preference */
 if ( chance > 90 ) 
 { 
 send_to_char("You miss your target!\n\r",ch); 
 extract_obj(obj); 
 multi_hit(victim,ch,TYPE_UNDEFINED); 
 return; 
 } else {
  WAIT_STATE(ch, 2 * PULSE_VIOLENCE ); 
  act("$n throws $p at $N.",ch,obj,victim,TO_ROOM); 
  act("$n throws $p at you.",ch,obj,NULL,TO_VICT); 
  act("You throw $p at $N.",ch,obj,victim,TO_CHAR); 

 /* notice which values for spell stuff.. */
  obj_cast_spell( obj->value[3], obj->value[0], ch, victim, obj ); 
  extract_obj(obj); 
  return; 
  } 
} 

