// ヱ
int Rule = 1;
int RoundTime = 99;
int PlayerSpawn = 3;
int PlayerSpawnDir = 0;
int PlayerWeapon = 18;
int PlayerWeapon2 = 51;
int PlayerHP = 13000;

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 trg16 = 0;
int trg17 = 0;
int trg18 = 0;
int trg19 = 0;
int trg20 = 0;
int trg21 = 0;
int trg22 = 0;
int trg23 = 0;
int trg24 = 0;
int timer0 = 0;
int timer1 = 0;
int timer2 = 0;
int timer3 = 0;
int timer4 = 0;
int timer5 = 0;
int gameover = 0;
OnStart()
{
		AddNPC("npc+17+01");
		AddNPC("npc+17+02");
		AddNPC("npc+17+03");
		AddNPC("npc+17+04");
		AddNPC("npc+17+05");
		AddNPC("npc+17+06");
		AddNPC("npc+17+07");
		AddNPC("npc+17+08");
}
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("疾风马贼-6");
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "guard", 3);
			Perform(c, "say", "你﹒﹒你﹒﹒你是谁！竟敢擅自闯入禁地！找死！");
			Perform(c, "faceto", player);
			trg0 = 1;
		}
	}
	if (trg1==0)
	{
		c = GetChar("疾风马贼-7");
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "哈，正愁着没乐子呢来过过招");
			Perform(c, "faceto", player);
			trg1 = 1;
		}
	}
	if (trg2==0)
	{
		c = GetChar("疾风马贼-8");
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "伏虎山好久没来刺客了，让我来试试你");
			Perform(c, "faceto", player);
			trg2 = 1;
		}
	}
	if (trg3==0)
	{
		c = GetChar("疾风马贼-1");
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "哼，既然有人能走到这来，来让爷练练手");
			Perform(c, "faceto", player);
			trg3 = 1;
		}
	}
	if (trg4==0)
	{
		c = GetChar("疾风马贼-2");
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "没人能从这活着出去，你的死期到了");
			Perform(c, "faceto", player);
			trg4 = 1;
		}
	}
	if (trg5==0)
	{
		c = GetChar("疾风马贼-3");
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "擅闯禁地的人都要死，你也不例外");
			Perform(c, "faceto", player);
			trg5 = 1;
		}
	}
	if (trg6==0)
	{
		c = GetChar("疾风马贼-4");
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "guard", 3);
			Perform(c, "say", "既然你来了，你就别想活着出去了");
			Perform(c, "faceto", player);
			trg6 = 1;
		}
	}
	if (trg7==0)
	{
		c = GetChar("疾风马贼-5");
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "来问我手中的剑吧！");
			Perform(c, "pause", 4);
			Perform(c, "faceto", player);

			PlayerPerform("block", 0);
		        PlayerPerform("say", "如果你不想和他们一样就告诉我你们首领在哪");
			PlayerPerform("pause", 2);
		        PlayerPerform("say", "你有很多同伴都死了");
			PlayerPerform("block", 1);
			trg7 = 1;
		}
	}
	if (trg0==1 && trg1==1 && trg2==1 && trg3==1 && trg4==1 && trg5==1 && trg6==1 && trg7==1)
	{
		c = GetAnyChar("疾风马贼-1");
		c2 = GetAnyChar("疾风马贼-2");
		c3 = GetAnyChar("疾风马贼-3");
		c4 = GetAnyChar("疾风马贼-4");
		c5 = GetAnyChar("疾风马贼-5");
		c6 = GetAnyChar("疾风马贼-6");
		c7 = GetAnyChar("疾风马贼-7");
		c8 = GetAnyChar("疾风马贼-8");

		if (GetHP(c2)<=0 && GetHP(c3)<=0 && GetHP(c4)<=0 && GetHP(c5)<=0 && GetHP(c6)<=0 && GetHP(c7)<=0 && GetHP(c8)<=0 && GetHP(c)<=0 && player>=0 && GetHP(player)>0)
		{

			PlayerPerform("say", "虽然都是马贼,却也全部忠心耿耿");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "疾风. . . . .");

			timer0 = now + 3;
			trg0 = 2;
		}
	}
	if (trg0 == 2 && now>timer0)
	{
			RemoveNPC(c);
			RemoveNPC(c2);
			RemoveNPC(c8);
			RemoveNPC(c7);
			RemoveNPC(c6);
			RemoveNPC(c5);
			RemoveNPC(c4);
			RemoveNPC(c3);
			timer1 = now + 3;
		trg0 = 3;
	}
	if (trg0 == 3 && now>timer1)
	{
		AddNPC("npc+17+09");
		AddNPC("npc+17+10");
		AddNPC("npc+17+11");
		AddNPC("npc+17+12");
		AddNPC("npc+17+13");
		AddNPC("npc+17+14");
		trg0 = 4;
	}
	if (trg0==4)
	{
		c = GetChar("疾风马贼小队长-1");
		c2 = GetChar("疾风马贼小队长-2");
		c3 = GetChar("疾风马贼小队长-3");
		c4 = GetChar("疾风马贼-1");
		c5 = GetChar("疾风马贼-2");
		c6 = GetChar("疾风马贼-3");
		if (c>=0 && c2>=0 && c3>=0 && c4>=0 && c5>=0 && c6>=0)
		{
			Perform(c, "say", "杀！！");

			trg0 = 5;
		}
	}
	if (trg0==5)
	{
		c = GetAnyChar("疾风马贼小队长-1");
		c2 = GetAnyChar("疾风马贼小队长-2");
		c3 = GetAnyChar("疾风马贼小队长-3");
		c4 = GetAnyChar("疾风马贼-1");
		c5 = GetAnyChar("疾风马贼-2");
		c6 = GetAnyChar("疾风马贼-3");

		if (GetHP(c2)<=0 && GetHP(c3)<=0 && GetHP(c4)<=0 && GetHP(c5)<=0 && GetHP(c6)<=0 && GetHP(c)<=0 && player>=0 && GetHP(player)>0)
		{

			PlayerPerform("pause", 2);

			timer2 = now + 3;
			trg0 = 6;
		}
	}
	if (trg0 == 6 && now>timer2)
	{
			RemoveNPC(c);
			RemoveNPC(c2);
			RemoveNPC(c6);
			RemoveNPC(c5);
			RemoveNPC(c4);
			RemoveNPC(c3);
			timer3 = now + 3;
		trg0 = 7;
	}
	if (trg0 == 7 && now>timer3)
	{
		AddNPC("npc+17+16");
		AddNPC("npc+17+17");
		AddNPC("npc+17+18");
		AddNPC("npc+17+15");
		trg0 = 8;
	}
	if (trg0==8)
	{
		c = GetAnyChar("疾风马贼副首领");
		c2 = GetAnyChar("疾风马贼护法-1");
		c3 = GetAnyChar("疾风马贼护法-2");
		c4 = GetAnyChar("疾风马贼护法-3");
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "问阎王去吧！");
			Perform(c, "pause", 2);

		        PlayerPerform("say", "你们首领在哪？");
			trg0 = 9;
		}
	}
	if (trg0==9)
	{
		c = GetAnyChar("疾风马贼副首领");
		if (c>=0 && GetHP(c)<=GetMaxHP(c)/3)
		{
			Perform(c, "say", "快去地坛通报首领");

		        PlayerPerform("say", "你们已经没有利用价值了，受死吧");
			PlayerPerform("pause", 2);
		        PlayerPerform("say", "地坛吗？");
			PlayerPerform("pause", 2);

			trg0 = 10;
		}
	}
	if (trg0==10)
	{
		c = GetChar("疾风马贼副首领");
		c2 = GetChar("疾风马贼护法-1");
		c3 = GetChar("疾风马贼护法-2");
		c4 = GetChar("疾风马贼护法-3");

		if (GetHP(c)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && GetHP(c4)<=0 && player>=0 && GetHP(player)>0)
		{


			trg0 = 11;
		}
	}
	if (trg0 == 11)
	{
		trg0 = 12;
		gameover = 1;
	}


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

}
