// 炼铁狱
int Rule = 4;
int RoundTime = 30;
int PlayerSpawn = 38;
int PlayerSpawnDir = 100;
int PlayerWeapon = 50;
int PlayerWeapon2 = 14;
int PlayerHP = 10000;

int trg0 = 0;
int trg1 = 0;
int trg2 = 0;
int trg3 = 0;
int trg4 = 0;
int trg5 = 0;
int timer0 = 0;
int timer1 = 0;
int timer2 = 0;
int timer3 = 0;
int timer4 = 0;
int timer5 = 0;
int gameover = 0;
int reborn = -1;
string rebornName;

OnStart()
{
	AddNPC("npc14_01");
}

OnUpdate()
{
	int player = GetChar("player");
	if (player < 0)
	{
		return 0;
	}
	
	int c;
	int c2;
	int c3;
	int c4;
	int c5;
	int now = GetGameTime();
	
	if (trg0 == 0)
	{
		c = GetChar("高老大");
		if (c >= 0)
		{
			Perform(c, "faceto", player);			
			PlayerPerform("use", 9);
			trg0 = 1;
		}
	}
	
	if (trg0 == 1)
	{
		c = GetChar("高老大");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && GetEnemy(c)==player && Distance(0, 1)<150)
		{	
			Perform(c, "use", 7);
			Perform(c, "use", 4);
			Perform(c, "aggress");
			Perform(c, "say", "不要再说了！！！没事的。出手吧。，！！！！");
			Perform(c, "pause", 8);
			Perform(c, "say", "君，我是不放心你，先考验一下你。...");
			Perform(c, "pause", 8);
			Perform(c, "say", "没错，因为这次的任务很危险.......");
			Perform(c, "pause", 6);
			Perform(c, "faceto", player);
			
			PlayerPerform("block", 0);
			PlayerPerform("say", "...阿？。，.......");
			PlayerPerform("pause", 8);			
			PlayerPerform("say", "...阿？汗。我怎么敢向您动手阿。，.......");
			PlayerPerform("pause", 8);			
			PlayerPerform("say", "哇，老大，这么不信任我，我伊人君不会让您失望的。.");
			PlayerPerform("pause", 8);			
			PlayerPerform("say", "？？老大. 想训练我阿？.........");
			PlayerPerform("pause", 2);			
			PlayerPerform("block", 1);
		
			trg0 = 2; 
			timer1 = now + 50;			
		}		
	}
	
	if (trg0==2 && now>timer1)
	{
		c = GetChar("高老大");
		if (c >= 0)
		{
			Perform(c, "use", 4);
			Perform(c, "use", 7);
			Perform(c, "say", "，拿出真本事来！！！！！");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg0 = 3;
			timer1 = now + 30;
		}				
	}
	if (trg0==3 && now>timer1)
	{
		c = GetChar("高老大");
		if (c >= 0)
		{
			Perform(c, "use", 4);
			Perform(c, "use", 7);
			Perform(c, "say", "平时的那个伊人君哪去了？？认真打！！！");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg0 = 4;
			timer1 = now + 30;
		}				
	}	
	if (trg0==4 && now>timer1)
	{
		c = GetChar("高老大");
		if (c >= 0)
		{
			Perform(c, "use", 4);
			Perform(c, "use", 7);
			Perform(c, "say", "我不会对你手下留情的！！！！！");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg0 = 2;
			timer1 = now + 30;
		}				
	}		
	
	if (trg2 == 0)
	{
		c = GetChar("高老大");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{
			Perform(c, "attack");
			Perform(c, "faceto", player);
			Perform(c, "say", ".....（武功还行，只好叫人帮我了..........）");
			Perform(c, "pause", 3);
			Perform(c, "say", "（呜.............）");
			Perform(c, "faceto", player);
					
			trg2 = 1;
			timer0 = now + 6;
		}	
	}
	
	if (trg2==1 && now>timer0)
	{
		AddNPC("npc14_02");
		AddNPC("npc14_03");
		AddNPC("npc14_04");
		AddNPC("npc14_05");
		
		trg2 = 2;
	}	
	if (trg2 == 2)
	{		
		c = GetAnyChar("高老大");
		if (c>=0 && GetHP(c)<=0)
		{
			Say(c, "，阿.........");		
			
			PlayerPerform(c, "﹒﹒﹒﹒﹒﹒");
			PlayerPerform(c, "pause", 3);
			
			ChangeBehavior(c2, "idle");
			Perform(c2, "faceto", c);
			ChangeBehavior(c3, "idle");
			Perform(c3, "faceto", c);
			ChangeBehavior(c4, "idle");
			Perform(c4, "faceto", c);
			ChangeBehavior(c5, "idle");
			Perform(c5, "faceto", c);

			trg2 = 3;			
		}
	}
	
	if (trg3==0 && trg2==2)
	{
		c2 = GetAnyChar("凤凤");
		if (c2>=0 && GetHP(c2)<=0)
		{
			reborn = c2;
			rebornName = "npc10_02";
			trg3 = 1;
			timer4 = now + 2;
		}
		c3 = GetAnyChar("杀手");
		if (c3>=0 && GetHP(c3)<=0)
		{
			reborn = c3;
			rebornName = "npc10_03";
			trg3 = 1;
			timer4 = now + 2;
		}
		c4 = GetAnyChar("小何");
		if (c4>=0 && GetHP(c4)<=0)
		{
			reborn = c4;
			rebornName = "npc10_04";
			trg3 = 1;
			timer4 = now + 2;
		}
		c5 = GetAnyChar("叶翔");
		if (c5>=0 && GetHP(c5)<=0)
		{
			reborn = c5;
			rebornName = "npc10_05";
			trg3 = 1;
			timer4 = now + 2;
		}
	}				
	if (trg3==1 && now>timer4)
	{
		RemoveNPC(reborn);
		timer4 = now + 5;
		trg3 = 2;
	}
	if (trg3==2 && now>timer4)
	{
		AddNPC(rebornName);
		trg3 = 0;
	}

	if (trg4==0 && trg2==2)
	{
		c = GetChar("高老大");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && GetHP(c)<GetMaxHP(c)/4 && Distance(0, 1)<150)
		{
			Perform(c, "say", ".................");
			Perform(c, "pause", 4);
			Perform(c, "faceto", player);
			
                        PlayerPerform("use", 19);
			PlayerPerform("say", ".............");
			PlayerPerform("block", 1);
			
			c2 = GetChar("凤凤");
			if (c2 >= 0)
			{
				Perform(c2, "guard", 30);
				Perform(c2, "faceto", player);
				ChangeBehavior(c2, "dodge", player);
			}
			c2 = GetChar("杀手");
			if (c2 >= 0)
			{
				Perform(c2, "guard", 30);
				Perform(c2, "faceto", player);
				ChangeBehavior(c2, "dodge", player);
			}
			c2 = GetChar("小何");
			if (c2 >= 0)
			{
				Perform(c2, "guard", 30);
				Perform(c2, "faceto", player);
				ChangeBehavior(c2, "dodge", player);
			}
			c2 = GetChar("叶翔");
			if (c2 >= 0)
			{
				Perform(c2, "guard", 30);
				Perform(c2, "faceto", player);
				ChangeBehavior(c2, "dodge", player);
			}
			
			trg4 = 1;
			trg1 = 1;
			trg0 = 5;
			timer1 = now + 10;
			timer2 = now + 10;
		}	
	}

	if (trg4==1 && now>timer1)
	{
		c = GetChar("高老大");
		if (c >= 0)
		{
			Perform(c, "say", "...............");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg4 = 2;
			timer1 = now + 180;
		}				
	}
	if (trg4==2 && now>timer1)
	{
		c = GetChar("高老大");
		if (c >= 0)
		{
			Perform(c, "say", "...");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg4 = 3;
			timer1 = now + 180;
		}				
	}	
	if (trg4==3 && now>timer1)
	{
		c = GetChar("高老大");
		if (c >= 0)
		{
			Perform(c, "say", "...？");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			
			trg4 = 1;
			timer1 = now + 180;
		}				
	}			
	
	if (trg1==1 && now>timer2)
	{
		c = GetChar("高老大");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/4)
		{
			Perform(c, "use", 15);
			Perform(c, "say", "...");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			trg1 = 2;
			timer2 = now + 60;
		}
	}
	if (trg1==2 && now>timer2)
	{
		c = GetChar("高老大");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/4)
		{
			Perform(c, "use", 15);
			Perform(c, "say", "............！！");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			trg1 = 3;
			timer2 = now + 60;
		}
	}	
	if (trg1==3 && now>timer2)
	{
		c = GetChar("高老大");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/4)
		{
			Perform(c, "use", 15);
			Perform(c, "say", "﹒﹒﹒........！！");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			trg1 = 4;
			timer2 = now + 60;
		}
	}	
	if (trg1==4 && now>timer2)
	{
		c = GetChar("高老大");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/4)
		{
			Perform(c, "use", 15);
			Perform(c, "say", "﹒﹒﹒！！！！！！");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			ChangeBehavior(c, "dodge", player);
			trg1 = 1;
			timer2 = now + 60;
		}
	}		



        if (trg5 == 0)
	{
		c = GetChar("高老大");
		if (c>=0 && GetHP(c)<5000)
		{


			Perform(c, "faceto", player);
			Perform(c, "say", "  。唉。希望你们能顺利杀掉孙剑 ");
			Perform(c, "pause", 3);
			Perform(c, "say", "  让梦陪 你一起去把，但是你们不要光顾的甜蜜，而误了大事。 ");
			Perform(c, "pause", 3);
			Perform(c, "say", "好了，不打了，你可以执行任务了。呜，，累死我了");
			Perform(c, "faceto", player);

			PlayerPerform("say", "谢谢老大. 梦。，梦.....呵呵....");
			PlayerPerform("pause", 8);
			trg5 = 1;
			timer3 = now + 9;
		}	
	}



	if (trg5 == 1 && now>timer3)
	{
		AddNPC("npc14_06");
                RemoveNPC(GetAnyChar("杀手"));
                RemoveNPC(GetAnyChar("凤凤"));
                RemoveNPC(GetAnyChar("小何"));
                RemoveNPC(GetAnyChar("叶翔"));

		trg5 = 2;
	}

       if (trg5 == 2)
	{
		c = GetChar("伊人梦");
		c2 = GetChar("高老大");
		if (c>=0 && c2>=0 && GetHP(player)>0)
		{
			Perform(c2, "say", "那我要走了。！");
			Perform(c2, "pause", 4);
			Perform(c2, "say", "但是你们要多加小心，知道吗？");
			Perform(c2, "pause", 1);

			Perform(c, "pause", 30);
			Perform(c, "say", "！我们知道了老大。。");
			Perform(c, "pause", 2);
			Perform(c, "say", "谢谢老大。要不我就闷死了。");
			Perform(c, "pause", 2);
			Perform(c, "say", "老大，我听到了，你让我陪老公一起去。﹒﹒﹒﹒﹒﹒");
			Perform(c, "faceto", c2);

			PlayerPerform("block", 1);

			trg5 = 3;
			timer4 = now + 10;
	      }
	}

	if (trg5 == 3 && now>timer4)
	{
		c = GetAnyChar("高老大");
		if (c>=0)
		{
			RemoveNPC(c);
		}

		gameover = 1;
		timer5 = now + 2;
		trg5 = 4;
	}
         c = GetAnyChar("高寄萍");
	if (gameover!=-1 && c>=0 && GetHP(c)<=0)
	{			
		gameover = -1;
		timer1 = now + 2; 
	}

	if ((gameover==1 || gameover==-1) && now>timer1)
	{
		GameOver(gameover);
		gameover = 2;
	}

}
