//  武当山
int Rule = 4;
int RoundTime = 45;
int PlayerSpawn = 115;
int PlayerSpawnDir = 80;
int PlayerWeapon = 15;
int PlayerWeapon2 = 24;
int PlayerHP = 28000;

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 timer0 = 0;
int timer1 = 0;
int timer2 = 0;
int timer3 = 0;
int timer4 = 0;
int timer5 = 0;
int timer6 = 0;
int timer7 = 0;
int gameover = 0;
int reborn = -1;
string rebornName;

OnStart()
{
	AddNPC("npc-15-01");
	AddNPC("npc-15-04");
	AddNPC("npc-15-02");
	AddNPC("npc-15-03");
}


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 now = GetGameTime();
	
	if (trg0 == 0)
	{
		c = GetChar("履面使");
		c2 = GetChar("武当-青玄");
		c3 = GetChar("武当-靛墨");
		c4 = GetChar("武当-柳云飞");
		if (c>=0 && c2>=0 && c3>=0 && c4>=0)
		{
			ChangeBehavior(c, "follow", "player");
			Perform(c, "pause", 26);
			
			ChangeBehavior(c2, "kill", "player");
                        Perform(c2, "say", "是！！！！");
			Perform(c2, "pause", 26);
			Perform(c2, "faceto", c);
			
			ChangeBehavior(c3, "kill", "player");
                        Perform(c3, "say", "是！！！！");
			Perform(c3, "pause", 26);
			Perform(c3, "faceto", c);


			Perform(c4, "say", "布阵！！！两仪！！！");
			Perform(c4, "pause", 2);
			Perform(c4, "say", "哼，我倒要看看你有什么本事，能够连杀两位掌门！！！！");
			Perform(c4, "pause", 6);
			Perform(c4, "say", "阁下今天来恐怕不是来和在下聊聊天的吧……");
			Perform(c4, "pause", 2);
			Perform(c4, "say", "哼，杀了他们的就是阁下了吧……");
			Perform(c4, "pause", 6);
			Perform(c4, "say", "起初我还不信，不过现在看来是真的了……");
			Perform(c4, "pause", 2);
			Perform(c4, "say", "传闻三大门派已经有两个掌门被杀了……");
			Perform(c4, "pause", 2);
			Perform(c4, "faceto", player);
			
			PlayerPerform("block", 0);
			PlayerPerform("pause", 4);
			PlayerPerform("say", "当然不是，我让阁下多活了几天阁下是不是该感谢我呢？？");
			PlayerPerform("pause", 4);
			PlayerPerform("say", "呵呵，见笑了……");
			PlayerPerform("pause", 4);
			PlayerPerform("say", "阁下还真是消息灵通啊！！");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "哼哼，只不过是3天的事而已，阁下就听到了传闻");
			PlayerPerform("pause", 6);
			PlayerPerform("block", 1);
			
			trg0 = 1;
  		}
	}	
	if (trg4 == 0)
	{
		c = GetAnyChar("履面使");
		c2 = GetAnyChar("武当-青玄");
		c3 = GetAnyChar("武当-靛墨");
		c4 = GetAnyChar("武当-柳云飞");
		if (GetHP(c2)<=0 && GetHP(c3)<=0 && c4>=0 && player>=0 && GetHP(player)>0)
		{
			Perform(c, "pause", 6);

			Perform(c4, "say", "三才阵！！！");
			Perform(c4, "pause", 2);
			Perform(c4, "say", "不过这个呢……");
			Perform(c4, "pause", 2);
			Perform(c4, "say", "不错啊，竟然能破掉我的两仪阵……");
			Perform(c4, "pause", 2);

			PlayerPerform("block", 0);
			PlayerPerform("say", "…………");
			PlayerPerform("pause", 6);
			PlayerPerform("block", 1);
			trg4 = 1;
			timer0 = now + 3;
		}
	}  
	if (trg4 == 1 && now>timer0)
	{
		        AddNPC("npc-15-05");
		        AddNPC("npc-15-06");
		        AddNPC("npc-15-07");
		        RemoveNPC(c2);
		        RemoveNPC(c3);
		        trg4 = 2;
	}  
	if (trg5 == 0)
	{
		c = GetAnyChar("履面使");
		c2 = GetAnyChar("武当-紫夜");
		c3 = GetAnyChar("武当-赤明");
		c4 = GetAnyChar("武当-黄云");
		c5 = GetAnyChar("武当-柳云飞");
		if (GetHP(c2)<=0 && GetHP(c3)<=0 && GetHP(c4)<=0 && c4>=0 && player>=0 && GetHP(player)>0)
		{
			Perform(c, "pause", 6);

			Perform(c5, "say", "四象阵！！！");
			Perform(c5, "pause", 2);
			Perform(c5, "say", "不过不要以为只有如此而已……");
			Perform(c5, "pause", 2);
			Perform(c5, "say", "好厉害……");
			Perform(c5, "pause", 2);

			PlayerPerform("block", 0);
			PlayerPerform("say", "…………");
			PlayerPerform("pause", 6);
			PlayerPerform("block", 1);
			trg5 = 1;
			timer3 = now + 3;
		}
	}  
	if (trg5 == 1 && now>timer3)
	{
		        RemoveNPC(c2);
		        RemoveNPC(c3);
		        RemoveNPC(c4);
		        AddNPC("npc-15-09");
		        AddNPC("npc-15-10");
		        AddNPC("npc-15-11");
		        AddNPC("npc-15-12");
		        trg5 = 2;
		        timer4 = now + 3;
	}
        if (trg5 == 2)
	{
		c2 = GetAnyChar("武当-橙月");
		if (c2>=0 && GetHP(c2)<=0)
		{
			reborn = c2;
			rebornName = "npc-33-02";
			trg5 = 3;
			timer2 = now + 5;
		}
		c3 = GetAnyChar("武当-绿幽");
		if (c3>=0 && GetHP(c3)<=0)
		{
			reborn = c3;
			rebornName = "npc-33-03";
			trg5 = 3;
			timer2 = now + 5;
		}
		c4 = GetAnyChar("武当-蓝牙");
		if (c4>=0 && GetHP(c4)<=0)
		{
			reborn = c4;
			rebornName = "npc-33-07";
			trg5 = 3;
			timer2 = now + 5;
		}
		c2 = GetAnyChar("武当-黑火");
		if (c2>=0 && GetHP(c2)<=0)
		{
			reborn = c2;
			rebornName = "npc-33-04";
			trg5 = 3;
			timer2 = now + 5;
		}

	if (trg5==3 && now>timer2)
	{
		RemoveNPC(reborn);
		timer2 = now + 2;
		trg5 = 4;
	}
	if (trg5==4 && now>timer2)
	{
		AddNPC(rebornName);
		trg5 = 2;
	}
        if (trg1 == 0)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)<25000)
                {
                        Perform(c, "say", "哼，你也不过如此……");
                        trg1 = 1;
		}
	} 
        if (trg1 == 1)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)<20000)
                {
                        Perform(c, "say", "哟，还不是太差……");
                        trg1 = 2;
		}
	} 
        if (trg1 == 2)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)<15000)
                {
                        Perform(c, "say", "啧啧，有点本事……");
                        trg1 = 3;
		}
	} 
        if (trg1 == 3)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)<10000)
                {
                        Perform(c, "say", "看来我还小看你了嘛……");
                        trg1 = 4;
		}
	} 	
        if (trg1 == 4)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)<8000)
                {
                        Perform(c, "say", "我要动真格的了……");
                        trg1 = 5;
		}
	} 
        if (trg1 == 5)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)<5000)
                {
                        Perform(c, "say", "可恶……都给我顶住！！！");
                        trg1 = 6;
		}
	} 
        if (trg1 == 6)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)<3000)
                {
           		Perform(c, "use", 19);
                        Perform(c, "say", "哇哑哑，看我的厉害！！！！");
                        trg1 = 7;
		}
	} 
        if (trg2 == 0)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)>0 && GetHP(player)<GetMaxHP(player)/3 )
                {
                        Perform(c, "say", "哼哼，你小子也不过如此！！！！");
                        trg2 = 1;
		}
	} 
        if (trg2 == 1)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)>0 && GetHP(player)<GetMaxHP(player)/4 )
                {
                        Perform(c, "say", "哈哈，你去死吧！！！！");

			PlayerPerform("say", "哼，你不要嚣张待会儿就叫你死！！！");
			PlayerPerform("pause", 2);

                        trg2 = 2;
		}
	} 
        if (trg2 == 2)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)>0 && GetHP(player)<GetMaxHP(player)/14 )
                {
                        Perform(c, "say", "哇卡卡卡卡卡，你这么垃啊，看我直接送你去死！！！！");

           		PlayerPerform("use", 35);
			PlayerPerform("say", "啊！！！！");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "什么！！！");
			PlayerPerform("pause", 2);

                        trg2 = 3;
		}
	} 
        if (trg3 == 0 && trg1 == 0)
        {
                c = GetAnyChar("武当-柳云飞");      
                if (c>=0 && GetHP(c)>20000 && GetHP(player)<GetMaxHP(player)/12 )
                {
			Perform(c, "say", "我*死编剧的，这分明是和我过不去啊！！！……");
			Perform(c, "pause", 2);
			Perform(c, "say", "！！！！！怎么回事？？？？这也太扯了吧……");
			Perform(c, "pause", 12);
                        Perform(c, "say", "小东西，你还真没用啊，不知道那些掌门是不是看你太帅了才自杀的哦~~~~");

           		PlayerPerform("use", 15);
           		PlayerPerform("use", 15);
			PlayerPerform("say", "啊！！！！！太爽啦！！！你丫的去死吧！！");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "有股力量要出来！！！！");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "飞焱剑在震动！！！！");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "该怎么办？？？！！！！");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "可恶，这样下去根本就不是办法！！！！");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "你！！！");
			PlayerPerform("pause", 2);

                        trg3 = 1;
		        timer2 = now + 12;
		}
	} 
	if (trg3 == 1 && now>timer2)
	{
		        AddNPC("npc-15-08");
		        trg3 = 2;
	}  
}