• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ object类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中object的典型用法代码示例。如果您正苦于以下问题:C++ object类的具体用法?C++ object怎么用?C++ object使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了object类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getitem

BOOST_PYTHON_DECL object getitem(object const& target, object const& key)
{
    return object(detail::new_reference(
                      PyObject_GetItem(target.ptr(), key.ptr())));
}
开发者ID:AsherBond,项目名称:PDAL,代码行数:5,代码来源:object_protocol.cpp


示例2: do_press_obj_with_obj

void do_press_obj_with_obj(object ob1, object ob2) {
    ob1->do_press( ob2 );
}
开发者ID:ClockworkSoul,项目名称:MortalRemains,代码行数:3,代码来源:press.c


示例3: main

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");
		}
//.........这里部分代码省略.........
开发者ID:aricxu,项目名称:xkx100,代码行数:101,代码来源:get.c


示例4: main

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;
}
开发者ID:szhowardhuang,项目名称:fs2,代码行数:62,代码来源:fight.c


示例5: do_press_obj_str

void do_press_obj_str(object ob, string str) {
    ob->do_press( str );
}
开发者ID:ClockworkSoul,项目名称:MortalRemains,代码行数:3,代码来源:press.c


示例6: perform

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;
}
开发者ID:mudchina,项目名称:nitan3,代码行数:97,代码来源:xian.c


示例7: tell_player

void tell_player(object player, string message) {
    if((string)player->getenv("autowrap") == "on") message = "\n"+message;
    tell_object(player, message);
}
开发者ID:ehershey,项目名称:pd,代码行数:4,代码来源:tell_player.c


示例8: exert

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;
}
开发者ID:mudchina,项目名称:fy4,代码行数:31,代码来源:huilijue.c


示例9: valid_leave

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;
}  
开发者ID:mudchina,项目名称:fy4,代码行数:78,代码来源:bingao.c


示例10: main

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;
}
开发者ID:,项目名称:,代码行数:71,代码来源:


示例11: recruit_apprentice

int recruit_apprentice(object ob)
{
        if( ::recruit_apprentice(ob) )
                ob->set("class", "taoist");
}
开发者ID:gongfuPanada,项目名称:mhxy2002,代码行数:5,代码来源:guangyun.c


示例12: main

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");
}
开发者ID:gongfuPanada,项目名称:xyj45,代码行数:65,代码来源:help.c


示例13: delitem

BOOST_PYTHON_DECL void delitem(object const& target, object const& key)
{
    if (PyObject_DelItem(target.ptr(), key.ptr()) == -1)
        throw_error_already_set();
}
开发者ID:AsherBond,项目名称:PDAL,代码行数:5,代码来源:object_protocol.cpp


示例14: setitem

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();
}
开发者ID:AsherBond,项目名称:PDAL,代码行数:5,代码来源:object_protocol.cpp


示例15: build_rag

// ?! 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;
}
开发者ID:qedq,项目名称:NeuroProof,代码行数:71,代码来源:pythonRagInterface.cpp


示例16: exert

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;
}
开发者ID:gongfuPanada,项目名称:xyj2006,代码行数:27,代码来源:lifeheal.c


示例17: valid_leave

int valid_leave(object me, string dir)
{
        me->add("mana", -10);

	return ::valid_leave(me, dir);
}
开发者ID:cosin,项目名称:XYJ,代码行数:6,代码来源:cloud2.c


示例18: next_sword

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;
}
开发者ID:heypnus,项目名称:xkx2001,代码行数:52,代码来源:songshan-jian.c


示例19: main

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;
	}
}
开发者ID:mudchina,项目名称:fy3,代码行数:82,代码来源:bai.c


示例20: valid_learn

int valid_learn(object me)
{
	if ((int)me->query("max_neili") < 100)
		return notify_fail("你的内力不够。\n");
	return 1;
}
开发者ID:heypnus,项目名称:xkx2001,代码行数:6,代码来源:songshan-jian.c



注:本文中的object类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ objectRegistry类代码示例发布时间:2022-05-31
下一篇:
C++ obj_map类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap