//  秒杀飞城.通往五爪
int Rule = 1;
int RoundTime = 99;
int PlayerSpawn = 42;
int PlayerSpawnDir = 80;
int PlayerWeapon = 17;
int PlayerWeapon2 = 50;
int PlayerHP = 15000;

int trg0 = 0;
int trg1 = 0;
int trg2 = 0;
int trg3 = 0;
int trg4 = 0;
int trg5 = 0;
int trg6 = 0;
int trg7 = 0;
int trg8 = 0;
int trg9 = 0;
int trg10 = 0;
int trg11 = 0;
int timer0 = 0;
int timer1 = 0;
int timer2 = 0;
int timer3 = 0;
int timer4 = 0;
int gameover = 0;
int reborn = -1;
string rebornName;

OnStart()
{
	AddNPC("飞城魔鬼1");
	AddNPC("飞城魔鬼2");
	AddNPC("飞城魔鬼3");
	AddNPC("飞城魔鬼4");
	AddNPC("飞城魔鬼5");
	AddNPC("飞城魔鬼6");
	AddNPC("飞城魔鬼7");
	AddNPC("飞城魔鬼8");

}

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

if (trg0 == 0)
	{
		c = GetChar("地狱魔鬼1");
		c1 = GetChar("地狱魔鬼2");
		c2 = GetChar("地狱魔鬼3");
		c3 = GetChar("地狱魔鬼4");
		c4 = GetChar("地狱魔鬼5");
		c5 = GetChar("地狱魔鬼6");
		c6 = GetChar("地狱魔鬼7");
		c7 = GetChar("地狱魔鬼8");
		if (c>=0 && c1>0 && c2>0 && c3>0 && c4>0 && c5>0 && c6>0 && c7>0)
		{


			Perform(c, "faceto", player);	
                        Perform(c, "use", 19);
                        Perform(c1, "use", 19);
                        Perform(c2, "use", 19);
                        Perform(c3, "use", 19);
                        Perform(c4, "use", 19);
                        Perform(c5, "use", 19);
                        Perform(c6, "use", 19);
                        Perform(c7, "use", 19);

			PlayerPerform("block", 0);
			PlayerPerform("use", 19);
			PlayerPerform("use", 5);
			PlayerPerform("use", 33);
			PlayerPerform("use", 34);
			PlayerPerform("use", 4);
			PlayerPerform("use", 20);
			PlayerPerform("use", 41);
			PlayerPerform("use", 42);
		        PlayerPerform("crouch", 1);
			PlayerPerform("say", "我应该去五爪峰看看。只有去哪里才能赶去金华。。");
			PlayerPerform("pause", 2);
                        PlayerPerform("say", "孙玉伯..。他为何不见我..他不想杀我了？"); 
			PlayerPerform("block", 1);
						
			trg0 = 1;
                }          
        }     



if (trg0 == 1)
	{
		c = GetChar("地狱魔鬼1");
		c1 = GetChar("地狱魔鬼2");
		c2 = GetChar("地狱魔鬼3");
		c3 = GetChar("地狱魔鬼4");
		c4 = GetChar("地狱魔鬼5");
		c5 = GetChar("地狱魔鬼6");
		c6 = GetChar("地狱魔鬼7");
		c7 = GetChar("地狱魔鬼8");
		
		if (c>=0 && GetEnemy(c)==player)
		{

			ChangeBehavior(c, "follow", player);
			Perform(c, "say", "你真是厉害，竟能闯入这里，受死吧。。..");
			Perform(c, "pause", 2);
			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);
		       ChangeBehavior(c5, "kill", player);
                        Perform(c5, "use", 19);
                        Perform(c5, "use", 5);
		       ChangeBehavior(c6, "kill", player);
                        Perform(c6, "use", 19);
                        Perform(c6, "use", 5);
		       ChangeBehavior(c7, "kill", player);
                        Perform(c7, "use", 19);
                        Perform(c7, "use", 5);

			PlayerPerform("block", 0);
			PlayerPerform("say", "地狱魔鬼....想必不是一般 的人物。。");
			PlayerPerform("block", 1);


			trg0 = 2;


		}		
	}

	if (trg0 == 2)
	{
		c = GetChar("地狱魔鬼1");
		if (GetHP(c) <= 0)
		{	
			Say(c, "好阿....。。哼哼");
			trg0 = 3;
		        timer0 = now + 3;
		}
	}
      if (trg0 == 3 && now>timer0)
	{


                RemoveNPC(GetAnyChar("地狱魔鬼1"));
		RemoveNPC(GetAnyChar("地狱魔鬼2"));
                RemoveNPC(GetAnyChar("地狱魔鬼3"));
		RemoveNPC(GetAnyChar("地狱魔鬼4"));
                RemoveNPC(GetAnyChar("地狱魔鬼5"));
		RemoveNPC(GetAnyChar("地狱魔鬼6"));
                RemoveNPC(GetAnyChar("地狱魔鬼7"));
		RemoveNPC(GetAnyChar("地狱魔鬼8"));
			trg0 = 4;
		        timer1 = now + 1;
		}
      if (trg0 == 4 && now>timer1)
	{

              AddNPC("飞城枪神1");
              AddNPC("飞城枪神2");
              AddNPC("飞城枪神3");
              AddNPC("飞城枪神4");
              AddNPC("飞城枪神5");
              AddNPC("飞城枪神6");
              AddNPC("飞城枪神7");
              AddNPC("飞城枪神8");

		trg0 = 5;

	}

 if (trg1 == 0)
	{
		c = GetChar("枪神1");
		c1 = GetChar("枪神2");
		c2 = GetChar("枪神3");
		c3 = GetChar("枪神4");
		c4 = GetChar("枪神5");
		c5 = GetChar("枪神6");
		c6 = GetChar("枪神7");
		c7 = GetChar("枪神8");		
		if (c>=0 && GetEnemy(c)==player)
		{
                    	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);
		       ChangeBehavior(c5, "kill", player);
                        Perform(c5, "use", 19);
                        Perform(c5, "use", 5);
		       ChangeBehavior(c6, "kill", player);
                        Perform(c6, "use", 19);
                        Perform(c6, "use", 5);
		       ChangeBehavior(c7, "kill", player);
                        Perform(c7, "use", 19);
                        Perform(c7, "use", 5);			
						

			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 20);				
			PlayerPerform("block", 0);
			PlayerPerform("say", "我都闯入这里了，还能怕你们这些小人。。。。");
			PlayerPerform("say", "我瞧瞧你们有多厉害。");
			PlayerPerform("pause", 1);

			trg1 = 1;
		}
	}

if (trg1 == 1)
	{
		c = GetChar("枪神1");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "guard", 4);
			Perform(c, "say", "有两下子..");
			Perform(c, "faceto", player);

			PlayerPerform("say", "哼。。");
			PlayerPerform("pause", 4);
			trg1 = 2;
		}
	}

 if (trg1 == 2)
	{
		c = GetAnyChar("枪神1");
		if (GetHP(c) <= 0)
		{
			Say(c, "你给我等着..撤。。");
			trg1 = 3;
			timer0 = now + 2;
		}
	}

        if (trg1 == 3 && now>timer0)
	{               
                RemoveNPC(GetAnyChar("枪神1"));
		RemoveNPC(GetAnyChar("枪神2"));
                RemoveNPC(GetAnyChar("枪神3"));
		RemoveNPC(GetAnyChar("枪神4"));
                RemoveNPC(GetAnyChar("枪神5"));
		RemoveNPC(GetAnyChar("枪神6"));
                RemoveNPC(GetAnyChar("枪神7"));
		RemoveNPC(GetAnyChar("枪神8"));



			timer1 = now + 1;
			trg1 = 4;
		}

        if (trg1 == 4 && now>timer1)
	{               
		
              AddNPC("飞城强盗1");
              AddNPC("飞城强盗2");
              AddNPC("飞城强盗3");
              AddNPC("飞城强盗4");
              AddNPC("飞城强盗5");
              AddNPC("飞城强盗6");
              AddNPC("飞城强盗7");
              AddNPC("飞城强盗8");
			trg1 = 5;
		}


 if (trg2 == 0)
	{
		c = GetChar("强盗1");
		c1 = GetChar("强盗2");
		c2 = GetChar("强盗3");
		c3 = GetChar("强盗4");
		c4 = GetChar("强盗5");
		c5 = GetChar("强盗6");
		c6 = GetChar("强盗7");
		c7 = GetChar("强盗8");		
		if (c>=0 && GetEnemy(c)==player)
		{
                    	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);
		       ChangeBehavior(c5, "kill", player);
                        Perform(c5, "use", 19);
                        Perform(c5, "use", 5);
		       ChangeBehavior(c6, "kill", player);
                        Perform(c6, "use", 19);
                        Perform(c6, "use", 5);
		       ChangeBehavior(c7, "kill", player);
                        Perform(c7, "use", 19);
                        Perform(c7, "use", 5);			
						

			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 20);				
			PlayerPerform("block", 0);
			PlayerPerform("say", "....。。。。");
			PlayerPerform("pause", 1);

			trg2 = 1;
		}
	}

 if (trg2 == 1)
	{
		c = GetAnyChar("强盗1");
		if (GetHP(c) <= 0)
		{
			Say(c, "你给我等着..。。");
			trg2 = 2;
			timer0 = now + 2;
		}
	}

        if (trg2 == 2 && now>timer0)
	{               
                RemoveNPC(GetAnyChar("强盗1"));
		RemoveNPC(GetAnyChar("强盗2"));
                RemoveNPC(GetAnyChar("强盗3"));
		RemoveNPC(GetAnyChar("强盗4"));
                RemoveNPC(GetAnyChar("强盗5"));
		RemoveNPC(GetAnyChar("强盗6"));
                RemoveNPC(GetAnyChar("强盗7"));
		RemoveNPC(GetAnyChar("强盗8"));



			timer1 = now + 1;
			trg2 = 3;
		}


        if (trg2 == 3 && now>timer1)
	{               
		
              AddNPC("飞城1");
              AddNPC("飞城2");
			trg2 = 4;
		}


if (trg3 == 0)
	{
		c = GetChar("律香川第一杀手");
		c1 = GetChar("一级高官");
		if (c>=0 )
		{


			Perform(c, "faceto", player);	
                        Perform(c, "use", 35);
			Perform(c1, "pause", 100);
                        Perform(c1, "use", 19);

			trg3 = 1;
		}
}

if (trg3==1)
	{
		c = GetChar("一级高官");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && GetEnemy(c)==player && Distance(0, 1)<500)
		{
			StopPerform(player);
			StopPerform(c);

			Perform(c, "say", "是?。那让你看看我怎么救活他。哼哼。");
			Perform(c, "pause", 4);
			Perform(c, "faceto", player);
			Perform(c, "say", "他是你杀的对不对？。你这家伙，你别以为这样就完了阿。");
			Perform(c, "pause", 2);
			Perform(c, "faceto", player);

			PlayerPerform("block", 0);
			PlayerPerform("say", "？？？？？？？。");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "对，我跟他打N次，在一线天干掉了他。。");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "杀手..。");
			PlayerPerform("block", 1);

			trg3 = 2;
			timer0 = now + 7;
		}
	}	

     if (trg3==2 && now>timer0)
	{	
                RemoveNPC(GetAnyChar("律香川第一杀手"));
                RemoveNPC(GetAnyChar("一级高官"));
			trg3 = 3;
			timer1 = now + 1;

		}

    if (trg3==3 && now>timer1)
	{	


                 AddNPC("飞城1");
			trg3 = 4;

		}
     if (trg3==4)
	{
		c = GetChar("律香川第一杀手");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && GetEnemy(c)==player && Distance(0, 1)<150)
		{
			StopPerform(player);
			StopPerform(c);

			Perform(c, "say", "那你为何为你老大卖命，我们杀手就是这种命，认命吧。");
			Perform(c, "pause", 4);
			Perform(c, "faceto", player);
			Perform(c, "say", "我跟你说了，我们老大是会救活我的。。。不自量力。");
			Perform(c, "pause", 2);
			Perform(c, "faceto", player);

			PlayerPerform("block", 0);
			PlayerPerform("say", "我们注定会这样..。得罪了。");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "为何这样为他卖命，值吗？。。");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "你..。...");
			PlayerPerform("block", 1);

			trg3 = 5;
		}
	}	
if (trg4 == 0)
	{
		c = GetChar("律香川第一杀手");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "guard", 4);
			Perform(c, "say", "金华城，我们终极一战，再见。..");
			Perform(c, "faceto", player);

			PlayerPerform("say", "。。老头在金华。，哼...");
			PlayerPerform("pause", 4);
			trg4 = 1;
			timer0 = now + 2;
		}
	}

    if (trg4==1 && now>timer0)
	{
                RemoveNPC(GetAnyChar("律香川第一杀手"));
			trg4 = 2;
			timer1 = now + 2;
		}
    if (trg4==2 && now>timer1)
	{	


              AddNPC("飞城野猫1");
              AddNPC("飞城野猫2");
              AddNPC("飞城野猫3");
              AddNPC("飞城野猫4");
              AddNPC("飞城野猫5");
              AddNPC("飞城野猫6");
              AddNPC("飞城野猫7");
              AddNPC("飞城野猫8");
			trg4 = 3;

		}

if (trg5 == 0)
	{
		c = GetChar("飞城野猫1");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "say", "。......");

			trg5 = 1;
		}
	}

 if (trg5 == 1)
	{
		c = GetAnyChar("飞城野猫1");
		if (GetHP(c) <= 0)
		{
			Say(c, "......。。我们不会在出现了。");
			trg5 = 2;
			timer1 = now + 2;
		}
	}


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

}