// 圆满楼

int Rule = 1;
int RoundTime = 600;
int PlayerSpawn = 19;
int PlayerSpawnDir =Rand(200);
int PlayerWeapon = 10+Rand(20);
int PlayerWeapon2 = 14;
int PlayerHP = 15000;



int player;
int trg0;
int trg1;
int trg2;
int trg3;
int trg4;
int trg5;
int Spa1;
int Spa2;
int s1;
int s2;
int s3;
int s4;
int s5;
int k1;
int k2;
int k3;
int k4;
int k5;
int obj1;
int obj2;
int obj3;
int obj4;
int obj5;
int obj6;
int timer0;
int timer1;
int timer2;
int timer3;
int gameover; 


OnStart()
{
	AddNPC("7关血头1"); 
	AddNPC("4关黑衣1");
	AddNPC("4关黑衣2"); 
	AddNPC("4关黑衣3"); 
	AddNPC("4关黑衣4");
}

OnUpdate()
{
	int player = GetAnyChar("player");
	if (player < 0)
	{
		return 0;
	}
	if (gameover == 2)
	{
		return 0;
	}
	int now = GetGameTime();

        if (trg0 == 0)
	{
		int c = GetChar("血杀总头领");
		int c1 = GetChar("黑衣杀手1");
		int c2 = GetChar("黑衣杀手2");
		int c3 = GetChar("黑衣杀手3");
		int c4 = GetChar("黑衣杀手4");
		if (c > 0 && c1 > 0)
		{

			Perform(c, "say", "你们去把那家伙抓过来！");

			trg0 = 1;
		}
        }
        if (c1>=0 && GetEnemy(c1)==player && s1==0)
		{
			ChangeBehavior(c2, "follow", c1);
			ChangeBehavior(c3, "follow", c1);
			ChangeBehavior(c4, "follow", c1);
			Perform(c1, "aggress");
			Perform(c1, "say", "发现了！这小子在这，快来帮忙！");
			Perform(c1, "faceto", player);
		        s1=1; 
		}
		if (c2>=0 && GetEnemy(c2)==player && s1==0)
		{
			ChangeBehavior(c1, "follow", c2);
			ChangeBehavior(c3, "follow", c2);
			ChangeBehavior(c4, "follow", c2);
			Perform(c2, "aggress");
			Perform(c2, "say", "发现了！这小子在这，快来帮忙！");
			Perform(c2, "faceto", player);
		        s1=1; 
		}
		if (c>=0 && GetEnemy(c)==player && s2==0)
		{
			ChangeBehavior(c1, "follow", c);
			ChangeBehavior(c3, "follow", c);
			ChangeBehavior(c4, "follow", c);
			ChangeBehavior(c2, "follow", c);
			Perform(c, "aggress");
			Perform(c, "say", "都过来！这家伙可让我找到了！！");
			Perform(c, "faceto", player);

			Perform(c2, "say", "老大！小子马上去支援！！");
			Perform(c2, "pause", 3);
      		        s2=1; 
		        timer0 = now + 10; 
		}
        if ( s2==1 && now > timer0)
	{
			Perform(c, "say", "这家伙跑哪去了！怕死的家伙·");
			Perform(c, "faceto", player);

	        PlayerPerform("say","你怕死是真的！！…");
			PlayerPerform("pause", 2);
      		        s2=2; 
		        timer0 = now + 10; 
		}
        if ( s2==2 && now > timer0)
	{		Perform(c, "aggress");
			Perform(c, "say", "老子想陪你玩玩在让你死...");
			Perform(c, "faceto", player);
			Perform(c1, "attack");
			Perform(c1, "say", "死的当然是你了！！..");
                        Perform(c1, "pause", 4);
			Perform(c1, "faceto", player);

	                PlayerPerform("say","谁死现在还不知道呢。/…");
			PlayerPerform("pause", 2);
      		        s2=3; 
		}
		if (GetHP(c) <= 0 && s2== 3)
		{
			Say(c,"怎么会！我怎么会败给你！！恨阿...");
			ChangeBehavior(c1, "kill", player);
			ChangeBehavior(c2, "kill", player);
			ChangeBehavior(c3, "kill", player);
			ChangeBehavior(c4, "kill", player);
		        RemoveNPC(c);
			s2=4;
		}

	if (trg0 == 1)
	{
		if (GetHP(c) <=0 &&GetHP(c1) <=0 && GetHP(c2) <=0 && GetHP(c3)<=0 && GetHP(c4)<=0)
		{
		RemoveNPC(c1);
		RemoveNPC(c2);
		RemoveNPC(c3);
		RemoveNPC(c4);
trg0 = 2;timer2 = now + 5; }}
if ( trg0 == 2 && now > timer2)
{
		AddNPC("7关杀手1");
		AddNPC("7关杀手2");
		AddNPC("7关杀手3");
		AddNPC("7关杀手4");
		AddNPC("7关杀手5");
		trg0 = 3;}

             if (trg1 == 0)
	     {
                int  c5 = GetChar("鶴雪杀手团1");
                int  c6 = GetChar("鶴雪杀手团2");
                int  c7 = GetChar("鶴雪杀手团3");
                int  c8 = GetChar("鶴雪杀手团4");
                int  c9 = GetChar("鶴雪杀手团5");
		if (c5 > 0)
		{
			Perform(c5, "say", "哼！！那岂不更好！杀...");
			Perform(c5, "guard", 4);
			Perform(c5, "faceto", player);
			Perform(c5, "say", "所有人不能让伊人君通关了。听见了没有？");

			ChangeBehavior(c6, "kill", player);
			ChangeBehavior(c7, "kill", player);
			ChangeBehavior(c8, "kill", player);
			ChangeBehavior(c9, "kill", player);

			PlayerPerform("block", 0);
			PlayerPerform("say", "我就在这里！过来杀我吧！！");
			PlayerPerform("pause", 2);
			PlayerPerform("block", 1);

			         trg1 = 1;
		        }
                     }
		if (GetHP(c5) <= 0 && trg1 == 1)
		{
			Say(c5,"怎么会！我怎么会败给你！！恨阿...");
			ChangeBehavior(c9, "kill", player);
			ChangeBehavior(c6, "kill", player);
			ChangeBehavior(c7, "kill", player);
			ChangeBehavior(c8, "kill", player);
		        AddNPC("7关1");
		        RemoveNPC(c5);
			trg1 = 2;
		}
	if (trg2 == 0)
	{
                int c10 = GetChar("一剑飙血");
		if (c10 > 0)
		{
			ChangeBehavior(c10, "kill", player);
			Perform(c10, "say", "那么多废话干什么.连续杀死这么多人。今天让你尝尝被杀的滋味。.");
			Perform(c10, "guard", 4);
			Perform(c10, "faceto", player);
			Perform(c10, "say", "唉..真是一群废物阿！！还是让我来修理你吧");
			Perform(c10, "faceto", player);
				PlayerPerform("block", 0);
			PlayerPerform("say", "那看你有没有这么大的能耐了！");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "你是谁！！");
			PlayerPerform("pause", 2);
			PlayerPerform("block", 1);

			trg2 = 1;
		}
        }
		if (GetHP(c10) <= 0 && trg2 == 1)
		{
			Say(c10,"怎么会！我怎么会败给你！！恨阿...");
			trg2 = 2;
		}
	        if (trg2 == 2)
		{
                 int p2 = GetChar("只痛笑ZJ  ☆");
		 if (p2 > 0)
		  {
			Perform(p2, "say", "去了你就知道了！");
			Perform(p2, "pause", 3);
			Perform(p2, "say", "好了..去执行任务吧！！");
			Perform(p2, "faceto", player);
				PlayerPerform("block", 0);
			PlayerPerform("say", "阿！！");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "？？？什么");
			PlayerPerform("pause", 2);
			PlayerPerform("block", 1);
			trg2 = 3;
		        timer3 = now + 6; 
		}
	}
        if ( trg2 == 3 && now > timer3)
	{

		gameover = 1;

			trg2 = 4;
	                }

        if (trg3 == 0)
	{
		if (GetHP(player)<GetMaxHP(player)/2)
	        { 

		        AddNPC("7关");
                        PlayerPerform("use", 8);
			PlayerPerform("use", 5);
			PlayerPerform("use", 3);		
		        PlayerPerform("use", 4);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
                        trg3 = 1;
		}
	}
	if (trg3 == 1)
	{
                int p1 = GetChar("只痛笑ZJ  ☆");
		if (p1 > 0)
		{
			ChangeBehavior(p1, "follow", player);
			Perform(p1, "say", "我是来帮你的！！别说了。一起杀死他");
			Perform(p1, "guard", 2);
			Perform(p1, "faceto", player);

			PlayerPerform("block", 0);
			PlayerPerform("say", "多谢了！！");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "你是？！！");
			PlayerPerform("block", 1);
                        trg3 = 2;
		}
	}

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

}
