/* Snippet Made By Dreka 
	Feel free to use it as you like. */


void do_bludgeon( CHAR_DATA *ch, char *argument, int dam_type, int dt )
{
    CHAR_DATA *victim;
    OBJ_DATA *wield;
    char arg[MAX_INPUT_LENGTH];
    AFFECT_DATA af;
    int chance = 100;

   if ( !IS_NPC( ch )
        && ch->level < skill_table[gsn_bludgeon].skill_level[ch->class] )
   {
      send_to_char( "huh?", ch );
      return;
   }

    one_argument( argument, arg );
    if ( arg[0] == '\0' )      
     {
        send_to_char( "pistolwhip whom?\n\r", ch );
        return;
     }

    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
        send_to_char( "They aren't here.\n\r", ch );
        return;
    }

    if (ch->fighting != NULL)
    {
        send_to_char("You're facing the wrong end.\n\r",ch);
          return;
    }

    if (victim->fighting != NULL)
    {
        send_to_char("They are fighting and aware of your threat.\n\r",ch);
        return;
    }
 if (IS_AFFECTED2 (victim, AFF2_DIABLO))
    {
act ("$N avoids your pistolwhip.", ch, NULL, victim, TO_CHAR);
        damage (ch, victim, 0, gsn_bludgeon, DAM_NONE, TRUE);
        return;
    }
    if ( victim->hit < victim->max_hit / 3)
    {
        act( "$N is hurt and suspicious ... you can't sneak up.\n\r",
               ch, NULL, victim, TO_CHAR );
        return;
    }

    if (is_safe(ch,victim))
        return;

    if ( IS_AFFECTED(victim, AFF_SLEEP))
     {
      send_to_char("Give me a break they are already sleeping.", ch);
      return;
     }

   if ( ( wield = get_eq_char( ch, WEAR_WIELD ) ) == NULL )
   {
      send_to_char( "You need to wield a weapon first...\n\r", ch );
      return;
    }

     if(!IS_NPC(victim))
      {
        if ((ch->level + 9) <= victim->level)
         {
          send_to_char("You failed your attempt to pistolwhip!\n\r",ch);
          send_to_char("Failed his attempt to pistolwhip you!\n\r",victim);
          damage( ch, victim, 0, gsn_bludgeon,DAM_NONE,TRUE);
          check_improve(ch,gsn_bludgeon,TRUE,1);
          return;
         }
      }

    if (get_curr_stat(victim,STAT_STR) > get_curr_stat(ch,STAT_STR))
         chance -= 5;
    if (get_curr_stat(victim,STAT_DEX) > get_curr_stat(ch,STAT_DEX))
         chance -= 10;
    if (ch->size < victim->size)
         chance -= 10;

    if ( get_skill(ch,gsn_bludgeon) > number_percent() && chance > 80)
     {
      damage(ch,victim,number_range( ch->level*5, ch->level*9 ), gsn_bludgeon, DAM_NONE, TRUE)
      stop_fighting( ch, TRUE );
      stop_fighting( victim, TRUE );
      af.where     = TO_AFFECTS;
      af.type      = gsn_bludgeon;
      af.level     = ch->level;
      af.duration  = ch->level/20;
      af.location  = APPLY_NONE;
      af.modifier  = 0;
      af.bitvector = AFF_SLEEP;
      affect_join( victim, &af );
   
      if ( IS_AWAKE(victim) )
      {
          send_to_char( "{RB{rL{RA{rM{x.... Then {Ddarkness{x.\n\r", victim );
          act( "$n groans then falls over.", victim, NULL, NULL, TO_ROOM );
          check_improve(ch,gsn_bludgeon,TRUE,10);
          victim->position = POS_SLEEPING;
          check_improve(ch,gsn_bludgeon,TRUE,1);
          return;
      }
     }
     else
      {
          send_to_char("You failed your attempt to pistolwhip!\n\r",ch);
          send_to_char("Failed his attempt to pistolwhip you!\n\r",victim);
          damage( ch, victim, 0, gsn_bludgeon,DAM_NONE,TRUE);
          check_improve(ch,gsn_bludgeon,TRUE,1);
          return;
      }
    WAIT_STATE( ch, skill_table[gsn_bludgeon].beats );
    return;
}

   

/******* In fight.c ******/

/*  void set_fighting */
  if ( IS_AFFECTED(ch, AFF_SLEEP) )
        affect_strip( ch, gsn_bludgeon );
  
/******  const.c ********/

 {
        "?*?",             { 302, 302, 100, 302, 150, 302},     { 0, 0, 0, 0, 0, 0 },
        spell_null,             TAR_IGNORE,             POS_FIGHTING,
        &gsn_bludgeon,          SLOT( 0),       0,      24,
        "?*?",             "The pain at the back of your head disapates", ""
    },
     /* ?*? = name you want skillt to be. */

/********* act_obj.c *******/

/* do_steal */

/*add at bottom with other affect_strips */
	
	affect_strip(victim,gsn_sleep);
+       affect_strip(victim,gsn_bludgeon);   +
        REMOVE_BIT(ch->affected_by,AFF_SLEEP);

/****** db.c ******/

sh_int                  gsn_bash;
+ sh_int                  gsn_bludgeon;  +

       

/***** merc.h ******/

extern sh_int  gsn_bash;
+  extern sh_int  gsn_bludgeon;  +


/****** interp.c/interp.h *****/

ADD LIKE ANY OTHER COMMAND


