// zuijiu.c 

#include <ansi.h>
#include <combat.h>

inherit F_SSERVER;

int perform(object me, object target)
{
      string msg;                                   
      int limit, damage;
      object weapon = me->query_temp("weapon");
      limit = (me->query("con") + (int)me->query("max_neili") / 50) * 2;
      
      if( !target ) target = offensive_target(me);
     
      if( !target || !me->is_fighting(target) )
      return notify_fail("ֻսжԶʹá\n");

      if (!weapon || weapon->query("skill_type") != "club"
        || me->query_skill_mapped("club") != "zui-gun")
                return notify_fail("޷ʹá򡹡\n");
                     
      if( (int)me->query_skill("zui-gun",1) < 100 )
      return notify_fail("죬ʹá򡹣\n");
      
      if( me->query_skill_mapped("force") != "hunyuan-yiqi" )
                return notify_fail("޷ʹá򡹡\n");

      if( (int)me->query_skill("hunyuan-yiqi",1) < 100 )
      return notify_fail("ĻԪһȼʹá򡹣\n");  
       
      if( (int)me->query_str() < 25 )
      return notify_fail("ıǿʹá򡹣\n");
      
      if( (int)me->query("max_neili") < 800 )
      return notify_fail("̫ʹá򡹣\n");
      
      if( (int)me->query("neili") < 250 )
      return notify_fail("̫ˣ޷ʹó򡹣\n");   
                                                                                 
      if(userp(me) && (int)me->query_condition("drunk", 1) > limit/2 )
      return notify_fail("ⶼûУôʹĹ\n");

      msg = HIY"$NͻȻһ$nȥʱѬ$n֪룬$Nžƾʱ\n"NOR;

      if( random(10) > 6 && (int)me->query("combat_exp") > random((int)target->query("combat_exp"))/ 3)
      {
      me->start_busy(1);
      target->start_busy(1);

      damage = (int)me->query_skill("zui-gun", 1);
      damage = (int)me->query_skill("hunyuan-yiqi", 1) +damage;
      damage = (int)me->query_skill("buddhism", 1) +damage;
      damage = damage + random(damage/2);
             
      target->receive_damage("qi", damage);
      target->receive_wound("qi", damage/3);

      me->add("neili", -150);
      if( damage < 300 ) msg += HIY"$nɫòҰף˺ü\n"NOR;
      else if( damage < 400 ) msg += HIY"صػУ$nۡһ³һѪ\n"NOR;
      else if( damage < 500 ) msg += HIR"䡹һ$nȫѪѪ\n"NOR;
      else msg += HIR"\nֻ죬$nһҽУ̲ȥ\n"NOR;
      me->start_busy(1);
        } else 
        {       me->start_busy(random(3));
                me->add("neili", -100);                
                msg += HIY"$pһŲԶԶĶ˿ȥ\n"NOR;
        }

                message_vision(msg, me, target);
        return 1;
}

