MUD-武林MUD资料站-武侠MUD游戏
标题:
求教一个PERFORM
[打印本页]
作者:
雁北飞
时间:
2014-5-12 23:16
标题:
求教一个PERFORM
碧落姐姐你好,我想模仿海洋的泰山剑法岱宗如何一招,计算可以正常显示,可是结束了计算之后不能使出一击必中,先将代码粘贴如下,请姐姐帮忙看看
#include <ansi.h>
inherit F_DBASE;
inherit F_SSERVER;
int perform(object me, object target)
{
object weapon;
int skill;
if( !target ) target = offensive_target(me);
if( !target
|| !target->is_character()
|| !me->is_fighting(target) )
return notify_fail("「岱宗如何」只能对战斗中的对手使用。\n");
if( me->query_temp("ruhe") )
return notify_fail("你已经在以「岱宗如何」计算如何出招了!\n");
weapon = me->query_temp("weapon");
if( !objectp(weapon) || weapon->query("skill_type") != "sword" )
return notify_fail("你手中无剑,即使以「岱宗如何」计算攻守,也无法出击。\n");
if( me->query_skill("sword") < 100 )
return notify_fail("你在剑法上的造诣不足以使出「岱宗如何」!\n");
if( me->query("neili") <= 300 )
return notify_fail("你的内力不够!\n");
if( me->query("jing") <= 200 )
return notify_fail("你的精不够!\n");
skill = me->query_skill("taishan-sword");
message_vision(YEL"\n只见$N右手"+weapon->query("name")+YEL"斜指而下,左手五指正在屈指而数,正是「岱宗如何」的要旨。\n" NOR, me, target);
me->set_temp("ruhe_count", 1);
me->add_temp("apply/attack", skill*2);
me->add_temp("apply/dodge", skill);
me->add_temp("apply/parry", skill);
me->set_temp("ruhe", 1);
call_out("checking", 1, me, target);
me->start_call_out( (: call_other, __FILE__, "remove_effect", me :), skill /7);
me->add("neili", -150);
me->add("jing", -150);
return 1;
}
void checking(object me, object target)
{
object weapon;
int skill;
string *msg;
if (!me)
return;
skill = me->query_skill("taishan-sword");
weapon = me->query_temp("weapon");
if ( me->query_temp("ruhe_finish") ) {
me->set_temp("ruhe_hit",1);
message_vision(HIW"\n$N左手捏起剑诀,已经结束「岱宗如何」的计算。\n" NOR, me);
me->add_temp("apply/attack", -skill*2);
me->add_temp("apply/dodge", -skill);
me->add_temp("apply/parry", -skill);
me->delete_temp("ruhe");
me->delete_temp("ruhe_hit");
me->delete_temp("ruhe_count");
me->delete_temp("ruhe_finish");
}
else if ( me->query_temp("ruhe") ) {
if (!objectp(weapon = me->query_temp("weapon"))
|| (string)weapon->query("skill_type") != "sword") {
tell_object(me, "\n你手中无剑,继续算下去也是枉然,?得停止「岱宗如何」的计算。\n" NOR);
me->add_temp("apply/attack", -skill*2);
me->add_temp("apply/dodge", -skill);
me->add_temp("apply/parry", -skill);
me->delete_temp("ruhe");
return;
}
else if ( weapon->query("weapon_prop") == 0 ) {
tell_object(me, "\n你的"+weapon->name()+"已毁,继续算下去也是枉然,?得停止「岱宗如何」的计算。\n" NOR);
me->add_temp("apply/attack", -skill*2);
me->add_temp("apply/dodge", -skill);
me->add_temp("apply/parry", -skill);
me->delete_temp("ruhe");
return;
}
else if ( (int)me->query("jing") < 200 ) {
tell_object(me, "\n你暗觉精神不继,难以继续以「岱宗如何」计算,?好停止计数。\n\n" NOR);
me->add_temp("apply/attack", -skill*2);
me->add_temp("apply/dodge", -skill);
me->add_temp("apply/parry", -skill);
me->delete_temp("ruhe");
return;
}
else if ( me->query_skill_mapped("sword") != "taishan-sword" ) {
tell_object(me, "\n你转而施展其他剑法,不能再以「岱宗如何」计算。\n\n" NOR);
me->add_temp("apply/attack", -skill*2);
me->add_temp("apply/dodge", -skill);
me->add_temp("apply/parry", -skill);
me->delete_temp("ruhe");
return;
}
else if (!me->is_fighting()) {
tell_object(me, "\n你现在没有和人过招,自然也不用以「岱宗如何」计算了。\n\n" NOR);
me->add_temp("apply/attack", -skill*2);
me->add_temp("apply/dodge", -skill);
me->add_temp("apply/parry", -skill);
me->delete_temp("ruhe");
return;
}
else {
msg = ({
"$N左手从一数到五,握而成拳。\n",
"$N将拇指伸出,次而食指,终至五指全展,跟着又屈拇指而屈食指,再屈中指。\n",
"$N左手不住屈指计算,右手"+weapon->name()+"轻轻摆动。\n",
"$N左手五指不住伸屈,似乎在计算数目。\n",
});
message_vision(msg[random(sizeof(msg))], me,target);
me->add_temp("ruhe_count",1);
me->add("jing", -20);
call_out("checking", 1, me, target);
}
}
else return;
}
void remove_effect(object me, object target)
{
int skill;
skill = me->query_skill("taishan-sword");
if ( me->query_temp("ruhe") ) {
me->set_temp("ruhe_hit",1);
message_vision(HIW"\n$N左手捏起剑诀,已经结束「岱宗如何」的计算。\n" NOR, me);
me->add_temp("apply/attack", -skill*2);
me->add_temp("apply/dodge", -skill);
me->add_temp("apply/parry", -skill);
me->delete_temp("ruhe");
}
}
void hit_him(object me, object target)
{
string msg;
int skill = me->query_skill("sword", 1);
if(me->is_fighting(target) && target->is_fighting(me) &&
environment(me) == environment(target))
{
msg = HIY"$N使出泰山剑法中一击必中的"+HIR "岱宗何如" +HIY",无论$n窜高跃低,变换方位,均无从闪避,只觉得眼前一花,一股"HIR"血箭"HIY"喷涌而出。\n" NOR;
message_combatd(msg, me, target);
target->receive_damage("qi",300+skill*2+me->query_skill("force",1),me);
target->receive_wound("qi",300+skill*2+me->query_skill("force",1),me);
}
return ;
}
作者:
是开碧落
时间:
2014-5-14 15:09
说明白点, 你希望哪句出现效果, 但是没出现, 只出现了哪句
作者:
雁北飞
时间:
2014-5-14 17:41
我希望void hit_him(object me, object target)
{
string msg;
int skill = me->query_skill("sword", 1);
if(me->is_fighting(target) && target->is_fighting(me) &&
environment(me) == environment(target))
{
msg = HIY"$N使出泰山剑法中一击必中的"+HIR "岱宗何如" +HIY",无论$n窜高跃低,变换方位,均无从闪避,只觉得眼前一花,一股"HIR"血箭"HIY"喷涌而出。\n" NOR;
message_combatd(msg, me, target);
target->receive_damage("qi",300+skill*2+me->query_skill("force",1),me);
target->receive_wound("qi",300+skill*2+me->query_skill("force",1),me);
}
return ;
}这一段出效果。现在是void remove_effect(object me, object target)结束了perform 就结束了,谢谢姐姐了
作者:
是开碧落
时间:
2014-5-15 08:29
你搜一下这个pfm, 根本没有调用hit_him()的地方啊
这个pfm是这样的
施展以后, 增加buff, 1秒后开始checking(), 如果一堆条件满足就继续1秒后checking(), 不满足就buff取消.
要不你把 hit_him(me, target); 放在第2个 call_out("checking", 1, me, target);前面?
作者:
dllkg
时间:
2014-5-15 09:48
本帖最后由 dllkg 于 2014-5-15 09:51 编辑
雁北飞 发表于 2014-5-14 17:41
我希望void hit_him(object me, object target)
{
string msg;
lz可以把hit_him函数if里面的4条语句放到checking函数最后的call_out前面,hit_him可以不需要了
另外我没发现checking函数的第一个if能起到作用,其他地方没有设定ruhe_finish的,也就是说只要还在战斗,checking就不会结束
欢迎光临 MUD-武林MUD资料站-武侠MUD游戏 (http://17mud.com/)
Powered by Discuz! X3.2