// 决死阵
int Rule = 5;
int RoundTime = 99;
int PlayerSpawn = 79;
int PlayerSpawnDir = 80;
int PlayerWeapon = 56;
int PlayerWeapon2 = 54;
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("npc09_01");
}

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 c10;
	int c11;
	int c12;
	int c13;
	int c14;
	int c15;
	int now = GetGameTime();
	
	
	if (trg0 == 0)
	{
		c = GetChar("孙剑");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && GetEnemy(c)==player && Distance(0, 1)<150)
		{	
                        Perform(c, "pause", 30);
			Perform(c, "say", "你要是能活着出来。！去炼铁狱找我！");
			Perform(c, "say", "现在才知道上当了。。我不耽误你了。哈。");
			Perform(c, "pause", 4);
			Perform(c, "say", "你真是蠢，哈哈！");
			Perform(c, "pause", 3);
			Perform(c, "say", "哈哈，你知道从18层楼上摔下去是什么滋味吗？");
			Perform(c, "faceto", player);
			
			
			PlayerPerform("say", "阿？");
			PlayerPerform("pause", 4);
			PlayerPerform("say", "阿？上当了。。");
			PlayerPerform("pause", 4);
			PlayerPerform("say", "别给我废话，梦呢，不是说送到这里吗？");
			PlayerPerform("pause", 3);
			PlayerPerform("block", 1);
			
			trg0 = 1;
			timer0 = now + 12;
		}
	}
	if (trg0==1 && now>timer0)
	{
	 AddNPC("npc09_02");
	 AddNPC("npc09_03");
	 AddNPC("npc09_04");
	 AddNPC("npc09_05");
	 AddNPC("npc09_06");
	 AddNPC("npc09_07");
	 AddNPC("npc09_08");
	 AddNPC("npc09_09");
         RemoveNPC(GetAnyChar("孙剑"));			
	     trg0 = 2;

	}
	
   if (trg1==0 && trg0==2)
	{
		c2 = GetAnyChar("干死大队长");
		if (c2>=0 && GetHP(c2)<=0)
		{
			reborn = c2;
			rebornName = "npc09_02";
			trg1 = 1;
			timer1 = now + 10;
		}
		c3 = GetAnyChar("干死队2");
		if (c3>=0 && GetHP(c3)<=0)
		{
			reborn = c3;
			rebornName = "npc09_03";
			trg1 = 1;
			timer1 = now + 10;
		}
		c4 = GetAnyChar("干死队3");
		if (c4>=0 && GetHP(c4)<=0)
		{
			reborn = c4;
			rebornName = "npc09_04";
			trg1 = 1;
			timer1 = now + 10;
		}
		c5 = GetAnyChar("干死队4");
		if (c5>=0 && GetHP(c5)<=0)
		{
			reborn = c5;
			rebornName = "npc09_05";
			trg1 = 1;
			timer1 = now + 10;
		}
		c6 = GetAnyChar("干死队5");
		if (c6>=0 && GetHP(c6)<=0)
		{
			reborn = c6;
			rebornName = "npc09_06";
			trg1 = 1;
			timer1 = now + 10;
		}
		c7 = GetAnyChar("干死队6");
		if (c7>=0 && GetHP(c7)<=0)
		{
			reborn = c7;
			rebornName = "npc09_07";
			trg1 = 1;
			timer1 = now + 10;
		}
		c8 = GetAnyChar("干死队7");
		if (c8>=0 && GetHP(c8)<=0)
		{
			reborn = c8;
			rebornName = "npc09_08";
			trg1 = 1;
			timer1 = now + 10;
		}
		c9 = GetAnyChar("干死队8");
		if (c9>=0 && GetHP(c9)<=0)
		{
			reborn = c9;
			rebornName = "npc09_09";
			trg1 = 1;
			timer1 = now + 10;
		}
	}

		
        if (trg1==1 && now>timer1)
	{
		RemoveNPC(reborn);
		timer1 = now + 5;
		trg1 = 2;
	}
	if (trg1==2 && now>timer1)
	{
		AddNPC(rebornName);
		trg1 = 0;
	}
	


	if (trg2 == 0)
	{
		c = GetChar("干死大队长");
		if (c>=0 && GetHP(player)>0)
		{
			Perform(c, "say", "哈哈，终于有肉吃了。一起上吧。。");
	                trg2 = 1;

	}
}

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