// 黄天城
int Rule = 1;
int RoundTime = 990;
int PlayerSpawn = 83;
int PlayerSpawnDir = 0;
int PlayerWeapon = 17;
int PlayerWeapon2 = 48;
int PlayerHP = 15000;

int player;
int trg0;
int trg1;
int trg2;
int k1;
int k2;
int k3;
int k4;
int k5;
int k6;
int k7;
int k8;
int k9;
int k10;
int win;
int timer0;
int timer1;
int timer2;
int gameover; 
OnStart()
{
		AddNPC("5关人1");
		AddNPC("5关人2");
		AddNPC("5关人3");
		AddNPC("5关人4");
		AddNPC("5关人5");
		AddNPC("5关人6");
		AddNPC("5关人7");
		AddNPC("5关人8");
}
OnUpdate()
{
	int player = GetAnyChar("player");
	if (player < 0)
	{
		return 0;
	}
	if (gameover == 2)
	{
		return 0;
	}
	int now = GetGameTime();
	if (trg0 == 0)
	{
		int c = GetChar("光明侍卫1");
		int c1 = GetChar("光明侍卫2");
		int c2 = GetChar("光明侍卫3");
		int c3 = GetChar("光明侍卫4");
		int c4 = GetChar("光明侍卫5");
		int c5 = GetChar("光明侍卫6");
		int c6 = GetChar("光明侍卫7");
		int c7 = GetChar("光明侍卫8");
		if (c > 0 && c1 > 0)
		{

			Perform(c, "say", "大家都要注意，伊人君随时会来！！");

			trg0 = 1;
		}
        }
if (trg0 == 1)
	{
		SetTarget(0, "char",player);
		SetTarget(1, "char",c);
		if (GetEnemy(c) == player)
		{
			if (Distance(0, 1) < 200 && k1 == 0)
			{


				Perform(c, "say", "那就别想活着出去了！");
				Perform(c, "pause", 3);
				Perform(c, "faceto", player);

				PlayerPerform("block", 0);
				PlayerPerform("say", "我来了...");
				PlayerPerform("block", 1);
				
				k1 = 1;
			}
		}
		SetTarget(0, "char",player);
		SetTarget(1, "char",c1);
		if (GetEnemy(c1) == player)
		{
			if (Distance(0, 1) < 200 && k2 == 0)
			{
				Perform(c1, "say", "受死吧！");
				Perform(c1, "faceto", player);

				
				k2 = 1;
			}
		    }
		SetTarget(0, "char",player);
		SetTarget(1, "char",c2);
		if (GetEnemy(c2) == player)
		{
			if (Distance(0, 1) < 200 && k3 == 0)
			{
				Perform(c2, "say", "真的过来了！");
				Perform(c2, "faceto", player);

				
				k3 = 1;
			}
		    }
		SetTarget(0, "char",player);
		SetTarget(1, "char",c3);
		if (GetEnemy(c3) == player)
		{
			if (Distance(0, 1) < 200 && k4 == 0)
			{
				Perform(c3, "say", "真的过来了！");
				Perform(c3, "faceto", player);

				
				k4 = 1;
			}
		    }
		SetTarget(0, "char",player);
		SetTarget(1, "char",c4);
		if (GetEnemy(c4) == player)
		{
			if (Distance(0, 1) < 200 && k5 == 0)
			{
				Perform(c4, "say", "真的过来了！");
				Perform(c4, "faceto", player);

				
				k5 = 1;
			}
                   } 
		SetTarget(0, "char",player);
		SetTarget(1, "char",c5);
		if (GetEnemy(c5) == player)
		{
			if (Distance(0, 1) < 200 && k6 == 0)
			{
				Perform(c5, "say", "真的过来了！");
				Perform(c5, "faceto", player);

				
				k6 = 1;
			}
                   } 
		SetTarget(0, "char",player);
		SetTarget(1, "char",c6);
		if (GetEnemy(c6) == player)
		{
			if (Distance(0, 1) < 200 && k7 == 0)
			{
				Perform(c6, "say", "真的过来了！");
				Perform(c6, "faceto", player);

				
				k7 = 1;
			}
                   } 
		SetTarget(0, "char",player);
		SetTarget(1, "char",c7);
		if (GetEnemy(c7) == player)
		{
			if (Distance(0, 1) < 200 && k8 == 0)
			{
				Perform(c7, "say", "真的过来了！");
				Perform(c7, "faceto", player);

				
				k8 = 1;
			}
                   }
              } 


		if (GetHP(c) <= 0 && k1 ==1)
		{
			Say(c,"你给我等着！！");
		        RemoveNPC(c);
			k1 = 2;
			win++;
		}
		if (GetHP(c1) <= 0 && k2 ==1)
		{
			Say(c1,"你这家伙！！");
		        RemoveNPC(c1);
			k2 = 2;
			win++;
		}
		if (GetHP(c2) <= 0 && k3 ==1)
		{
			Say(c2,"果然厉害！！");
		        RemoveNPC(c2);
			k3 = 2;
			win++;
		}
		if (GetHP(c3) <= 0 && k4 ==1)
		{
			Say(c3,"在下F了！！");
		        RemoveNPC(c3);
			k4 = 2;
			win++;
		}
		if (GetHP(c4) <= 0 && k5 ==1)
		{
			Say(c4,"厉害！！");
		        RemoveNPC(c4);
			k5 = 2;
			win++;
		}
		if (GetHP(c5) <= 0 && k6 ==1)
		{
			Say(c5,"混帐！！你有种！！");
		        RemoveNPC(c5);
			k6 = 2;
			win++;
		}
		if (GetHP(c6) <= 0 && k7 ==1)
		{
			Say(c6,"混帐！！！！");
		        RemoveNPC(c6);
			k7 = 2;
			win++;
		}
		if (GetHP(c7) <= 0 && k8 ==1)
		{
			Say(c7,"混帐！！！！");
		        RemoveNPC(c7);
			k8 = 2;
			win++;
		}
              if (k1 ==2 && k2 ==2  && k3 ==2  && k4 ==2  && k5 ==2  && k6 ==2  && k7 ==2  && k8 ==2  && trg1 == 0)
		{

		     AddNPC("5关");
                     c = GetChar("光明顶长官");
		     if (c > 0)
		     {

			Perform(c, "say", "哈哈！！你找不着我...还当什么杀手！！哼");
			Perform(c, "guard", 4);
			Perform(c, "say", "很不错..不知道你是不是我的对手！！王八蛋！！");
			Perform(c, "faceto", player);

			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
				PlayerPerform("block", 0);
			PlayerPerform("say", "我马上去找你...！");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "给我滚出来！！");
			PlayerPerform("pause", 2);
			PlayerPerform("block", 1);
	

			         trg1 = 1;
		        }
                     }

		if(GetHP(c) <= 10000 && trg1 == 1)
		{


			        AddNPC("5关侍卫1");
			        AddNPC("5关侍卫2");
			        AddNPC("5关侍卫3");
			        AddNPC("5关侍卫5");
			        AddNPC("5关侍卫6");
			        Perform(c, "guard", 5);
				Perform(c, "use", 15);
				Perform(c, "use", 15);
				Perform(c, "use", 15);
				Perform(c, "use", 20);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
				Perform(c, "say", "哈哈！！果然令人佩服的实力！不过好戏还在后面！");
				Perform(c, "faceto", player);



			         trg1 = 2;
		          } 

		if (GetHP(c) <= 0 && trg1 == 2)
		{
			Say(c,"真行阿，你这小子！！");
		        RemoveNPC(c);			        
                        trg1 = 3;
			gameover = 1;
			timer0 = now + 2;
		}


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

}
