// mingsi.c

#include <skill.h>

inherit F_CLEAN_UP;

int main(object me, string arg)
{
        int force_cost, potential_gain , potential ;

//   potential=(int)me->query("potential") 
//           - (int)me->query("learned_points"));

        seteuid(getuid());
        
        if( me->is_fighting() )
                return notify_fail("战斗中冥思？找死啊？\n");


        if( me->query("food") <70 )
                return notify_fail("饿着肚子冥思啊？\n");

        if( !arg
        ||      !sscanf(arg, "%d", force_cost) )
                return notify_fail("你要花多少内力来冥思？\n");

        if( force_cost < 10 ) return notify_fail("你最少要花 10 点「内力」。\n");

        if( (int)me->query("force") < force_cost )
                return 
notify_fail("你的内力不够。\n");

        if( (int)me->query("sen") * 100 / (int)me->query("max_sen") < 70 )
                return notify_fail("你现在精神状况太差了，无法凝神专一！\n");

        if( (int)me->query("gin") * 100 / (int)me->query("max_gin") < 70 )
                return notify_fail("你现在精力不够，无法控制内息的流动！\n");
        if( (me->query("eff_gin") < 90 ) || (me->query("eff_sen") <90) )
               return notify_fail("你现在精力不够，无法控制内息的流动！\n");
        write("你盘膝而坐，闭目冥思。\n");

        me->add("eff_gin", -80);
        me->add("eff_sen", -80);
        me->set("gin",10);
        me->set("sen",10);
 
        me->set("force",me->query("force")-force_cost); 

        me->disable_player("<冥思中>");
        call_out("wakeup",random( 20*force_cost/(int)me->query("cps")) , me,force_cost); 

}

int wakeup(object me,int force_cost)
   {
   int potential_gain ;
        // This function ranged from 1 to 15 when kee_cost = 30
        potential_gain = (int)force_cost * (int)me->query("con") / 1000;

        me->enable_player();

        if( potential_gain < 1 ) {
                write("你站起身来，只觉得浑身无力。\n");
                return 1;
            }
        else{
             me->add("potential", potential_gain );
             write("你的潜能提高了！！！\n");
            }

        
        return 1;
}

int help(object me)
{
        write(@HELP
指令格式 : [mingsi] [耗费「内力」的量]

冥思是种心法，可以将内力转化为潜能，但这很费精神又花时间
潜能还可以通过打斗来取得。

请参考 help stats
HELP
        );
        return 1;
}
 
