//  上官vip=超强蒙面杀手
int Rule = 3;
int RoundTime = 900;
int PlayerSpawn = 132;
int PlayerSpawnDir = 270;
int PlayerWeapon = 15;
int PlayerWeapon2 =17;
int PlayerHP = 18642;

int trg0;
int shi0;
int trg1;
int shi1;
int trg2;
int shi2;
int trg3;
int shi3;
int trg4;
int shi4;
int trg5;
int shi5;
int sj;
int gameover;
int fshi;
int player;

//
int vip;  
int vip1;  // 循环

int sgs1; // 死亡

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 c9;            
int ca9;      
int c10;      
int ca10;   
int c11;   
int ca11; 
int c12;
int ca12;
int c13;
int ca13;
int c14;
int ca14;
int c15; 
int ca15;
int c16;
int ca16;
int c17;
int ca17;
int c18; 
int ca18;
int c19;
int ca19;
int c20;
int ca20;

////////////////
int j1;int sj1;
int j2;int sj2;
int j3;int sj3;
int j4;int sj4;
int j5;int sj5;// F条件

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

npcjia() {
if (vip+30<=GetGameTime()){ 
vip=GetGameTime();
Perform(c15,"use",34);
Perform(c15,"use",7);
Perform(c16,"use",34);
Perform(c16,"use",7);
Perform(c17,"use",34);
Perform(c17,"use",7);
Perform(c18,"use",34);
Perform(c18,"use",7);
Perform(c19,"use",34);
Perform(c19,"use",7);}

if (vip1+30<=GetGameTime()){ 
vip1=GetGameTime();
Perform(c9,"use",41);
Perform(c9,"use",40);
Perform(c9,"use",34);
Perform(c9,"use",5);
Perform(c9,"use",4);
Perform(c9,"use",3);
Perform(c11,"use",40);
Perform(c11,"use",34);
Perform(c12,"use",40);
Perform(c12,"use",34);
Perform(c13,"use",40);
Perform(c13,"use",34);
Perform(c14,"use",40);
Perform(c14,"use",34);
Perform(c14,"use",4);
  }
}

npc() 
{
   c1=GetChar("b||k-1");
   c2=GetChar("b||k-2");
   c3=GetChar("b||k-3");
   c4=GetChar("b||k-4");
   c5=GetChar("b||k-5");
   c6=GetChar("b||k-6");
   c7=GetChar("b||k-7");
   c8=GetChar("b||k-8");
   //
   c9=GetChar("vip_ay上官");//

   c10=GetChar("暗月s-探子");
   c11=GetChar("暗月侍卫、枪卫");
   c12=GetChar("jd_sw= 魔刀");
   c13=GetChar("wmsi-无名");
   c14=GetChar("vip_gsgsggs");
   ///////////////////////
   ca1=GetAnyChar("b||k-1");
   ca2=GetAnyChar("b||k-2");
   ca3=GetAnyChar("b||k-3");
   ca4=GetAnyChar("b||k-4");
   ca5=GetAnyChar("b||k-5");
   ca6=GetAnyChar("b||k-6");
   ca7=GetAnyChar("b||k-7");
   ca8=GetAnyChar("b||k-8");
   //
   ca9=GetAnyChar("vip_ay上官");//

   ca10=GetAnyChar("暗月s-探子");
   ca11=GetAnyChar("暗月侍卫、枪卫");
   ca12=GetAnyChar("jd_sw= 魔刀");
   ca13=GetAnyChar("wmsi-无名"); 
   ca14=GetAnyChar("vip_gsgsggs");
   /////////////////////////////

   c15=GetChar("vip_ay-1");
   ca15=GetAnyChar("vip_ay-1");
   c16=GetChar("vip_ay-2");
   ca16=GetAnyChar("vip_ay-2");
   c17=GetChar("vip_ay-3");
   ca17=GetAnyChar("vip_ay-3");
   c18=GetChar("vip_ay-4");
   ca18=GetAnyChar("vip_ay-4");
   c19=GetChar("vip_ay-5");
   ca19=GetAnyChar("vip_ay-5");
}
zong1(){
if (trg0==0 && c11>=0 && c12>=0 && c13>=0 && c14>=0){ 
//
ChangeBehavior(c14, "run");
ChangeBehavior(c13, "run");
ChangeBehavior(c12, "run");
ChangeBehavior(c11, "run");//
PlayerPerform("block", 0);
PlayerPerform("say","  先上前看看究竟。  暗月的首领应该即将出现了！ ");  // 时刻:2
PlayerPerform("pause",2);
PlayerPerform("say","  探子应该还没有报信，因为我紧追而来，但是在这里却不见了。 .");  // 时刻:0
PlayerPerform("block", 1);
PlayerPerform("use", 31);
trg0++;}


if (trg0==1  && c14>=0 && GetDistance(player,c14)<=100 ){ 

//
ChangeBehavior(c12,"follow",c14);
ChangeBehavior(c13,"follow",c14);
ChangeBehavior(c14,"follow",c14);
ChangeBehavior(c14,"follow",player);//
Perform(c13,"use",19);
Perform(c13,"use",41);
Perform(c13,"use",40);
Perform(c13,"say","  尝尝我们的厉害吧！.. "); // =6
Perform(c13,"pause",6);
Perform(c14,"use",19);
Perform(c14,"use",41);
Perform(c14,"use",40);
PlayerPerform("block", 0);
Perform(c14,"say","  尽管来吧！.. ");  // =4
Perform(c14,"pause",2);
Perform(c14,"say","  佩服..闯进这里了，怪不得首领叫我们当心.. "); 
Perform(c14,"pause",2);
PlayerPerform("say","  你是首领？ ");  // 时刻:0
PlayerPerform("block", 1);
Perform(c14, "faceto", player);

trg0++;j1=1;j2=1;}


if (trg0==2  && c9>=0  && c10>=0){ 

ChangeBehavior(c10,"follow",c9);
Perform(c10,"use",41);
Perform(c10,"use",5);
trg0++;}

if (trg0==3){PlayerPerform("block", 1);}


if (trg0==3  && GetDistance(c9,c10)<=100 ){ 

ChangeBehavior(c9,"wait");
PlayerPerform("block", 0);
PlayerPerform("say","  那个探子，先不要理会他，让他报信去吧...  ");  // 时刻:11
PlayerPerform("pause",1);
PlayerPerform("block", 1);
PlayerPerform("say","  他不是首领..但一定不是一般的人物！找他去..  ");  // 时刻:10
PlayerPerform("pause",8);
PlayerPerform("block", 1);
Perform(c10,"pause",80);
Perform(c10,"say","  是..  小子知道了！  ");  // = 8
Perform(c10,"pause",8);
PlayerPerform("block", 1);
Perform(c9,"say","  你先回去向首领混报..这里交给我了..  ");  // = 6
Perform(c9,"pause",1);
PlayerPerform("block", 1);
Perform(c9,"say","  哼.. 早知道他迟早会闯近来的！那就看看他有没有战胜暗月的力量吧！  ");  // = 5
Perform(c9,"pause",5);
PlayerPerform("block", 1);
PlayerPerform("say","  探子！ 他在向谁报信！赶紧去看看..  ");  // 时刻:2
PlayerPerform("pause",2);
PlayerPerform("block", 1);
Perform(c10,"say","  我在追风的地方发现伊人君果然是来了. "); 
PlayerPerform("block", 1);

trg0++;shi0 = sj + 10;}


if (sj>shi0 && trg0==4) {

// vip+入
AddNPC("9关6"); 
AddNPC("9关7");
AddNPC("9关8");
AddNPC("9关9");
AddNPC("9关10");
RemoveNPC(ca10); // 探子离开！
PlayerPerform("use", 19);
PlayerPerform("use", 40);
PlayerPerform("use", 15);
PlayerPerform("use", 20);
PlayerPerform("say","   准备作战了.    "); 

trg0++;}

// vip=循环

if (trg0==5  && c15>=0  && c16>=0  && c17>=0  && c18>=0  && c19>=0 && sj>shi0){ 

ChangeBehavior(c15,"follow",c10);
ChangeBehavior(c16,"follow",c10);
ChangeBehavior(c17,"follow",c10);
ChangeBehavior(c18,"follow",c10);
ChangeBehavior(c19,"follow",c10);
Perform(c15,"use",41);
Perform(c16,"use",41);
Perform(c17,"use",41);
Perform(c18,"use",41);
Perform(c19,"use",41);

trg0++;shi0 = sj + 30;}


if (sj>shi0 && trg0==6) {

ChangeBehavior(c15,"run");
ChangeBehavior(c16,"run");
ChangeBehavior(c17,"run");
ChangeBehavior(c18,"run");
ChangeBehavior(c19,"run");
Perform(c15,"use",34);
Perform(c16,"use",34);
Perform(c17,"use",34);
Perform(c18,"use",34);
Perform(c19,"use",34);

trg0=5;shi0 = sj + 30;}


///////////////////////////////////////////////////////////////////



if (j1==0  && c11>=0 && GetDistance(player,c11)<=100 ){ 


ChangeBehavior(c12,"follow",c11);
Perform(c11,"guard",2);
Perform(c11,"say","  快来人，这小子闯进来了！ "); 
Perform(c11, "faceto", player);

j1=1;}

if (j1==0  && c12>=0 && GetDistance(player,c12)<=100 ){ 


ChangeBehavior(c11,"follow",c12);
Perform(c12,"guard",2);
Perform(c12,"say","  找到了！ ... 看看我们的厉害吧！ "); 
Perform(c12, "faceto", player);

j1=1;}

if (j2==0  && c13>=0 && GetDistance(player,c13)<=100 ){ 

ChangeBehavior(c12,"follow",c13);
ChangeBehavior(c11,"follow",c13);
Perform(c13,"guard",2);
Perform(c13,"use",19);
Perform(c13,"use",34);
Perform(c13,"use",40);
Perform(c13,"say","  混帐！ ... 给我过来杀了他...  "); 
Perform(c13, "faceto", player);

j2=1;}

if (j1==1 && c11<0 && c12<0 && c13<0 && c14<0 && ca14>=0) {

RemoveNPC(ca11);RemoveNPC(ca13);
RemoveNPC(ca12);RemoveNPC(ca14);
Say(ca14,"   怎么会败给你这小子，不甘心阿...  ");

j1=2;   

sj1 = sj + 3;} 

if (sj>sj1  && j1==2) {

AddNPC("9关");
AddNPC("9关1");
    j1++;
   }
}  // 第1批NPC结束
///////////////////////////////////////////////////////////////////




zong2(){
if (trg1==0  && c9>=0 && GetDistance(player,c9)<=300 ){ 

ChangeBehavior(c9,"follow",player);
Perform(c9,"use",20);
Perform(c9,"use",19);
Perform(c9,"use",34);
Perform(c9,"use",4);
Perform(c9,"use",3);
Perform(c9,"use",5);
Perform(c9,"use",40);
Perform(c9,"pause",1);
Perform(c15,"pause",5);
Perform(c16,"pause",5);
Perform(c17,"pause",5);
Perform(c18,"pause",5);
Perform(c19,"pause",5);
PlayerPerform("block", 0);
PlayerPerform("say","  先制服他吧，然后问问他首领的下落0.  ");  // 时刻:5
PlayerPerform("pause",5);
Perform(c9,"say","  真是混帐..乖乖的受死吧..  "); 
Perform(c9,"pause",1);
Perform(c9,"say","  你来了.. 看看你究竟有多么的厉害..  "); 
Perform(c9,"pause",3);
PlayerPerform("say","  看来他应该是首领身边的贴身杀手..貌似像！他的地位不一般！  ");  // 时刻:0
PlayerPerform("block", 1);
Perform(c9, "faceto", player);

trg1++;sgs1=1;}


if (sgs1==1 && c9<0) {GameOver(-1);}

// vip_ay上官-1


if (trg1==1 && GetHP(c9)<6000) {

Perform(c9,"say","  哎哟.  行...  "); 
Perform(c9,"use",15);
Perform(c9,"use",15);
Perform(c9,"use",15);

trg1++;}

if (trg1==2 && GetHP(c9)<2000) {

Perform(c9,"pause",50);
Perform(c15,"pause",50);
Perform(c16,"pause",50);
Perform(c17,"pause",50);
Perform(c18,"pause",50);
Perform(c19,"pause",50);
PlayerPerform("say","  可恶！..看来还有埋伏！..  ");  // 时刻:8
PlayerPerform("pause",8);
Perform(c9,"say","  我们走.. "); 
Perform(c9,"pause",1);
Perform(c9,"say","  不过看你能不能见到我们的首领了.. "); 
Perform(c9,"pause",1);
Perform(c9,"say","  哈哈. 行。你厉害..首领在洛阳等着你0.0  "); 
Perform(c9,"pause",3);
PlayerPerform("say","  说，首领在哪..  ");  // 时刻:0
PlayerPerform("block", 1);
Perform(c9, "faceto", player);

sgs1=2;trg1++;shi1 = sj + 6;}

if (sj>shi1 && trg1==3) {

PlayerPerform("say"," 首领在洛阳 .. 我马上过去看看是什么人物..  "); 
RemoveNPC(ca9);RemoveNPC(ca15);
RemoveNPC(ca16);RemoveNPC(ca18);
RemoveNPC(ca17);RemoveNPC(ca19);

trg1++;shi1 = sj + 6;}

if (sj>shi1 && trg1==4) {

PlayerPerform("say"," 直接破城而入吧！...  ");  // 时刻:8
PlayerPerform("pause",8);
PlayerPerform("say","   靠.  真的还有埋伏..不管了，速度解决，赶往洛阳做个了断！  "); 
	AddNPC("9关bk1");AddNPC("9关bk5");
	AddNPC("9关bk2");AddNPC("9关bk6");
	AddNPC("9关bk3");AddNPC("9关bk7");
	AddNPC("9关bk4");AddNPC("9关bk8");

trg1++;
   }
}

//////////////////////////////////////////////////


zong3(){
if (trg2==0  && c1>=0 && GetDistance(player,c1)<=300 ){ 
//
ChangeBehavior(c1,"follow",player);
ChangeBehavior(c2,"follow",player);
ChangeBehavior(c3,"follow",player);
ChangeBehavior(c4,"follow",player);
ChangeBehavior(c5,"follow",player);
ChangeBehavior(c6,"follow",player);
ChangeBehavior(c7,"follow",player);
ChangeBehavior(c8,"follow",player);//
Perform(c1,"say","  一定要让他死在这里，放镖.. "); 
Perform(c1,"pause",1);
Perform(c1,"say","  哈哈哈哈 .  笑话，该死的是你，别想从这过去.. "); 
Perform(c1,"pause",3);
PlayerPerform("say","  不想死的滚开！.. ");
PlayerPerform("block", 1);


trg2++;
   }
}





////////////////////////////////////////////////////////

yiren(){
if (GetHP(player)<=0){ //自己死亡
GameOver(-1);
}}

////////////////////////////////////////////////////////
OnStart()
{   
	AddNPC("9关2");
	AddNPC("9关3");
	AddNPC("9关4");
        AddNPC("9关5");
}
/////////////////////////////////////////////////////////
OnUpdate()
{	
	player = GetAnyChar("player");
	sj = GetGameTime();
	if (player < 0)
	{
		return 0;
	}
        npc(); 
        npcjia(); 
	yiren();
	zong1();
        zong2();
        zong3();
}
