Exemplo n.º 1
0
BOOST_PYTHON_DECL object getitem(object const& target, object const& key)
{
    return object(detail::new_reference(
                      PyObject_GetItem(target.ptr(), key.ptr())));
}
Exemplo n.º 2
0
void do_press_obj_with_obj(object ob1, object ob2) {
    ob1->do_press( ob2 );
}
Exemplo n.º 3
0
Arquivo: get.c Projeto: aricxu/xkx100
int main(object me, string arg)
{
	string from, item;
	object obj, *inv, env, obj2;
	int i, amount , res;
  string msg;

	all=0;
	if (!arg) return notify_fail("你要捡起什么东西?\n");
	if (me->is_busy())
		return notify_fail("你上一个动作还没有完成!\n");
	if (sscanf(arg, "%s from %s", arg, from) == 2)
	{
	//	env = present(from, me);
	    env = i_have(me,from);
//		if (!env) env = present(from, environment(me));
		if (!env) env = i_have(environment(me),from);
		if (!env)
			return notify_fail("你找不到 "+from+" 这样东西。\n");
		if ((env->query("no_get_from") ||
			living(env) && !env->query_temp("noliving/unconcious")) 
			&& (wiz_level(me) <= wiz_level(env)))
			return notify_fail("你的巫师等级必须比对方高,才能搜身。\n");
	} else env = environment(me);

	if (sscanf(arg, "%d %s", amount, item) == 2)
	{
	//	if (!objectp(obj = present(item, env)))
		if( !objectp(obj = i_have( env,item )) ) // env have item	
			return notify_fail("这里没有这样东西。\n");
		if (!obj->query_amount())
			return notify_fail(obj->name() + "不能被分开拿走。\n");
		if (amount < 1)
			return notify_fail("东西的个数至少是一个。\n");
		if (amount > obj->query_amount())
			return notify_fail("这里没那么多的"+obj->name()+"。\n");
		else
			if(amount == (int)obj->query_amount())
				return do_get(me, obj);
			else
			{
				obj2 = new(base_name(obj));
				obj2->set_amount((int)obj->query_amount()-amount);
				obj->set_amount( amount );
				res=do_get(me, obj);
				obj2->move(env);
//				if (me->is_fighting())
//					me->start_busy(3);
				return res;
			}
	}
	if (arg=="all")
	{
		if (me->is_fighting())
			return notify_fail("你还在战斗中!只能一次拿一样。\n");
		if (!env->query_max_encumbrance())
			return notify_fail("那不是容器。\n");
   	if (env->is_tree())
   		return notify_fail("这是给新手活命用的,还是不要太贪心了吧n");
		inv = all_inventory(env);
		if (!sizeof(inv))
		{
   		if (env->is_tree())
         		return notify_fail("树上什么也没有了。\n");
			return notify_fail("那里面没有任何东西。\n");
   	}        	
    if (sizeof(inv)>=20) all=1;
		for (i = 0; i < sizeof(inv); i ++)
		{
			if (inv[i]->is_character() 
			|| inv[i]->query("no_get")
			||inv[i]->query("taskobj")
			||inv[i]->query("owner"))
				continue;
			
			do_get(me, inv[i]);
		}
    if (env->is_character())
        msg = "$N从" + env->name() + "身上搜出了一堆东西。\n";
    else
     if (env == environment(me))
        msg = "$N把地上的东西都拣了起来。\n";
     else
        msg = "$N把" + env->name() + "里面的东西都拿了出来。\n";
 
		if (all!=1)
		write("捡好了。\n");
	  else
	   message_vision(msg,me);
		return 1;
	}
//	if (!objectp(obj = present(arg, env)))
	if( !objectp(obj = i_have( env,arg )) ) // me have item	
		return notify_fail("你附近没有这样东西。\n");
	else
		if( userp(obj))
		{
			if(!obj->query_temp("noliving/unconcious") )
				return notify_fail("你附近没有这样东西。\n");
		}
		else
		{
			if(living(obj))
				return notify_fail("你附近没有这样东西。\n");
		}

	if (obj->query("no_get"))
	  if (stringp(obj->query("no_get")))
      return notify_fail(obj->query("no_get"));
    else
  		return notify_fail("这个东西拿不起来。\n");
	return do_get(me, obj);
}
Exemplo n.º 4
0
int main(object me, string arg)
{
	object obj, old_target;

        seteuid(getuid());
  if((!wizardp(me) && environment(me)->query("no_fight"))||me->query("id")=="guest")
		return notify_fail("这里禁止对打。\n");

	if(!arg || !objectp(obj = present(lower_case(arg), environment(me))))
		return notify_fail("你想攻击谁?\n");
        arg = lower_case(arg);

	if( !obj->is_character() )
		return notify_fail("看清楚一点,那并不是生物。\n");

	if (obj->query("no_kill")) return
          notify_fail ("这家伙你不能动就是不能动。\n");

	if( obj->is_fighting(me) )
		return notify_fail("加油!加油!加油!\n");

	if( !living(obj) )
		return notify_fail(obj->name() + "已经无法战斗了。\n"); 

	if(obj==me)	return notify_fail("你不能攻击自己。\n");

if( !userp(obj) && !obj->accept_fight(me) ) return
    notify_fail ("看起来你砍不到"+obj->name()+"\n");

	if (in_edit(obj) || in_input(obj) || obj->query_temp("netdead"))
          return notify_fail ("等他醒过来再砍吧.\n");

	if( userp(obj) && (object)obj->query_temp("pending/fight")!=me ) {
		message_vision("\n$N对着$n说道:" 
			+ RANK_D->query_self(me) 
			+ me->name() + ",领教"
			+ RANK_D->query_respect(obj) + "的高招!\n\n", me, obj);
		if( objectp(old_target = me->query_temp("pending/fight")) )
			tell_object(old_target, YEL + me->name() + "取消了和你比试的念头。\n" NOR);
		me->set_temp("pending/fight", obj);
		tell_object(obj, YEL "如果你愿意和对方进行比试,请你也对" + me->name() + "("+(string)me->query("id")+")"+ "下一次 fight 指令。\n" NOR);
		write(YEL "由于对方是由玩家控制的人物,你必须等对方同意才能进行比试。\n" NOR);
		return 1;
	}

	if( obj->query("can_speak") ) {
		message_vision("\n$N对着$n说道:" 
			+ RANK_D->query_self(me) 
			+ me->name() + ",领教"
			+ RANK_D->query_respect(obj) + "的高招!\n\n", me, obj);


		me->fight_ob(obj);
		obj->fight_ob(me);
	} else {
		message_vision("\n$N大喝一声,开始对$n发动攻击!\n\n", me, obj);
		me->fight_ob(obj);
		obj->kill_ob(me);
	}

	return 1;
}
Exemplo n.º 5
0
void do_press_obj_str(object ob, string str) {
    ob->do_press( str );
}
Exemplo n.º 6
0
int perform(object me, object target)
{
        object weapon;
        string msg;
        string skill;
        int ap, pp, dp, damage;

        if (userp(me) && ! me->query("can_perform/shedao-qigong/xian"))
                return notify_fail("你现在还不会使用神龙再现!\n");

        if (! target)
        {
                me->clean_up_enemy();
                target = me->select_opponent();
        }

        if (! me->is_fighting(target))
                return notify_fail("「神龙再现」只能对战斗中的对手使用。\n");

        if (me->query_skill("shedao-qigong", 1) < 120)
                return notify_fail("你的蛇岛奇功修为有限,不能使用「神龙再现」!\n");

        if (me->query("neili") < 200)
                return notify_fail("你的真气不够,无法运用「神龙再现」!\n");

        if (objectp(weapon = me->query_temp("weapon")) &&
            weapon->query("skill_type") != "staff" &&
            weapon->query("skill_type") != "sword")
                return notify_fail("你使用的兵器不对,怎么使用「神龙再现」!\n");

        if (weapon)
                skill = weapon->query("skill_type");
        else
                skill = "unarmed";

        if (me->query_skill_mapped(skill) != "shedao-qigong")
                return notify_fail("你没有将" + (string)to_chinese(skill)[4..<1] +
                                   "激发为蛇岛奇功, 不能使用「神龙再现」!\n");

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

        switch (skill)
        {
        case "unarmed":
                msg = HIW "$N" HIW "轻身一跃,已然逼近$n" HIW "随即一掌向$p"
                      HIW "肩头按去,虚虚实实,暗藏千百变化。\n" NOR;
                break;

        case "sword":
                msg = HIW "$N" HIW "足不点地,飘然欺身上前,一剑刺出," +
                      weapon->name() + HIW "直指$n" HIW "腰间。" NOR;
                break;

        case "staff":
                msg = HIW "$N" HIW "手中" + weapon->name() +
                      HIW "吞吞吐吐,虚虚实实,化作一团光影,斜斜扫向$n"
                      HIW "腰间。\n" NOR;
                break;
        }

        ap = me->query_skill(skill) * 3 / 2 + me->query("level") * 20 + 
             me->query_skill("martial-cognize", 1);
        pp = target->query_skill("parry") + target->query("level") * 20 + 
             target->query_skill("martial-cognize", 1);
        dp = target->query_skill("dodge") + target->query("level") * 20 + 
             target->query_skill("martial-cognize", 1);
             
        if (ap / 2 + random(ap) > pp)
        {
                me->add("neili", -150);
                me->start_busy(2);
                damage = ap / 2 + random(ap / 2);
                msg += COMBAT_D->do_damage(me, target, REMOTE_ATTACK, damage, 50,
                                           HIR "$n" HIR "欲架不能,欲躲不得,一个闪失"
                                           ",被$P" HIR "打了个正中,鲜血迸流。\n" NOR);
        } else
        if (ap / 3 + random(ap) > dp)
        {
                me->add("neili", -180);
                me->start_busy(3);
                damage = ap / 2 + random(ap / 2);
                msg += COMBAT_D->do_damage(me, target, REMOTE_ATTACK, damage, 55,
                                           HIR "$n" HIR "见$P" HIR "这招极为精妙,不敢"
                                           "抵挡,慌忙后退跃开,却见$P" HIR "招式一变,竟然料敌在先,\n"
                                           "一招正中$p" HIR ",直打了个鲜血四下飞溅。\n" NOR);
        } else
        {
                me->add("neili", -100);
                me->start_busy(3);
                msg += CYN "$n" CYN "不敢怠慢,见招拆招,接连破去$P"
                       CYN "后续三十六道变化,不漏半点破绽。\n" NOR;
        }
        message_combatd(msg, me, target);

        return 1;
}
Exemplo n.º 7
0
void tell_player(object player, string message) {
    if((string)player->getenv("autowrap") == "on") message = "\n"+message;
    tell_object(player, message);
}
Exemplo n.º 8
0
int exert(object me, object target, int amount)
{
        int ammount; 
        if(me->query("class")!="beggar")
        return notify_fail("只有丐帮弟子才能领悟回力的奥妙。\n"); 
        if( target && target!=me )
                return notify_fail("「回力诀」只能用在自己身上。\n"); 
        amount = 100;
        
        if( (int)me->query("force") < amount*3 )
                return notify_fail("你的内力不够。\n");
                
        me->add("force", -amount*3);
        message_vision(HIY "$N闭目凝神,运转了一周混沌心法中的「回力诀」...\n"NOR,me);
        
        if ( (int)me->query_skill("huntunforce",1)<150) 
                {
                if (me->query("food")<100) me->set("food",100);
                message_vision(HIY"$N只觉丹田升起一股暖流,腹中空空的感觉顿时无影无踪。\n" NOR,me);
                }
        else {
                if (me->query("food")<100) me->set("food",100);
                if (me->query("water")<100) me->set("water",100);
                message_vision(
                        HIY"$N只觉丹田升起一股暖流,腹中空空的感觉顿时无影无踪。\n" NOR,me);
                message_vision(
                        HIG"$N觉得口干舌燥的感觉也消失了。\n"NOR,me);
             }  
        me->start_busy(3);
        return 1;
}
Exemplo n.º 9
0
int valid_leave(object me, string dir)
{
        int dam_gin,dam_sen,dam_kee;
        dam_gin = me->query("max_gin")/6;
        dam_sen = me->query("max_sen")/6;
        dam_kee = me->query("max_kee")/6;
        if( userp(me) && dir == "up" )
        {
                if ( me->query_skill("dodge") < 200 ) {
                        if ((int)me->query("kee") <= 50) {
                                message_vision("山冰如镜,狂风似刀,惊魂未定之间,$N但觉脚下一空,摔了下来......\n\n",me);
                                me->unconcious();
                        }
                        else {
                                me->start_busy(5);
                                me->receive_damage("kee",50);
                                message_vision("山冰如镜,狂风似刀,$N只觉脚下无根,立足不稳......\n\n",me);
                        }
                        return notify_fail("\n");
           }
                else {
                    switch ( random(10) ) {
                        case 1:         
                                if ((int)me->query("gin") < dam_gin || (int)me->query("kee") < dam_kee || (int)me->query("sen") < dam_sen) {
                                        message_vision(HIW"$N突然觉得脚下流冰浮动,四处哗哗作响,脚底一滑,竟已仰天摔了下去。\n"NOR,me);
                                        me->unconcious();
                                }
                                else {
                                        me->receive_damage("gin", dam_gin);
                                        me->receive_damage("kee", dam_kee);
                                        me->receive_damage("sen", dam_sen);
                                        message_vision(HIW"$N突然觉得脚底一滑,竟仰天摔了一跤。\n"NOR,me);
                                }
                                return notify_fail("\n");
                                break;
                        case 2:
                                message_vision(HIW"骤然之间,无数巨大的冰柱冰岩,在狂风中呼啸,炸裂,铺天盖地向$N头顶上砸来。。。\n\n"NOR,me);
                                if ( random(2) )
                                {
                                        message_vision(HIW"一块巨大无匹的冰石从天而降,砸向$N的额角,“轰。。。”\n"NOR,me);
                                        me->unconcious();
                                }
                                else
                                {
                                        message_vision(HIW"$N全身紧贴在岩石下,紧紧抓着凸出来的冰笋,终于躲过冰块,却不由得惊出一身冷汗!\n\n"NOR,me);
                                }
                                return notify_fail("\n");
                                break;
                        case 3:
                                message_vision(HIW"募地“轰隆”一声巨响,山摇地晃,闷雷阵阵,山崩了!\n\n"NOR,me);
                                me->unconcious();
                                return notify_fail("\n");
                                break;
                        case 4:
                                message_vision(HIW"远处隐隐传来轰轰巨响,响声愈来愈近,愈来愈猛,转瞬之间竟\n然是一个愈来愈大的雪球从山上滚下!\n\n"NOR,me);
                                message_vision(HIW"\n$N躲避不及,被大雪球紧紧的压在下边!\n\n"NOR,me);
                                if( me->query_kar()<12 || me->query_per()<12 )
                                {
                                        message_vision(HIW"$N浑身被压在冰块之中,血液都已被冻僵,眼前只是白芒芒的一片....\n\n"NOR,me);
                                   me->die();
                                }
                                else if ( me->query_kar()<16 || me->query_per()<16 )
                                {
                                        message_vision(HIW"$N气若游丝,渐渐奈不住稀薄的空气,神智逐渐模糊起来....\n\n"NOR,me);
                                        me->unconcious();
                                }
                                else
                                {
                                        message_vision(HIW"$N咬紧牙关,用尽全力往雪堆外挤,一寸,两寸......\n终于$N从雪堆里摇摇晃晃爬了出来......\n\n"NOR,me);
                                        me->start_busy(3);
                                }
                                return notify_fail("\n");
                                break;
                        }       
                }
        }
        return 1;
}  
Exemplo n.º 10
0
int main(object me, string arg)
{
    string id, src, dst ,room_name;
	// object link_ob, env=environment(me);
	object link_ob, env;

	seteuid(getuid());
	env = environment(me);

	if(env) room_name=file_name(env);
	if( !objectp(link_ob = me->query_temp("link_ob")) ) {
		// return notify_fail("你不是经由正常连线进入,不能储存。\n");
		me->set_temp( "link_ob", me );
		link_ob = me;
	}
	if( me->save() ) {
		if( env->query("valid_startroom") ) {
			me->set( "startroom", base_name(env) );
			write( HIW"当你下次连线进来时,将从此处进入狂想空间。\n"NOR );
		}
		else if( me->query("clan") )
			if( base_name(env) == CLAN_D->clan_query( me->query("clan/id"), "home" ) ) {
				me->set( "startroom", base_name(env) );
				write( HIW"当你下次连线进来时,将从此处进入狂想空间。\n"NOR );
			}
		write( HIY"档案储存完毕。\n请记得以 save -1 或 save -2 备份档案。\n"HIC"请随时以 help news 来观看狂想之任何最新异动。:)\n"NOR );
	}
	else return notify_fail( "\n\t存档失败...\n\n" );
	if( me != link_ob )
		link_ob->save();
	id = me->query("id");
	seteuid(ROOT_UID);
	src = sprintf( "/data/user/%s/%s.o", id[0..0], id );
	dst = sprintf( "/data/backup/user/%s", id[0..0] );
	if( file_size(dst) != -2 ) // 目录传回 -2,空档或不在传回 -1
	mkdirs(dst); // 新增的,会自动一层一层 mkdir
	dst += "/" + id + ".o";
	if( !cp( src, dst ) )
		return notify_fail( "无法备份您的资料档.\n" );
	src = sprintf( "/data/login/%s/%s.o", id[0..0], id );
	dst = sprintf( "/data/backup/login/%s", id[0..0] );
	if( file_size(dst) != -2 )
	mkdirs(dst);
	dst += "/"+id+".o";
	if (!cp (src, dst))
	  return notify_fail("无法备份您的资料档.\n");

	if (arg == "-1" || arg == "-2") {
	if( me->query("mud_age") < 10800 ) {
	  return notify_fail("你的年纪太小无法备份喔");}
	  src = sprintf ("/data/user/%s/%s.o", id[0..0], id);
	  dst = sprintf ("/data/backup2/user/%s", id[0..0]);
	  if (file_size(dst) != -2)
	    mkdirs(dst);
	  dst += "/"+id+".o";
	  if (!cp (src, dst))
	    return notify_fail("无法备份您的资料档.\n");
	}

	if (arg == "-1" || arg == "-2") {
	  src = sprintf ("/data/login/%s/%s.o", id[0..0], id);
	  dst = sprintf ("/data/backup2/login/%s", id[0..0]);
	  if (file_size(dst) != -2)
	    mkdirs(dst);
	  dst += "/"+id+".o";
	  if (!cp (src, dst))
	    return notify_fail("无法备份您的资料档.\n");
	}
	write (HIW"备份资料 ok.\n"NOR);
	return 1;
}
Exemplo n.º 11
0
int recruit_apprentice(object ob)
{
        if( ::recruit_apprentice(ob) )
                ob->set("class", "taoist");
}
Exemplo n.º 12
0
int main(object me, string arg)
{
   int i;
   string file, *search;
        string *default_search;
   int wildcard;

   // If no topic specified, give the topics.
   if( !arg ) {
     cat(HELP_DIR + "help/topics");
     return 1;
   }

   // Else, try if a command name is specified.
   seteuid(getuid());
   if( stringp(file = me->find_command(arg)) ) {
     notify_fail("有这个指令存在,但是并没有详细的说明文件。\n");
     return file->help(me);
   }
   //Now see if it aliases to a command.
   //mon 10/27/97
   if( stringp(file =
     me->find_command(ALIAS_D->process_global_alias(arg))) ) {
     notify_fail("有这个指令存在,但是并没有详细的说明文件。\n");
     return file->help(me);
   }

   // Search the individual search path first.
   if( pointerp(search = me->query("help_search_path")) ) {
     i = sizeof(search);
     while(i--) if( file_size(search[i] + arg)>0 ) {
        me->start_more( read_file(search[i] + arg) );
        return 1;
     }
   }

   // Support efun/lfun help with same name as other topics such as
   // ed() and ed command.
   // Using a "()" after the function name can prevent it being
   // interpreted as a user command with the same name. -- mon
   sscanf(arg, "%s()", arg);
   arg=replace_string(arg, "/", "");

        if(strsrch(arg,"*")>=0 || strsrch(arg,"?")>=0) wildcard=1;
   else wildcard=0;

   found=0;
   write("\n");

   // Finally, search the default search paths.
   // by snowcat feb 21 1998
   if (wizardp(me))
     default_search = DEFAULT_SEARCH_PATHS;
   else
     default_search = DEFAULT_PLAYER_SEARCH_PATHS;
   if( pointerp(default_search) ) {
     if(search_dir(default_search, arg, me, wildcard, wizardp(me))>0) {
       if(wildcard) write("找到"+chinese_number(found)+
         "个相关主题。\n");
       return 1;
          }
   }

   return notify_fail("没有针对这项主题的说明文件。\n");
}
Exemplo n.º 13
0
BOOST_PYTHON_DECL void delitem(object const& target, object const& key)
{
    if (PyObject_DelItem(target.ptr(), key.ptr()) == -1)
        throw_error_already_set();
}
Exemplo n.º 14
0
BOOST_PYTHON_DECL void setitem(object const& target, object const& key, object const& value)
{
    if (PyObject_SetItem(target.ptr(), key.ptr(), value.ptr()) == -1)
        throw_error_already_set();
}
Exemplo n.º 15
0
// ?! how to add features to RAG
bool build_rag(Rag_ui* rag, object watershed, object prediction)
{
    // there will be 0 padding around image
    unsigned width, height, depth; 

    boost::python::tuple watershed_shape(watershed.attr("shape"));
    boost::python::tuple prediction_shape(prediction.attr("shape"));

    width = boost::python::extract<unsigned>(watershed_shape[0]);
    std::cout << width << std::endl;
    height = boost::python::extract<unsigned>(watershed_shape[1]);
    std::cout << height << std::endl;
    depth = boost::python::extract<unsigned>(watershed_shape[2]);
    std::cout << depth << std::endl;

    unsigned int * watershed_array = new unsigned int[width*height*depth];
    double * prediction_array = new double[width*height*depth];

    unsigned int plane_size = width * height;

    for (unsigned int x = 0; x < width; ++x) {
        for (unsigned int y = 0; y < height; ++y) {
            for (unsigned int z = 0; z < depth; ++z) {
                watershed_array[x+y*width+z*plane_size] =
                    int(boost::python::extract<double>(watershed[boost::python::make_tuple(x,y,z)]));
                prediction_array[x+y*width+z*plane_size] =
                    boost::python::extract<double>(prediction[boost::python::make_tuple(x,y,z)]);
            }
        }
    }

    boost::shared_ptr<PropertyList<Label> > edge_list = EdgePropertyList<Label>::create_edge_list();
    rag->bind_property_list("median", edge_list);

    for (unsigned int x = 1; x < (width-1); ++x) {
        for (unsigned int y = 1; y < (height-1); ++y) {
            for (unsigned int z = 1; z < (depth-1); ++z) {
                unsigned long long curr_spot = x + y * width + z * plane_size;
                unsigned int spot0 = watershed_array[curr_spot];
                unsigned int spot1 = watershed_array[curr_spot-1];
                unsigned int spot2 = watershed_array[curr_spot+1];
                unsigned int spot3 = watershed_array[curr_spot-width];
                unsigned int spot4 = watershed_array[curr_spot+width];
                unsigned int spot5 = watershed_array[curr_spot-plane_size];
                unsigned int spot6 = watershed_array[curr_spot+plane_size];

                if (spot0 != spot1) {
                    rag_add_edge(rag, spot0, spot1, prediction_array[curr_spot], edge_list);
                }
                if (spot0 != spot2) {
                    rag_add_edge(rag, spot0, spot1, prediction_array[curr_spot], edge_list);
                }
                if (spot0 != spot3) {
                    rag_add_edge(rag, spot0, spot1, prediction_array[curr_spot], edge_list);
                }
                if (spot0 != spot4) {
                    rag_add_edge(rag, spot0, spot1, prediction_array[curr_spot], edge_list);
                }
                if (spot0 != spot5) {
                    rag_add_edge(rag, spot0, spot1, prediction_array[curr_spot], edge_list);
                }
                if (spot0 != spot6) {
                    rag_add_edge(rag, spot0, spot1, prediction_array[curr_spot], edge_list);
                }

            }
        }
    } 
    return true;
}
Exemplo n.º 16
0
int exert(object me, object target)
{
        if(me->query("family/family_name")!="南海普陀山")
                return notify_fail("你并非出家和尚,不能使用这项技能!\n");
	if( !target )
		return notify_fail("你要用真气为谁疗伤?\n");

	if( me->is_fighting() || target->is_fighting())
		return notify_fail("战斗中无法运功疗伤!\n");

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

	if( (int)target->query("eff_kee") < (int)target->query("max_kee") / 5 )
		return notify_fail( target->name() + "已经受伤过重,经受不起你的真气震□!\n");

	message_vision(
		HIY "$N坐了下来运起内功,将手掌贴在$n背心,缓缓地将真气输入$n体内....\n\n"
		"过了不久,$N额头上冒出豆大的汗珠,$n吐出一口瘀血,脸色看起来红润多了。\n" NOR,
		me, target );

	target->receive_curing("kee", 10 + (int)me->query_skill("force")/3 );
	me->add("force", -150);
	me->set("force_factor", 0);

	return 1;
}
Exemplo n.º 17
0
Arquivo: cloud2.c Projeto: cosin/XYJ
int valid_leave(object me, string dir)
{
        me->add("mana", -10);

	return ::valid_leave(me, dir);
}
Exemplo n.º 18
0
int next_sword(object me, object victim, object weapon, int damage)
{
	int wap,wdp;
	object ob;
	ob = victim->query_temp("weapon");
        if(victim->query("eff_qi") < 0 && victim->query("qi") < 0) 
        {
        message_vision(HIW"紧跟着剑光带过,"+weapon->name()+HIW"一剑从$n左肩直劈到右腰,这一剑势道之凌厉,端的是匪夷所思,只是闪电般一亮,$n已被斩成两截!\n"NOR, me,victim );
        
        }
        	
        else if( damage==RESULT_PARRY && objectp(ob = victim->query_temp("weapon")) ) 
        {
                
                wap = (int)weapon->weight() / 500
                        + (int)weapon->query("rigidity")
                        + (int)me->query_str()
                        + (int)me->query("jiali")
                        + (int)me->query_skill("songshan-jian")/3
                        + me->query_temp("songshan_xuli");
                wdp = (int)ob->weight() / 500
                        + (int)ob->query("rigidity")
                        + (int)victim->query_str()
                        + (int)victim->query("jiali")
                        + (int)victim->query_skill("parry")/3;
                wap = random(wap/2)+wap/2;

                if( wap > 3 * wdp ) {
	message_vision(HIY"$N手上"+weapon->name()+HIY"连连催劲,「」的一声响,与$n的"+ob->name()+HIY"一撞,喀喀喀十余声轻响过去,$n手中"+ob->name()+HIY"寸断,折成数十截掉在地下!\n"NOR, me,victim );
                        ob->unequip();
                        ob->move(environment(victim));
                        ob->set("name", "断碎的" + ob->query("name"));
//                      ob->set("value", (int)ob->query("value") / 10);
                        ob->set("value", 0);
                        ob->set("weapon_prop", 0);
                        victim->reset_action();
                } else if( wap > 2 * wdp ) {
                        message_vision(HIW"但是$N手上"+weapon->name()+HIW"连连催劲,$n手臂酸麻,虎口剧痛,"+ob->name()+HIW"登时脱手!\n" NOR,me,victim);
                        ob->unequip();
                        ob->move(environment(victim));
                        victim->reset_action();
                } else if( wap > wdp ) {
                        message_vision("$N只觉得手中" + ob->name() + "一震,险些脱手!\n",
                                victim);
                } else {
                        message_vision("$N的" + weapon->name() + "和$n的" + ob->name()
                                + "相击,冒出点点的火星。\n", me, victim);
                }
        }

        return 1;
}
Exemplo n.º 19
0
Arquivo: bai.c Projeto: mudchina/fy3
int main(object me, string arg)
{
	object ob, old_app;
	mapping family, skills;
	int i;
	string *skname;
	if( !arg ) return notify_fail("指令格式:[bai | apprentice] [cancel]|<对象>\n");

	if( arg=="cancel" ) {
		old_app = me->query_temp("pending/apprentice");
		if( !objectp(old_app) )
			return notify_fail("你现在并没有拜任何人为师的意思。\n");
		write("你改变主意不想拜" + old_app->name() + "为师了。\n");
		tell_object(old_app, me->name() + "改变主意不想拜你为师了。\n");
		me->delete_temp("pending/apprentice");
		return 1;
	}

	if( !(ob = present(arg, environment(me)))
	||	!ob->is_character() )
		return notify_fail("你想拜谁为师?\n");

	if(userp(ob))		return notify_fail("你无法拜玩家为师。\n");

	if( !living(ob) ) return notify_fail("你必须先把" + ob->name() + "弄醒。\n");

	if( ob==me ) return notify_fail("拜自己为师?好主意....不过没有用。\n");

	if( me->is_apprentice_of(ob) ) {
		message_vision("$N恭恭敬敬地向$n磕头请安,叫道:「师父!」\n", me, ob);
		return 1;
	}

	if( !mapp( ob->query("family") ) )
		return notify_fail(ob->name() + "既不属於任何门派,也没有开山立派,不能拜师。\n");

	// If the target is willing to recruit us already, we do it.
	if( (object)ob->query_temp("pending/recruit") == me ) {
              if( (string)me->query("family/family_name") != 
                            (string)ob->query("family/family_name") ) {
			message_vision(
				"$N决定背叛师门,改投入$n门下!!\n\n"
				"$N跪了下来向$n恭恭敬敬地磕了四个响头,叫道:「师父!」\n\n",
				me, ob);
                      me->set("mingwang", (int)me->query("mingwang")*2/3 );
                      me->add("betrayer",1);
		} else
			message_vision(
				"$N决定拜$n为师。\n\n"
				"$N跪了下来向$n恭恭敬敬地磕了四个响头,叫道:「师父!」\n\n",
				me, ob);

		ob->recruit_apprentice(me);
		ob->delete_temp("pending/recruit");

		tell_object(ob, "恭喜你新收了一名弟子!\n");
		family = me->query("family");
		printf("恭喜您成为%s的第%s代弟子。\n", me->query("family/family_name"),
			chinese_number( me->query("family/generation")));

		return 1;
	
	} else {

		old_app = me->query_temp("pending/apprentice");
		if( ob==old_app )
			return notify_fail("你想拜" + ob->name() + "为师,但是对方还没有答应。\n");
		else if( objectp(old_app) ) {
			write("你改变主意不想拜" + old_app->name() + "为师了。\n");
			tell_object(old_app, me->name() + "改变主意不想拜你为师了。\n");
		}

		message_vision("$N想要拜$n为师。\n", me, ob);
		me->set_temp("pending/apprentice", ob );
		if( userp(ob) ) {
			tell_object(ob, YEL "如果你愿意收" + me->name() + "为弟子,用 recruit 指令。\n" NOR);
		} else 
			ob->attempt_apprentice(me);
	
		return 1;
	}
}
Exemplo n.º 20
0
int valid_learn(object me)
{
	if ((int)me->query("max_neili") < 100)
		return notify_fail("你的内力不够。\n");
	return 1;
}
Exemplo n.º 21
0
int perform(object me, object target)
{
        object weapon;
        string str;
        int snowsword,moonforce,moondance,ini_damage_apply,times,damage;
   string desc_msg="";
  int sword_level;
        
        snowsword = (int)me->query_skill("snowsword", 1);
        moonforce = (int)me->query_skill("moonforce", 1);
        moondance = (int)me->query_skill("moondance", 1);
       
        if( !target ) target = offensive_target(me);

        if( !target
        ||      !target->is_character()
        ||      target->is_corpse()
        ||      target==me)
                return notify_fail("你要对谁施展「漫天飞雪」?\n");

        if(!me->is_fighting())
                return notify_fail("「漫天飞雪」只能在战斗中使用!\n");
        
        
        sword_level=(int)(snowsword/50);
        if( snowsword < 50)
                return notify_fail("你的风回雪舞剑法级别还不够,使用这一招会有困难!\n");

        if(me->query("family/family_name") != "月宫")
                return notify_fail("[漫天飞雪]是月宫不传之密!\n");
        
        if( moonforce < 50)
                return notify_fail("你的圆月心法修为不够,使用这一招会有困难!\n");
        
        if( moondance < 50)
                return notify_fail("你的冷月凝香舞级别还不够,使用这一招会有困难!\n");
                
        if( me->query("force_factor") > 0)
                return notify_fail("「漫天飞雪」绝技重招不重力。加力出招怎能剑走轻灵?\n");
        
        if( time()-(int)me->query_temp("wuxue_end") < 10 )
                return notify_fail("绝招用多就不灵了!\n");
   if ( sword_level <= 1 ) desc_msg = "" ; else
       desc_msg = chinese_number(sword_level);
  if ( sword_level > 9 ) desc_msg = "百";
        ini_damage_apply = me->query_temp("apply/damage");
        
        message_vision(HIW"\n$N轻叱一声,脚尖一点,身体急速上旋,在半空中一个折腰。
同时手腕轻抖,剑光闪动幻作漫天飞雪卷向$n。\n"NOR,me,target);
        damage=1;
        //前三剑
        message_vision(HIC"\n$N同时使出风回雪舞剑的前三招,在半空中压向$n。\n"NOR,me,target);
        
        me->set_temp("WX_perform", 5);
        damage=COMBAT_D->do_attack(me, target, me->query_temp("weapon"));

        if (damage < 1) me->add_temp("apply/damage",100);
        me->set_temp("WX_perform", 0);  
        damage=COMBAT_D->do_attack(me, target, me->query_temp("weapon")); 
        
        if (damage < 1) {me->add_temp("apply/damage",100);}
                else    {me->set_temp("apply/damage",ini_damage_apply);}
        me->set_temp("WX_perform", 6);
        damage=COMBAT_D->do_attack(me, target, me->query_temp("weapon"));

        //再两剑
        if( snowsword > 99 && moonforce > 99 && moondance > 99 )
            {
                message_vision(HIC"\n$N身体斜斜向上飘出,也不回头,反手就刺出了两招。\n"NOR,me);
                
                if (damage < 1) {me->add_temp("apply/damage",100);}
                    else    {me->set_temp("apply/damage",ini_damage_apply);}
                me->set_temp("WX_perform", 7);
                damage=COMBAT_D->do_attack(me, target, me->query_temp("weapon"));
             
                if (damage < 1) {me->add_temp("apply/damage",100);}
                    else    {me->set_temp("apply/damage",ini_damage_apply);}
                me->set_temp("WX_perform", 8);
                damage=COMBAT_D->do_attack(me, target, me->query_temp("weapon"));
              }
      
           //最后两剑
           if( snowsword > 149 && moonforce > 149 && moondance > 149 )
               {
                    message_vision(HIC"\n$N斜斜一再个翻身,长剑幻作千百支冰箭,夹着一股寒风扑向$n。\n"NOR,me,target);
                    
                    if (damage < 1) {me->add_temp("apply/damage",100);}
                         else    {me->set_temp("apply/damage",ini_damage_apply);}
                    me->set_temp("WX_perform", 9);
                    damage=COMBAT_D->do_attack(me, target, me->query_temp("weapon"));
      
                     if (damage < 1) {me->add_temp("apply/damage",300);}
                         else    {me->set_temp("apply/damage",ini_damage_apply);}
                    me->set_temp("WX_perform", 10);
                    COMBAT_D->do_attack(me, target, me->query_temp("weapon"));
            
                     if (target->query("eff_kee")<0 || !living(target))  
                       {str=HIG+target->name()+NOR+HIM"被"HIY+me->name()+NOR+HIM"用月宫绝招"HIC"『"HIW"漫天飞雪"HIC"』"NOR+HIM"杀死了。听说尸体上有"HIR+desc_msg+"十"NOR+HIM"多道深可见骨的伤痕!";
                        message("channel:rumor",HIM"【谣言】某人:"+str+"\n"NOR,users());
                       }
                  }
                        
        me->delete_temp("WX_perform");
        me->set_temp("apply/damage",ini_damage_apply);
        

        if( !target->is_fighting(me) ) {
                if( living(target) ) {
                        if( userp(target) ) target->fight_ob(me);
                        else target->kill_ob(me);
                }
        }

        me->set_temp("wuxue_end",time());
        return 1;
}
Exemplo n.º 22
0
int valid_learn(object me)
{
    int lvl = (int)me->query_skill("jidao-shaqi", 1);

    if ((int)me->query_skill("force", 1) < 30)
        return notify_fail("你的基本内功火候还不够,还不能学习极道煞气。\n");

    if (
    me->query_skill("bahuang-gong",1)    // 灵鹫:八荒六合功
    || me->query_skill("beiming-shengong",1)    // 逍遥:北冥神功
    || me->query_skill("bibo-shengong",1)    // 桃花:碧波神功
    || me->query_skill("chunyang-gong",1)    // 大理:纯阳功
    || me->query_skill("hamagong",1)    // 白驼:蛤蟆功
    || me->query_skill("huagong-dafa",1)    // 星宿:化功大法
    || me->query_skill("huntian-qigong",1)    // 丐帮:混天气功
    || me->query_skill("hunyuan-yiqi",1)    // 少林:混元一气功
    || me->query_skill("jiuyang-shengong",1)    // 少林:九阳神功
    || me->query_skill("linji-zhuang",1)    // 峨嵋:临济十二庄
    || me->query_skill("longhu-baqi",1)    // 武官:龙虎霸气
    || me->query_skill("nilian-shengong",1)    // 白驼:逆练神功
    || me->query_skill("shenlong-zhanqi",1)    // 神龙:神龙战气
    || me->query_skill("taiji-shengong",1)    // 武当:太极神功
    || me->query_skill("wolong-xingfa",1)    // 巡捕:卧龙心法
    || me->query_skill("wuwang-shenzhou",1)    // 凌霄城:无妄神咒
    || me->query_skill("xiantian-gong",1)    // 全真:先天功
    || me->query_skill("xiawuxiang",1)    // 雪山:小无相功
    || me->query_skill("xuanmen-neigong",1)    // 全真:玄门内功
    || me->query_skill("yunlong-shengong",1) // 云龙:云龙神功
    || me->query_skill("zixia-shengong",1) )    // 华山:紫霞神功
        return notify_fail("你不先散了别派内功,怎能学极道煞气?!\n");
    return 1;
}
Exemplo n.º 23
0
int perform(object me, object target)
{
    string msg;
    int step,fist,extra;

    if( !target ) target = offensive_target(me);
    if( !target
            ||      !target->is_character()
            ||      !me->is_fighting(target) )
        return notify_fail("[掌腿双飞]只能对战斗中的对手使用。\n");

    step = me->query_skill("doomsteps",1);
    fist = me->query_skill("doomstrike",1);

    if (step< 100) return notify_fail("你的[寒天神掌]不够熟练。\n");
    if (fist< 100) return notify_fail("你的[吹血步法]不够熟练。\n");

    if (me->query("class")=="fighter") {
        fist= fist*3/2;
        step=step*3/2;
    }

    me->add_temp("apply/attack", fist);
    me->add_temp("apply/damage", fist*2);
    msg = HIR  "$N使出[九重寒天掌],全身飞速旋转,双掌一前一后,闪电般的击向$n!" NOR;
    COMBAT_D->do_attack(me,target, TYPE_PERFORM,msg);
    me->add_temp("apply/attack", -fist);
    me->add_temp("apply/damage", -fist*2);

    me->add_temp("apply/attack", step);
    me->add_temp("apply/damage",step*2);
    msg = HIR  "$N猛一个翻身,迅捷无比地向$n踢出飞天一腿!" NOR;
    COMBAT_D->do_attack(me,target, TYPE_PERFORM,msg,"瘀伤");
    me->add_temp("apply/attack", -step);
    me->add_temp("apply/damage",-step*2);

    if (me->query("class")=="fighter" || !userp(me)) {
        if (me->query_busy()<2) me->start_busy(2);
    } else {
        if (me->query_busy()<3) me->start_busy(3);
    }
    return 1;
}
Exemplo n.º 24
0
int perform(object me, object target)
{
        object weapon, ob;
        string msg;
        int i;
        int extra;
i = me->query_skill("bibo-shengong", 1) * 3 / 10;
        if( !target ) target = offensive_target(me);
        if( !me->is_fighting() )
                return notify_fail("「狂风绝技」只能在战斗中对对手使用。\n");

        if (me->query_temp("weapon") || me->query_temp("secondary_weapon"))
                return notify_fail("「狂风绝技」开始时不能拿着兵器!\n");

        if ((int)me->query("neili") < 150)
                return notify_fail("你的真气不够!\n");

        if ((int)me->query_skill("force") < 100)
                return notify_fail("你的内功水平不够!\n");

        if ((int)me->query_skill("luoying-shenzhang", 1) < 100 ||
            me->query_skill("xuanfeng-leg",1) < 100)
                return notify_fail("你的腿掌功夫还不到家,无法使用狂风绝技!\n");

        if (me->query_skill_prepared("unarmed") != "xuanfeng-leg")
                return notify_fail("你没有准备旋风腿法,无法施展狂风绝技。\n");

        msg = HIY "$N" HIY "使出桃花岛绝技「狂风绝技」,身法飘忽"
              "不定,有若天仙!\n" NOR;
         message_vision(msg, me);
         me->add_temp("apply/attack", i);
        {
                msg = YEL  "\n$N" YEL"聚力于左掌,右腿一脚跟着踢出!\n"NOR;
                message_vision(msg,me,target);
                COMBAT_D->do_attack(me,target,weapon,TYPE_REGULAR,msg);

                msg = HIM  "人影中," HIM "$N" HIM "翻身而起,左掌大力得挥向$n!\n"NOR;
                message_vision(msg,me,target);
                COMBAT_D->do_attack(me,target,weapon,TYPE_REGULAR,msg);

                msg = YEL "\n$N" YEL "见" YEL "$n" YEL "门户大开,暗运内力,双腿连环踢向" YEL "$n!\n"NOR;
                message_vision(msg,me,target);
                COMBAT_D->do_attack(me,target,weapon,TYPE_REGULAR,msg);

                msg = HIM  "$N" HIM "越战越勇,周围骤起一阵旋风,使得" HIM "$n" CYN "看不清方向!\n"NOR;
                message_vision(msg,me,target);
                COMBAT_D->do_attack(me,target,weapon,TYPE_REGULAR,msg);

                msg = YEL "\n$N" YEL "如星光乍现,右掌略带悠然之色轻拍" YEL "$n!\n"NOR;
                message_vision(msg,me,target);
                COMBAT_D->do_attack(me,target,weapon,TYPE_REGULAR,msg);

                msg = HIM "$N" HIM "长啸一声,面如赤发,忽然转到" HIM "$n" HIM"身后,反手又是一掌!\n"NOR;
                message_vision(msg,me,target);
                COMBAT_D->do_attack(me,target,weapon,TYPE_REGULAR,msg);

        }
        me->add("neili", -100);
        me->start_busy(1 + random(2));
        me->add_temp("apply/attack", -i);
        return 1;
}
Exemplo n.º 25
0
void do_press_obj(object ob, string name) {
    ob->do_press();
}
Exemplo n.º 26
0
Arquivo: scythe.c Projeto: ehershey/pd
int weapon_hit(object atk)
{
    int result;
    if(random(100) < 10) {
        write("%^BOLD%^%^BLACK%^Your eyes sparkle as the %^RESET%^ORANGE%^S%^BOLD%^%^BLACK%^cyt%^RESET%^%^ORANGE%^he%^RESET%^%^BOLD%^%^BLACK%^ hacks at your opponent.");
        say(""+(string)this_player()->query_cap_name()+"%^BOLD%^%^BLACK%^'s %^BOLD%^%^RED%^e%^RESET%^%^RED%^y%^BOLD%^%^RED%^e%^RESET%^%^RED%^s%^RESET%^%^BOLD%^%^BLACK%^ twinkle with %^RED%^e%^BOLD%^%^RED%^vi%^RESET%^%^RED%^l%^BOLD%^%^BLACK%^ as he hacks away at "+atk->query_cap_name()+".");
       
result=(random(60))+((this_player()->query_level()));
  }
}
Exemplo n.º 27
0
int update_condition(object me, int duration)
{
	if (duration < 1) return 0;
	me->apply_condition("quanzhen_drug", duration - 1);
	return 1;
}
Exemplo n.º 28
0
int cast(object me, object target)
{
        string msg;
        int damage, ap, dp;
        int extradam;

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

        if((int)me->query_skill("gouhunshu",1) < 100 )
                return notify_fail("你的勾魂术不够高!\n");
        if(me->query("family/family_name")!="阎罗地府")
                return notify_fail("你不是地府弟子,不能使用这项技能!\n");
        if( !target
        ||      !target->is_character()
        ||      target->is_corpse()
        ||      target==me)
                return notify_fail("你要对谁施展魂飞魄散?\n");

        if((int)me->query("kee") < 25 )
                return notify_fail("你的气血不够!\n");

        me->receive_wound("kee", 25);
        msg = HIC "$N口中不断的念着咒文,只见阴气不停的向$n扑去!\n\n" NOR;

        ap = me->query_skill("gouhunshu");
        extradam = ap/2;
        ap = ( ap * ap /100 * ap / 4 ) * (int)me->query("sen") ;
        dp = target->query("combat_exp");
        if( random(ap + dp) > dp ) {
                damage = me->query("bellicosity") /50 ;
                        msg +=  RED "阴气逐渐包围了$p的身体!\n" NOR;
                         message_vision(msg, me, target);
                         if (damage > 1000) damage = 975 + random(50);
                        target->receive_damage("kee", damage, me);
                        target->receive_wound("kee", damage/3, me);
                        if( damage > 0 ) COMBAT_D->report_status(target);

        } else
                {
                msg += "但是被$n发现了!!\n";
                message_vision(msg, me, target);
                target->kill_ob(me);
                me->kill_ob(target);
                }
        me->start_busy(2);
        return 1;
}
Exemplo n.º 29
0
void do_ring_obj(object ob) {
    ob->ring();
}
Exemplo n.º 30
0
BOOST_PYTHON_DECL object getslice(object const& target, handle<> const& begin, handle<> const& end)
{
    return object(
        detail::new_reference(
            apply_slice(target.ptr(), begin.get(), end.get())));
}