文字MUD游戏论坛-天下泥潭群英会-水泊梁山

文字MUD游戏论坛-天下泥潭群英会-水泊梁山 (http://www.aolai.org/forums/)
-   『 梁山论剑 』 (http://www.aolai.org/forums/f3/)
-   -   请教用大米速练主ID的问题 (http://www.aolai.org/forums/t12830/)

zhangj 2007-06-19 12:10

回复: 请教用大米速练主ID的问题
 
请教高手解读下transfer指令源码:

// cracked by vikee 2/09/2002 vikee@263.net
// transfer.c
#include <ansi.h>

inherit SSERVER;

int exert(object me, object target)
{
int force, trans;
int tforce, tmaxforce;

if( !target || target==me || !living(target) )
return notify_fail("你要将真气传给谁?\n");

if(target->is_busy())
return notify_fail("对方正在忙着呢。\n");

if(target->is_fighting())
return notify_fail("对方正在忙着呢。\n");

if( (string)me->query_skill_mapped("force") != target->query_skill_mapped("force") )
return notify_fail(target->name() + "所使用的内功和你不同。\n");

if( (int)me->query("force") <= (int)me->query("max_force") )
return notify_fail("你的真气不足。\n");

force = me->query("force") - me->query("max_force");

if( force/2 < 1 ) return notify_fail("你的真气不足。\n");
me->add("force", - force / 2 );
message_vision("$N将手掌贴在$n背心,运气将体内真气传送过去。\n", me, target);
if( random(force/3) > (int)me->query_skill("force") )
return notify_fail("你失败了。\n");

tforce = (int)target->query("force");
tmaxforce = (int)target->query("max_force");
write("Ok.\n");
tell_object(target, HIY "你觉得一股热气从" + me->name() + "的手掌传了过来。\n" NOR);
me->start_busy(2+random(4));
target->start_busy(2+random(4));
if( tforce < tmaxforce ) {
tforce += force/6;
if(tforce > tmaxforce) tforce = tmaxforce;
target->set("force", tforce);
}
return 1;
}


所有时间均为格林尼治时间 +9, 现在的时间是 06:25.

Powered by SPLS
版权所有 2001-2023 水泊梁山
皖ICP备05012024号

站长 fengyue


Content Relevant URLs by vBSEO 3.6.1