damage.c

来自「C实现的MUD,对大家基本入门网络游戏很有帮助!」· C语言 代码 · 共 474 行 · 第 1/2 页

C
474
字号
		this_object()->set("eff_jing",100);		this_object()->set("jing",1);		this_object()->set("eff_qi",100);		this_object()->set("qi",1);		return;	}        //比武区不死        if (userp(this_object())&&environment(this_object())->query("biwu"))        {                message_vision(HIR "比武之地,只分胜负,不分生死。$N被打败了但却偷得一命。\n" NOR, this_object());                this_object()->set("eff_jing",this_object()->query("max_jing")/2);                this_object()->set("jing",1);                this_object()->set("eff_qi",this_object()->query("max_qi")/2);                this_object()->set("qi",1);                return;        }        if(userp(this_object())&& this_object()->is_ghost()){                message_vision(HIC "死人没有办法再死一次。\n" NOR, this_object());                message_vision(HIG "$N的魂魄回到了阴间。\n" NOR, this_object());		this_object()->set("jing", 10);		this_object()->set("eff_jing", 10);		this_object()->set("qi", 10);		this_object()->set("eff_qi", 10);		this_object()->move(DEATH_ROOM);}        if (userp(this_object())&& environment(this_object())->query("bwdhpk"))        {                message_vision(HIR "比武之地,只分胜负,不分生死。$N被打败了但却偷得一命。\n" NOR, this_object());                message_vision(HIR "$N被抬了下去。\n" NOR, this_object());	if( objectp(killer = query_temp("last_damage_from")) ){	killer->add_temp("bwdhpk",1);message("channel:chat", HIC"【屠人战况】"HIR + " "+this_object()->query("name")+"被"+killer->query("name")+"打出了屠人大会!\n"NOR,users() );}	  this_object()->set("eff_jing", (int)this_object()->query("max_jing"));	  this_object()->set("jing", (int)this_object()->query("max_jing"));	  this_object()->set("eff_qi", (int)this_object()->query("max_qi"));	  this_object()->set("qi", (int)this_object()->query("max_qi"));	  this_object()->set("jingli", (int)this_object()->query("max_jingli"));	  this_object()->set("neili", (int)this_object()->query("max_neili"));	  this_object()->set("food", (int)this_object()->max_food_capacity());	  this_object()->set("water", (int)this_object()->max_water_capacity());	  this_object()->remove_all_killer();	  this_object()->clear_condition();          this_object()->move("/d/pk/pk/ready");          return;}        if (userp(this_object())&& environment(this_object())->query("citybiwu"))        {                message_vision(HIR "比武之地,只分胜负,不分生死。$N被打败了但却偷得一命。\n" NOR, this_object());                message_vision(HIR "$N被抬了下去。\n" NOR, this_object());		this_object()->set("jing", 50);			this_object()->set("eff_jing", 50);		this_object()->set("qi", 50);		this_object()->set("eff_qi", 50);                this_object()->remove_all_killer();                this_object()->unconcious();                this_object()->move("d/city/wudao4");                return;        }	// Clear all the conditions by death.this_object()->remove_all_killer();if (!this_object()->query_condition("killer")){	this_object()->clear_condition();}    //call clear not here , in combatd.c         this_object()->set("killbyname","死因不明");	COMBAT_D->announce(this_object(), "dead");	if( objectp(killer = query_temp("last_damage_from")) &&		file_name(environment(killer)) == file_name(environment(this_object())))	{		this_object()->add("normal_die", 1);		set_temp("my_killer", killer->query("id"));		COMBAT_D->killer_reward(killer, this_object());	}	else	message("channel:rumor", HIM"【谣言】"+"听说"+this_object()->name()+    "死了 死因不明。\n"NOR, users());	this_object()->add("dietimes",1);        if (!environment(this_object())->query("no_death_penalty"))        {		if (this_object()->query("combat_exp")>500000		||this_object()->query_condition("killer")){	this_object()->add("combat_exp", -(int)this_object()->query("combat_exp") / 200);}        }			if( objectp(corpse = CHAR_D->make_corpse(this_object(), killer)) )	{		corpse->move(environment());// 超度用的经验值		corpse->set("combat_exp", this_object()->query("combat_exp"));// 死者是玩家		if (userp(this_player()))			corpse->set("userp", 1);	}	this_object()->remove_all_killer();	all_inventory(environment())->remove_killer(this_object());	this_object()->dismiss_team();	if( userp(this_object()) ) {		if (this_object()->is_busy())			this_object()->interrupt_me();		set("jing", 1);	set("eff_jing", 1);		set("qi", 1);	set("eff_qi", 1);		ghost = 1;		this_object()->move(DEATH_ROOM);		DEATH_ROOM->start_death(this_object());	} else		destruct(this_object());}void reincarnate(){	ghost = 0;	set("eff_jing", query("max_jing"));	set("eff_qi", query("max_qi"));}int max_food_capacity() { return query_weight() / 200; }int max_water_capacity() { return query_weight() / 200; }int heal_up(){	int update_flag, i;	mapping my;	object ob=this_object();     	//	object where = environment(me);//	if( this_object()->is_fighting() ) return -1;	update_flag = 0;	my = query_entire_dbase();	if( my["water"] > 0 ) 	{	 my["water"] -= 1;update_flag++; 	}	if( my["food"] > 0 ) 	{	my["food"] -= 1;	if ( my["food"] == ob->max_food_capacity()*0.3 )		tell_object(ob,HIY "\n你肚子咕咕直叫,看来得吃点东西了。\n"NOR);	if ( my["food"] == ob->max_food_capacity()*0.1 )		{		tell_object(ob,HIY "\n你饿得直发慌,赶快吃点东西吧。\n"NOR);		ob->delete_temp("foods");		}	update_flag++; 	}/*	else	{	if (!ob->query_temp("foods"))		{tell_object(ob,HIR "\n你饿得直冒金星,实在是顶不住了。\n"NOR);		ob->set_temp("foods",10);}			if ((int)ob->query_temp("foods") > 1) ob->add_temp("foods",-1);		else {tell_object(ob,HIR "\n你饿得快要死了。。。。\n"NOR);                          if (userp(this_object())&& environment(this_object())->query("pingan") && (int)this_object()->query("age") <= 17)		        {tell_object(ob,HIY "还好这儿是平安城,永远不会有饿死的人,平安之光照得你精神饱满。\n"NOR);			ob->set("food",ob->max_food_capacity());ob->set("water",ob->max_water_capacity());			}else			if (wizardp(ob))			{tell_object(ob,HIY "还好你是神仙,只见你伸手一招,变出了一大堆好吃的\n"+					"哇,还有汉堡包耶!,你哗啦两下就吃光了,看来你真是饿坏了!\n"NOR);			ob->set("food",ob->max_food_capacity());ob->set("water",ob->max_water_capacity());			}else			if ((int)ob->query("age")<15) 			{			tell_object(ob,HIY "还好你没过断奶期。。。你掏出一支奶瓶狠狠的吸了两口,觉得好过多了。\n"NOR);			ob->set("food",ob->max_food_capacity());ob->set("water",ob->max_water_capacity());			}else			{if (userp(ob))			ob->unconcious();			ob->set_temp("foods",10);			}		}		update_flag++; 	}*/	if( my["water"] < 1 && userp(this_object()) ) return update_flag;    	i = my["con"] / 3 + my["max_jingli"] / 10;	if (ob->is_fighting()) i /= 3;	my["jing"] += i;	if( my["jing"] >= my["eff_jing"] ) {		my["jing"] = my["eff_jing"];		if( my["eff_jing"] < my["max_jing"] ) { my["eff_jing"] ++; update_flag++; }	} else update_flag++;	i = my["con"] / 3 + my["max_neili"] / 10;	if (ob->is_fighting()) i /= 3;	my["qi"] += i;	if( my["qi"] >= my["eff_qi"] ) {		my["qi"] = my["eff_qi"];		if( my["eff_qi"] < my["max_qi"] ) { my["eff_qi"] ++; update_flag++; }	} else update_flag++;	if( my["food"] < 1 && userp(this_object()) ) return update_flag;	if( my["max_jingli"] && my["jingli"] < my["max_jingli"] ) {		my["jingli"] += (int)this_object()->query_skill("magic", 1) / 2;		if( my["jingli"] > my["max_jingli"] ) my["jingli"] = my["max_jingli"];		update_flag++;	}	if( my["max_neili"] && my["neili"] < my["max_neili"] ) {	    i = (int)this_object()->query_skill("force", 1) / 2;		if (ob->is_fighting()) i /= 3;		my["neili"] += i;		if( my["neili"] > my["max_neili"] ) my["neili"] = my["max_neili"];		update_flag++;	}	if (ob->query("szj/passed") && ob->query("szj/over200") && my["max_neili"] && my["neili"] < my["max_neili"] * 3 / 2	&& (int)ob->query_skill("shenzhao-jing", 1) > 100) {		tell_object(ob, WHT"你潜运「神照经」心法,将天地二气交泰于身,顿觉自己内力源源不止了。\n"NOR);		i = (int)ob->query_skill("shenzhao-jing", 1);		if (ob->is_fighting()) i /= 2;		my["neili"] += i + random(i * 2);		if( my["neili"] > my["max_neili"] * 3 / 2) my["neili"] = my["max_neili"] * 3 / 2;		update_flag++;	}	return update_flag;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?