// 第六章
int Rule = 1;
int RoundTime = 60;
int PlayerSpawn = 105;
int PlayerSpawnDir = 180;
int PlayerWeapon = 5;
int PlayerWeapon2 = 0;
int PlayerHP = 4500;

int q=0;
int q1=0;
int qz=0;
int qz1=0;
int qz2=0;
int qz3=0;
int gwc=0;
int jr=0;
int jr1=0;
int jr2=0;
int cd=0;
int z1=0;
int z2=0;
int t=0;
int tqz=0;
int tz1=0;
int tz2=0;
int t5=0;
int v= 0;

Save(string SFile, int s)
{
	int f = OpenFile(SFile,"w");
	WriteFile(f,s);
	CloseFile(f);
	return 1;
}
Load(string SFile)
{
	int f = OpenFile(SFile,"r");
	return ReadFile(f);
	CloseFile(f);
}

OnStart()
{
	AddNPC("6-1");
}

OnUpdate()
{
	int player = GetAnyChar("player");
	if (player < 0)
	{
		return 0;
	}
	
	int c = GetAnyChar("李知言");
	int c2 = GetAnyChar("恶僧·甲");
	int c3 = GetAnyChar("恶僧·乙");
	int c4 = GetAnyChar("恶僧·丙");
	int c5 = GetAnyChar("柴家侍卫·甲");
	int c6 = GetAnyChar("柴家侍卫·乙");
	int c7 = GetAnyChar("柴家侍卫·丙");
	int c8 = GetAnyChar("柴家护院·甲");
	int c9 = GetAnyChar("柴家护院·乙");
	int c10 = GetAnyChar("柴家护院·丙");
	int c11 = GetAnyChar("观云");
	int c12 = GetAnyChar("观海");
	int c13 = GetAnyChar("剑儒·高文才");
	int c14 = GetAnyChar("【开阳】祁峥云");
	int c15 = GetAnyChar("【摇光】褚广英");
	int c16 = GetAnyChar("传令兵");
	int c17 = GetAnyChar("观山");
	int c18 = GetAnyChar("普广");
	int c19 = GetAnyChar("观松");
	int c20 = GetAnyChar("观痴");
	int c21 = GetAnyChar("反僧·甲");
	int c22 = GetAnyChar("反僧·乙");
	int c23 = GetAnyChar("反僧·丙");
	int c24 = GetAnyChar("反僧·丁");
	int c25 = GetAnyChar("普广");
	int c26 = GetAnyChar("反僧·甲");
	int c27 = GetAnyChar("反僧·乙");
	int c28 = GetAnyChar("反僧·丙");
	int c29 = GetAnyChar("反僧·丁");
	int c30 = GetAnyChar("反僧·戊");
	int c31 = GetAnyChar("反僧·己");
	int c32 = GetAnyChar("萧别恨");
	int c33 = GetAnyChar("洪先");
	int c34 = GetAnyChar("柴家侍卫·甲");
	int c35 = GetAnyChar("柴家侍卫·乙");
	int c36 = GetAnyChar("柴家侍卫·丙");
	int c37 = GetAnyChar("柴家侍卫·丁");
	int c38 = GetAnyChar("柴家侍卫·戊");
	int c39 = GetAnyChar("柴家侍卫·己");
	int c40 = GetAnyChar("汤 怀");
	int c41 = GetAnyChar("张 显");
	int c42 = GetAnyChar("王 贵");
	int c43 = GetAnyChar("牛 皋");
	int c44 = GetAnyChar("护法僧·甲");
	int c45 = GetAnyChar("护法僧·乙");
	int c46 = GetAnyChar("护法僧·丙");
	int c47 = GetAnyChar("普广");
	int c48 = GetAnyChar("【单挑本尊】");
	int c49 = GetAnyChar("【挑战分身】");
	int c50 = GetAnyChar("普玄");
	int c51 = GetAnyChar("风");
	int c52 = GetAnyChar("雨");
	int c53 = GetAnyChar("雷");
	int c54 = GetAnyChar("电");
	int c55 = GetAnyChar("云");
	int c56 = GetAnyChar("雾");
	int c57 = GetAnyChar("霜");
	int c58 = GetAnyChar("雪");
	int c59 = GetAnyChar("普玄");
	int now=GetGameTime();
	int gameover = 0;
	///
	
	if(cd==0)
	{
		if(Load("Level\sa15.sav")==0)
		{
			cd=9;
			q=0;
			q1=0;
			t=now+1;
		}
		if(Load("Level\sa15.sav")==1)
		{
			cd=9;
			q1=9;
			q=30;
			t=now+1;
		}
		if(Load("Level\sa15.sav")==2)
		{
			cd=9;
			q1=9;
			q=54;
			t=now+1;
		}
	}
	if(q1==0)
	{
		
	    AddNPC("6-2");
	    AddNPC("6-3");
	    AddNPC("6-4");
		q1=9;
		q=0;
	}
	if(q==0)
	{
		
		if(c>=0&&c2>=0&&c3>=0&&c4>=0)
		{
			
			Perform(c4,"guard",6);
			Perform(c3,"guard",6);
			Perform(c,"guard",4);
			
			PlayerPerform("block", 0);
			Perform(c2,"say", "少废话！岳飞，束手就擒吧！也好让佛爷讨个封赏！");
			Perform(c2,"pause", 5);
			
			Perform(c,"say", "岳公子，你没看明白么？这些和尚显然也被柴桂收买了。");
			Perform(c,"pause", 3);
			
			PlayerPerform("say", "三位大师！岳某初来乍到，不知何处得罪！");
			PlayerPerform("block", 1);
			Perform(c4, "faceto", player);
			Perform(c3, "faceto", player);
			Perform(c2, "faceto", player);
			Perform(c, "faceto", c2);
			q=1;
			qz1=1;
			qz2=1;
			qz3=1;
		}
	}
	if(q==1)
	{
		if(GetHP(c2)<=0&&GetHP(c3)<=0&&GetHP(c4)<=0&&GetHP(c5)<=0&&GetHP(c6)<=0&&GetHP(c7)<=0&&GetHP(c8)<=0&&GetHP(c9)<=0&&GetHP(c10)<=0)
		{
			AddNPC("6-11");
	        AddNPC("6-12");
			q=2;
			t=now+3;
		}
	}
	if(q==2&&now>t)
	{
		
		Perform(c,"say", "至少李朝宗已有所动摇，此人尚有血性，惟愿他能看清真相。");
		Perform(c,"pause", 2);
		Perform(c,"say", "（岳公子……）");
		Perform(c,"pause", 17);
		Perform(c,"say", "南郊武营昨夜已伤了元气，今日再挑去北关显通寺，让那小梁王做他的春秋美梦去。");
		Perform(c,"pause", 12);
		
		PlayerPerform("say", "岳某昨夜潜入武营只为救你，彼时并不曾想到此节，是以也未作大动作。");
		PlayerPerform("pause", 13);
		PlayerPerform("say", "恐怕朝廷尚不知晓，今日既教我遇上，绝不让他阴谋得逞。");
		PlayerPerform("pause", 4);
		PlayerPerform("say", "柴桂以此为据点，与南郊武营夹击京城，确为一记杀招。");
		PlayerPerform("pause", 4);
		PlayerPerform("say", "看来所言不差，这显通寺地靠京畿，扼守北关要道，又山势险峻易守难攻。");
		PlayerPerform("block", 1);
		q=3;
		t=now+25;
		
	}
	if(q==3&&now>t)
	{
		if(c11>=0&&c12>=0)
		{
			Perform(c11,"say", "小僧并非歹人，烦请施主移步前殿，小僧有事相求。");
		    Perform(c11,"pause", 6);
			PlayerPerform("block", 0);
			Perform(c11,"say", "施主……施主！");
			
			PlayerPerform("block", 0);
			PlayerPerform("say", "【提示：前往前殿】");
			PlayerPerform("say", "【提示：前往前殿】");
			PlayerPerform("block", 0);
		    PlayerPerform("pause", 5);
			PlayerPerform("say", "什么人！");
		    PlayerPerform("pause", 2);
			PlayerPerform("block", 1);
			q=4;
		}
	}
	if(q==4)
	{
		if(GetEnemy(c11)==player)
		{
			Perform(c11,"say", "两位施主尽可取来自用。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "我们原是下山采办，如今有一件降魔杵和些许食物，藏于【山门两侧】。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "多谢二位施主！小僧还有一事相告。");
			Perform(c11,"pause", 8);
			Perform(c11,"say", "小僧绝不敢打诳语。");
			Perform(c11,"pause", 7);
			Perform(c11,"say", "伤药尚有富余，二位亦可留下一些备用。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "小僧偷寻了一些伤药，想请二位施主代小僧送给他。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "眼下小僧的师弟观海，因腿脚受伤，此刻正躲在【寺院东墙外】的山崖边。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "小僧见二位施主一身正气，便想求二位一事。");
			Perform(c11,"pause", 6);
			Perform(c11,"say", "小僧看到观明师兄与二位起了争斗，这才知道是寺内出了奸细。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "小僧本想找找还有无幸存的师兄弟，这时便见二位施主前来。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "小僧与观海师弟只得躲在寺外，待领头的强人离去之后，小僧才偷偷翻进来。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "小僧的师父与师兄弟，全教这伙强人所杀。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "哪知……哪知我佛门清净地，却似修罗炼狱一般！");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "我师兄弟二人不敢回寺，躲在寺墙外查看。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "然而还未到山门，便听得寺内哭喊声大作。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "只因两日前小僧与师弟观海奉师命下山采办，今日方才回山。");
			Perform(c11,"pause", 3);
			Perform(c11,"say", "小僧法名观云，施主莫要误会，小僧与他们并不相干。");
			Perform(c11,"pause", 3);
			
			PlayerPerform("say", "【提示：山门两侧有武器与包子】");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "【提示：东侧寺墙外，找寻观海】");
			PlayerPerform("block", 0);
			PlayerPerform("say", "承惠了。");
		    PlayerPerform("pause", 12);
			PlayerPerform("say", "既如此，我们帮你送去。");
		    PlayerPerform("pause", 8);
			PlayerPerform("say", "我怎知你是否诓我！");
		    PlayerPerform("pause", 20);
			PlayerPerform("say", "你说这些，想表明什么？");
		    PlayerPerform("pause", 38);
			PlayerPerform("say", "贼秃！你有何花样？");
			PlayerPerform("block", 1);
			Perform(c11, "faceto", player);
			RemoveNPC(c2);
		    RemoveNPC(c3);
			RemoveNPC(c4);
			q=5;
		}	
	}
	if(q==5)
	{
		if(GetEnemy(c12)==player)
		{
			AddNPC("6-13");
			q=6;
		}
	}
	if(q==6)
	{
		Perform(c12,"say", "多谢施主！小僧用不了这许多，余下的二位施主便收好罢。");
		Perform(c12,"pause", 9);
		Perform(c12,"say", "小僧正是观海！");
		Perform(c12,"pause", 3);
		
		PlayerPerform("block", 0);
		PlayerPerform("say", "甚好，你师兄托我送药给你。");
		PlayerPerform("pause", 6);
		PlayerPerform("say", "和尚，你可是观海？");
		PlayerPerform("block", 1);
		Perform(c12, "faceto", player);
		q=7;
		t=now+10;
	}
	if(q==7&&now>t)
	{
		PlayerPerform("say", "【提示：回去找观云】");
		PlayerPerform("say", "【提示：回去找观云】");
		Perform(c,"use", 16);
		Perform(c,"use", 16);
		PlayerPerform("use", 16);
		PlayerPerform("use", 16);
		q=8;
	}
	if(q==8&&c>=0&&c13>=0&&GetEnemy(c13)==player)
	{
		
		RemoveNPC(c11);
		RemoveNPC(c12);
	    ChangeBehavior(c,"idle");
		q=9;
		gwc=1;
		
	}
	
	if(q==9)
	{
		Perform(c13,"say", "高某正是因你去而复返，不过是想跟你玩玩。");
		Perform(c13,"pause", 6);
		Perform(c13,"say", "不错，某正是小梁王麾下高文才，受江湖朋友抬爱，称为‘剑儒’的便是区区。");
		Perform(c13,"pause", 6);
		Perform(c13,"say", "果然有过人的胆识。");
		Perform(c13,"pause", 3);
		Perform(c13,"say", "你就是岳飞？");
		Perform(c13,"pause", 2);
		
		PlayerPerform("say", "显通寺一众僧侣死于非命，也是阁下的手笔罢。你意欲何为？");
		PlayerPerform("pause", 6);
		PlayerPerform("say", "阁下眉宇间煞气纵横，想必亦是柴桂一党。");
		PlayerPerform("pause", 8);
		PlayerPerform("say", "【注意！请勿攻击高文才！】");
		PlayerPerform("block", 1);
		Perform(c13, "faceto", player);
		q=10;
		t=now+15;
	}
	if(q==10&&now>t)
	{
		AddNPC("6-14");
		AddNPC("6-15");
		q=11;
		t=now+2;
	}
	if(q==11&&c14>=0&&c15>=0&&now>t)
	{
		
		PlayerPerform("block", 0);
		Perform(c13,"say", "这是区区两个不成器的属下，岳公子可有兴致指点指点？");
		Perform(c13,"pause", 2);
		Perform(c15,"guard",5);
		Perform(c14,"guard",5);
		Perform(c15, "faceto", player);
		Perform(c14, "faceto", player);
		PlayerPerform("block", 1);
		q=12;
	}
	if(q==12&&c>=0)
	{
		ChangeBehavior(c,"follow", "c14");
		q=13;
	}
	if(q==13)
	{
		if(GetHP(c14)<=1000 && GetHP(c14)>0 || GetHP(c15)<=1000 && GetHP(c15)>0)
		{
		    Perform(c13,"say", "够了！你们俩先退下。");
		    Perform(c15,"guard",5);
		    Perform(c14,"guard",5);
		    Perform(c,"guard",5);
		    q=14;
		    t=now+3;
		}
	}
	if(q==14&&now>t)
	{
		RemoveNPC(c14);
		RemoveNPC(c15);
		q=15;
	}
	if(q==15)
	{
		ChangeBehavior(c,"follow", player);
		PlayerPerform("say", "【提示：走到高文才旁边】");
		PlayerPerform("pause", 2);
		Perform(c13,"say", "岳飞，你过来。");
		q=16;
	}
	if(q==16&&c13>=0&&GetEnemy(c13)==player)
	{
		PlayerPerform("block", 0);
		Perform(c13,"say", "不急不急。岳飞，你当真不错，在下有一言相告……");
		Perform(c13,"pause", 3);
		
		PlayerPerform("say", "何须多言，出招吧！");
		PlayerPerform("block", 1);
		Perform(c13, "faceto", player);
		q=17;
		t=now+4;
	}
	if(q==17&&now>t)
	{
		AddNPC("6-16");
		q=18;
	}
	if(q==18&&c16>=0&&now>t)
	{
		Perform(c13,"say", "岳飞，今日不巧，咱们后会有期。");
		Perform(c13,"pause", 3);
		Perform(c13,"say", "…………");
		Perform(c13,"pause", 2);
		
		Perform(c16,"say", "高先生！南郊武营被踹，王爷召您速速返回。");
		q=19;
		t=now+5;
	}
	if(q==19&&now>t)
	{
		RemoveNPC(c13);
		RemoveNPC(c16);
		q=20;
		gwc=9;
		t=now+2;
	}
	if(q==20&&c>=0&&now>t)
	{
		Perform(c,"say", "看来李朝宗果然不会同流合污。");
		Perform(c,"pause", 9);
		Perform(c,"say", "岳公子……");
		
		PlayerPerform("block", 0);
		PlayerPerform("say", "咱们再在寺内找找，看看有何线索。");
		PlayerPerform("pause", 3);
		PlayerPerform("say", "但愿如此。如今那洪先也未现身，沥泉神矛依然不知下落。");
		PlayerPerform("pause", 6);
		PlayerPerform("say", "估计是那李朝宗从中周旋，以至他们还不明就里。");
		PlayerPerform("pause", 3);
		PlayerPerform("say", "武营被踹，正是我二人所为。");
		PlayerPerform("pause", 3);
		PlayerPerform("block", 1);
		q=21;
		t=now+10;
	}
	if(q==21&&now>t)
	{
		
		AddNPC("6-17");
		AddNPC("6-18");
		
		q=22;
	}
	if(q==22)
	{
		SetTarget(0, "waypoint", 52);
		SetTarget(1, "char", player);
		if (c17>=0 && c18>=0 && Distance(0, 1) <=200)
		{
			Perform(c17,"say", "师侄只是怕我显通寺百年基业毁于一旦。");
		    Perform(c17,"pause", 3);
			Perform(c17,"say", "那小梁王意图犯上，你们又岂能不知？");
		    Perform(c17,"pause", 3);
			Perform(c17,"say", "普广师叔，出家人首戒贪嗔痴，可如今你与普玄师伯皆已堕入魔障。");
		    Perform(c17,"pause", 3);
			
			Perform(c18,"say", "胡言乱语！观山，老衲见你反骨已成，不如及早超度了你！");
		    Perform(c18,"pause", 12);
			Perform(c18,"say", "观山师侄，事已至此，你还想反悔不成？");
			Perform(c17, "faceto", c18);
			Perform(c18, "faceto", c17);
			ChangeBehavior(c,"idle");
			PlayerPerform("block", 1);
			q=23;
			t=now+12;
		}
	}
	if(q==23&&now>t)
	{
		PlayerPerform("block", 0);
		Perform(c18,"say", "两个小子，想多管闲事救人么？看你们救不救得过来！");
		Perform(c18,"pause", 6);
			
		Perform(c,"say", "可恶的贼和尚！");
		Perform(c,"pause", 3);
		
		Perform(c18, "faceto", player);
		Perform(c17,"use", 35);
		PlayerPerform("say", "住手！");
		PlayerPerform("block", 1);
		
		q=24;
		t=now+6;
	}
	if(q==24&&now>t)
	{
		RemoveNPC(c17);
		RemoveNPC(c18);
		q=25;
	}
	if(q==25)
	{
		AddNPC("6-19");
		AddNPC("6-20");
		AddNPC("6-21");
		AddNPC("6-22");
		AddNPC("6-23");
		AddNPC("6-24");
		q=26;
		t=now+1;
	}
	if(q==26&&now>t)
	{
		PlayerPerform("say", "【前往两边偏殿，阻止反僧杀人】");
		PlayerPerform("say", "【前往两边偏殿，阻止反僧杀人】");
		PlayerPerform("pause", 2);
		PlayerPerform("say", "李姑娘，先救人！");
		q=28;
		jr1=1;
		jr2=1;
	}
	if(q==28)
	{
		ChangeBehavior(c,"follow","观松");
		q=29;
	}
	if(q==29&&GetHP(c21)<=0&&GetHP(c22)<=0&&GetHP(c23)<=0&&GetHP(c24)<=0&&GetHP(c19)>0&&GetHP(c20)>0)
	{
		PlayerPerform("say", "如今这寺里已不能再留，你们赶紧逃命去吧。");
		PlayerPerform("pause", 2);
		Perform(c19,"say", "多谢施主救命之恩！");
		q=30;
		jr1=9;
		jr2=9;
		t=now+3;
	}
	if(q==30&&now>t)
	{
		RemoveNPC(c2);
		RemoveNPC(c3);
		RemoveNPC(c4);
		RemoveNPC(c19);
		RemoveNPC(c20);
		RemoveNPC(c21);
		RemoveNPC(c22);
		RemoveNPC(c23);
		RemoveNPC(c24);
		PlayerPerform("say", "【存档已生成！】");
		PlayerPerform("pause", 1);
		PlayerPerform("say", "【存档已生成！】");
		PlayerPerform("pause", 1);
		PlayerPerform("say", "【正在存档...】");
		PlayerPerform("pause", 1);
		PlayerPerform("say", "【正在存档...】");
		Save("Level\sa15.sav",1);
		q=31;
		jr1=9;
		jr2=9;
	}
	if(q==31)
	{
		Perform(c,"use", 4);
		Perform(c,"use", 16);
		Perform(c,"use", 16);
		PlayerPerform("use", 8);
		PlayerPerform("use", 4);
		PlayerPerform("use", 16);
		PlayerPerform("use", 16);
		q=32;
		t=now+2;
	}
	if(q==32&&now>t)
	{
		
		AddNPC("6-25");
		AddNPC("6-26");
		AddNPC("6-27");
		AddNPC("6-28");
		AddNPC("6-29");
		AddNPC("6-30");
		AddNPC("6-31");
		q=33;
		t=now+2;
	}
	if(q==33&&c25>=0&&c26>=0&&c27>=0&&c28>=0&&c29>=0&&c30>=0&&c31>=0&&c>=0&&now>t)
	{
		Perform(c25,"say", "两个小孽障！还不快快来佛爷处领死！");
		
		PlayerPerform("say", "李姑娘……");
		PlayerPerform("pause", 2);
		ChangeBehavior(c,"follow", player);
		q=34;
		t=now+3;
	}
	if(q==34&&now>t&&c>=0)
	{
		PlayerPerform("say", "咱们今日便扫除这些叛逆！");
		PlayerPerform("pause", 3);
		PlayerPerform("say", "好！看来显通寺余下的和尚，全都投靠了柴桂。");
		PlayerPerform("pause", 3);
		Perform(c,"say", "岳公子无需多言，知言愿与君同生共死！");
	    q=35;
	}
	if(q==35&&GetHP(c26)<=0&&GetHP(c27)<=0&&GetHP(c28)<=0&&GetHP(c29)<=0&&GetHP(c30)<=0&&GetHP(c31)<=0)
	{
		Perform(c,"use", 4);
		Perform(c,"use", 16);
		Perform(c,"use", 16);
		Perform(c,"use", 16);
		PlayerPerform("use", 4);
		PlayerPerform("use", 16);
		PlayerPerform("use", 16);
		PlayerPerform("use", 16);
		PlayerPerform("say", "贼秃！还不投降么！");
		q=36;
		t=now+1;
	}
	if(q==36&&now>t)
	{
		RemoveNPC(c26);
		RemoveNPC(c27);
		RemoveNPC(c28);
		RemoveNPC(c29);
		RemoveNPC(c30);
		RemoveNPC(c31);
		q=37;
		t=now+2;
		
	}
	if(q==37&&now>t)
	{
		AddNPC("6-32");
		AddNPC("6-33");
		q=38;
	}
	if(q==38&&c32>=0&&c33>=0)
	{
		Perform(c33,"say", "岳飞！休得张狂！");
        q=39;
	}
	if(q==39)
	{
		ChangeBehavior(c33,"idle");
		ChangeBehavior(c32,"idle");
		ChangeBehavior(c25,"idle");
		ChangeBehavior(c,"idle");
		PlayerPerform("block", 1);
		q=40;
		t=now+2;
	}
	if(q==40&&now>t&&c>=0&&c25>=0)
	{
		Perform(c25,"say", "两位大人来得正好，贫僧正要拿了这两个小贼！");
		
		Perform(c32,"say", "休说废话！普广你且退下。来人，抓了这俩小贼！");
		Perform(c32,"pause", 17);
		Perform(c32,"say", "岳飞，你好大的胆子！连梁王驻扎的武营都敢踹！");
		Perform(c32,"pause", 3);
		
		Perform(c33,"say", "如今王爷震怒，你二人乖乖束手就擒罢！");
		Perform(c33,"pause", 3);
		Perform(c33,"say", "岳飞！你要救走姓李的丫头，却不该伤我营中军士！");
		Perform(c33,"pause", 12);
		
		Perform(c,"say", "洪先！你尚且执迷不悟么！");
		Perform(c,"pause", 17);
		
		PlayerPerform("block", 0);
		PlayerPerform("say", "好！且来试试岳某的手段！");
		PlayerPerform("pause", 11);
		PlayerPerform("say", "今日岳某便要为朝廷除去你俩这反贼！");
		PlayerPerform("pause", 3);
		PlayerPerform("say", "洪先萧别恨！你二人助纣为虐倒行逆施！");
		PlayerPerform("pause", 6);
		PlayerPerform("block", 1);
		Perform(c, "faceto", player);
		Perform(c25, "faceto", player);
		Perform(c33, "faceto", player);
		Perform(c32, "faceto", player);
		q=41;
		t=now+18;
	}
	if(q==41&&now>t)
	{
		RemoveNPC(c25);
		q=42;
		t=now+1;
	}
	if(q==42&&now>t)
	{
		AddNPC("6-34");
		AddNPC("6-35");
		AddNPC("6-36");
		AddNPC("6-37");
		AddNPC("6-38");
		AddNPC("6-39");
		q=43;
	}
	if(q==43)
	{
		ChangeBehavior(c33,"follow", player);
		ChangeBehavior(c32,"follow", player);
		
		ChangeBehavior(c,"follow", player);
		t=now+30;
		q=44;
	}
	if(q==44&&now>t)
	{
		AddNPC("6-40");
		AddNPC("6-41");
		AddNPC("6-42");
		AddNPC("6-43");
		q=45;
		t=now+1;
	}
	if(q==45&&now>t&&c40>=0&&c41>=0&&c42>=0&&c43>=0)
	{
		
		Perform(c43,"say", "岳大哥！莫要杀完了，给俺老牛留上一两个！");
		Perform(c43,"pause",3);
		Perform(c40,"say", "岳大哥！兄弟们来助你杀敌了！");
		
		PlayerPerform("say", "兄弟们来得正是时候！一同杀了这些反贼！");
		PlayerPerform("pause", 6);
		q=46;
		t=now+8;
	}
	if(q==46&&now>t)
	{
		PlayerPerform("say", "【提示：优先攻击萧别恨。】");
		PlayerPerform("say", "【提示：优先攻击萧别恨。】");
		Perform(c,"use", 16);
		Perform(c,"use", 16);
		
		PlayerPerform("use", 16);
		PlayerPerform("use", 16);
		q=47;
	}
	if(q==47&&GetHP(c32)<=2000)
	{
		Perform(c33,"say", "萧别恨！你这个腌臜泼才直娘贼！");
		Perform(c33,"pause",5);
		
		Perform(c32,"say", "洪兄！你且抵挡一番，萧某去搬救兵来！");
		Perform(c32,"pause",3);
		Perform(c32,"say", "（这群蛮子当真不易对付，大爷可不能没来由折在此处。）");
		q=48;
		t=now+5;
	}
	if(q==48&&now>t)
	{
		RemoveNPC(c32);
		q=49;
	}
	if(q==49&&GetHP(c34)<=0&&GetHP(c35)<=0&&GetHP(c36)<=0&&GetHP(c37)<=0&&GetHP(c38)<=0&&GetHP(c39)<=0&&GetHP(c33)>0)
	{
		PlayerPerform("say", "诸位兄弟暂且停手！");
		q=50;
		t=now+2;
	}
	if(q==50&&now>t)
	{
		
		Perform(c33,"say", "神矛……就在这显通寺别院之中。");
		Perform(c33,"pause",3);
		Perform(c33,"say", "…………");
		Perform(c33,"pause",6);
		Perform(c33,"say", "休要哄骗爷爷！");
		Perform(c33,"pause",6);
		
		PlayerPerform("say", "既如此，你去吧。诸位兄弟不可为难。");
		PlayerPerform("pause", 9);
		PlayerPerform("say", "岳某言出如山！");
		PlayerPerform("pause", 6);
		PlayerPerform("say", "你交出沥泉神矛，并弃暗投明，岳某担保你性命无虞。");
		PlayerPerform("pause", 3);
		PlayerPerform("say", "洪先！眼下情势不需多言，你我之间并无深仇大怨。");
		PlayerPerform("block", 1);
		
		Perform(c,"guard",20);
		
		Perform(c40,"guard",20);
		Perform(c41,"guard",20);
		Perform(c42,"guard",20);
		Perform(c43,"guard",20);
		q=51;
		t=now+20;
	}
	if(q==51&&now>t)
	{
		ChangeBehavior(c33, "follow", "player");
		q=52;
	}
	if(q==52)
	{
		Perform(c43,"say", "岳大哥当心！贼厮鸟吃俺一矛！");
		q=53;
		t=now+1;
	}
	if(q==53&&now>t)
	{
		PlayerPerform("say", "【存档已生成！】");
		PlayerPerform("pause", 1);
		PlayerPerform("say", "【存档已生成！】");
		PlayerPerform("pause", 1);
		PlayerPerform("say", "【正在存档...】");
		PlayerPerform("pause", 1);
		PlayerPerform("say", "【正在存档...】");
		PlayerPerform("pause", 3);
		Say(c33,"啊！……岳飞……梁王必定……");
		Perform(c33,"use", 35);
		q=54;
		t=now+5;
		Save("Level\sa15.sav",2);
	}
	if(q==54&&now>t)
	{
		Perform(c41,"say", "既然岳大哥如此说了，兄弟们自当照办。我们在山下等你。");
		Perform(c41,"pause",30);
		
		Perform(c,"say", "岳……岳公子……");
		Perform(c,"pause",27);
		
		Perform(c40,"say", "是，汤怀谨记。");
		Perform(c40,"pause",24);
		Perform(c40,"say", "岳大哥，洪先这奸贼执迷不悟，他的话未必可信。");
		
		Perform(c42,"say", "既然岳大哥要去，咱大家伙儿一同前去便了。");
		Perform(c42,"pause",6);
		
		PlayerPerform("block", 0);
		PlayerPerform("say", "李姑娘，岳某必将寻回沥泉神矛，不负姑娘所托。");
		PlayerPerform("pause", 9);
		PlayerPerform("say", "汤兄弟，烦你好生照看李姑娘，只待岳某出来，便一同下山。");
		PlayerPerform("pause", 3);
		PlayerPerform("say", "诸位兄弟可去山口设伏，阻止敌人封山。");
		PlayerPerform("pause", 3);
		PlayerPerform("say", "况且小梁王手下高手如云，为防他们围困显通寺，");
		PlayerPerform("pause", 3);
		PlayerPerform("say", "诸位兄弟且慢，现下洪先虽然已死，但那萧别恨却已逃脱。");
		PlayerPerform("pause", 6);
		PlayerPerform("say", "即便如此，愚兄也当往别院一探。");
		PlayerPerform("pause", 3);
		PlayerPerform("block", 1);
		q=55;
		t=now+29;
	}
	if(q==55&&now>t)
	{
		RemoveNPC(c);
		RemoveNPC(c33);
		RemoveNPC(c34);
		RemoveNPC(c35);
		RemoveNPC(c36);
		RemoveNPC(c37);
		RemoveNPC(c38);
		RemoveNPC(c39);
		RemoveNPC(c40);
		RemoveNPC(c41);
		RemoveNPC(c42);
		RemoveNPC(c43);
		q=56;
		t=now+1;
	}
	if(q==56&&now>t)
	{
		AddNPC("6-44");
		AddNPC("6-45");
		AddNPC("6-46");
		q=57;
	}
	if(q==57&&c44>=0&&c45>=0&&c46>=0)
	{
		SetTarget(0, "waypoint", 49);
		SetTarget(1, "char", player);
		if (Distance(0, 1) <=50)
		{
			PlayerPerform("block", 0);
			PlayerPerform("say", "（此处便是通往别院，无论如何都得夺回沥泉神矛。）");
			PlayerPerform("block", 1);
			q=58;
		}
	}
	if(q==58)
	{
		if(c44>=0&&GetEnemy(c44)==player)
		{
			Perform(c44,"say", "好小子！休想通过此处！");
			q=59;
		}
	}
	if(q==59)
	{
		if(c45>=0&&GetEnemy(c45)==player)
		{
			Perform(c45,"say", "施主已经入魔，让老衲超度了你罢！");
			q=60;
		}
	}
	if(q==60)
	{
		if(c46>=0&&GetEnemy(c46)==player)
		{
			Perform(c46,"say", "阿弥陀佛！纳命来！");
			q=61;
		}
	}
	if(q==61&&GetHP(c44)<=0&&GetHP(c45)<=0&&GetHP(c46)<=0)
	{
		AddNPC("6-47");
		q=62;
	}
	if(q==62)
	{
		if(c47>=0&&GetEnemy(c47)==player)
		{
			Perform(c47,"guard",5);
			Perform(c47,"say", "岳飞！老衲劝你趁早回头！再往前走，便是死路！");
			PlayerPerform("block", 0);
	        PlayerPerform("say", "少废话！不找到沥泉神矛，岳某岂能罢休！");
		    PlayerPerform("pause", 3);
			PlayerPerform("block", 1);
			Perform(c47, "faceto", player);
			q=63;
		}
	}
	if(q==63&&GetHP(c47)<=0)
	{
		Say(c47,"呃啊！王爷……");
		
		q=64;
		t=now+2;
	}
	if(q==64&&now>t)
	{
		PlayerPerform("use", 15);
		
		PlayerPerform("pause", 3);
		PlayerPerform("say", "上面不知还有何凶险，为免夜长梦多，须得速战速决。");
		q=65;
		t=now+1;
	}
	if(q==65&&now>t)
	{
		RemoveNPC(c44);
		RemoveNPC(c45);
		RemoveNPC(c46);
		RemoveNPC(c47);
		q=66;
	}
	if(q==66)
	{
		SetTarget(0, "waypoint", 110);
		SetTarget(1, "char", player);
		if (Distance(0, 1) <=100)
		{
			AddNPC("6-48");
		    AddNPC("6-49");
			q=67;
		}
	}
	if(q==67)
	{
		PlayerPerform("block", 0);
		PlayerPerform("say", "【考虑好之后，【攻击选择好的石龟】，即可进入战斗。");
		PlayerPerform("pause", 4);
		PlayerPerform("say", "【如果选择【挑战分身】，则与【八名敌人】战斗。");
		PlayerPerform("pause", 4);
		PlayerPerform("say", "【如果选择【单挑本尊】，则与【普玄】单挑。");
		PlayerPerform("pause", 4);
		PlayerPerform("say", "【提示：此处为本关最后一战，面前两座石龟可做选择。】");
		PlayerPerform("block", 1);
		q=68;
		z1=1;
		z2=1;
	}
	if(z1==1&&c48>=0&&c49>=0)
	{
		SetTarget(0, "waypoint", 111);
		SetTarget(1, "char", player);
		if (Distance(0, 1) <=50)
		{
			PlayerPerform("block", 0);
			PlayerPerform("say", "【确定请【攻击】石龟。】");
			PlayerPerform("say", "【考虑好了？确定选择【单挑本尊】吗？】");
			PlayerPerform("block", 1);
			z1=2;
			tz1=now+2;
		}
	}
	if(z1==2&& GetHP(c48)<10000)
	{
		RemoveNPC(c48);
		RemoveNPC(c49);
		z1=3;
		z2=9;
		tz1=now+1;
	}
	if(z1==3&&now>tz1)
	{
		AddNPC("6-50");
		z1=4;
		tz1=now+2;
	}
	if(z1==4&&c50>=0&&now>tz1)
	{
		Perform(c50,"say", "混账！看棒！");
		Perform(c50,"pause",18);
		Perform(c50,"say", "岳飞！需知赶人莫要赶上，你大闹我显通寺，步步紧逼，是何道理！");
		
		PlayerPerform("block", 0);
		PlayerPerform("say", "还不快快交出沥泉神矛，认罪伏法！");
		PlayerPerform("pause", 4);
		PlayerPerform("say", "忠孝仁义你不懂，贪嗔痴欲你不舍，佛门岂能容你！");
		PlayerPerform("pause", 4);
		PlayerPerform("say", "眼界不明而犯上作乱，欺君害民而倒行逆施！");
		PlayerPerform("pause", 4);
		PlayerPerform("say", "咄！你身为出家之人却滥杀同门僧侣，攀附权贵而抛弃慈悲之心！");
		PlayerPerform("pause", 4);
		PlayerPerform("block", 1);
		z1=5;
	}
	if(z1==5&&GetHP(c50)<=5000)
	{
		Perform(c50,"say", "【普玄还剩500血值。】");
		z1=6;
	}
	if(z1==6&&GetHP(c50)<=2000)
	{
		Perform(c50,"say", "【普玄还剩200血值。】");
		z1=7;
	}
	if(z1==7&&GetHP(c50)<=0)
	{
		Say(c50,"岳飞！果然名不虚传！可惜我显通寺百年基业……");
		z1=8;
		tz1=now+3;
		Save("Level\sa15.sav",0);
	}
	if(z1==8&&now>tz1)
	{
		v=2;
	}
	
	if(z2==1&&c48>=0&&c49>=0)
	{
		SetTarget(0, "waypoint", 112);
		SetTarget(1, "char", player);
		if (Distance(0, 1) <=50)
		{
			PlayerPerform("block", 0);
			PlayerPerform("say", "【确定请【攻击】石龟。】");
			PlayerPerform("say", "【考虑好了？确定选择【挑战分身】吗？】");
			PlayerPerform("block", 1);
			z2=2;
			tz2=now+2;
		}
	}
	if(z2==2&& GetHP(c49)<10000)
	{
		RemoveNPC(c48);
		RemoveNPC(c49);
		z2=3;
		z1=9;
		tz2=now+1;
	}
	if(z2==3&&now>tz2)
	{
		AddNPC("6-51");
		AddNPC("6-52");
		AddNPC("6-53");
		AddNPC("6-54");
		AddNPC("6-55");
		AddNPC("6-56");
		AddNPC("6-57");
		AddNPC("6-58");
		z2=4;
	}
	if(z2==4&&c51>=0&&c52>=0&&c53>=0&&c54>=0&&c55>=0&&c56>=0&&c57>=0&&c58>=0)
	{
		z2=5;
	}
	if(z2==5&&GetHP(c51)<=0&&GetHP(c52)<=0&&GetHP(c53)<=0&&GetHP(c54)<=0&&GetHP(c55)<=0&&GetHP(c56)<=0&&GetHP(c57)<=0&&GetHP(c58)<=0)
	{
		AddNPC("6-59");
		z2=6;
	}
	if(z2==6&&c59>=0)
	{
		PlayerPerform("say", "【提示：前往钟楼找到普玄】");
		PlayerPerform("say", "【提示：前往钟楼找到普玄】");
		PlayerPerform("pause", 3);
		
		Perform(c59,"say", "岳飞！需知赶人莫要赶上，你大闹我显通寺，步步紧逼，是何道理！");
		z2=7;
		Save("Level\sa15.sav",0);
	}
	if(z2==7)
	{
		SetTarget(0, "waypoint", 122);
		SetTarget(1, "char", player);
		if (Distance(0, 1) <=200)
		{
			PlayerPerform("block", 0);
		    PlayerPerform("say", "还不快快交出沥泉神矛，认罪伏法！");
		    PlayerPerform("pause", 4);
		    PlayerPerform("say", "忠孝仁义你不懂，贪嗔痴欲你不舍，佛门岂能容你！");
		    PlayerPerform("pause", 4);
		    PlayerPerform("say", "眼界不明而犯上作乱，欺君害民而倒行逆施！");
		    PlayerPerform("pause", 4);
		    PlayerPerform("say", "咄！你身为出家之人却滥杀同门僧侣，攀附权贵而抛弃慈悲之心！");
		    PlayerPerform("block", 1);
			z2=8;
			tz2=now+15;
		}
	}
	if(z2==8&&now>tz2)
	{
		v=2;
	}
		
	if(jr1==1&&c19>=0&&GetHP(c19)<=0)
	{
		PlayerPerform("say", "【救人失败，被减30血o(╥﹏╥)o】");
		PlayerPerform("pause", 2);
		PlayerPerform("use", 42);
		PlayerPerform("say", "不好！没能救下他性命！");
		jr1=2;
	}
	if(jr1==2&&GetHP(c19)<=0&&GetHP(c21)<=0&&GetHP(c22)<=0&&GetHP(c23)<=0&&GetHP(c24)<=0)
	{
		PlayerPerform("say", "可惜！只救得一人性命……");
		jr1=9;
		q=30;
	}
		
	if(jr2==1&&c20>=0&&GetHP(c20)<=0)
	{
		PlayerPerform("say", "【救人失败，被减30血o(╥﹏╥)o】");
		PlayerPerform("pause", 2);
		PlayerPerform("use", 42);
		PlayerPerform("say", "不好！没能救下他性命！");
		jr2=2;
	}
	if(jr2==2&&GetHP(c20)<=0&&GetHP(c21)<=0&&GetHP(c22)<=0&&GetHP(c23)<=0&&GetHP(c24)<=0)
	{
		PlayerPerform("say", "可惜！只救得一人性命……");
		jr2=9;
		q=30;
	}
	if(jr==1&&GetHP(c20)<=0&&GetHP(c19)<=0)
	{
		PlayerPerform("say", "【救人失败，被减90血o(╥﹏╥)o】");
		PlayerPerform("pause", 2);
		PlayerPerform("use", 42);
		PlayerPerform("use", 42);
		PlayerPerform("use", 42);
		PlayerPerform("say", "我岳飞竟然一个都没能救下！");
		jr=2;
	}
	if(jr==2&&GetHP(c19)<=0&&GetHP(c20)<=0&&GetHP(c21)<=0&&GetHP(c22)<=0&&GetHP(c23)<=0&&GetHP(c24)<=0)
	{
		RemoveNPC(c19);
		RemoveNPC(c20);
		RemoveNPC(c21);
		RemoveNPC(c22);
		RemoveNPC(c23);
		RemoveNPC(c24);
		q=32;
		jr=9;
		jr=9;
	}
	
	if(gwc==1&&c13>=0&&GetHP(c13)<10000)
	{
		
		Perform(c13,"say", "你想对我动手？可想清楚了！");
		gwc=2;
		
	}
	if(gwc==2)
	{
		PlayerPerform("use", 12);
		gwc=9;
	}
	
	if(qz1==1)
	{
		if(GetHP(c2)>0&&GetHP(c3)<=0&&GetHP(c4)<=0)
		{
			SetTarget(0, "waypoint", 13);
		    ChangeBehavior(c2, "attacktarget", 0);
			Perform(c2, "use", 5);
			Say(c3,"师兄！快去鸣钟……");
			qz1=2;
		}
	}
	if(qz1==2)
	{
		
		SetTarget(0, "char", c2);
		SetTarget(1, "waypoint", 13);
		if (Distance(0, 1) <=30)
		{
			RemoveNPC(c3);
		    RemoveNPC(c4);
			qz1=3;
			
		}
	}
	if(qz1==3)
	{
		
		qz1=99;
		qz=1;
		tqz=now+2;
	}
	if(qz2==1)
	{
		if(GetHP(c3)>0&&GetHP(c2)<=0&&GetHP(c4)<=0)
		{
			SetTarget(0, "waypoint", 13);
		    ChangeBehavior(c3, "attacktarget", 0);
			Perform(c3, "use", 5);
			Say(c2,"师兄！快去鸣钟……");
			qz2=2;
		}
	}
	if(qz2==2)
	{
		
		SetTarget(0, "char", c3);
		SetTarget(1, "waypoint", 13);
		if (Distance(0, 1) <=30)
		{
			RemoveNPC(c2);
		    RemoveNPC(c4);
			qz2=3;
		}
	}
	if(qz2==3)
	{

		qz2=99;
		qz=1;
		tqz=now+2;
	}
	if(qz3==1)
	{
		if(GetHP(c4)>0&&GetHP(c2)<=0&&GetHP(c3)<=0)
		{
			SetTarget(0, "waypoint", 13);
		    ChangeBehavior(c4, "attacktarget", 0);
			Say(c3,"师兄！快去鸣钟……");
			Perform(c4, "use", 5);
			qz3=2;
		}
	}
	if(qz3==2)
	{
		
		SetTarget(0, "char", c4);
		SetTarget(1, "waypoint", 13);
		if (Distance(0, 1) <=30)
		{
			RemoveNPC(c2);
	        RemoveNPC(c3);
			qz3=3;
		}
	}
	if(qz3==3)
	{
		
		qz3=99;
		qz=1;
		tqz=now+2;
	}
	if(qz==1&&now>tqz)
	{
		AddNPC("6-5");
		AddNPC("6-6");
		AddNPC("6-7");
		AddNPC("6-8");
		AddNPC("6-9");
		AddNPC("6-10");
		qz=2;
	}
	if(qz==2&&c5>=0&&c6>=0&&c7>=0&&c8>=0&&c9>=0&&c10>=0)
	{
		Perform(c,"say", "岳公子……知言明白。");
		Perform(c,"pause", 3);
		
		PlayerPerform("say", "李姑娘当心，敌人众多，务必跟紧岳某！");
		qz=3;
	}
	if(qz==3)
	{
		if(GetHP(c5)<=0&&GetHP(c6)<=0&&GetHP(c7)<=0&&GetHP(c8)<=0&&GetHP(c9)<=0&&GetHP(c10)<=0)
		{
		    qz=4;
		    tqz=now+1;
		}
	}
	if(qz==4&&now>tqz)
	{
		RemoveNPC(c2);
	    RemoveNPC(c3);
        RemoveNPC(c4);
	    RemoveNPC(c5);
	    RemoveNPC(c6);
	    RemoveNPC(c7);
	    RemoveNPC(c8);
	    RemoveNPC(c9);
	    RemoveNPC(c10);
		qz=9;
		q=2;
	}
	
	
	
	/////
	if(v==0&&GetHP(player)==0)
	{
		PlayerPerform("say", "壮志未酬身先死……");
		v=1;t5=now+6;
		
	}
	if(v==0&&GetHP(c)==0)
	{
		Say(c, "岳公子……来生……");
		v=1;t5=now+4;
		
	}
    if(v==2&&now>=t5)
	{
		gameover = 1;
		
	}
	if(v==1&&now>=t5)
	{
		gameover = -1;
		
	}
	if ((gameover==1 || gameover==-1))
	{
		GameOver(gameover);
		gameover = 2;
	}
}