//   快活林人事脱险
int Rule = 1;
int RoundTime = 70;
int PlayerSpawn = 43;
int PlayerSpawnDir = 90;
int PlayerWeapon = 50;
int PlayerWeapon2 = 16;
int PlayerHP = 30000;


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 trg12 = 0;
int trg13 = 0;
int trg14 = 0;
int trg15 = 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 = 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 c11;
        int c12;
        int c13;
        int c14;
        int c15;
	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)
		{
                     ChangeBehavior(c,"follow",player);
			Perform(c, "say", "兄弟们，一起杀了他。。咱们有肉吃，好久没吃过人肉了。");
			Perform(c, "say", "我不是说了吗？。小子们肉了..");
			Perform(c, "pause", 2);
			Perform(c, "say", "..想救他们..先当我的下酒菜吧..");
			Perform(c, "pause", 2);
			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("block", 0);
			PlayerPerform("say", "吃肉？。野兽果然是野兽，想吃肉也要看你们有没有能耐了。");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "你这家伙，我问你话呢，是不是在这里？");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "这又是什么家伙....请问快活林的人是不是在这里？");
			PlayerPerform("pause", 1);
			PlayerPerform("block", 1);
			
			trg0 = 2;
		}
	}	


	 if (trg0 == 2)
	{	
		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 (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", 2);
			PlayerPerform("say", "这些野兽跟僵尸有什么区别.. . .");


			timer0 = now + 6;
			trg0 = 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"));



			timer1 = now + 1;
			trg0 = 4;
		}

        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;
		}
	}

	 if (trg1 == 3)
	{	
		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 (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("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("say", "还会有什么呢？..哼哼。");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "野兽.，僵尸都有... . .");


			timer0 = now + 6;
			trg1 = 4;
		}
	}

        if (trg1 == 4 && 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 = 5;
		}

        if (trg1 == 5 && now>timer1)
	{               
		
              AddNPC("风雪镖客1");
              AddNPC("风雪镖客2");
              AddNPC("风雪镖客3");
              AddNPC("风雪镖客4");
              AddNPC("风雪镖客5");
              AddNPC("风雪镖客6");
              AddNPC("风雪镖客7");
              AddNPC("风雪镖客8");
			trg1 = 6;
		}

        if (trg1 == 6)
	{
		c = GetChar("风雪镖客1");		
		if (c>=0 && GetEnemy(c)==player)
		{
                    	Perform(c, "say", "..。我们又来找你了-呵呵");
			Perform(c, "faceto", player);

			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 = 7;
		}
	}

	 if (trg1 == 7)
	{	
		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 (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", 2);


			timer0 = now + 4;
			trg1 = 8;
		}
	}

        if (trg1 == 8 && 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 = 9;
		}

        if (trg1 == 9 && now>timer1)
	{               
		
              AddNPC("风雪1");
              AddNPC("风雪2");
			trg1 = 10;
		}


  if (trg2 == 0)
	{
		c = GetChar("一级高官");	
		c2 = GetChar("律香川");		
		if (c>=0 && GetEnemy(c)==player)
		{
                        ChangeBehavior(c,"follow",player);
			Perform(c, "aggress");
			Perform(c, "pause", 70);
			Perform(c, "say", "伊人君..你们慢慢聊。我们不打扰你们了，哈哈");
			Perform(c, "pause", 7);
			Perform(c, "say", "你想见他们，也不是不让你见，我叫他们出来不就得了。");
			Perform(c, "pause", 3);
			Perform(c, "say", "别着急，我们这不是出来了..。。");
			Perform(c, "faceto", player);

			Perform(c2, "pause", 10);
			Perform(c2, "say", "对。。哈哈，你看看他们是不是安然无恙啊。");
			Perform(c2, "faceto", c);
			Perform(c2, "pause", 5);
			Perform(c2, "say", "别着急吗？你快活林的人安然无恙，你担心什么？。");
			Perform(c2, "pause", 2);
			Perform(c2, "faceto", player);


			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("say", "？？？？？？？");		
			PlayerPerform("pause", 2);
			PlayerPerform("say", "那好阿，我到要看看你是个什么人物，这么受人敬仰。放马过来吧。。");		
			PlayerPerform("pause", 8);
			PlayerPerform("say", "快点把快活林的人给我交出来，否则我不客气了。");		
			PlayerPerform("pause", 1);
			PlayerPerform("block", 1);

		         trg2 = 1;
		        timer0 = now + 10; 


	    }

          }

        if (trg2 == 1 && now>timer0)
	{               
		
              AddNPC("风雪3");
              AddNPC("风雪4");
              AddNPC("风雪5");
              AddNPC("风雪6");
              AddNPC("风雪7");
			trg2 = 2;
		        timer1 = now + 1;

		}


     if (trg2 == 2 && now>timer1)
	{

                RemoveNPC(GetAnyChar("律香川"));
                RemoveNPC(GetAnyChar("一级高官"));
		         trg2 = 3;

	}

  if (trg2 == 3)
	{
		c = GetChar("伊人梦");	
		c1 = GetChar("凤凤");
		c2 = GetChar("高老大");	
		c3 = GetChar("小何");	
		c4 = GetChar("叶翔");			
		if (c>=0 && GetEnemy(c)==player)
                {
			Perform(c, "aggress");
			Perform(c, "pause", 20000);
			Perform(c, "say", "好..。那我们要走了，你自己多加小心。");
			Perform(c, "pause", 2);
			Perform(c, "say", "当初是你自己不杀他的，。好了，我们不要在这了，这不安全。");
			Perform(c, "pause", 2);
			Perform(c, "say", "不用..他会自然来找我们的。我们不用等，他很快就会来的。");
			Perform(c, "pause", 2);
			Perform(c, "say", "现在还不是时候，我也不知道他在哪里，只是知道他有这个念头。。");
			Perform(c, "pause", 2);
			Perform(c, "say", "我们没事，现在孙玉伯把我们放了.。。他要注定跟你开斗了。");
			Perform(c, "faceto", player);

			Perform(c1, "pause", 20000);
			Perform(c2, "pause", 20000);
			Perform(c3, "pause", 20000);
			Perform(c4, "pause", 20000);

			PlayerPerform("say", "恩..。你们赶紧去快活林，我继续摸孙老头的底。");		
			PlayerPerform("pause", 2);
			PlayerPerform("say", "哼..这老头子，当初在金华我该一刀杀死他。。");		
			PlayerPerform("pause", 2);
			PlayerPerform("say", "梦。那你说怎么办才好？难道就这么等着他。");		
			PlayerPerform("pause", 2);
			PlayerPerform("say", "我正等着他呢，他人现在在哪里？。");		
			PlayerPerform("pause", 1);
			PlayerPerform("block", 1);

		         trg2 = 4;
		        timer2 = now + 10; 


	    }

          }

     if (trg2 == 4 && now>timer2)
	{


              AddNPC("风雪1");
              AddNPC("风雪2");
                RemoveNPC(GetAnyChar("伊人梦"));
                RemoveNPC(GetAnyChar("凤凤"));
                RemoveNPC(GetAnyChar("高老大"));
                RemoveNPC(GetAnyChar("小何"));
                RemoveNPC(GetAnyChar("叶翔"));
		         trg2 = 5;

	}


 if (trg2 == 5)
	{
		c = GetChar("一级高官");	
		c2 = GetChar("律香川");		
		if (c>=0 && GetEnemy(c)==player)
		{
                        ChangeBehavior(c,"follow",player);
			Perform(c, "aggress");
			Perform(c, "say", "你小子有志气，是我的对手..来吧。。");
			Perform(c, "pause", 6);
			Perform(c, "say", "伊人君..。在次领教你的高招了。");
			Perform(c, "pause", 4);
			Perform(c, "say", "谈完了吧，。。快活林的人我已经放了，但是你是不会放的。");
			Perform(c, "faceto", player);

			Perform(c2, "say", "猖狂。看招");
			Perform(c2, "pause", 6);
			Perform(c2, "say", "今天就是为公子报仇的机会了，这次不会让你活着走出风雪半步");
			Perform(c2, "say", "知道为什么不会放你吗。因为公子全是你一人杀害.");
			Perform(c2, "pause", 2);
			Perform(c2, "faceto", player);

			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 20);
			PlayerPerform("say", "那好阿，..。我看我能不能走出去，1 2 你们两个一起上。");		
			PlayerPerform("pause", 5);
			PlayerPerform("say", "哦？这么偏见。。");		
			PlayerPerform("pause", 1);
			PlayerPerform("block", 1);

		         trg2 = 6;
		        timer0 = now + 12; 


	    }

          }

     if (trg2 == 6 && now>timer0)
	{


              AddNPC("风雪镖客1");
              AddNPC("风雪镖客2");
              AddNPC("风雪野兽1");
              AddNPC("风雪野兽2");
              AddNPC("风雪僵尸1");
              AddNPC("风雪僵尸2");

		         trg2 = 7;


	    }


 if (trg2 == 7)
	{
		c = GetChar("一级高官");	
		c1 = GetChar("律香川");	
		c2 = GetChar("指虎僵尸王1");	
		c3 = GetChar("指虎僵尸王2");	
		c4 = GetChar("野兽1");	
		c5 = GetChar("野兽2");	
		c6 = GetChar("风雪镖客1");	
		c7 = GetChar("风雪镖客2");	
		if (c>=0 && GetEnemy(c)==player)
		{

                        Perform(c, "use", 19);
                        Perform(c, "use", 5);
                        Perform(c, "use", 33);
                        Perform(c, "use", 4);
                        Perform(c, "use", 34);
                        Perform(c, "use", 41);
			Perform(c, "say", "都过来干掉这小子...。");
			Perform(c, "faceto", player);

		       ChangeBehavior(c1, "kill", player);
                        Perform(c1, "use", 19);
                        Perform(c1, "use", 5);
                        Perform(c1, "use", 34);
                        Perform(c1, "use", 4);
                        Perform(c1, "use", 33);
                        Perform(c1, "use", 3);
		       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);	

		trg2 = 8;
	}
}



if (trg2 == 8)
	{
		c = GetChar("一级高官");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "say", "。..");

			trg2 = 9;
		}
	}
if (trg2 == 9)
	{
		c = GetChar("律香川");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "say", "。....不可能的..");

			trg2 = 10;
		}
	}

      if (trg2 == 10)
	{
		c = GetAnyChar("一级高官");
		c1 = GetAnyChar("律香川");
		if (GetHP(c)<=0 && GetHP(c1)<=0 && player>=0 && GetHP(player)>0)
		{

			PlayerPerform("say", "不自量力..。别以为你们了不起。不还是败给我伊人");

			trg2 = 11;
			timer0 = now + 4;
		}		
	}
	if (trg2==11 && now>timer0)
	{

	        gameover = 1;
		trg2 = 12;	
	}
	


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