#include "../PScriptLib/AsHelper.as"
// 炼铁狱
int Rule = 2;
int RoundTime = 8;
int PlayerSpawn = 34;
int PlayerSpawnDir = 50;
int PlayerWeapon = 18;
int PlayerWeapon2 = 56;
int PlayerHP = 2000;

int g_counter = 0;
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 timer0 = 0;
int timer1 = 0;
int timer2 = 0;
int timer3 = 0;
int timer4 = 0;
int timer5 = 0;
int gameover = 0;
int gameover1 = 0;
int gameover2 = 0;
int gameover3 = 0;
int gameover4 = 0;
int gameover5 = 0;
int now = 0;
int damn =0; 
int survivor = -1;
string rebornName;
void OnStart()
{
AddNPC("npc10_01");
AddNPC("npc10_02");
	string voiceFolder = "UserData/Voice/sn10/";
	AsSoundCacheFolder(voiceFolder);
	AsSetChatVoiceFolder(voiceFolder);
	

}

void OnUpdate()
{
	int player = GetChar("player");
	if (player < 0)
	{
		player = 0;
	}
	
	int c;
	int c2;
	int flag;
	int c3;
	int c4;
	int c5;
	int c6;
	int c7;
	int c8;
	int c9;
	int c10;
	int c11;
	int c12;
	int c13;
	int t;
	int now = GetGameTime();
	
	if (trg0 == 0)
	{
		c = GetChar("屠城");
		c2 = GetChar("冷燕");
		if (c >= 0)
		{
			Perform(c, "faceto", player);			
			PlayerPerform("use", 14);
			Perform(c2,"use",14);
			trg0 = 1;
		}
	}
	if (trg0 == 1)
	{
		c = GetChar("屠城");
		c2 = GetChar("player");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && GetEnemy(c)==player && Distance(0, 1)<150)
		{	
			Perform(c, "aggress");
			AsPerform(c, "say", "你不愿听命於我那只有死路一条！");
			Perform(c, "pause", 7);
			AsPerform(c, "say", "你们这些杀手，说穿了只是会听话的狗而已！");
			Perform(c, "pause", 7);
			Perform(c, "say", "绝对比你的狗窝快活林还要来的快活多了！");
			Perform(c, "pause", 2);
			Perform(c, "say", "你就作我的左右手，包你有享不尽的容华富贵");
			Perform(c, "pause", 2);
			AsPerform(c, "say", "看你的功夫还有两下子，我很赏识你！");
			Perform(c, "pause", 2);
			Perform(c, "say", "想不到你能活到现在，没把你们整死真是可惜");
			Perform(c, "faceto", c2);
			
			PlayerPerform("block", 0);					
			PlayerPerform("say", "﹒﹒﹒﹒﹒");
			PlayerPerform("pause", 6);			
			PlayerPerform("block", 1);
		
			trg0 = 3; 	
		}		
	}
	if (trg2 == 0)
	{
		c = GetChar("屠城");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{
		Perform(c, "use", 19);
		Perform(c, "use", 34);
		Perform(c, "use", 4);
		CharSetBaseAttrib(2, CharAttrib_Attack, 100);
			AsPerform(c, "say", "你﹒﹒﹒你这家伙！！看我怎麽治你！！");
			Perform(c, "faceto", player);
					
			trg2 = 2;
			timer0 = now + 6;
			trg0 =4;
		}	
	}
	if (trg2 == 2)
	{		
		c = GetAnyChar("屠城");
		if (c>=0 && GetHP(c)<=0)
		{
			Say(c, "﹒﹒﹒﹒想不到﹒﹒﹒我会死在你﹒﹒手中﹒﹒﹒﹒");		
			
			PlayerPerform(c, "﹒﹒﹒﹒﹒﹒");
			PlayerPerform(c, "pause", 3);
			trg2 = 3;			
		}
	}
		if (trg4==0 && trg2==2)
	{
		c = GetChar("屠城");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		c2 = GetChar("player");
		if (GetHP(c2)<GetMaxHP(c2)/2 or GetHP(c)<GetMaxHP(c)/4)
		{

			AsPerform(c, "say", "可恶！竟然敬酒不吃，就让我成全你想死的念头吧！");
			Perform(c, "pause", 8);
			AsPerform(c, "say", "能有这样的福份，你真该好好把握才是﹒﹒呵");
			Perform(c, "pause", 2);
			Perform(c, "say", "还让你当我的左右手，算是很宽宏大量的了");
			Perform(c, "pause", 2);
			Perform(c, "say", "呵！大人有大量，我赦免你一死！");
			Perform(c, "pause", 2);
			AsPerform(c, "say", "我可是英雄惜英雄，留条後路给你走﹒﹒");
			Perform(c, "pause", 6);
			Perform(c, "say", "而且还有大把大把的银子可花，何乐而不为呢？");
			Perform(c, "pause", 2);
			AsPerform(c, "say", "我这还有一瓶解药，只要你点头就不必如此痛苦了");
			Perform(c, "pause", 4);
			Perform(c, "say", "早跟你说了，当我的左右手也没啥不好的嘛！");
			Perform(c, "pause", 4);
			AsPerform(c, "say", "怎麽啦？？毒性是不是已经侵蚀全身了！？");
			Perform(c, "pause", 3);
			Perform(c, "use", 15);
			Perform(c, "use", 15);
			Perform(c, "use", 15);
			Perform(c, "use", 15);
			Perform(c, "use", 19);
			Perform(c, "faceto", player);
			

			PlayerPerform("pause", 6);
			PlayerPerform("use", 19);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 20);			
			PlayerPerform("say", "我不会让在你死的时候感到一丝痛苦地！！");
			PlayerPerform("pause", 6);
			PlayerPerform("say", "还好﹒﹒﹒我还留有一颗心﹒﹒﹒ 不像你﹒﹒");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "而你﹒﹒﹒竟然如此玩弄别人的性命﹒﹒﹒");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "但是﹒﹒﹒我从不会让目标感到痛苦，就让他死去﹒﹒﹒");
			PlayerPerform("pause", 8);
			PlayerPerform("say", "成天就像行尸走肉一般﹒﹒");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "为了生存，永远只能活在黑暗的地方﹒﹒﹒");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "﹒﹒﹒杀手﹒﹒虽然只是工具﹒﹒");
			PlayerPerform("pause", 6);
			PlayerPerform("say", "﹒﹒﹒﹒﹒");
			PlayerPerform("pause", 5);
			PlayerPerform("block", 0);
			PlayerPerform("say", "你﹒﹒把人当做是什麽！！");
			PlayerPerform("say", "（可恶﹒﹒﹒再这样下去﹒﹒﹒撑不了多久的﹒﹒）");
			PlayerPerform("pause", 20);
			PlayerPerform("say", "﹒﹒﹒呜﹒﹒﹒﹒");
			PlayerPerform("block", 1);
			
			
			trg4 = 1;
			trg1 = 1;
			trg0 = 5;
			timer1 = now + 120;
			timer2 = now + 120;
		}	
	}
		if (trg0 == 5)
	{		
		c = GetAnyChar("屠城");
		if (c>=0 && GetHP(c)<=2000&& now>timer3&&GetHP(c)>0)
		{
		    AsPerform(c, "say", "哈哈，你不会不知道你中的毒会致幻吧？你自以为的觉醒不过是透支生命的幻觉！");
			Perform(c, "use", 15);
			Perform(c, "use", 15);
			Perform(c, "use", 19);
			PlayerPerform("use", 19);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 8);
			CharSetBaseAttrib(1, CharAttrib_Attack, 60);
			PlayerPerform("say", "（提示，估算好血量，运用高爆发招式秒杀屠城！）");
			PlayerPerform("say", "我究竟该如何战胜他呢......）");
			PlayerPerform(c, "pause", 3);
			trg0 = 5;
			timer3= now+2;			
		}
	}
		if (trg0 >= 3 && now>timer4&&trg6==0)
	{		
		c = GetAnyChar("屠城");
		c2= GetAnyChar("player");
		if (IsAlive(c)&&!IsAlive(c2))
		{
		    AsPerform(c, "say", "哼，白溅老子一身血！");
			Perform(c, "pause", 3);
			Perform(c, "faceto", c2);
			gameover = -1;
			timer4 = now+5;
			trg6=2;
		}
			if (!IsAlive(c))
		{	timer4 = now+1;
			trg6=1;
		}

	}
	if (trg0 >= 3 && now>timer4&&trg6==1)
	{		c = GetAnyChar("屠城");
		c2= GetAnyChar("player");
	if (IsAlive(c2))
	    {	PlayerPerform("use", 35);
		PlayerPerform("pause", 3);
		PlayerPerform("say", "我已经没有体力了......");
		PlayerPerform("pause", 7);
		    PlayerPerform("say", "又一次赢了......又能如何呢？一切都已经回不去了......");
			PlayerPerform("pause", 3);
			PlayerPerform("faceto", c);	
			timer4=now+5;
			trg6=2;
			gameover=-1;
		}

	if (!IsAlive(c2)&&!IsAlive(c))
		{
            PlayerPerform("use", 19);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 8);
             PlayerPerform("say", "不，只有活着才有希望，我还能救冷燕出去！");
			PlayerPerform("pause", 10);
		    PlayerPerform("say", "难道死亡就是杀手最终的归宿吗？");
			PlayerPerform("pause", 5);
			timer4 = now+15;
			trg6=3;
			
	     }
	}
	if (trg0 >= 3 && now>timer4&&trg6==3)
	{
	timer4 = now+1;	
	Reborn(1);
	trg6= 4;
	}
		if (trg0 >= 3 && now>timer4&&trg6==4)
	{
	gameover = 1;
	timer4 = now+3;	
	AsPlayerPose(22);
	trg6= 5;
	}
		if ((gameover==1 || gameover==-1) && now>timer4)
	{   
		GameOver(gameover);
		gameover = 2;
	}
}

