//  武当山
int Rule = 1;
int RoundTime = 900;
int PlayerSpawn = 53;
int PlayerSpawnDir = 90;
int PlayerWeapon = 15;
int PlayerWeapon2 = 14;
int PlayerHP = 10000;

int trg0;
int trg1;
int tiao0;
int tiao1;
int tiao2;

int now;
int sj;
int gameover;
int timer0;
int player;


int c1;    // 第一批        
int ca1;      
int c2;      
int ca2;   
int c3;   
int ca3; 
int c4;
int ca4;
int c5;
int ca5;
int c6;
int ca6;
int c7; 
int ca7;
int c8;
int ca8;

int e1;       // 第2批
int ea1;      
int e2;      
int ea2;   
int e3;   
int ea3; 
int e4;
int ea4;
int e5;
int ea5;
int e6;
int ea6;
int e7;
int ea7;
int e8;
int ea8;

int g;
int gz; // 关主

int b; // BOSS
int ba;


GetDistance(int k1,int k2)
{
   SetTarget(0, "char", k1);
   SetTarget(1, "char", k2);
   return Distance(0,1);
}


GetNPCChar() 
{
   c1=GetChar("白眉道长");
   c2=GetChar("武当弟子1");
   c3=GetChar("武当弟子2");
   c4=GetChar("武当弟子3");
   c5=GetChar("武当弟子4");
   c6=GetChar("武当弟子5");
   c7=GetChar("武当弟子6");
   c8=GetChar("武当弟子7");
   ca1=GetAnyChar("白眉道长");
   ca2=GetAnyChar("武当弟子1");
   ca3=GetAnyChar("武当弟子2");
   ca4=GetAnyChar("武当弟子3");
   ca5=GetAnyChar("武当弟子4");
   ca6=GetAnyChar("武当弟子5");
   ca7=GetAnyChar("武当弟子6");
   ca8=GetAnyChar("武当弟子7");

   e1=GetChar("布衣杀手1");
   e2=GetChar("布衣杀手2");
   e3=GetChar("布衣杀手3");
   e4=GetChar("布衣杀手4");
   e5=GetChar("武侠月客1");
   e6=GetChar("武侠月客2");
   e7=GetChar("武侠月客3");
   e8=GetChar("武侠月客4");
   ea1=GetAnyChar("布衣杀手1");
   ea2=GetAnyChar("布衣杀手2");
   ea3=GetAnyChar("布衣杀手3");
   ea4=GetAnyChar("布衣杀手4");
   ea5=GetAnyChar("武侠月客1");
   ea6=GetAnyChar("武侠月客2");
   ea7=GetAnyChar("武侠月客3");
   ea8=GetAnyChar("武侠月客4");
   g=GetChar("关主");
   gz=GetAnyChar("关主");   
   b=GetChar("武当无极");
   ba=GetAnyChar("武当无极");
}

AlwaysDo()
{
        now = GetGameTime();

	    if (GetHP(player)>=0 && sj<now) 
		{
		   sj=sj+150;		
		PlayerPerform("use", 16);
		PlayerPerform("use", 16);
		PlayerPerform("use", 16);
		PlayerPerform("use", 34);
		} 
if (GetHP(player)<=0) 
{ 
GameOver(-1); 
}} 

scene1()
{
if (trg0==0 && c2>=0 && GetDistance(player,c2)<=300 )
{ 
ChangeBehavior(c2, "kill", player);
ChangeBehavior(c3, "kill", player);
ChangeBehavior(c4, "kill", player);
ChangeBehavior(c5, "kill", player);
ChangeBehavior(c6, "kill", player);
ChangeBehavior(c7, "kill", player);
ChangeBehavior(c8, "kill", player);
Perform(c3, "pause", 18);
Perform(c4, "pause", 18);
Perform(c5, "pause", 18);
Perform(c6, "pause", 18);
Perform(c7, "pause", 18);
Perform(c8, "pause", 18);
PlayerPerform("block", 0);
PlayerPerform("say","不可取。那还等什么·来吧！");  // 时刻:16
PlayerPerform("pause",4);
Perform(c2,"say","即使我们死在你的手下。也要为武当争回这点面子！！");  // 时刻:14
Perform(c2,"pause",4);
PlayerPerform("say","哼。..张无忌都败给我，你们这几个烂蒜凑什么热闹，自寻死路。。");  // 时刻:12
PlayerPerform("pause",4);
Perform(c2,"say","好大的胆子。本不想杀你，但不杀是不行了！今天我就在这清理你这个家伙。 ");  // 时刻:10
Perform(c2,"pause",4);
PlayerPerform("say","死心眼。败给在下还不F气，如果在败一次呢！");  // 时刻:8
PlayerPerform("pause",4);
Perform(c2,"say","放肆！。我们只是讨个公道！武当成业数百年，竟能输给你这个小人！");  // 时刻:6
Perform(c2,"pause",4);
PlayerPerform("say","你们还是不相信我。宁可做朝廷的俘虏！真亏你们还是英雄/。");  // 时刻:4
PlayerPerform("pause",4);
Perform(c2,"say","你能到这里，自然是有人安排的。之后你还会到少林，昆仑！个等地处！");  // 时刻:2
Perform(c2,"pause",2);
PlayerPerform("say","这里乃是武当山了！。嘿嘿！我怎么到这里来了。");  // 时刻:0
Perform(c2, "faceto", player);
Perform(c3, "faceto", player);
Perform(c4, "faceto", player);
Perform(c5, "faceto", player);
Perform(c6, "faceto", player);
Perform(c7, "faceto", player);
Perform(c8, "faceto", player);
PlayerPerform("block", 1);
trg0++;}

if (trg0==1 && c2<0 ){


ChangeBehavior(c3, "follow", c1);
ChangeBehavior(c4, "follow", c1);
ChangeBehavior(c5, "follow", c1);
ChangeBehavior(c6, "follow", c1);
ChangeBehavior(c7, "follow", c1);
ChangeBehavior(c8, "follow", c1);
Perform(c3, "aggress");
Perform(c4, "aggress");
Perform(c5, "aggress");
Perform(c3,"say","我们走！！有本事你就来阿.."); 
Perform(c3,"pause",2);
Perform(c4,"say","我们走！！有本事你就来阿.."); 
Perform(c4,"pause",2);
Perform(c5,"say","我们走！！有本事你就来阿.."); 
trg0++;}
			
if (tiao0==0 && c1>=0 && GetDistance(player,c1)<=200 )
{ 
ChangeBehavior(c1, "kill", player);
ChangeBehavior(c2, "kill", player);
ChangeBehavior(c3, "kill", player);
ChangeBehavior(c4, "kill", player);
ChangeBehavior(c5, "kill", player);
ChangeBehavior(c6, "kill", player);
ChangeBehavior(c7, "kill", player);
ChangeBehavior(c8, "kill", player);
Perform(c3, "pause", 18);
Perform(c2, "pause", 18);
Perform(c4, "pause", 18);
Perform(c5, "pause", 18);
Perform(c6, "pause", 18);
Perform(c7, "pause", 18);
Perform(c8, "pause", 18);
PlayerPerform("block", 0);
Perform(c1,"use",34);
Perform(c1,"use",19);
Perform(c1,"use",4);
Perform(c1,"use",40);
PlayerPerform("say","今天本公子教训教训你们这些昏徒！！");  // 时刻:16
PlayerPerform("pause",4);
Perform(c1,"say","对你来说是小事，但是在我们眼里可不是了，！废话少说，留下你的命吧。");  // 时刻:14
Perform(c1,"pause",4);
PlayerPerform("say","。什么行走江湖。胜负乃家常事，这点小事也放不下去，还说什么名门正派。");  // 时刻:12
PlayerPerform("pause",4);
Perform(c1,"say","武当乃名门正派。竟输给你这个小小的杀手！当然是不F，不铲除你，我们还有何颜面行走江湖。 ");  // 时刻:10
Perform(c1,"pause",4);
PlayerPerform("say","你们是为了报复？！");  // 时刻:8
PlayerPerform("pause",4);
Perform(c1,"say","是吗！那既然来了，就别想活着出去武当山！");  // 时刻:6
Perform(c1,"pause",4);
PlayerPerform("say","我误闯。是你们引我来，怎能说我是误闯，大师你骗我有何事阿？看来你居心不鬼阿。");  // 时刻:4
PlayerPerform("pause",4);
Perform(c1,"say","废话！你说这话有没有考虑，武当山乃静身之地，你误闯这里本是该死。");  // 时刻:2
Perform(c1,"pause",2);
PlayerPerform("say","白眉道长。你这武当山莫非跟朝廷有关系吗？");  // 时刻:0
Perform(c1, "faceto", player);
Perform(c2, "faceto", player);
Perform(c3, "faceto", player);
Perform(c4, "faceto", player);
Perform(c5, "faceto", player);
Perform(c6, "faceto", player);
Perform(c7, "faceto", player);
Perform(c8, "faceto", player);
PlayerPerform("block", 1);
tiao0++;}

if (trg0==2 && c1<0 && c2<0 && c3<0  && c4<0 && c5<0 && c6<0 && c7<0 && c8<0 )  
{ 
PlayerPerform("say","阿？。结束了吗？武当就这几个人吗？"); 
PlayerPerform("block", 1);
PlayerPerform("pause",20);
PlayerPerform("say","武功平常吗！。"); 
   RemoveNPC(ca1);   RemoveNPC(ca2);
   RemoveNPC(ca3);   RemoveNPC(ca4);
   RemoveNPC(ca5);   RemoveNPC(ca6);
   RemoveNPC(ca7);   RemoveNPC(ca8);trg0++;timer0 = now + 25;}

if (trg0 == 3 && now>timer0)
{
PlayerPerform("say","谁？我去找找看！"); 
	AddNPC("7关关");trg0++;}


if (tiao0==1 && g>=0 && GetDistance(player,g)<=800 )
{ 

PlayerPerform("block", 0);
Perform(g,"use",7);
Perform(g,"say","呵呵.去吧，年轻人！！");  // 时刻:19
Perform(g,"pause",5);
PlayerPerform("say","原来是这样！！多谢指教！");  // 时刻:16
PlayerPerform("pause",4);
Perform(g,"say","呵呵..知道你也是这么想的，不过他们都败给你，所以一直有人来会你！你只有输给他们//才行！");  // 时刻:14
Perform(g,"pause",4);
PlayerPerform("say","。都来会会我。要会到什么时候。");  // 时刻:12
PlayerPerform("pause",4);
Perform(g,"say","你现在在江湖上是个名人，人人知道你。所以都想来会会你。 ");  // 时刻:10
Perform(g,"pause",4);
PlayerPerform("say","哦？你怎么知道。！！！");  // 时刻:8
PlayerPerform("pause",4);
Perform(g,"say","他们是不会杀你的，嘴上虽然这么说，但是他们是不会杀你的。");  // 时刻:6
Perform(g,"pause",4);
PlayerPerform("say","。我没有啊。只是他们自己来找事情，我总不能 让着他们，让他们来杀我阿/");  // 时刻:4
PlayerPerform("pause",4);
Perform(g,"say","我不是。我是前辈！我是来告诉你，别把武林的人为敌，你的敌人是皇宫里人。");  // 时刻:2
Perform(g,"pause",2);
Perform(g, "faceto", player);
PlayerPerform("say","你是谁？是否也是来领教我伊人君的？");  // 时刻:0
PlayerPerform("block", 1);
tiao0++;timer0 = now + 20;}


if (tiao0 == 2 && now>timer0)
{
	AddNPC("7关人1");
	AddNPC("7关人2");
	AddNPC("7关人3");
	AddNPC("7关人4");
	AddNPC("7关人5");
	AddNPC("7关人6");
	AddNPC("7关人7");
	AddNPC("7关人8");tiao0++;}



if (tiao0==3 && e1>=0 && GetDistance(player,e1)<=300 )
{ 
ChangeBehavior(e1, "kill", player);
ChangeBehavior(e2, "kill", player);
ChangeBehavior(e3, "kill", player);
ChangeBehavior(e4, "kill", player);
ChangeBehavior(e5, "kill", player);
ChangeBehavior(e6, "kill", player);
ChangeBehavior(e7, "kill", player);
ChangeBehavior(e8, "kill", player);

Perform(e2, "pause", 5);
Perform(e3, "pause", 5);
Perform(e4, "pause", 5);
Perform(e5, "pause", 5);
Perform(e6, "pause", 5);
Perform(e7, "pause", 5);
Perform(e8, "pause", 5);
PlayerPerform("block", 0);
Perform(e1,"say","哼！拿命的是你！");
Perform(e1,"pause",4);
PlayerPerform("say","皇宫的人？哈哈！真是不白来！拿命吧！");  
PlayerPerform("pause",2);
Perform(e1,"say","你能在这撒野！也是一种本事！"); 
Perform(e1, "faceto", player);
Perform(e2, "faceto", player);
Perform(e3, "faceto", player);
Perform(e4, "faceto", player);
Perform(e5, "faceto", player);
Perform(e6, "faceto", player);
Perform(e7, "faceto", player);
Perform(e8, "faceto", player);
PlayerPerform("block", 1);
tiao0++;}

if (tiao0 == 4 && e1<0 && e2<0 && e3<0  && e4<0 && e5<0 && e6<0 && e7<0 && e8<0 )  
{ 

   RemoveNPC(ea1);   RemoveNPC(ea2); RemoveNPC(gz);
   RemoveNPC(ea3);   RemoveNPC(ea4);
   RemoveNPC(ea5);   RemoveNPC(ea6);
   RemoveNPC(ea7);   RemoveNPC(ea8);tiao0++;timer0 = now + 5;}

if (tiao0 == 5 && now>timer0)
{
	AddNPC("7关");tiao0++;}


if (tiao0==6 && b>=0 && GetDistance(player,b)<=300 )
{ 
ChangeBehavior(b, "kill", player);
PlayerPerform("block", 0);
Perform(b,"say","哼哼...");  // 时刻:10
Perform(b,"pause",4);
PlayerPerform("say","你厉害！那就请动手吧！");  // 时刻:8
PlayerPerform("pause",4);
Perform(b,"say","假西西的。你以为我不会杀你吗。我一招就要你的命..");  // 时刻:6
Perform(b,"pause",4);
PlayerPerform("say","在下作为一名杀手！为的是执行任务，并没心跟你们斗，你杀了我吧。");  // 时刻:4
PlayerPerform("pause",4);
Perform(b,"say","你这家伙..在我的地方撒野！今天可让我逮住你了。 ");  // 时刻:2
Perform(b,"pause",2);
PlayerPerform("say","这人是武当的，我不能在给他交手了，先把他们说服在说吧！");  // 时刻:0
PlayerPerform("block", 1);
tiao0++;timer0 = now + 100;}

if (tiao0==7 && now>timer0 && b>=0){ 
PlayerPerform("block", 0);
PlayerPerform("say","告辞！");  // 时刻:12
PlayerPerform("pause",4);
Perform(b,"pause",40);
Perform(b,"say","哈哈！那你走吧！改日切磋！");  // 时刻:10
Perform(b,"pause",4);
PlayerPerform("say","我杀的全是奸人！");  // 时刻:8
PlayerPerform("pause",4);
Perform(b,"say","不可滥杀无辜.");  // 时刻:6
Perform(b,"pause",4);
PlayerPerform("say","我有事在身，。有时间自会与你切磋。");  // 时刻:4
PlayerPerform("pause",4);
Perform(b,"say","我本想跟你切磋！不过没想到你这么没乐趣。，");  // 时刻:2
Perform(b,"pause",2);
PlayerPerform("say","怎么停下来了！杀吧！");  // 时刻:0
PlayerPerform("block", 1);
tiao0++;timer0 = now + 14;}
if (tiao0 == 8 && now>timer0)
{
   GameOver(1);tiao0++;}

if (trg1 == 0 && b>=0 && GetHP(b)<GetMaxHP(b)){
PlayerPerform("use", 35);	
trg1 = 1;}}

OnStart()
{   
	AddNPC("7关1");
	AddNPC("7关2");
	AddNPC("7关3");
	AddNPC("7关4");
	AddNPC("7关5");
	AddNPC("7关6");
	AddNPC("7关7");
	AddNPC("7关8");
}

OnUpdate()
{	
	player = GetAnyChar("player");
	now = GetGameTime();
	if (player < 0)
	{
		return 0;
	}

    GetNPCChar() ; 

	AlwaysDo();

	scene1();
}







