// 畃筽
int Rule = 1;
int RoundTime = 15;
int PlayerSpawn = 54;
int PlayerSpawnDir = 0;
int PlayerWeapon = 25;
int PlayerWeapon2 = 4;
int PlayerHP = 3000;

int trg0 = 0;
int timer0 = 0;
int timer1 = 0;
int timer2 = 0;
int gameover = 0;

OnStart()
{
	AddNPC("npc+12+01");
	AddNPC("npc+12+03");
	AddNPC("npc+12+04");
	AddNPC("npc+12+05");
	AddNPC("npc+12+06");
	AddNPC("npc+12+07");
}

OnUpdate()
{
	int player = GetAnyChar("player");
	if (player < 0)
	{
		return 0;
	}
	if (gameover == 2)
	{
		return 0;
	}
	
	int c;
	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("疾风马贼首领");
		c2 = GetChar("疾风马贼护卫-3");
		c3 = GetChar("疾风马贼-2");
		c4 = GetChar("疾风马贼-3");
		c5 = GetChar("疾风马贼-4");
		c6 = GetChar("疾风马贼-1");
		if (c>=0 && c2>=0 && c3>=0 && c4>=0 && c5>=0 && c6>=0)
		{
			Perform(c2, "pause", 100);

			Perform(c3, "pause", 100);

			Perform(c4, "pause", 100);

			Perform(c5, "pause", 100);

			Perform(c6, "pause", 100);

			Perform(c, "pause", 100);
			Perform(c, "faceto", player);
			Perform(c, "pause", 4);
			Perform(c, "say", "哼，一群废物");
			Perform(c, "pause", 4);
			Perform(c, "say", "一个人攻入了伏虎山？");
			Perform(c, "faceto", c2);
			
			Perform(c2, "use", 35);
			Perform(c2, "say", "首﹒﹒﹒首领﹒﹒﹒﹒");
			Perform(c2, "pause", 4);
			Perform(c2, "say", "是，武功极高的一个人");
			Perform(c2, "pause", 2);
			Perform(c2, "faceto", c);
			
			PlayerPerform("block", 0);
			PlayerPerform("pause", 100);
			PlayerPerform("say", "你若不杀他一会儿他可能会帮你挡一剑");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "其实你不该杀他的");
			PlayerPerform("pause", 8);
			PlayerPerform("block", 1);
			
			timer0 = now + 10;
			trg0 = 1;
		}
	}
	if (trg0 == 1 && now>timer0)
	{
		AddNPC("npc+12+02");

		trg0 = 2;
	}

	if (trg0 == 2)
	{
		c = GetChar("疾风马贼首领");
		c2 = GetChar("疾风马贼-1");
		c3 = GetChar("疾风马贼-2");
		c4 = GetChar("疾风马贼-3");
		c5 = GetChar("疾风马贼-4");
		c6 = GetChar("疾风小队长");
		if (c>=0 && c2>=0 && c3>=0 && c4>=0 && c5>=0 && c6>=0 && GetHP(player)>0)
		{
			StopPerform(player);
			StopPerform(c);
			StopPerform(c2);
			StopPerform(c3);
			StopPerform(c4);
			StopPerform(c5);

			Perform(c2, "pause", 100);

			Perform(c3, "pause", 100);

			Perform(c4, "pause", 100);

			Perform(c5, "pause", 100);

			Perform(c, "pause", 100);
			Perform(c, "say", "你们首领是谁？");
			Perform(c, "pause", 3);
			Perform(c, "say", "谁派你来的？");
			Perform(c, "pause", 4);
			Perform(c, "say", "疾风马贼团和阁下有仇吗？");
			Perform(c, "faceto", player);
			Perform(c, "pause", 6);
			Perform(c, "faceto", c6);
			
			Perform(c6, "pause", 100);
			Perform(c6, "say", "啊首领，就是他，他和那丫头联手对付我们的");
			Perform(c6, "faceto", player);
			Perform(c6, "crouch", 0);
			Perform(c6, "pause", 3);
			Perform(c6, "say", "首领，那个姓林的丫头死活不肯说那个男的是谁");
			Perform(c6, "crouch", 1);
			Perform(c6, "faceto", c);
			
			PlayerPerform("block", 0);
			PlayerPerform("pause", 100);
			PlayerPerform("say", "话多了死的会更快的，受死！");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "首领");
			PlayerPerform("pause", 4);
			PlayerPerform("say", "没有，奉命，杀你！");
			PlayerPerform("pause", 8);
			PlayerPerform("block", 1);
			
			timer1 = now + 16;
			trg0 = 3;
		}
	}
	if (trg0 == 3 && now>timer1)
	{
		c = GetChar("疾风马贼首领");
		c2 = GetChar("疾风马贼-1");
		c3 = GetChar("疾风马贼-2");
		c4 = GetChar("疾风马贼-3");
		c5 = GetChar("疾风马贼-4");
		c6 = GetChar("疾风小队长");
		if (c>=0 && c2>=0 && c3>=0 && c4>=0 && c5>=0 && c6>=0 && GetHP(player)>0)
		{
			StopPerform(player);
			StopPerform(c);
			StopPerform(c2);
			StopPerform(c3);
			StopPerform(c4);
			StopPerform(c5);
			StopPerform(c6);
			
			trg0 = 4;
		}
	}
	if (trg0 == 4)
	{
		c = GetAnyChar("疾风马贼首领");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/3 && GetHP(player)>0)
		{			
			Perform(c, "say", "你们先在这顶着！我先想法子去！！");
			Perform(c, "faceto", player);

			PlayerPerform("say", "哼，没良心，受死！");
			PlayerPerform("pause", 6);
			trg0 = 5;
			timer2 = now + 20;
		}
	}
	if (trg0 == 5 && now>timer2)
	{
		c = GetChar("疾风马贼首领");
		if (c >= 0)
		{
				RemoveNPC(c);
				trg0 = 6;
		}		
	}
	if (trg0 == 6)
	{
		c2 = GetChar("疾风马贼-1");
		c3 = GetChar("疾风马贼-2");
		c4 = GetChar("疾风马贼-3");
		c5 = GetChar("疾风马贼-4");
		c6 = GetChar("疾风小队长");
		if (c2<=0 && c3<=0 && c4<=0 && c5<=0 && c6<=0 && GetHP(player)>0)
		{
			
			trg0 = 7;
		}
	}
	if (trg0 == 7)
	{
		trg0 = 8;
		gameover = 1;
	}
	if (gameover!=-1 && GetHP(player)<=0)
	{
		gameover = -1;
		timer1 = now + 2; 
	}
	if ((gameover==1 || gameover==-1) && now>timer1)
	{
		GameOver(gameover);
		gameover = 2;
	}

}
