#include "../PScriptLib/AsHelper.as"
// 快活林
int Rule = 5;
int RoundTime = 30;
int PlayerSpawn = 152;
int PlayerSpawnDir = 45;
int PlayerWeapon = 15;
int PlayerWeapon2 = 14;
int PlayerHP = 4500;

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 trg13 = 0;
int timer0 = 0;
int timer1 = 0;
int timer2 = 0;
int timer3 = 0;
int timer4 = 0;
int timer5 = 0;
int timer6 = 0;
int gameover = 0;
int gameover1 = 0;
int gameover2 = 0;
int gameover3 = 0;
int gameover4 = 0;
int gameover5 = 0;
int gameover6 = 0;
int now = 0;
int damn =0; 

void OnStart()

{
	string voiceFolder = "UserData/Voice/sn05/";
	AsSoundCacheFolder(voiceFolder);
	AsSetChatVoiceFolder(voiceFolder);
	AddNPC("npc05_01");
}


void OnUpdate()
{

    int player = GetChar("player");
	if (player < 0)
	{
		player = 1;
	}
	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;
now = GetGameTime();
if(trg13 == 0&&now>timer6)
{
 Say(1,"提示：按下K键可以快速跳过剧情。");
 trg13=1;
 timer6=now+1;
 
}
if(trg13 == 1&&now>timer6&&trg0==1)
{
 if (AsIsKeyPressed(ImGuiKey_K))
 {
 trg0=1;
 timer0=now+1;
 trg13=2;
 timer6=now+1;
  Say(1,"提示：按下K键可以快速跳过剧情。");
   StopPerform(2);
 StopPerform(3);
  StopPerform(4);
   StopPerform(5);
    StopPerform(6);
	 StopPerform(7);
	  StopPerform(8);
	   StopPerform(9);
 }
}
if(trg13 == 2&&now>timer6&&trg0==2)
{
 if (AsIsKeyPressed(ImGuiKey_K))
 {
 trg0=2;
 timer0=now+1;
 trg13=3;
 timer6=now+1;
  Say(1,"提示：按下K键可以快速跳过剧情。");
   StopPerform(2);
 StopPerform(3);
  StopPerform(4);
   StopPerform(5);
    StopPerform(6);
	 StopPerform(7);
	  StopPerform(8);
	   StopPerform(9);
 }
}
if(trg13 == 3&&now>timer6&&trg0==3)
{
 if (AsIsKeyPressed(ImGuiKey_K))
 {
 trg0=3;
 timer0=now+1;
 trg13=4;
 timer6=now+1;
  Say(1,"提示：按下K键可以快速跳过剧情。");
   StopPerform(2);
 StopPerform(3);
  StopPerform(4);
   StopPerform(5);
    StopPerform(6);
	 StopPerform(7);
	  StopPerform(8);
	   StopPerform(9);
 }
}
if(trg13 == 4&&now>timer6&&trg0==4)
{
 if (AsIsKeyPressed(ImGuiKey_K))
 {
 trg0=4;
 timer0=now+1;
 trg13=5;
 timer6=now+1;
  Say(1,"提示：按下K键可以快速跳过剧情。");
   StopPerform(2);
 StopPerform(3);
  StopPerform(4);
   StopPerform(5);
    StopPerform(6);
	 StopPerform(7);
	  StopPerform(8);
	   StopPerform(9);
 }
}
if(trg13 == 5&&now>timer6&&trg0==5)
{
 if (AsIsKeyPressed(ImGuiKey_K))
 {
 trg0=5;
 timer0=now+1;
 trg13=6;
 timer6=now+1;
 StopPerform(2);
 StopPerform(3);
  StopPerform(4);
   StopPerform(5);
    StopPerform(6);
	 StopPerform(7);
	  StopPerform(8);
	   StopPerform(9);
 }
}
if(trg0 == 0)
{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		if(c2 >= 0)
		{
		PlayerPerform("say", "（......）");
		PlayerPerform("pause", 10); 
	    PlayerPerform("say", "那我们以后......自由了？");
		PlayerPerform("pause", 10); 
		
		AsPerform(c2, "say", "自由？区区一幢产业就想填饱我的野心？我要的是孙府的气！我要的是孙府的势！");
		Perform(c2, "pause", 8);
		AsPerform(c2, "say", "作为嫁妆之一，孙玉伯将快活林的地契交与了我。");
		Perform(c2, "pause", 8);
		AsPerform(c2, "say", "叶翔将成为孙府的贤婿，他要迎娶孙玉伯的女儿小蝶。");
		SetAllowCharSwitchWeapon(c2, false);
		Perform(c2, "faceto", c);
		trg0 =1;
		timer0 = now +20;//原本+20
		}
}
if(trg0 == 1 && now>timer0)
{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		if(c2 >= 0)
		{
	AddNPC("npc05_02");
	AddNPC("npc05_03");
	AddNPC("npc05_04");
		trg0 =2;
		timer0 = now +1;
		}
}
if(trg0 == 2 && now>timer0)
{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		if(c2 >= 0)
		{
		SetAllowCharSwitchWeapon(c3, false);
		SetAllowCharSwitchWeapon(c4, false);
		SetAllowCharSwitchWeapon(c5, false);
		AsPerform(c4, "say", "现在飞鹏帮已尽在我手，律爷也该设计孙玉伯，夺取孙府了！");
		Perform(c4, "pause", 7);
		Perform(c4, "aggress");
		AsPerform(c4, "say", "小子，还得谢谢你，范璇从密道中逃脱，刚从狗洞中出来，就被我一刀剁了！");
		Perform(c4, "pause", 9);
		AsPerform(c4, "say", "高老板说的对！孙府唾手可得，又怎能因小恩小惠而放弃？");
		Perform(c4, "faceto", c2);
		Perform(c3, "faceto", c2);
		Perform(c5, "faceto", c2);

		trg0 =3;
		timer0 = now +16;//原本+16
		}
}
if(trg0 == 3 && now>timer0)
{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		if(c2 >= 0)
		{
		AddNPC("npc05_05");
		trg0 =4;
		timer0 = now +3;
		}
}
if(trg0 == 4 && now>timer0)
{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		if(c2 >= 0)
		{
		AsPerform(c2, "say", "杀掉孙玉伯，我同样给你自由！");
		Perform(c2, "pause", 9);
		Perform(c2, "aggress");
		AsPerform(c2, "say", "你呢，星魂？是要帮叶翔那个叛徒，还是要帮高老大我，以及你的——小情人？");
		Perform(c2, "pause", 16);
		
		Perform(c5, "aggress");
		AsPerform(c5, "say", "小姑娘，你不是想复国吗？替律爷收拾了孙玉伯后，凭屠老大和律爷的势力，便可助你夺取琉球！");
		Perform(c5, "pause", 1);
		

		AsPerform(c6, "say", "好，我同意了！");
		Perform(c6, "pause", 8);
		Perform(c6, "say", "......");
		Perform(c6, "pause", 4);
		Perform(c6, "faceto", c);
		
PlayerPerform("block",0);	
        PlayerPerform("say", "（可我又该，如何抉择呢......）");
        PlayerPerform("pause", 5); 
        PlayerPerform("say", "（难道自由，还需要别人的施舍？？）");
        PlayerPerform("pause", 5); 
        PlayerPerform("say", "（为什么......我的心这么痛？）");
		PlayerPerform("pause", 5); 
		PlayerPerform("say", "（一边是我的兄弟......一边是......）");		
		PlayerPerform("say", "（......）");
		PlayerPerform("pause", 15);
PlayerPerform("block",1);		
		trg0 =5;
		timer0 = now +22;//原本22
		}
}
if(trg0 == 5 && now>timer0)
{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		if(c2 >= 0)
		{
		AddNPC("npc05_06");
		AddNPC("npc05_07");
		AddNPC("npc05_08");
       RemoveNPC(c3);	
		trg0 =6;
		timer0 = now +1;
		}
}
if(trg0 == 6 && now>timer0)
{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		if(c2 >= 0)
		{
		AddNPC("npc05_09");	
		trg0 =7;
		timer0 = now +1;
		}
}
if(trg0 == 7 && now>timer0)
{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		if(c2 >= 0)
		{
		AddNPC("npc05_10");			
		Perform(c7, "say", "（脱掉宝甲）！！！七星针！！");

		Perform(c7, "pause", 15);
		AsPerform(c7, "say", "安排了叶翔和小蝶的婚事，我就带人去和万鹏王决战，香川，以后小蝶和孙府就拜托你辅佐了。");
		Perform(c7, "pause", 15);
		
		AsPerform(c3, "say", "老伯，我已经帮你找好了姑娘，或许能为你再诞生一位子嗣。");
		Perform(c3, "pause", 29);

		ChangeBehavior(c4, "patrol", 156);
		ChangeBehavior(c5, "patrol", 156);
		ChangeBehavior(c6, "patrol", 38,23,158);
        AsPerform(c2, "say", "星魂，你去杀掉叶翔这个叛徒！");
		CharSetBaseAttrib(9, CharAttrib_Defense, 70);
		Perform(c2, "pause", 8);
		AsPerform(c2, "say", "呵呵呵，贵客来了，诸位，准备接客吧！~");
		Perform(c2, "pause", 1);
		PlayerPerform("block",1);
		trg0 =8;
		timer0 = now +20;//原本20
		}
		}
		if(trg0 == 8 && now>timer0)
{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		 RemoveNPC(c10);
		 AsMoveTo(-514,188, 1);
ChangeBehavior(c5, "kill", c7);
ChangeBehavior(c4, "kill", c7);
ChangeBehavior(c3, "kill", c7);
ChangeBehavior(c7, "wait");
trg0 = 9;			 
}
		if(trg1 == 0&& now>timer0&& trg0 >= 8)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		if (Distance(1, 2) < 200)
		{
		
		PlayerPerform("pause", 8); 
	    PlayerPerform("say", "(我究竟该不该对叶翔出手呢？)");
		PlayerPerform("pause", 8); 
		PlayerPerform("block",0);
		
		
		Perform(c8, "say", "我的手上已经沾满了罪孽，若能有机会，希望你替我向高老大致歉。");
		Perform(c8, "pause", 3);
		AsPerform(c8, "say", "往后，我要隐退江湖当个篾匠了，希望你也能寻找到你的归属。");
		Perform(c8, "pause", 3);
		Perform(c8, "say", "蝴蝶的生命是脆弱的，甚至比最鲜艳的花还脆弱，可是它永远活在春天里，它美丽，它自由，它飞翔......");
		Perform(c8, "pause", 1);
		AsPerform(c8, "say", "小孟，久违了。");
		Perform(c8, "faceto", c);		
		trg1 =2;
		timer1 = now+ 15;
		}
	}
			if(trg1 == 2&& now>timer0&&trg0 >= 9)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);
		if (Distance(1, 2) < 200)
		{
		Perform(c6, "pause", 3);
		AsPerform(c6, "say", "我不想再杀人了！");
		Perform(c6, "say", "......");
		Perform(c6, "pause", 10);
		AsPerform(c6, "say", "你知道我的身世？");
		Perform(c6, "pause", 10);
		
		Perform(c9, "say", "不过我认为，放下这些前缘，找个好人家过日子，或许对你的人生更有意义。");
		Perform(c9, "pause", 5);
		Perform(c9, "say", "小姑娘，你与她有几分神似，若你真渴求力量，我长江排会倒是个不错的选择，孙玉伯也会为你伸张公道。");
		Perform(c9, "pause", 5);
		AsPerform(c9, "say", "现如今，那个姑娘也有你这般大了吧，希望她不要认贼作父，将仇恨带回中原。");
		Perform(c9, "pause", 3);
		Perform(c9, "say", "我记得二十年前，南京城的皇女因政变逃离去了南海，可惜我护卫不利，她襁褓里的婴儿被倭寇掠走了......");
		Perform(c9, "pause", 6);
		Perform(c9, "say", "你是海边长大的孩子吧？你见过流星吗？流星的光芒虽然短促，但天上还有什么星比他更灿烂......");
		Perform(c9, "pause", 1);
		AsPerform(c9, "say", "小姑娘，想不到自金华城一别，我们又见面了！");
		Perform(c9, "pause", 1);
		Perform(c6, "faceto", c9);
		Perform(c9, "faceto", c6);
		trg1 =3;
		SetTeam(c6, 2);
		}
	}
				if(trg1 == 3&&now>timer1)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);
		if (c2>=0 && GetHP(c8)==GetMaxHP(c8)/1)
		{
		ChangeBehavior(c2, "kill",c);
		ChangeBehavior(c9, "kill", c4);
		ChangeBehavior(c6, "follow",c2);
		ChangeBehavior(c3, "kill",c7);
		ChangeBehavior(c4, "kill",c7);
		ChangeBehavior(c5, "kill",c7);
		ChangeBehavior(c8, "follow",c2);
	    PlayerPerform("say", "老伯遇刺了！高老大要杀老伯！");
		PlayerPerform("pause", 3); 
		PlayerPerform("say", "......");
		ChangeBehavior(c8, "patrol", 23,38,49,57);
		ChangeBehavior(c6, "patrol", 23,38,49,57);
		ChangeBehavior(c9, "patrol", 23,38,49,57);
		Perform(c8, "say", "！！！！");
		Perform(c8, "pause", 6);
		SetTeam(c, 2);
		trg1 =5;
		SetTeam(c7, 2);
		}
		
		if (c2>=0 && GetHP(c8)<GetMaxHP(c8)/1)
		{
	    PlayerPerform("say", "对不起，叶翔，我不能背叛高老大。");
		PlayerPerform("pause", 3); 
		PlayerPerform("say", "......");
		ChangeBehavior(c9, "follow", c7);
		ChangeBehavior(c6, "kill", c);
		CharSwitchWeapon(c6);
		Perform(c6, "pause", 1);
		ChangeBehavior(c3, "follow", c4);
		ChangeBehavior(c8, "kill",c);

		ChangeBehavior(c2, "kill", c7);
		ChangeBehavior(c4, "kill", c7);
		ChangeBehavior(c5, "kill", c7);
		ChangeBehavior(c7, "wait");
		Perform(c8, "pause", 6);
		trg1 =4;
		gameover = 3;
		timer1= now +5;
		SetTeam(c7, 2);
		}
	}
	if(trg1 == 5&&now>timer1)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);
		if (c2>=0)
		{
		gameover=4;
		AsPerform(c2, "say", "小孟，想不到你也背叛我！我就知道你们不忠于我的事业，你们都该死！");
		CharSetBaseAttrib(2, CharAttrib_Attack, 45);
		CharSetBaseAttrib(3, CharAttrib_Attack, 9);
		CharSetBaseAttrib(4, CharAttrib_Attack, 9);
		CharSetBaseAttrib(1, CharAttrib_Attack, 15);
		CharSetBaseAttrib(5, CharAttrib_Attack, 9);
		CharSetBaseAttrib(7, CharAttrib_Attack, -15);
		CharSetBaseAttrib(2, CharAttrib_Defense, 20);
		CharSetBaseAttrib(3, CharAttrib_Defense, 20);
		CharSetBaseAttrib(4, CharAttrib_Defense, 20);
		CharSetBaseAttrib(5, CharAttrib_Defense, 20);
		CharSetBaseAttrib(9, CharAttrib_Defense, 20);
		CharSetBaseAttrib(2, CharAttrib_Speed, 150);
		CharSetBaseAttrib(3, CharAttrib_Speed, 150);
		CharSetBaseAttrib(4, CharAttrib_Speed, 150);
		CharSetBaseAttrib(5, CharAttrib_Speed, 150);
		CharSetBaseAttrib(6, CharAttrib_Speed, 150);
		CharSetBaseAttrib(7, CharAttrib_Speed, -50);
		CharSetBaseAttrib(8, CharAttrib_Speed, 150);
		CharSetBaseAttrib(9, CharAttrib_Speed, 150);		
		Perform(c2, "pause", 6);
		trg1 =7;
		}
	}
		if(trg1 == 4&&now>timer1)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);
		if (c2>=0)
		{
		ChangeBehavior(c6, "kill", c);
		SetAllowCharSwitchWeapon(c6, false);
		ChangeBehavior(c9, "kill", c4);
		ChangeBehavior(c5, "kill", c3);
		CharSetBaseAttrib(9, CharAttrib_Attack, 140);
		AsPerform(c8, "say", "我实在不想再出手了，既然如此......我们决一胜负吧！");
		Perform(c8, "pause", 1);		
		CharSetBaseAttrib(6, CharAttrib_Attack, 95);
		CharSetBaseAttrib(5, CharAttrib_Attack, 185);
		CharSetBaseAttrib(9, CharAttrib_Attack, 135);
		CharSetBaseAttrib(2, CharAttrib_Attack, 65);
		CharSetBaseAttrib(4, CharAttrib_Attack, 65);
		CharSetBaseAttrib(3, CharAttrib_Attack, 65);
		CharSetBaseAttrib(9, CharAttrib_Defense, 30);
		CharSetBaseAttrib(4, CharAttrib_Defense, 30);
		CharSetBaseAttrib(5, CharAttrib_Defense, 20);
		CharSetBaseAttrib(3, CharAttrib_Defense, 20);
		CharSetBaseAttrib(2, CharAttrib_Defense, 30);
		CharSetBaseAttrib(6, CharAttrib_Defense, 35);
		CharSetBaseAttrib(5, CharAttrib_Defense, 20);
		CharSetBaseAttrib(9, CharAttrib_Defense, 20);
		AsPerform(c4, "say", "哼，非我族类，其心必异！");
		Perform(c4, "pause", 16);
		AsPerform(c5, "say", "......屠城，你竟然出卖我！");
		Perform(c5, "pause", 10);
		SetTeam(c5, 0);		
		trg1 = 6;
		trg3=1;
		}
	}
			if(trg3 == 0&&now>timer2&&trg1==7)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);
		if (!IsAlive(c7)&&now>timer2)
		{
		ChangeBehavior(c2, "kill", c2);
		ChangeBehavior(c3, "follow",c2);
		ChangeBehavior(c4, "kill", c9);
		ChangeBehavior(c5, "kill", c6);
		ChangeBehavior(c9, "kill", c4);
		ChangeBehavior(c6, "kill", c5);
		ChangeBehavior(c8, "follow", c);
		ChangeBehavior(c9, "follow", c);
		AsPerform(c4, "say", "孙玉伯已经倒了！孙府的人还不投降？");
		trg3=2;
		}
			if (!IsAlive(c3)&&now>timer2)
		{
		ChangeBehavior(c2, "kill", c7);
		ChangeBehavior(c3, "follow", c2);
		ChangeBehavior(c4, "kill", c9);
		ChangeBehavior(c5, "kill", c6);
		ChangeBehavior(c9, "kill", c4);
		ChangeBehavior(c6, "kill", c5);
		ChangeBehavior(c8, "follow", c);
		ChangeBehavior(c7, "follow", c);
		AsPerform(c4, "say", "妈的！");
		AsPerform(c5, "say", "该死的");
		trg3=2;
		}
				if (!IsAlive(c4)&&now>timer2)
		{
		ChangeBehavior(c2, "kill", c7);
		ChangeBehavior(c3, "kill", c);
		ChangeBehavior(c4, "kill", c9);
		ChangeBehavior(c5, "kill", c6);
		ChangeBehavior(c9, "kill", c4);
		ChangeBehavior(c6, "kill", c5);
		ChangeBehavior(c8, "follow", c);
		ChangeBehavior(c7, "follow", c);
		AsPerform(c3, "say", "可恶！");
		AsPerform(c5, "say", "该死的");
		trg3=2;
		}
				if (!IsAlive(c5)&&now>timer2)
		{
		ChangeBehavior(c2, "kill", c7);
		ChangeBehavior(c3, "kill", c);
		ChangeBehavior(c4, "kill", c6);
		ChangeBehavior(c9, "kill", c4);
		ChangeBehavior(c6, "follow", c);
		ChangeBehavior(c8, "follow", c);
		ChangeBehavior(c7, "follow", c);
		AsPerform(c3, "say", "可恶！");
		AsPerform(c5, "say", "该死的");
		trg3=2;
		}
	}
		if(trg3 == 1&&now>timer2&&trg1==6&&trg9==0)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);
		if (!IsAlive(c8)&&now>timer2)
		{
		ChangeBehavior(c9, "follow", c7);
		ChangeBehavior(c6, "kill", c);
		ChangeBehavior(c3, "kill", c7);
		ChangeBehavior(c2, "kill", c7);
		ChangeBehavior(c4, "kill", c7);
		ChangeBehavior(c5, "kill", c7);
		ChangeBehavior(c7, "wait");
		PlayerPerform("say", "我做的......究竟对吗？");
		CharSetBaseAttrib(1, CharAttrib_Attack, 5);
		CharSetBaseAttrib(7, CharAttrib_Attack, 35);
		CharSetBaseAttrib(8, CharAttrib_Attack, 100);
		CharSetBaseAttrib(6, CharAttrib_Attack, 100);			
trg3=1;
trg9=2;
		}
			if (GetHP(c)<=GetMaxHP(c)/3)
		{
		
		ChangeBehavior(c9, "follow", c7);
		ChangeBehavior(c8, "kill", c3);
		ChangeBehavior(c6, "kill", c);
		ChangeBehavior(c3, "kill", c7);
		ChangeBehavior(c2, "kill", c7);
		ChangeBehavior(c4, "kill", c7);
		ChangeBehavior(c5, "kill", c7);
		ChangeBehavior(c7, "wait");
		PlayerPerform("say", "我做的......究竟对吗？");
		PlayerPerform("pause", 10); 		
		CharSetBaseAttrib(7, CharAttrib_Attack, 35);
		CharSetBaseAttrib(6, CharAttrib_Attack, 125);
		CharSetBaseAttrib(9, CharAttrib_Attack, 250);
        CharSetBaseAttrib(9, CharAttrib_Defense, 60);
CharSetBaseAttrib(8, CharAttrib_Attack, 100);	
Say(8, "小孟，你的剑不够锋利");	
        trg3=1;trg9=1;
		}
	}
			if(trg3 == 1&&now>timer2&&trg1==6)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);
		if (!IsAlive(c7)&&now>timer2)
		{
		ChangeBehavior(c9, "kill", c2);
		ChangeBehavior(c6, "kill", c4);
		ChangeBehavior(c7, "kill", c3);
		ChangeBehavior(c3, "follow", c4);
		ChangeBehavior(c2, "kill", c9);
		ChangeBehavior(c4, "kill", c8);
		ChangeBehavior(c5, "kill", c3);		
		ChangeBehavior(c8, "kill", c4);
		CharSetBaseAttrib(6, CharAttrib_Attack, 170);
		CharSetBaseAttrib(5, CharAttrib_Attack, 180);
		CharSetBaseAttrib(7, CharAttrib_Attack, 180);
		CharSetBaseAttrib(8, CharAttrib_Attack, 180);
		CharSetBaseAttrib(9, CharAttrib_Attack, 180);
		CharSetBaseAttrib(6, CharAttrib_Defense, 25);
		CharSetBaseAttrib(7, CharAttrib_Defense, 25);
		CharSetBaseAttrib(8, CharAttrib_Defense, 25);
		CharSetBaseAttrib(9, CharAttrib_Defense, 25);
		CharSetBaseAttrib(2, CharAttrib_Attack, 0);
		CharSetBaseAttrib(4, CharAttrib_Attack, 0);
		CharSetBaseAttrib(3, CharAttrib_Attack, 0);
		CharSetBaseAttrib(4, CharAttrib_Defense, 25);
		CharSetBaseAttrib(3, CharAttrib_Defense, 0);
		CharSetBaseAttrib(2, CharAttrib_Defense, 0);
		Say(8, "老伯！");
		 trg3=4;timer2=now+20;
		 trg8=1;
		}
	}	
		if(trg3 == 1&&now>timer2&&trg1==6&&trg9==1)
	 {
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);
		if (!IsAlive(c7)&&now>timer2)
		{
		ChangeBehavior(c9, "kill", c2);
		ChangeBehavior(c6, "kill", c4);
		ChangeBehavior(c7, "kill", c3);
		ChangeBehavior(c3, "follow", c4);
		ChangeBehavior(c2, "kill", c9);
		ChangeBehavior(c4, "kill", c8);
		ChangeBehavior(c5, "kill", c3);		
		ChangeBehavior(c8, "kill", c4);
		
		CharSetBaseAttrib(6, CharAttrib_Attack, 170);
		CharSetBaseAttrib(5, CharAttrib_Attack, 180);
		CharSetBaseAttrib(7, CharAttrib_Attack, 180);
		CharSetBaseAttrib(8, CharAttrib_Attack, 180);
		CharSetBaseAttrib(9, CharAttrib_Attack, 250);
        CharSetBaseAttrib(9, CharAttrib_Defense, 60);
		CharSetBaseAttrib(6, CharAttrib_Defense, 25);
		CharSetBaseAttrib(7, CharAttrib_Defense, 25);
		CharSetBaseAttrib(8, CharAttrib_Defense, 25);
		CharSetBaseAttrib(2, CharAttrib_Attack, 0);
		CharSetBaseAttrib(4, CharAttrib_Attack, 0);
		CharSetBaseAttrib(3, CharAttrib_Attack, 0);
	    CharSetBaseAttrib(4, CharAttrib_Defense, 25);
		CharSetBaseAttrib(3, CharAttrib_Defense, 0);
		CharSetBaseAttrib(2, CharAttrib_Defense, 0);
		Say(8, "老伯！");
trg3=4;timer2=now+20;trg8=1;
		}
	}
		if(trg3 == 2)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);
		if (now>timer2)
		{
		CharSetBaseAttrib(2, CharAttrib_Attack, 190);
		CharSetBaseAttrib(3, CharAttrib_Attack, 190);
		CharSetBaseAttrib(4, CharAttrib_Attack, 190);
		CharSetBaseAttrib(5, CharAttrib_Attack, 190);
		CharSetBaseAttrib(2, CharAttrib_Defense, 30);
		CharSetBaseAttrib(3, CharAttrib_Defense, 30);
		CharSetBaseAttrib(4, CharAttrib_Defense, 30);
		CharSetBaseAttrib(5, CharAttrib_Defense, 30);
		timer2= now+10;
        trg3=3;
		}
	}
			if(trg3 == 3&&now>timer2)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);

		if (!IsAlive(c7)&&now>timer2&&IsAlive(c6)&&IsAlive(c8)&&IsAlive(c9)&&IsAlive(c3)&&IsAlive(c2)&&IsAlive(c4)&&IsAlive(c5))
		{
		ChangeBehavior(c2, "kill", c);
		ChangeBehavior(c3, "follow", c2);
		ChangeBehavior(c4, "kill", c9);
		ChangeBehavior(c5, "kill", c6);
		ChangeBehavior(c9, "kill", c4);
		ChangeBehavior(c6, "kill", c5);
		ChangeBehavior(c8, "follow", c);
		ChangeBehavior(c9, "follow", c);
		timer2= now+10;
		}
		if (!IsAlive(c7)&&now>timer2&&IsAlive(c6)&&IsAlive(c8)&&IsAlive(c9)&&!IsAlive(c3)&&IsAlive(c2)&&IsAlive(c4)&&IsAlive(c5))
		{
		ChangeBehavior(c2, "kill", c);
		ChangeBehavior(c3, "follow", c2);
		ChangeBehavior(c4, "kill", c9);
		ChangeBehavior(c5, "kill", c6);
		ChangeBehavior(c9, "kill", c4);
		ChangeBehavior(c6, "kill", c5);
		ChangeBehavior(c8, "follow", c);
		ChangeBehavior(c7, "follow", c);
		timer2= now+10;
		}
		if (!IsAlive(c4)&&now>timer2&&!IsAlive(c2))
		{
		trg3 = 5;
		timer2= now+2;
		}
		if (!IsAlive(c4)&&now>timer2&&!IsAlive(c5))
		{
		trg3 = 5;
		timer2= now+2;
		}
		if (!IsAlive(c5)&&now>timer2&&!IsAlive(c2))
		{
		trg3 = 5;
		timer2= now+2;
		}
		if (!IsAlive(c6)&&now>timer2&&!IsAlive(c8))
		{
		trg3 = 5;
		timer2= now+2;
		}
		if (!IsAlive(c6)&&now>timer2&&!IsAlive(c9))
		{
		trg3 = 5;
		timer2= now+2;
		}
		if (!IsAlive(c8)&&now>timer2&&!IsAlive(c9))
		{
		trg3 = 5;
		timer2= now+2;
		}
		if (!IsAlive(c3)&&now>timer2&&!IsAlive(c4))
		{
		trg3 = 5;
		timer2= now+2;
		}
				if (!IsAlive(c3)&&now>timer2&&!IsAlive(c5))
		{
		trg3 = 5;
		timer2= now+2;
		}
		if (!IsAlive(c3)&&now>timer2&&!IsAlive(c2))
		{
		trg3 = 5;
		timer2= now+2;
		}
	}
		if (trg3==5)
		{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		if (c>=0)
		{
		
		ChangeBehavior(c6, "follow",c);
		ChangeBehavior(c9, "follow",c);
		ChangeBehavior(c8, "follow",c);
		ChangeBehavior(c7, "follow",c);
		ChangeBehavior(c2, "kill",c);
		ChangeBehavior(c3, "kill",c);
		ChangeBehavior(c4, "kill",c);
		ChangeBehavior(c5, "kill",c);
		trg3 = 7;
		timer2= now+2;
		}
		}


	if(trg3 == 4&&now>timer2)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		SetTarget(1, "char", player);
		SetTarget(2, "char", c8);
		SetTarget(3, "char", c6);
		SetTarget(4, "char", c9);
		if (trg8==1&&now>timer2)
		{
		Perform(c, "say",  "我得去支援高老大......");
		Perform(c, "pause", 10);
		AsPerform(c4, "say", "小子，同时对付两个好手，也算是难为你了！高寄萍那娘们现在可吃劲的很！你再不去他可要从了易潜龙那老家伙了！");
		Perform(c4, "pause", 2);
		timer2= now+10;
		trg8=2;
		}
if (!IsAlive(c7)&&now>timer2&&IsAlive(c6)&&IsAlive(c8)&&IsAlive(c9)&&IsAlive(c3)&&IsAlive(c2)&&IsAlive(c4)&&IsAlive(c5))
		{
		ChangeBehavior(c9, "kill", c2);
		ChangeBehavior(c6, "kill", c4);
		ChangeBehavior(c7, "kill", c3);
		ChangeBehavior(c3, "follow", c4);
		ChangeBehavior(c2, "kill", c9);
		ChangeBehavior(c4, "kill", c8);
		ChangeBehavior(c5, "kill", c3);		
		ChangeBehavior(c8, "kill", c4);
		timer2= now+10;
		}
		if (!IsAlive(c7)&&now>timer2&&IsAlive(c6)&&!IsAlive(c8)&&IsAlive(c9)&&IsAlive(c3)&&IsAlive(c2)&&IsAlive(c4)&&IsAlive(c5))
		{
		ChangeBehavior(c9, "kill", c2);
		ChangeBehavior(c6, "kill", c4);
		ChangeBehavior(c7, "kill", c3);
		ChangeBehavior(c3, "follow", c4);
		ChangeBehavior(c2, "kill", c9);
		ChangeBehavior(c4, "kill", c6);
		ChangeBehavior(c5, "kill", c3);		
		ChangeBehavior(c8, "kill", c4);
		timer2= now+10;
		}
				if (!IsAlive(c7)&&now>timer2&&IsAlive(c6)&&!IsAlive(c8)&&IsAlive(c9)&&!IsAlive(c3)&&IsAlive(c2)&&IsAlive(c4)&&IsAlive(c5))
		{
		ChangeBehavior(c9, "kill", c2);
		ChangeBehavior(c6, "kill", c4);
		ChangeBehavior(c7, "kill", c3);
		ChangeBehavior(c3, "follow", c4);
		ChangeBehavior(c2, "kill", c9);
		ChangeBehavior(c4, "kill", c6);
		ChangeBehavior(c5, "kill", c4);		
		ChangeBehavior(c8, "kill", c4);
		timer2= now+10;
		}
		if (!IsAlive(c7)&&now>timer2&&!IsAlive(c6)&&IsAlive(c8)&&IsAlive(c9)&&IsAlive(c2)&&IsAlive(c4)&&IsAlive(c5))
		{
		ChangeBehavior(c9, "kill", c2);
		ChangeBehavior(c6, "kill", c4);
		ChangeBehavior(c7, "kill", c3);
		ChangeBehavior(c3, "follow", c4);
		ChangeBehavior(c2, "kill", c9);
		ChangeBehavior(c4, "kill", c8);
		ChangeBehavior(c5, "kill", c4);		
		ChangeBehavior(c8, "kill", c4);
		}
		if (!IsAlive(c7)&&now>timer2&&IsAlive(c6)&&IsAlive(c8)&&IsAlive(c9)&&IsAlive(c3)&&IsAlive(c2)&&!IsAlive(c4)&&IsAlive(c5))
		{
		ChangeBehavior(c9, "kill", c2);
		ChangeBehavior(c6, "kill", c2);
		ChangeBehavior(c7, "kill", c3);
		ChangeBehavior(c3, "follow", c5);
		ChangeBehavior(c2, "kill", c9);
		ChangeBehavior(c4, "kill", c6);
		ChangeBehavior(c5, "kill", c3);		
		ChangeBehavior(c8, "kill", c3);
		timer2= now+10;
		}
		if (!IsAlive(c7)&&now>timer2&&IsAlive(c6)&&IsAlive(c8)&&IsAlive(c9)&&!IsAlive(c3)&&IsAlive(c2)&&IsAlive(c4)&&IsAlive(c5))
		{
		ChangeBehavior(c9, "kill", c2);
		ChangeBehavior(c6, "kill", c4);
		ChangeBehavior(c7, "kill", c4);
		ChangeBehavior(c3, "follow", c5);
		ChangeBehavior(c2, "kill", c9);
		ChangeBehavior(c4, "kill", c6);
		ChangeBehavior(c5, "kill", c4);		
		ChangeBehavior(c8, "kill", c4);
		timer2= now+10;
		}

		if (!IsAlive(c4)&&now>timer2&&!IsAlive(c5))
		{
		trg3 = 6;
		timer2= now+2;
		}
		if (!IsAlive(c5)&&now>timer2&&!IsAlive(c2))
		{
		trg3 = 6;
		timer2= now+2;
		}
		if (!IsAlive(c7)&&now>timer2&&!IsAlive(c9))
		{
		trg3 = 6;
		timer2= now+2;
		}
		if (!IsAlive(c6)&&now>timer2&&!IsAlive(c8))
		{
		trg3 = 6;
		timer2= now+2;
		}
		if (!IsAlive(c6)&&now>timer2&&!IsAlive(c9))
		{
		trg3 = 6;
		timer2= now+2;
		}
		if (!IsAlive(c8)&&now>timer2&&!IsAlive(c9))
		{
		trg3 = 6;
		timer2= now+2;
		}
		if (!IsAlive(c3)&&now>timer2&&!IsAlive(c4))
		{
		trg3 = 6;
		timer2= now+2;
		}
		if (!IsAlive(c3)&&now>timer2&&!IsAlive(c5))
		{
		trg3 = 6;
		timer2= now+2;
		}
		if (!IsAlive(c3)&&now>timer2&&!IsAlive(c2))
		{
		trg3 = 6;
		timer2= now+2;
		}

	}
			if (trg3==6)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		if (c>=0)
		{		
		ChangeBehavior(c6, "kill",c2);
		ChangeBehavior(c9, "kill",c);
		ChangeBehavior(c8, "kill",c2);
		ChangeBehavior(c7, "kill",c);
		ChangeBehavior(c2, "follow",c);
		ChangeBehavior(c3, "follow",c);
		ChangeBehavior(c4, "follow",c);
		ChangeBehavior(c5, "kill",c);
		CharSetBaseAttrib(5, CharAttrib_Attack, 30);
		trg3 = 7;
		timer2= now+2;
		}
	}
				if (trg3==6)
	{
		c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		if (c>=0)
		{		
		ChangeBehavior(c6, "kill",c);
		ChangeBehavior(c9, "kill",c);
		ChangeBehavior(c8, "kill",c);
		ChangeBehavior(c7, "kill",c);
		ChangeBehavior(c2, "follow",c);
		ChangeBehavior(c3, "follow",c);
		ChangeBehavior(c4, "follow",c);
		ChangeBehavior(c5, "kill",c);
		CharSetBaseAttrib(5, CharAttrib_Attack, 30);
		trg3 = 7;
		timer2= now+2;
		}
	}
		
		if (gameover==3 && GetHP(player)==0)
	{
		gameover = -1;
		timer0 = now + 2; 
	}
			if (gameover==4 && GetHP(player)==0)
	{
		gameover = 1;
		timer0 = now + 2; 
	}
		if (gameover==3)
	{	c = GetAnyChar("player");
		c2 = GetAnyChar("高寄萍");
		c3 = GetChar("律香川");
		c4 = GetChar("屠城");
		c5 = GetAnyChar("肖安");
		c6 = GetChar("冷燕");	        
		c7 = GetChar("孙玉伯");
		c8 = GetChar("叶翔");
        c9 = GetChar("易潜龙");	
		c10 = GetChar("凤凤");
		if (GetHP(c2)==0)
		{
		gameover = -1;
		timer0 = now + 2;
		}
		if (GetHP(c2)<=1500&&now>timer5)
		{
         Perform(c2, "say", "......我.....有点..累了");
		 Say( "提示，高寄萍败北游戏结束！");
		 timer5=now+120;
		}			
	}
	if ((gameover==1 || gameover==-1) && now>timer0)
	{
		GameOver(gameover);
		gameover = 2;
	}	
}

