// 洛阳城
int Rule = 4;
int RoundTime = 99;
int PlayerSpawn = 140;
int PlayerSpawnDir = 180;
int PlayerWeapon = 24;
int PlayerWeapon2 = 24;
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;

OnStart()
{
	AddNPC("npc-19-01");
	AddNPC("npc-19-02");
	AddNPC("npc-19-03");
	AddNPC("npc-19-04");
	AddNPC("npc-19-05");
	AddNPC("npc-19-06");
	AddNPC("npc-19-07");
        AddNPC("npc-19-25");
}


OnUpdate()
{
	int player = GetChar("player");
	if (player < 0)
	{
		return 0;
	}
	
	int c;
	int c2;
        int c3;
        int c4;
        int c5;
        int c6;

	if (trg0 == 0)
	{
		c = GetChar("虚凉"); 
		c2 = GetChar("琼华派弟子﹒甲"); 
		c3 = GetChar("琼华派弟子﹒乙");
		c4 = GetChar("琼华派弟子﹒丙"); 
		c5 = GetChar("琼华派弟子﹒丁");
                c6 = GetChar("慕容紫英");
		
		if (c>=0 && c2>=0 && c3>=0 && c4>=0 && c5>=0 && c6>=0)
		{
			Perform(c, "say", "住口！不必多说，拔你的剑！");
                        Perform(c, "pause", 5);
                        Perform(c, "say", "用不了多时，本派弟子皆可白日飞升，乃是否极泰来、先破后立！容不得你在此大放厥词！");
                        Perform(c, "say", "琼华派脱离山体，虽然不再受地灵之气庇护、四时如春，但却有双剑灵气支撑，飞往昆仑天光处！");
                        Perform(c, "pause", 5);
                        Perform(c, "say", "慕容紫英，你自甘堕落，与妖为伍！根本是师门之耻！有何资格在此胡言乱语！");
                        Perform(c, "pause", 3);
                        
			Perform(c, "faceto", c6);
			
                        Perform(c6, "say", "……天河，菱纱，你们都退开，让我一个人来。");
                        Perform(c6, "pause", 5);
                        Perform(c6, "say", "琼华派升起引发大地震动、昆仑山河水污浊，祸及山下百姓，如此为之，也是否极泰来、先破后立？");
                        Perform(c6, "say", "好一个否极泰来、先破后立！");
                        Perform(c6, "pause", 5);
                        Perform(c6, "say", "。。。。。。。。");
                        Perform(c6, "pause", 5);
                        Perform(c6, "say", "。。。。。。");
			Perform(c6, "pause", 5);
                       
			trg0 = 1;
		}
	}
	if (trg1 == 0)
	{
		c = GetChar("虚凉");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "guard", 4);
			Perform(c, "say", "呜～～你～～～～");
			Perform(c, "faceto", player);
			trg1 = 1;
		}
	}
	if (trg1 == 1)
	{
		c = GetAnyChar("虚凉");
		if (GetHP(c) <= 0)
		{
			Say(c, "慕。。。容。。紫。。。。英！！！！！");
			trg1 = 2;
		}
	}	
	if (trg1 == 2)
	{
		c = GetAnyChar("虚凉"); 
		c2 = GetAnyChar("琼华派弟子﹒甲"); 
		c3 = GetAnyChar("琼华派弟子﹒乙");
		c4 = GetAnyChar("琼华派弟子﹒丙"); 
		c5 = GetAnyChar("琼华派弟子﹒丁");
                c6 = GetAnyChar("慕容紫英");
		
		if (GetHP(c)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && GetHP(c4)<=0 && GetHP(c5)<=0 && player>=0 && GetHP(player)>0)
		{

			AddNPC("npc-19-08");
                 	AddNPC("npc-19-09");
                	AddNPC("npc-19-10");
		        RemoveNPC(c5);
		        RemoveNPC(c4);
		        RemoveNPC(c3);
		        RemoveNPC(c2);
		        RemoveNPC(c);

			trg1 = 3;
		}
	}
	if (trg2 == 0)
	{
		c = GetChar("昆仑四圣兽.开明"); 
		
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "嚎！！！");
			
			trg2 = 1;
		}
	}
	if (trg3 == 0)
	{
		c = GetChar("昆仑四圣兽.开明");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "guard", 4);
			Perform(c, "faceto", player);
			trg3 = 1;
		}
	}
	if (trg3 == 1)
	{
		c = GetAnyChar("琼华四圣兽.开明");
		if (GetHP(c) <= 0)
		{
			Say(c, "呜～～～～～");
			trg3 = 2;
		}
	}	
	if (trg3 == 2)
	{
		c = GetAnyChar("昆仑四圣兽.开明"); 
		c2 = GetAnyChar("琼华派弟子﹒戊"); 
		c3 = GetAnyChar("琼华派弟子﹒己");
		
		if (GetHP(c)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && player>=0 && GetHP(player)>0)
		{

			AddNPC("npc-19-11");
                 	AddNPC("npc-19-12");
                	AddNPC("npc-19-13");
		        RemoveNPC(c3);
		        RemoveNPC(c2);
		        RemoveNPC(c);

			trg3 = 3;
		}
	}
	if (trg4 == 0)
	{
		c = GetChar("昆仑四圣兽.离朱"); 
		
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "杀！！！！！！");
			
			trg4 = 1;
		}
	}
	if (trg4 == 1)
	{
		c = GetChar("昆仑四圣兽.离朱");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "guard", 4);
			Perform(c, "faceto", player);
			trg4 = 2;
		}
	}
	if (trg4 == 2)
	{
		c = GetAnyChar("昆仑四圣兽.离朱");
		if (GetHP(c) <= 0)
		{
			Say(c, "呃。。。。");
			trg4 = 3;
		}
	}	
	if (trg4 == 3)
	{
		c = GetAnyChar("昆仑四圣兽.离朱"); 
		c2 = GetAnyChar("琼华派弟子﹒庚"); 
		c3 = GetAnyChar("琼华派弟子﹒辛");
		
		if (GetHP(c)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && player>=0 && GetHP(player)>0)
		{

			AddNPC("npc-19-14");
                 	AddNPC("npc-19-15");
                	AddNPC("npc-19-16");
		        RemoveNPC(c3);
		        RemoveNPC(c2);
		        RemoveNPC(c);

			trg4 = 4;
		}
	}
	if (trg5 == 0)
	{
		c = GetChar("昆仑四圣兽.陆吾"); 
		
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "。。。。。。");
			
			trg5 = 1;
		}
	}
	if (trg5 == 1)
	{
		c = GetChar("昆仑四圣兽.陆吾");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "guard", 4);
			Perform(c, "faceto", player);
			trg5 = 2;
		}
	}
	if (trg5 == 2)
	{
		c = GetAnyChar("昆仑四圣兽.陆吾");
		if (GetHP(c) <= 0)
		{
			Say(c, "啊！！");
			trg5 = 3;
		}
	}	
	if (trg5 == 3)
	{
		c = GetAnyChar("昆仑四圣兽.陆吾"); 
		c2 = GetAnyChar("琼华派弟子﹒壬"); 
		c3 = GetAnyChar("琼华派弟子﹒癸");
		
		if (GetHP(c)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && player>=0 && GetHP(player)>0)
		{

			AddNPC("npc-19-17");
                 	AddNPC("npc-19-18");
                	AddNPC("npc-19-19");
		        RemoveNPC(c3);
		        RemoveNPC(c2);
		        RemoveNPC(c);

			trg5 = 4;
		}
	}

	if (trg6 == 0)
	{
		c = GetChar("昆仑四圣兽.英招"); 
		
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "say", "哼，给我上！！！！");
			
			trg6 = 1;
		}
	}
	if (trg6 == 1)
	{
		c = GetChar("昆仑四圣兽.英招");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "guard", 4);
			Perform(c, "say", "哦？你。。。。");
			Perform(c, "faceto", player);
			trg6 = 2;
		}
	}
	if (trg6 == 2)
	{
		c = GetAnyChar("昆仑四圣兽.英招");
		if (GetHP(c) <= 0)
		{
			Say(c, "。。。。。。");
			trg6 = 3;
		}
	}	
	if (trg6 == 3)
	{
		c = GetAnyChar("昆仑四圣兽.英招");
		c2 = GetAnyChar("琼华大弟子"); 
		c3 = GetAnyChar("琼华二弟子");
		
		if (GetHP(c)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && player>=0 && GetHP(player)>0)
		{

			AddNPC("npc-19-20");
                 	AddNPC("npc-19-21");
                	AddNPC("npc-19-22");
                	AddNPC("npc-19-23");
                      
                        RemoveNPC(c4);
		        RemoveNPC(c3);
		        RemoveNPC(c2);
		        RemoveNPC(c);

			trg6 = 4;
		}
	}
	if (trg7 == 0)
	{
		c = GetChar("玄萧");
		
		if (c>=0 && GetEnemy(c)==player)
		{
                        
                        Perform(c, "say", "有此实力，难怪敢来阻我！但结果一样是死！");
                        Perform(c, "pause", 5);
                        Perform(c, "say", "趁我未动杀念，通通滚回山下！");
                        Perform(c, "pause", 5);
                        Perform(c, "say", "我一生清心修道，竟有半生被人视为颠狂！若不做尽狂事，岂非名难副实！！");
                        Perform(c, "say", "哈哈哈！心性成狂、心魔深种！说得好！");
                        Perform(c, "pause", 5);
			Perform(c, "say", "……我未听错吧？此等梦话，今日说来未免大煞风景。");
                        Perform(c, "pause", 5);
                        Perform(c, "say", "好！好！天河你能来，大哥很高兴！");
                        Perform(c, "say", "……天河，你想通透了，要与我一同飞升？");
                        
                        PlayerPerform("say", "…………动手吧！");
                        PlayerPerform("pause", 5);
                        PlayerPerform("say", "玄霄！——");
                        PlayerPerform("pause", 5);
                        PlayerPerform("say", "你已心魔深重，更遑论飞升成仙？！");
			PlayerPerform("say", "我是说真的……你用双剑飞升，只会害人害己……不为别人，就算为你自己，也不该继续下去！");
                        PlayerPerform("pause", 5);
                        PlayerPerform("say", "玄霄，我来这里，是劝你放弃飞升。");
                        PlayerPerform("pause", 5);
                    
			trg7 = 1;
		}
	}
	if (trg7 == 1)
	{
		c = GetChar("玄萧");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "use", 15);
			Perform(c, "guard", 4);
			Perform(c, "say", "吾..你.....");
			Perform(c, "faceto", player);
			trg7 = 2;
		}
	}
	if (trg7 == 2)
	{
		c = GetAnyChar("玄萧");
		if (GetHP(c) <= 0)
		{
			Say(c, "……天河，我不忍下手，你却招招毫无容情！不错、当真不错！");

			PlayerPerform("use", 15);
                        
			trg7 = 3;
		}
	}	
	if (trg7 == 3)
	{
		c = GetAnyChar("玄萧");
		c2 = GetAnyChar("分身﹒甲"); 
		c3 = GetAnyChar("分身﹒乙");
		c4 = GetAnyChar("分身﹒丙"); 
		
		if (GetHP(c)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && GetHP(c4)<=0 && player>=0 && GetHP(player)>0)
		{

                 	AddNPC("npc-19-24");
		        RemoveNPC(c4);
		        RemoveNPC(c3);
		        RemoveNPC(c2);
		        RemoveNPC(c);

			trg7 = 4;
		}
	}
	if (trg8==0)
	{
		c = GetChar("羲和﹒玄萧");
		if (c>=0 && GetEnemy(c)==player)
		{
			Perform(c, "use", 5);
			Perform(c, "use", 4);
			Perform(c, "use", 3);
			Perform(c, "use", 9);
			Perform(c,"say", "顽固至此，我便成全了你！");
			Perform(c,"pause", 2);
			Perform(c,"say", "哈哈——哈哈哈哈！");
			Perform(c, "faceto", player);

                        PlayerPerform("use", 15);
                        PlayerPerform("use", 15);
                        PlayerPerform("use", 20);

			c2 = GetChar("韩菱纱");
			if (c2 >= 0)
			{
				ChangeBehavior(c2, "follow", c);
				Perform(c2, "guard", 10);
				Perform(c2, "faceto", player);
			}

			PlayerPerform("block", 0);
			PlayerPerform("pause", 15);
			PlayerPerform("block", 1);
			trg8 = 1;
		}
	}	
	if (trg8 == 1)
	{
		c = GetChar("羲和﹒玄萧");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "use", 5);
			Perform(c, "use", 4);
			Perform(c, "use", 3);
			Perform(c, "use", 9);
			Perform(c, "say", "呜.....");
			Perform(c,"pause", 2);
			Perform(c, "faceto", player);

			c2 = GetChar("韩菱纱");
			if (c2 >= 0)
			{
				ChangeBehavior(c2, "follow", c);
				Perform(c2, "guard", 10);
				Perform(c2, "faceto", player);
                                Perform(c2, "use", 15);
                                Perform(c2, "use", 15);
			}

			PlayerPerform("block", 0);
			PlayerPerform("pause", 8);
			PlayerPerform("block", 1);
                        PlayerPerform("use", 20);
                        PlayerPerform("use", 15);
                        PlayerPerform("use", 15);
			trg8 = 2;
		}
	}
	if (trg8 == 2)
	{
		c = GetAnyChar("羲和﹒玄萧");
		if (GetHP(c) <= 0)
		{
			Say(c, "好,很好...哈哈哈哈.........");
			trg8 = 3;
		}
	}	
	if (trg8 == 3)
	{
		c = GetAnyChar("韩菱纱");
                
		if (c>=0)
		{
			Perform(c, "say", "啊！……");

                        PlayerPerform("say", "菱纱！紫英！你们受伤了？！");
			trg8 = 4;
		}
	}
	if (trg8 == 4)
	{
		c = GetChar("青阳"); 
		
		if (c>=0)
		{
			Perform(c, "use", 35);
			Perform(c,"pause", 5);
			Perform(c, "say", "结束了～～～");
			
			trg8 = 5;
		}
	}
	if (trg9==0)
	{
		c = GetChar("青阳");
		if (c>=0)
		{
			Perform(c, "faceto", player);

			PlayerPerform("block", 0);
			PlayerPerform("pause", 15);
			PlayerPerform("block", 1);

			trg9 = 1;
		}
	}	
	if (trg9 == 1)
	{
		c = GetAnyChar("青阳");
		if (c>=0 && GetHP(c)<GetMaxHP(c))
		{
			ChangeBehavior(c, "patrol", 110);
			Perform(c, "say", "接招！！");
			Perform(c, "pause", 2);
			Perform(c, "say", "你要为此付代价");
			Perform(c, "pause", 2);
			Perform(c, "faceto", player);
			Perform(c, "say", "你没有遵守你的约定");

	
			PlayerPerform("pause", 8);

			trg9 = 2;
		}
	}
}