#include "../PScriptLib/AsHelper.as"
// 决死阵
int Rule = 1;
int RoundTime = 5;
int PlayerSpawn = 0;
int PlayerSpawnDir = 90;
int PlayerWeapon = 23;
int PlayerWeapon2 = 22;
int PlayerHP = 700;


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 damn1 =0;
int damn2 =0; 

void OnStart()
{
	AddNPC("npc09_01");
	AddNPC("npc09_02");
		string voiceFolder = "UserData/Voice/sn09/";
	AsSoundCacheFolder(voiceFolder);
	AsSetChatVoiceFolder(voiceFolder);
}

void OnUpdate()
{	
	int player = GetAnyChar("player");
	if (player < 0)
	{
		player = 0;
	}
	if (gameover == 2)
	{
		gameover = 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 now = GetGameTime();
	
	if (trg0 == 0)
	{
		c = GetChar("冷燕");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("player");
		if (c>=0 && c2>=0)
		{
            ChangeBehavior(c2, "kill", c3);
			Perform(c2, "pause", 2);
			AsPerform(c2, "say", "我倒要看看在你心中是谁更重要！");
			Perform(c2, "pause", 2);
			Perform(c2, "say", "现在我们三个都中了毒，而解药只有两瓶！");
			Perform(c2, "pause", 2);
			AsPerform(c2, "say", "我失败了，全是拜你们四个蠢货所赐！");
			Perform(c2, "pause", 2);
			Perform(c2, "say", "呵﹒﹒叶翔为了个女人背叛我，石群离我而去，小何已经废了，如今连你也要因为一个野女人与我为敌！！");
			Perform(c2, "pause", 5);
			AsPerform(c2, "say", "呵呵呵呵呵！");
			Perform(c2, "faceto", player);
			Perform(c2, "use", 14);
			
			
			AsPerform(c, "say", "（我还有大仇未报）我必须要活下去！！！");
			Perform(c, "guard", 6);
			ChangeBehavior(c, "kill", c2);
			Perform(c, "attack");		
			Perform(c, "faceto", player);
			Perform(c, "guard", 7);
			Perform(c, "faceto", player);
			Perform(c, "say", "......");
			Perform(c, "pause", 5);
			Perform(c, "faceto", player);
			Perform(c, "use", 14);
			
            PlayerPerform("block", 0);
			PlayerPerform("pause", 6);
			PlayerPerform("say", "高﹒﹒﹒高老大！？");
			PlayerPerform("pause", 3);
			PlayerPerform("use", 14);
			PlayerPerform("block", 1);
			CharSetBaseAttrib(1, CharAttrib_Attack, -30);
			CharSetBaseAttrib(2, CharAttrib_Attack, -25);
			CharSetBaseAttrib(3, CharAttrib_Attack, -15);
			SetTeam(c3, 1);	
			SetAllowCharSwitchWeapon(2, false);
			SetAllowCharSwitchWeapon(3, false);
			trg0 = 1;
			timer0 = now + 2;
		}
	}
	if (trg0==1 && now>35)
	{
		c = GetChar("冷燕");
		c2 = GetChar("高寄萍");
		c3 = GetChar("player");
		if (c >= 0)
		{	
           	
			Perform(c, "guard", 6);
			
			 ChangeBehavior(c2, "follow", c3);	
			AsPerform(c2, "say", "提那个狼心狗肺的家伙作什么！");
			Perform(c2, "pause", 4);
			Perform(c2, "faceto", player);			
			Perform(c2, "pause", 2);
			AsPerform(c2, "say", "来呀！！怎麽？？你们就只有这麽一点能耐吗？？");
			Perform(c, "faceto", player);
			

			PlayerPerform("say", "﹒﹒﹒我﹒﹒叶翔.....！！");
			PlayerPerform("pause", 4);
			PlayerPerform("say", "﹒﹒﹒﹒﹒");
			PlayerPerform("pause", 2);
			
			trg0 = 2;
		}				
	}
		if (trg0==2 && now>60)
	{
		c = GetChar("冷燕");
		c2 = GetChar("高寄萍");
		c3 = GetChar("player");
		if (c >= 0)
		{	
		Perform(c, "guard", 7);
            ChangeBehavior(c, "follow", c3);
			AsPerform(c, "say", "我真的好累......希望你们能够接受我的祝福，好好活下去！");
			Perform(c, "pause", 8);	
			AsPerform(c, "say", "（我怕孤独，怕无力，我想要小孟陪我，其实是想诱惑他为我卖命！）");
            Perform(c, "pause", 4);			
			AsPerform(c, "say", "（我真的喜欢小孟吗？我不过是个过客﹒﹒﹒﹒）");
			Perform(c, "pause", 4);
			Perform(c, "faceto", player);
			Perform(c, "say", ".......");
			
			ChangeBehavior(c2, "kill", c);
			Perform(c2, "pause", 2);
			AsPerform(c2, "say", "快呀！就让这个野女人杀了我！！");
			Perform(c2, "faceto", player);
			
			PlayerPerform("say", "或许......我的离开，才是最大的解脱吧，你们替我活下去。");
			PlayerPerform("pause", 4);
			PlayerPerform("say", "我不过是具看不见光明的行尸走肉，或许......");
			PlayerPerform("pause", 4);
			PlayerPerform("say", "高老大......冷燕......");
			PlayerPerform("pause", 7);			
			trg0 = 3;			
		}
	}
	
		if (trg0==3 && now>75)
	{
		c = GetChar("冷燕");
		c2 = GetChar("高寄萍");
		c3 = GetChar("player");
		if (c >= 0)
		{			
Perform(c2, "say", "小孟！");
Perform(c2, "pause", 10);
			
			trg0 = 4;			
		}
	}
		if (trg0==4 && now>85)
	{
		c = GetChar("冷燕");
		c2 = GetChar("高寄萍");
		c3 = GetChar("player");
		if (c >= 0)
		{			
gameover = 1;
			
			trg0 = 5;			
		}
	}
if (trg10==0&& now > timer0)
{
		c = GetChar("冷燕");
		c2 = GetChar("高寄萍");
		c3 = GetChar("player");
		if(!IsAlive(c) or !IsAlive(c2)or !IsAlive(c3))
		{
		gameover = -1;
		trg10 = 1;
		}
}
	
	if ((gameover==1 || gameover==-1) && now>timer1)
	{
		GameOver(gameover);
		gameover = 2;
	}
}
