// 威震八方
int Rule = 5;
int RoundTime = 25;
int PlayerSpawn = 0;
int PlayerSpawnDir = 0;
int PlayerWeapon = 5;
int PlayerWeapon2 = 0;
int PlayerHP = 4000;
OnStart()
{
	AddNPC("npc22_01");
	AddNPC("npc22_02");
	AddNPC("npc22_03");
	AddNPC("npc22_04");
	AddNPC("npc22_05");
	AddNPC("npc22_06");
	AddNPC("npc22_07");
	AddNPC("npc22_08");
}
int player;
int trg0;
int trg1;
int trg2;
int timer0;
int timer1;
int timer2;
int timer3;
int s1;
int s2;
int s3;
int s4;
int k1;
int k2;
int k3;
int ex1;
int ex2;
int ex3;
int ex4;
int cc1;
int cc2;
int cc3;
int cc4;
int con;
int i;
int gameover; 
SaySTG(int man)
{
	Perform(man, "pause", 5);
	Perform(man, "say", "杀.....");
	Perform(man, "pause", 2);
	Perform(man, "faceto", 1);

	PlayerPerform("block", 0);
	PlayerPerform("pause", 2);
	PlayerPerform("say", "怎么回是？");
	PlayerPerform("pause", 5);
	PlayerPerform("say", "你伤疗的如何了？");
	PlayerPerform("block", 1);
}

SaySTG2(int man)
{
	Perform(man, "pause", 5);
	Perform(man, "say", "杀.....");
	Perform(man, "pause", 2);
	Perform(man, "faceto", 1);

	PlayerPerform("block", 0);
	PlayerPerform("pause", 2);
	PlayerPerform("say", "失心散起作用了吗？先制服他吧！！");
	PlayerPerform("pause", 5);
	PlayerPerform("say", "你伤疗的如何了？");
	PlayerPerform("block", 1);
}

EXITWAR(int man)
{
	Perform(man, "say", "我明白了！！");
	Perform(man, "pause", 5);
	Perform(man, "say", "是么？？");
	Perform(man, "pause", 5);
	Perform(man, "say", "孟星魂？");
	Perform(man, "pause", 2);
	Perform(man, "faceto", 1);

	PlayerPerform("block", 0);
	PlayerPerform("pause", 3);
	PlayerPerform("say", "先离开这吧！");
	PlayerPerform("pause", 5);
	PlayerPerform("say", "有人用我的样子给你们下药了！！");
	PlayerPerform("pause", 5);
	PlayerPerform("say", "清醒一点了吗？");
	PlayerPerform("block", 1);
	
	return 0;
}

OnUpdate()
{	
	int now = GetGameTime();
	if (trg0==0)
	{
		int player = GetAnyChar("player");
		int c1 = GetChar("孟星魂");
		int c2 = GetChar("无名");
		int c3 = GetChar("小何");
		int c4 = GetChar("孙剑");
		int c5 = GetChar("凤凤");
		int c6 = GetChar("叶翔");
		int c7 = GetChar("石群");
		int c8 = GetChar("高寄萍");
		if ( player >0 && c8 > 0 && c5 > 0 && c6 > 0 && c7 > 0 && c1 > 0)
		{
			if (GetEnemy(c1)==player)
			{
				Perform(c1, "say", "领教了！！");
				Perform(c1, "pause", 5);
				Perform(c1, "say", "想知道我是谁，就打败我吧！！");
				Perform(c1, "pause", 3);
				Perform(c1, "say", ".虽然上头没令我宰了你，但是..我就不相信你有多强！");
				Perform(c1, "pause", 5);
				Perform(c1, "say", "哈哈！你没看到我就是你呀！！");
				Perform(c1, "pause", 5);
				Perform(c1, "say", "哇靠！居然碰到本尊！！");
				Perform(c1, "pause", 2);
				Perform(c1, "crouch", 30);
				Perform(c1, "faceto", player);

				PlayerPerform("block", 0);
				PlayerPerform("pause", 3);
				PlayerPerform("say", "是吗？休怪我无情了！！");
				PlayerPerform("pause", 8);
				PlayerPerform("say", "笑话！我就是我，你究竟是谁？");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "不说个明白..休想离开这里！！");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "！！你是谁？为何假冒我？来到我快活林疗伤之处？");
				PlayerPerform("block", 1);

				trg0 = 1;
			}
		}

	}
	if (trg0==1)
	{
		if (GetHP(c1)<=0 )
		{ 
			Say(c1,  "我刚才用你的样子给快活林一些疗伤药中..渗了实心散！");
			Say(c1,  "哈哈哈！他们现在是见人就砍的状况！！哈哈哈！！祝你好运了！！");
			Say(player, "混帐！！");
			trg0 = 2;
		}
	}
	if (trg0 <2 && c8 > 0)
	{
		if (GetEnemy(c2)==player && s1 == 0)
		{
			Perform(c2, "say", "你无须知道！！");
			Perform(c2, "pause", 5);
			Perform(c2, "say", "呵呵！要死掉的人不用说那么多！我只能说这是我上面的人意思！");
			Perform(c2, "pause", 5);
			Perform(c2, "say", "呵呵！来执行任务！！");
			Perform(c2, "pause", 2);
			Perform(c2, "crouch", 30);
			Perform(c2, "faceto", player);

			PlayerPerform("block", 0);
			PlayerPerform("pause", 3);
			PlayerPerform("say", "上面的人？");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "任务？什么任务？");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "是你！你为什么会在这？");
			PlayerPerform("block", 1);
				
			s1 = 1;
		}
		if (GetEnemy(c3)==player && s2 == 0)
		{
			Perform(c3, "say", "孟星魂！我今天要跟你一分高下！！");
			Perform(c3, "faceto", player);

			PlayerPerform("block", 0);
			PlayerPerform("say", "那就领教了！！");
			PlayerPerform("pause", 3);
			PlayerPerform("block", 1);
			s2 = 1 ;
		}
		if (GetEnemy(c4)==player && s3 == 0)
		{
			Perform(c4, "say", "多说无益！！受死吧！！");
			Perform(c4, "pause", 5);
			Perform(c4, "say", "孙玉伯是我老子！他被你们这群快活林的无赖杀了！我一定要报仇！");
			Perform(c4, "pause", 5);
			Perform(c4, "say", "我要来为我父亲报仇！！");
			Perform(c4, "pause", 2);
			Perform(c4, "faceto", player);

			PlayerPerform("block", 0);
			PlayerPerform("pause", 3);
			PlayerPerform("say", "是你父亲要杀我们的！！");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "你父亲？");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "你是谁！？为何闯入快活林的疗伤处？");
			PlayerPerform("block", 1);
			
			s3 = 1;
		}
		for (i=6;i<=9;i++)
		{
			if (GetEnemy(i)==player && s4 == 0 && c8 > 0)
			{
				SaySTG(i);
				s4 = 1;
			}
			if (GetHP(i) < GetMaxHP(i) && s4 == 1)
			{
				Say(player,"啊！我居然不明究理的打了他们！！");
				timer1 = now + 2; 
				s4 = 5;
				gameover = -1;
			}
		}
	}
	if (GetHP(c4)<=0 && k1 == 0)
	{
		Say(c4, "快活林的！你给我记住！！父仇不共戴天！我会再来的！");
		RemoveNPC(c4);
		k1 = 1;
	}
	if (GetHP(c3)<= 0 && k1 == 0)
	{
		Say(c3,"终究打不败你...我恨啊！！");

		k1 = 1 ;
	}
	if (trg0==2)
	{
		if (GetHP(player) >0 && c8 > 0)
		{
			if (GetEnemy(c2)==player && s1 == 0)
			{
				Perform(c2, "say", "我帮你疗个伤吧！就这一次了！！");
				Perform(c2, "pause", 3);
				Perform(c2, "say", "呵呵！在飞鹏堡及在这，都是那个叫我办的事！你以后就知道了！");
				Perform(c2, "pause", 5);
				Perform(c2, "say", "真厉害！！那监视我的人不在了！！我就闪人先了！");
				Perform(c2, "pause", 5);
				Perform(c2, "say", "他被你打败了？");
				Perform(c2, "pause", 5);
				Perform(c2, "say", "呵呵！来执行任务！！");
				Perform(c2, "pause", 2);
				Perform(c2, "crouch", 30);
				Perform(c2, "faceto", player);

				PlayerPerform("block", 0);
				PlayerPerform("say", "以后！？");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "你能告诉我，谁叫你们来的吗！？");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "没错！！");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "任务？什么任务？是跟那个仿冒我的人一样的任务吗？");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "是你！你为什么会在这？");
				PlayerPerform("block", 1);
				
				s1 = 5;
				timer1 = now + 20; 
				k2 = 1;
			}
			if (GetEnemy(c3)==player && s2 == 0)
			{
				Perform(c3, "pause", 2);
				Perform(c3, "say", "不过！既然你来了..就来比划比划吧！！");
				Perform(c3, "pause", 5);
				Perform(c3, "say", "呵呵！我看到你的嘴脸就浑身不自在！！怎可能吃模仿你的人给的药！？");
				Perform(c3, "pause", 5);
				Perform(c3, "say", "....难怪我觉得你方才很奇怪！！");
				Perform(c3, "pause", 5);
				Perform(c3, "say", "怎么？突然关心我了？有什么企图？");
				Perform(c3, "pause", 2);
				Perform(c3, "faceto", player);

				PlayerPerform("block", 0);
				PlayerPerform("say", "我还要看一下所有人的情况！！");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "........");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "总之你没事就好了！！");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "我刚才打败了一个跟我相似的人，他说他下了失心散！！");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "小何你没事吧？");
				PlayerPerform("block", 1);
				s2 = 1 ;
			}
			if (GetEnemy(c4)==player && s3 == 0)
			{
				Perform(c4, "say", "多说无益！！受死吧！！");
				Perform(c4, "pause", 5);
				Perform(c4, "say", "孙玉伯是我老子！他被你们这群快活林的无赖杀了！我一定要报仇！");
				Perform(c4, "pause", 5);
				Perform(c4, "say", "什么下药的东东？我是要来为我父亲报仇！！");
				Perform(c4, "pause", 2);
				Perform(c4, "faceto", player);

				PlayerPerform("block", 0);
				PlayerPerform("pause", 3);
				PlayerPerform("say", "是你父亲要杀我们的！！");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "你父亲？");
				PlayerPerform("pause", 5);
				PlayerPerform("say", "你是谁！？跟那个下药的人是同党吗？");
				PlayerPerform("block", 1);
				
				s3 = 1;
			}
			if (GetEnemy(c5) == player && cc1 == 0)
			{
				SaySTG2(c5);
				cc1 = 1;
			}
			if (GetEnemy(c6) == player && cc2 == 0)
			{
				SaySTG2(c6);
				cc2 = 1;
			}
			if (GetEnemy(c7) == player && cc3 == 0)
			{
				SaySTG2(c7);
				cc3 = 1;
			}
			if (GetEnemy(c8) == player && cc4 == 0)
			{
				SaySTG2(c8);
				cc4 = 1;
			}
			if (GetHP(c5) < GetMaxHP(c5) / 10 && ex1 == 0)
			{
				if (GetHP(c5)>0)
				{
					EXITWAR(c5);
					ex1 = 1;
					timer1 = now + 12; 
				}
			}
			if (GetHP(c6) < GetMaxHP(c6) / 10 && ex2 == 0)
			{
				if (GetHP(c6)>0)
				{
					EXITWAR(c6);
					ex2 = 1;
					timer1 = now + 12; 
				}
			}
			if (GetHP(c7) < GetMaxHP(c7) / 10 && ex3 == 0 )
			{
				if (GetHP(c7)>0)
				{
					EXITWAR(c7);
					ex3 = 1;
					timer1 = now + 12; 
				}
			}
			if (GetHP(c8) < GetMaxHP(c8) / 10 && ex4 == 0)
			{
				if (GetHP(c8)>0)
				{
					EXITWAR(c8);
					ex4 = 1;
					timer1 = now + 12; 
				}
			}
			if (GetHP(c5)<=0 && cc1 == 1  && GetAnyChar("凤凤") > c5)
			{
				Say(player,"啊！我居然失手打死他们了！！");
				timer1 = now + 2;
				cc1 = 2; 
				gameover = -1;
			}
			if (GetHP(c6)<=0 && cc2 == 1  && GetAnyChar("叶翔")>c6)
			{
				Say(player,"啊！我居然失手打死他们了！！");
				timer1 = now + 2; 
				cc2 = 2; 
				gameover = -1;
			}
			if (GetHP(c7)<=0 && cc3 == 1 && GetAnyChar("石群") > 0)
			{
				Say(player,"啊！我居然失手打死他们了！！");
				timer1 = now + 2; 
				cc3 = 2; 
				gameover = -1;
			}
			if (GetHP(c8)<=0 && cc4 == 1 && GetAnyChar("高寄萍") > 0)
			{
				Say(player,"啊！我居然失手打死他们了！！");
				timer1 = now + 2; 
				cc4 = 4; 
				gameover = -1;
			}
			if (k2 == 1 && now>timer1)
			{
				RemoveNPC(c2);
				PlayerPerform("use", 16);
				k2 = 2;
			}
			if (ex1 > 0 && now>timer1)
			{
				RemoveNPC(c5);
			}
			if (ex2 > 0 && now>timer1)
			{
				RemoveNPC(c6);
			}
			if (ex3 > 0 && now>timer1)
			{
				RemoveNPC(c7);
			}
			if (ex4 == 1 && now>timer1)
			{
				ChangeBehavior(c8, "idle");
				Say(c8,"我帮你回复一下体力再走..");
				PlayerPerform("use", 16);
				timer1 = now + 2; 
				ex4++;
			}
			if (ex4 == 2 && now>timer1)
			{
				RemoveNPC(c8);
			}
		}

	}
	if (gameover!=-1 && GetHP(player)<=0 && player >= 0 && now>timer1)
	{
		gameover = -1;
		timer1 = now + 2; 
	}
	if ((gameover==1 || gameover==-1) && now>timer1)
	{
		GameOver(gameover);
		gameover = 2;
	}
}