// 头领出面大杀苦心
int Rule = 1;
int RoundTime = 990;
int PlayerSpawn = 35;
int PlayerSpawnDir = 0;
int PlayerWeapon = 25;
int PlayerWeapon2 = 14;
int PlayerHP = 15000;

int trg0 = 0;
int trg1 = 0;
int trg2 = 0;
int timer0 = 0;
int timer1 = 0;
int timer2 = 0;
int timer3 = 0;
int timer4 = 0;
int timer5 = 0;
int timer6 = 0;
int gameover = 0;
int reborn = -1;
string rebornName;

OnStart()
{
	AddNPC("山谷1");
	AddNPC("山谷杀手1");
	AddNPC("山谷杀手2");
	AddNPC("山谷杀手3");
	AddNPC("山谷杀手4");
	AddNPC("山谷杀手5");
	AddNPC("山谷杀手6");
	AddNPC("山谷杀手7");
}

OnUpdate()
{
	int player = GetAnyChar("player");
	if (player < 0)
	{
		return 0;
	}
	if (gameover == 2)
	{
		return 0;
	}
	
	int c;
	int c1;
	int c2;
	int c3;
	int c4;
	int c5;
	int c6;
	int c7;
	int c8;
	int c9;
	int c10;
	int now = GetGameTime();

	if (trg0 == 0)
	{
		c = GetChar("山谷杀手队长");
		c1 = GetChar("山谷杀手1");
		c2 = GetChar("山谷杀手2");
		c3 = GetChar("山谷杀手3");
		c4 = GetChar("山谷杀手4");
		c5 = GetChar("山谷杀手5");
		c6 = GetChar("山谷杀手6");
		c7 = GetChar("山谷杀手7");
		if (c>=0 && c2>=0 && c3>=0 && c4>=0 && c5>=0 && c6>=0)
		{


			PlayerPerform("block", 0);
			PlayerPerform("pause", 1);
			PlayerPerform("say", "孙剑的余党要斩草除根！！");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "干掉他们！！");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "哼哼...");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "前面好象有人..");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "这里怎么这么黑..好阴森阿。比当年的金华还...");
			PlayerPerform("block", 1);

			trg0 = 1;
		}
	}
	if (trg0 == 1)
	{
		c = GetChar("山谷杀手队长");
		if (c>=0 && GetEnemy(c)==player)
		{


			Perform(c, "say", "干掉这小子....");
			Perform(c, "faceto", c2);


			c2 = GetChar("山谷杀手1"); 
			if (c2 >= 0)
			{
				ChangeBehavior(c2, "kill", player);

			}

			c2 = GetChar("山谷杀手2"); 
			if (c2 >= 0)
			{
				ChangeBehavior(c2, "kill", player);

			}

			c2 = GetChar("山谷杀手3"); 
			if (c2 >= 0)
			{
				ChangeBehavior(c2, "kill", player);

			}
			c2 = GetChar("山谷杀手4"); 
			if (c2 >= 0)
			{
				ChangeBehavior(c2, "kill", player);

			}
			c2 = GetChar("山谷杀手5"); 
			if (c2 >= 0)
			{
				ChangeBehavior(c2, "kill", player);

			}
			c2 = GetChar("山谷杀手6"); 
			if (c2 >= 0)
			{
				ChangeBehavior(c2, "kill", player);

			}
			c2 = GetChar("山谷杀手7"); 
			if (c2 >= 0)
			{
				ChangeBehavior(c2, "kill", player);

			}

			trg0 = 2;
		}
	}

if (trg0 == 2)
	{
		c = GetAnyChar("山谷杀手队长");
		c1 = GetAnyChar("山谷杀手2");
		c2 = GetAnyChar("山谷杀手3");
		c3 = GetAnyChar("山谷杀手4");
		c4 = GetAnyChar("山谷杀手5");
		c5 = GetAnyChar("山谷杀手6");
		c6 = GetAnyChar("山谷杀手7");
		c7 = GetAnyChar("山谷杀手1");
		
		if (GetHP(c)<=0 && GetHP(c1)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && GetHP(c4)<=0 && GetHP(c5)<=0 && GetHP(c6)<=0 && GetHP(c7)<=0 && player>=0 && GetHP(player)>0)
		{



			PlayerPerform("say", "......哼！！死了吧···");
			PlayerPerform("pause", 1);

			trg0 = 3;
			timer0 = now + 3;
		}
	}
	if (trg0 == 3 && now>timer0)
	{
                RemoveNPC(GetAnyChar("山谷杀手队长"));
		RemoveNPC(GetAnyChar("山谷杀手2"));
		RemoveNPC(GetAnyChar("山谷杀手3"));
                RemoveNPC(GetAnyChar("山谷杀手4"));
		RemoveNPC(GetAnyChar("山谷杀手5"));
		RemoveNPC(GetAnyChar("山谷杀手6"));
                RemoveNPC(GetAnyChar("山谷杀手7"));
		RemoveNPC(GetAnyChar("山谷杀手1"));

		trg0 = 4;
		timer1 = now + 1;
	}

if (trg0 == 4 && now>timer1)
	{
	  AddNPC("山谷恶魔1");
	  AddNPC("山谷恶魔2");
	  AddNPC("山谷恶魔3");
	  AddNPC("山谷恶魔4");
	  AddNPC("山谷恶魔5");

		trg0 = 5;
	}


if (trg1 == 0)
	{
		c = GetChar("恶魔1");
		c1 = GetChar("恶魔2");
		c2 = GetChar("恶魔3");
		c3 = GetChar("恶魔4");
		c4 = GetChar("恶魔5");
		if (c>=0 && GetEnemy(c)==player)
		{

			ChangeBehavior(c, "follow", player);
                        Perform(c, "use", 19);
                        Perform(c, "use", 41);
			Perform(c, "say", "杀！！！！！");
			Perform(c, "faceto", player);

		       ChangeBehavior(c1, "kill", player);
                        Perform(c1, "use", 19);
                        Perform(c1, "use", 5);
		       ChangeBehavior(c2, "kill", player);
                        Perform(c2, "use", 19);
                        Perform(c2, "use", 5);
		       ChangeBehavior(c3, "kill", player);
                        Perform(c3, "use", 19);
                        Perform(c3, "use", 5);
		       ChangeBehavior(c4, "kill", player);
                        Perform(c4, "use", 19);
                        Perform(c4, "use", 5);

			PlayerPerform("block", 0);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("say", "..........找死！！来几个，你爷爷杀几个。");
			PlayerPerform("pause", 3);
			PlayerPerform("block", 1);


			trg1 = 1;

		}		
	}

	if (trg1 == 1)
	{
		c = GetAnyChar("恶魔1");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/3 && GetHP(player)>0)
		{			
			Perform(c, "say", "！你小子真厉害阿..。");
			Perform(c, "faceto", player);

			PlayerPerform("say", "对付你在不厉害，怎能铲除恶魔。。");
			PlayerPerform("pause", 6);
			trg1 = 2;
		}
	}

if (trg1 == 2)
	{
		c = GetAnyChar("恶魔1");
		c1 = GetAnyChar("恶魔2");
		c2 = GetAnyChar("恶魔3");
		c3 = GetAnyChar("恶魔4");
		c4 = GetAnyChar("恶魔5");		
		if (GetHP(c)<=0 && GetHP(c1)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && GetHP(c4)<=0 && player>=0 && GetHP(player)>0)
		{



			PlayerPerform("say", ".........，想暗杀我！休想。");
			PlayerPerform("pause", 1);

			trg1 = 3;
			timer0 = now + 3;
		}
	}

	if (trg1 == 3 && now>timer0)
	{
                RemoveNPC(GetAnyChar("恶魔4"));
		RemoveNPC(GetAnyChar("恶魔5"));
		RemoveNPC(GetAnyChar("恶魔3"));
                RemoveNPC(GetAnyChar("恶魔2"));
		RemoveNPC(GetAnyChar("恶魔1"));

		trg1 = 4;
		timer1 = now + 1;
	}

if (trg1 == 4 && now>timer1)
	{
	  AddNPC("山谷人1");
	  AddNPC("山谷人2");
	  AddNPC("山谷人3");
	  AddNPC("山谷人4");
	  AddNPC("山谷人5");
	  AddNPC("山谷人6");

		trg1 = 5;
	}

if (trg1==5)
	{
		c = GetChar("孙玉城");
		c1 = GetChar("玉城 ！-！剑气");
		c2 = GetChar("玉城 ！-！乾坤");  
		c3 = GetChar("玉城 ！-！魔刀"); 
		c4 = GetChar("玉城 ！-！怒刺");
		c5 = GetChar("玉城 ！-！怒匕");
		if (c>=0 && GetEnemy(c)==player)
		{

                        Perform(c, "use", 19);
                        Perform(c, "use", 5);
                        Perform(c, "use", 33);
                        Perform(c, "use", 34);
                        Perform(c, "use", 41);
                        Perform(c, "use", 40);
			Perform(c, "say", "同感.我看你也非常的不顺眼，所以我要铲除你。。");
			Perform(c, "pause", 6);
			Perform(c, "say", "呵呵..不过这一切全都是因为你，没有你，我现在也不可能是老大。");
			Perform(c, "pause", 6);
			Perform(c, "say", "哈哈。不错，我之前也是孙剑的手下。不过现在他们都死了，我就做了老大。");
			Perform(c, "pause", 5);
			Perform(c, "faceto", player);
			Perform(c, "say", "不用想我是谁。想我也是你的敌人。。");
			Perform(c, "pause", 1);

                        Perform(c1, "use", 19);
                        Perform(c1, "use", 5);
			Perform(c1, "pause", 19);

                        Perform(c2, "use", 19);
                        Perform(c2, "use", 5);
			Perform(c2, "pause", 19);

                        Perform(c3, "use", 19);
                        Perform(c3, "use", 5);
			Perform(c3, "pause", 19);

                        Perform(c4, "use", 19);
                        Perform(c4, "use", 5);
			Perform(c4, "pause", 19);

                        Perform(c5, "use", 19);
                        Perform(c5, "use", 5);
			Perform(c5, "pause", 19);


			PlayerPerform("block", 0);
			PlayerPerform("say", "那就看你有没有能耐了....。");
			PlayerPerform("pause", 6);
			PlayerPerform("say", "不知羞耻..？..我为孙剑清理门户..");
			PlayerPerform("pause", 6);
			PlayerPerform("say", "你们简直比孙剑还卑鄙阿......孙剑知道你们这样，还不..");
			PlayerPerform("pause", 6);
			PlayerPerform("say", "我知道是敌人，我怎么没见过你。。。难道你也跟无名队长一样...");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "孙玉城？？ 他是谁....");
			PlayerPerform("block", 1);

			trg1 = 6;
			timer2 = now + 50;
		}
	}

if (trg1 == 6 && now>timer2)
	{
	  AddNPC("烽火伊人1");
	  AddNPC("烽火伊人2");
	  AddNPC("烽火伊人3");
	  AddNPC("烽火伊人4");
	  AddNPC("烽火伊人5");

		trg1 = 7;
	}



if (trg1 == 7)        
        {   

		c = GetChar("伊人杀手1");
		c1 = GetChar("伊人杀手2");
		c2 = GetChar("伊人杀手3");  
		c3 = GetChar("伊人杀手4"); 
		c4 = GetChar("伊人杀手5");
                if (c>0 && c1>0 && c2>0 && c3>0 && c4>0)
                { 
			ChangeBehavior(c, "follow", player);
                        Perform(c, "use", 19);
                        Perform(c, "use", 5);
			Perform(c, "say", "休想跟我们打赢我们老大，受死吧，你们。.。。");
			Perform(c, "faceto", player);	
			Perform(c, "crouch", 1);   

			ChangeBehavior(c1, "follow", player);
                        Perform(c1, "use", 19);
                        Perform(c1, "use", 5);
			Perform(c1, "faceto", player);	
			Perform(c1, "crouch", 1);

			ChangeBehavior(c2, "follow", player);
                        Perform(c2, "use", 19);
                        Perform(c2, "use", 5);
			Perform(c2, "pause", 2);
			Perform(c2, "faceto", player);	
			Perform(c2, "crouch", 1);

			ChangeBehavior(c3, "follow", player);
                        Perform(c3, "use", 19);
                        Perform(c3, "use", 5);
			Perform(c3, "pause", 2);
			Perform(c3, "faceto", player);	
			Perform(c3, "crouch", 1);

			ChangeBehavior(c4, "follow", player);
                        Perform(c4, "use", 19);
                        Perform(c4, "use", 5);
			Perform(c4, "pause", 2);
			Perform(c4, "faceto", player);	
			Perform(c4, "crouch", 1);

                        PlayerPerform("say", "想不到当个高官这么好阿，！。总有人出来帮助我。。平衡多了。");
                        PlayerPerform("pause", 2);

		          trg1 = 8;
	              }

           }

      if (trg1 == 8)
	{
		c = GetAnyChar("孙玉城");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "say", "好样的，...。，");
			trg1 = 9;
		}

       } 


      if (trg1 == 9)
	{
		c = GetAnyChar("孙玉城");
		if (c>=0 && GetHP(c)<3000)
		{			
			Perform(c, "say", "你这家伙.回来在收拾你。。！");
			trg1 = 10;
		         timer1 = now + 5; 
		}

       } 


	if (trg1==10 && now>timer2)
	{

		gameover = 1;

			trg1 = 11;

                }

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

}


