Exemplo n.º 1
0
 foreach(object ob in living_stack){
     if(playerp(ob) && !creatorp(ob) && !present("testchar badge",ob) &&
       !member_group(ob,"TEST")) {
         message("info","Putcri Brothers' back room is for authorized personnel only.", ob); 
         return 0;
     }
 }
Exemplo n.º 2
0
int hitCallback(object who, object agent, int x, class MagicProtection cl) {
    string str;
    object Caster = cl->caster;

    if( (int)agent->GetUndead() ) return 0;
    str = (string)agent->GetName() || (string)agent->GetShort();
    if( who == Caster ) {
        who->eventTrainSkill("magic defense",cl->args,x,1);
    }
    else if( Caster && playerp(who) && Caster != who ) {
        Caster->eventTrainSkill("magic defense",cl->args,0,1);
    } 

    send_messages("", "The %^YELLOW%^magical shield%^RESET%^ around "
      "$agent_name wavers as $target_name strikes it.",
      who, agent, environment(who), 0);
    return x;
}
Exemplo n.º 3
0
int main(object me, string arg)
{
	string target, mud;
	object obj;
        string no_tell, can_tell;
        string reply_out;

	if (! arg || arg == "")
		return notify_fail("你要回答什么?\n");

	if (! stringp(target = me->query_temp("reply")) )
		return notify_fail("刚才没有人和你说过话。\n");

	if (sscanf(target, "%s@%s", target, mud) == 2)
	{
		GTELL->send_gtell(lower_case(mud), lower_case(target), me, arg);
		write("网路讯息已送出,可能要稍候才能得到回应。\n");
		return 1;
	}

	obj = find_player(target);
	if (! obj || ! me->visible(obj))
	{
		if (MESSAGE_D->send_msg_to(me, target, arg))
			return 1;
		return notify_fail("刚才和你说话的人现在已经离开游戏了。\n");
	}

        no_tell = obj->query("env/no_tell");
	if (! wizardp(me) && (no_tell == "all" || no_tell == "ALL" ||
	    is_sub(me->query("id"), no_tell)))
        {
                can_tell = obj->query("env/can_tell");
                if (! is_sub(me->query("id"), can_tell))
		        return notify_fail("这个人不想听你罗嗦啦。\n");
        }

	if (playerp(obj) && obj->is_net_dead())
		return notify_fail("这个人现在不在线上,听不到你的话。\n");

	if (! living(obj))
		return notify_fail("这人现在恐怕听不到你说的话了...\n");

	reply_out = sprintf(HIG "%s回答你:%s\n" NOR,
                            me->name(1) + HIG "(" + me->query("id") + ")", arg);
        if (! TELL_CMD->notice_user(me->name(1), me->query("id"), obj, reply_out))
                return 1;

        // 成功的回答了
	write(HIG "你回答" + obj->name(1) + HIG + "(" + obj->query("id") +
              "):" + arg + "\n" NOR);

        if (query_idle(obj) >= 120)
                write(YEL "可是" + obj->name(1) +
                      YEL "已经在猪圈中发呆有" + chinese_number(query_idle(obj) / 60) +
                      "分钟了,恐怕没法听到你的话。\n");

        // 如果选择的不是全阻塞(2),则自动忽略这条信息,显示
        // 下一条信息。
        if (me->query("env/jam_talk") != 2)
                SKIP_CMD->main(me, "");

	return 1;
}
Exemplo n.º 4
0
int perform(object me, object target)
{
        object weapon;
        string msg;
        int ap, dp;
        int damage;
 
        if (playerp(me) && ! me->query("can_perform/yinlong-bian/zhu"))
                return notify_fail("你还不会这种功能。\n");

        if (! target) target = offensive_target(me);

        if (! target || ! me->is_fighting(target))
                return notify_fail(DUO "只能在战斗中对对手使用。\n");

        if (! objectp(weapon = me->query_temp("weapon")) ||
            weapon->query("skill_type") != "whip")
                return notify_fail("你使用的武器不对。\n");

        if (me->query_skill("force", 1) < 130)
                return notify_fail("你的内功火候不够,使不了" DUO "。\n");

        if (me->query_skill("yinlong-bian", 1) < 100)
                return notify_fail("你的银龙鞭法功力太浅,使不了" DUO "。\n");

        if (me->query("neili") < 300)
                return notify_fail("你的真气不够,无法使用" DUO "。\n");

        if (me->query_skill_mapped("whip") != "yinlong-bian")
                return notify_fail("你没有激发银龙鞭法,使不了" DUO "。\n");

        if (! living(target))
                return notify_fail("对方都已经这样了,用不着这么费力吧?\n");

        msg = HIW "$N" HIW "诡异的一笑,手中" + weapon->name() +
              HIW "犹如一条银龙猛然飞向$n" HIW ",正是九阴真经中的"
             "绝招「" HIC "天诛龙蛟诀" HIW "」!\n" NOR;

        ap = me->query_skill("whip") + me->query_skill("force");
        dp = target->query_skill("force") + target->query_skill("parry");

        if (ap * 11 / 20 + random(ap) > dp)
        {
                damage = ap + random(ap / 2);
                me->add("neili", -200);
                me->start_busy(2);

                msg += COMBAT_D->do_damage(me, target, WEAPON_ATTACK, damage, 85,
                                           HIR "结果$n" HIR "一声惨叫,未能看破$N"
                                           HIR "的企图,被这一鞭硬击在胸口,鲜血飞"
                                           "溅,皮肉绽开!\n" NOR);
                message_combatd(msg, me, target);
                
        } else
        {
                me->add("neili", -100);
                me->start_busy(3);
                msg += CYN "可是$p" CYN "飞身一跃而起,躲避开了"
                       CYN "$P" CYN "的攻击!\n" NOR;
                message_combatd(msg, me, target);
        }

        return 1;
}
Exemplo n.º 5
0
int perform(object me, object target)
{
        int skill, i, p, n;
        int my_exp, ob_exp;
        string pmsg;
        string msg;
        object weapon;

        if (playerp(me) && ! me->query("can_perform/mantian-xing/xing"))
                return notify_fail("你还没有受过高人指点,无法施展" XING "。\n");

        if (! target) target = offensive_target(me);

        if (! target || ! me->is_fighting(target))
                return notify_fail(XING "只能在战斗中对对手使用。\n");

        if (! objectp(weapon = me->query_temp("handing")) ||
            (string)weapon->query("skill_type") != "throwing")
                return notify_fail("你现在手中没有拿着暗器,难以施展" XING "。\n");

        if (weapon->query_amount() < 15)
                return notify_fail("至少要有十五枚暗器才能施展" XING "。\n");

        if ((skill = me->query_skill("mantian-xing", 1)) < 80)
                return notify_fail("你的满天星不够娴熟,难以施展" XING "。\n");

        if ((int)me->query_skill("force") < 150)
                return notify_fail("你的内功修为不足,难以施展" XING "。\n");

        if ((int)me->query("max_neili") < 1200)
                return notify_fail("你的内力修为不足,难以施展" XING "。\n");

        if ((int)me->query("neili") < 150)
                return notify_fail("你现在真气不足,难以施展" XING "。\n");

        if ((int)target->query_temp("feixing"))
                return notify_fail("对方已经中了你的绝招,现在是废人一个,赶快进攻吧!\n");

        if (! living(target))
                return notify_fail("对方都已经这样了,用不着这么费力吧?\n");

        me->add("neili", -100);
        weapon->add_amount(-15);

        msg = HIR "$N" HIR "蓦地飞身跃起,十指箕张,施出「穹外飞星」将"
              "手中" + weapon->name() + HIR "尽数凌空射出。\n霎时破空声"
              "骤响," + weapon->name() + HIR "便如同陨星飞坠一般,笼罩"
              "$n" HIR "各处大穴!\n" NOR;

        my_exp = COMBAT_D->valid_power(me->query("combat_exp"));
        ob_exp = COMBAT_D->valid_power(target->query("combat_exp"));

        me->want_kill(target);
        if (my_exp / 2 + random(my_exp * 3 / 2) > ob_exp)
        {
                if (target->query_skill("parry") < me->query_skill("throwing"))
                {
                        n = 2 + random(2);
                        if (random(my_exp) > ob_exp) n += 1 + random(2);
                        if (random(my_exp / 2) > ob_exp) n += 1 + random(2);
                        if (random(my_exp / 4) > ob_exp) n += 1 + random(2);

                        msg += HIR "结果$n" HIR "一声惨叫,同时中了$P" HIR +
                               chinese_number(n) + weapon->query("base_unit") +
                               weapon->name() + HIR ",直感两耳轰鸣,目不视"
                               "物。\n" NOR;

                        while (n--)
                        {
                                COMBAT_D->clear_ahinfo();
                                weapon->hit_ob(me, target,
                                               me->query("jiali") + 100 + n * 10);
                        }

                        target->set_temp("feixing", 1);
                        target->add_temp("apply/attack", -70);
                        target->add_temp("apply/dodge", -70);
                        target->add_temp("apply/parry", -20);
                        target->receive_damage("qi", 150, me);
                        target->receive_wound("qi", 50, me);

                        p = (int)target->query("qi") * 100 / (int)target->query("max_qi");

                        if (stringp(pmsg = COMBAT_D->query_ahinfo()))
                                msg += pmsg;

                        msg += "( $n" + eff_status_msg(p) + " )\n";
                        message_combatd(msg, me, target);

                        tell_object(target, RED "你现在要穴受到重损,乃至全身"
                                            "乏力,提不上半点力道!\n" NOR);
                        tell_object(me, HIC "你心知刚才这招已打中对方要寒,不"
                                            "禁暗自冷笑。\n" NOR);

                        target->kill_ob(me);
                        call_out("back", 2 + random(skill / 15), target);
                } else
                {
                        msg += HIR "$n" HIR "集中生智,双手画圈回旋挥舞,拨弄"
                               "开了要害处的杀着,可还是受了点轻伤。\n" NOR;

                        target->receive_damage("qi", 100);
                        target->receive_wound("qi", 40);

                        p = (int)target->query("qi") * 100 / (int)target->query("max_qi");
                        msg += "( $n" + eff_status_msg(p) + " )\n";
                        message_combatd(msg, me, target);

                        tell_object(target, RED "你只觉全身几处一阵刺痛,知道"
                                            "自己虽被击中,但却是避开了要穴。"
                                            "\n" NOR);
                        target->kill_ob(me);
                        me->start_busy(1 + random(2));
                }
        } else
        {
                 msg += CYN "可是$n" CYN "小巧腾挪,好不容易避开了"
                        CYN "$N" CYN "铺天盖地的攻击。\n" NOR;
                 me->start_busy(3);
                 message_combatd(msg, me, target);
        }
        return 1;
}
Exemplo n.º 6
0
void heart_beat()
{
        int t;
        int period;
        int wimpy_ratio, cnd_flag;
        mapping my;
        object ob;
	object me;
	string prompt;
	int is_player;

	me = this_object();
        my = query_entire_dbase();

        if (userp(me) && living(me) && mapp(my["env"]))
        {
                // update prompt
		prompt = my["env"]["prompt"];
                if ((prompt == "time" || prompt == "mud" || prompt == "hp") &&
		    is_waiting_command() && ! me->is_attach_system())
                    
                {
                        write_prompt();
                }
                
        }

        // If we're dying or falling unconcious?
        if (my["qi"] < 0 || my["jing"] < 0)
        {
                if (! living(me)) die();
                else unconcious();

                // Why does the living test? Because
                // The wizard may set immortal but his
                // qi was -1, so I don't want return,
                // or the continue_action will never be
                // called in such case.
                if (! me || ! living(me))
                        return;
        }

        if (is_p_busy())
        {
                continue_p_busy();
        }
        
        // Do attack if we are fighting.
        if (is_busy())
        {
                continue_action();
                // We don't want heart beat be halt eventually, so return here.
        } else
	if (living(me))
        {
                string apply;
                object apply_ob;

                // Is it time to flee?
                if (is_fighting() &&
                   intp(wimpy_ratio = (int)query("env/wimpy")) &&
                   wimpy_ratio > 0 &&
                   (my["qi"] * 100 / my["max_qi"] <= wimpy_ratio ||
                    my["jing"] * 100 / my["max_jing"] <= wimpy_ratio))
                {
                        if (stringp(apply = query("env/wimpy_apply")) &&
                            objectp(apply_ob = present(apply, me)) &&
                            apply_ob->query("can_apply_for_wimpy"))
                        {
                                apply_ob->apply_for_wimpy(this_object());
                        } else
                                GO_CMD->do_flee(this_object());
                }
                
                if (query("auto_perform") || me->query_auto_perform())
                {                       
                        if (my["eff_jing"] > 0 && my["jing"] * 100 / my["eff_jing"] <= 70)
                                SKILL_D("force/regenerate")->exert(me, me);
                        if (my["eff_qi"] > 0 && my["qi"] * 100 / my["eff_qi"] <= 70)
                                SKILL_D("force/recover")->exert(me, me);

                        // 如果不在打架而且处于受伤状态,则自行疗伤
                        if (! is_fighting())
                        {
                                if (my["eff_jing"] < my["max_jing"])
                                        SKILL_D("force/inspire")->exert(me, me);
                                if (my["eff_qi"] < my["max_qi"])
                                        SKILL_D("force/heal")->exert(me, me);
                        }
                }
                // Do attack or clean up enemy if we have fleed.
                if (is_busy())
                        continue_action();
                else
                        attack();
        }

        if (my["doing"] == "scheme")
                // executing schedule now
                SCHEME_CMD->execute_schedule(me);

        if (! me) return;

        if (! (is_player = playerp(me)))
        {
                me->scan();
                // scan() may do anything -- include destruct(this_object())
                if (! me) return;
        }

        if ((t = time()) < next_beat) return;
        else next_beat = t + 5 + random(10);

	if (! my["not_living"])
        	cnd_flag = update_condition();
	if (! me) return;

	if (! (cnd_flag & CND_NO_HEAL_UP))
		cnd_flag = heal_up();

        // If we are compeletely in peace, turn off heart beat.
        // heal_up() must be called prior to other two to make sure it is called
        // because the && operator is lazy :P
        if (! cnd_flag &&
	    ! is_player &&
            ! keep_beat_flag &&
            ! is_fighting() &&
	    ! is_busy() &&
            ! interactive(this_object()))
        {
                if (environment() && query("chat_msg"))
                {
                        ob = first_inventory(environment());
                        while (ob && ! interactive(ob))
                                ob = next_inventory(ob);
                } else
                        ob = 0;
                if (! ob) set_heart_beat(0);
        }

        update_all_limb_damage();
        
        if (! me || ! is_player) return;

        // Make us a bit older. Only player's update_age is defined.
        // Note: update_age() is no need to be called every heart_beat, it
        //       remember how much time has passed since last call.
        me->update_age();

#ifdef AUTO_SAVE
        if (living(me))
        {
            	period = t - ((int) my["last_save"]);
                if (period < 0 || period > 15 * 60)
            	{
                	string msg;
                        msg = HBCYN HIW "【档案存储】您的档案已经自动存盘,"
                              "欢迎访问论坛 http://bbs.mudbuilder.com/ 。\n" NOR;
                	if (! me->save())
                    	msg = HIR "【数据保护】由于数据异常,您的档"
                              "案本次存盘失败。\n" NOR;
                	set("last_save", t);
                	tell_object(me, msg);
            }
        }
#endif
	if (! interactive(me))
		return;

        if (my["food"] <= 0 || my["water"] <= 0)
        {
		if (environment() &&
		    ! environment()->is_chat_room() &&
                    ! wizardp(me) &&
                    ! query_condition("hunger"))
		{
			// born & enter the world
                        apply_condition("hunger", 1);
		}
        }

        if (query_idle(me) > IDLE_TIMEOUT && ! wizardp(me) &&
            (! mapp(my["env"]) || ! my["env"]["keep_idle"]))
                me->user_dump(DUMP_IDLE);
}