// 卧龙窟9
int Rule = 1;
int RoundTime = 990;
int PlayerSpawn = 598;
int PlayerSpawnDir = 270;
int PlayerWeapon = 17;
int PlayerWeapon2 = 42;
int PlayerHP = 25000;

int trg0; 
int shi0; 
int trg1;
int trg2;
int now;  
int player;
int timer0;  
int gameover;

int z1;   
int za1; 
int z2;   
int za2; 
int z3;   
int za3; 
int z4;   
int za4; 
int z5;   
int za5;
int z6;   
int za6;  
int zhongdu;  //循环中毒
int yiren;  // 自己人的一个小函数//    自己人


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;  // 闪电镖客=1+8

int shang; 
int shangguan;  //上官  属于关主
int xhs;   //  上官的小函数
int yinshen;  //循环隐身

int m1;   
int ma1; 
int m2;   
int ma2; 

GetDistance(int k1,int k2)
{
   SetTarget(0, "char", k1);
   SetTarget(1, "char", k2);
   return Distance(0,1);
}
GetManPlaceDistance(int man,int place)
{
   SetTarget(0, "char", man);
   SetTarget(1, "waypoint", place);
   return Distance(0,1);
}
kuaihuolin(int za,int z) { // 快活林人死亡失败
 if (za>=0 && z<0) {
  GameOver(-1);}}

GetNPCChar() {
   z1=GetChar("伊人梦");
   za1=GetAnyChar("伊人梦");
   z2=GetChar("凤凤");
   za2=GetAnyChar("凤凤");
   z3=GetChar("小何");
   za3=GetAnyChar("小何"); // 自己人
   z4=GetChar("叶翔");
   za4=GetAnyChar("叶翔");
   z5=GetChar("石头大哥");
   za5=GetAnyChar("石头大哥");
   z6=GetChar("高老大");
   za6=GetAnyChar("高老大");

   shang=GetChar("上官");
   shangguan=GetAnyChar("上官");

   c1=GetChar("闪电镖客=1");
   ca1=GetAnyChar("闪电镖客=1");
   c2=GetChar("闪电镖客=2");
   ca2=GetAnyChar("闪电镖客=2");
   c3=GetChar("闪电镖客=3");
   ca3=GetAnyChar("闪电镖客=3");
   c4=GetChar("闪电镖客=4");
   ca4=GetAnyChar("闪电镖客=4");
   c5=GetChar("闪电镖客=5");
   ca5=GetAnyChar("闪电镖客=5");
   c6=GetChar("闪电镖客=6");
   ca6=GetAnyChar("闪电镖客=6");
   c7=GetChar("闪电镖客=7");
   ca7=GetAnyChar("闪电镖客=7");
   c8=GetChar("闪电镖客=8");
   ca8=GetAnyChar("闪电镖客=8");

   m1=GetChar("bai 痴 ル");
   ma1=GetAnyChar("bai 痴 ル");
   m2=GetChar("独守空城");
   ma2=GetAnyChar("独守空城");

}

xunhuan(){
if (zhongdu+30<=GetGameTime()) {
zhongdu = GetGameTime();	
Perform(z1,"use",11);Perform(z2,"use",11);Perform(z3,"use",11);
Perform(z1,"use",12);Perform(z2,"use",12);Perform(z3,"use",12);
Perform(z1,"use",13);Perform(z2,"use",13);Perform(z3,"use",13);
Perform(z1,"use",14);Perform(z2,"use",14);Perform(z3,"use",14);	
Perform(z4,"use",11);Perform(z5,"use",11);Perform(z6,"use",11);
Perform(z4,"use",12);Perform(z5,"use",12);Perform(z6,"use",12);
Perform(z4,"use",13);Perform(z5,"use",13);Perform(z6,"use",13);
Perform(z4,"use",14);Perform(z5,"use",14);Perform(z6,"use",14);	
PlayerPerform("use", 11);
PlayerPerform("use", 12);
PlayerPerform("use", 13);
PlayerPerform("use", 14);

}}
scene1(){
if (trg0 == 0 &&  z1>=0 && z2>=0 && z3>=0 && z4>=0 && z5>=0 && z6>=0){

ChangeBehavior(z1, "follow", player);
ChangeBehavior(z2, "follow", player);
ChangeBehavior(z3, "follow", player);
ChangeBehavior(z4, "follow", player);
ChangeBehavior(z5, "follow", player);
ChangeBehavior(z6, "follow", player);
Perform(z1,"say"," 一切都听你的！！.");  // 时刻:8
Perform(z1,"pause",8);
PlayerPerform("say"," 那我们就杀出去吧，说不定有一点的机会！. ");  // 时刻:6
PlayerPerform("pause",4);
Perform(z6,"say"," 不用议论了！兵兵要收回一切，当然要将所有的人杀死了！.");  // 时刻:4
Perform(z6,"pause",4);
PlayerPerform("say"," 难道兵兵连你们也不放过吗？.. ");  // 时刻:2
PlayerPerform("pause",2);
Perform(z1,"say","  不行阿。我们都中毒了！怎么办！怎么办！...");  // 时刻:0
Perform(z1,"faceto",player);
Perform(z1,"use",11);Perform(z2,"use",11);Perform(z3,"use",11);
Perform(z1,"use",12);Perform(z2,"use",12);Perform(z3,"use",12);
Perform(z1,"use",13);Perform(z2,"use",13);Perform(z3,"use",13);
Perform(z1,"use",14);Perform(z2,"use",14);Perform(z3,"use",14);	
Perform(z4,"use",11);Perform(z5,"use",11);Perform(z6,"use",11);
Perform(z4,"use",12);Perform(z5,"use",12);Perform(z6,"use",12);
Perform(z4,"use",13);Perform(z5,"use",13);Perform(z6,"use",13);
Perform(z4,"use",14);Perform(z5,"use",14);Perform(z6,"use",14);	
PlayerPerform("use", 11);
PlayerPerform("use", 12);
PlayerPerform("use", 13);
PlayerPerform("use", 14);
trg0++;}

if (trg0 == 1 &&  c1>=0 && GetDistance(player,c1)<=300 ){

Perform(c1,"say"," 哼！杀出去？恐怕没你说的那么简单吧！放镖......");  // 时刻:4
Perform(c1,"pause",4);
Perform(z1,"say"," 恩！死也要有价值！杀出去吧！..");  // 时刻:2
Perform(z1,"pause",2);
PlayerPerform("say","   阿，闪电镖客！大家要小心应战了！这家伙都不好惹的！.. ");  // 时刻:2

trg0++;}


if (c3<0  && c4<0 && c5<0 && c6<0 && c7<0 && c8<0 && c1<0 && c2<0 && trg0 == 2){


PlayerPerform("say","  没那么简单！ ");  // 时刻:2
PlayerPerform("pause",2);
Perform(z1,"say","  结束了吗！...");  // 时刻:2
Perform(z1,"faceto",player);
Perform(z2,"faceto",player);
Perform(z3,"faceto",player);
Perform(z4,"faceto",player);
Perform(z5,"faceto",player);
RemoveNPC(ca1);RemoveNPC(ca2);
RemoveNPC(ca3);RemoveNPC(ca4);
RemoveNPC(ca7);RemoveNPC(ca5);
RemoveNPC(ca8);RemoveNPC(ca6);
trg0++;timer0 = now + 5;}

if (trg0==3 && now>timer0){

Perform(z1,"say","  难道真的要死在这里吗？！...");  // 时刻:2
Perform(z1,"faceto",player);
PlayerPerform("say","  我草！有没有搞错！ ");
AddNPC("9关1");
AddNPC("9关2");
AddNPC("9关3");
AddNPC("9关4");
AddNPC("9关5");
AddNPC("9关6");
AddNPC("9关7");
AddNPC("9关8");
trg0++;}

if (trg0 == 4 &&  c1>=0 && GetDistance(player,c1)<=300 ){

Perform(c1,"say"," 受死吧！你们是去不了金华的！死了这条心吧！....");  // 时刻:4

trg0++;}


if (c1>=0 && GetHP(c1)<3000 && trg0 == 5){

PlayerPerform("say","  不要大意！这些人都很棘手！ ");  // 时刻:2
PlayerPerform("pause",2);
Perform(z1,"say","  呵呵！看来我们还有一点的希望！...");  // 时刻:2
Perform(z1,"faceto",player);
Perform(z2,"faceto",player);
Perform(z3,"faceto",player);
Perform(z4,"faceto",player);
Perform(z5,"faceto",player);
trg0++;}

if (c3<0  && c4<0 && c5<0 && c6<0 && c7<0 && c8<0 && c1<0 && c2<0 && trg0 == 6){

PlayerPerform("say","  全部离开！这里就交给我吧！ ");  // 时刻:2
RemoveNPC(za1);RemoveNPC(za2);
RemoveNPC(za3);RemoveNPC(za4);
RemoveNPC(za5);RemoveNPC(za6);
RemoveNPC(ca1);RemoveNPC(ca2);
RemoveNPC(ca3);RemoveNPC(ca4);
RemoveNPC(ca7);RemoveNPC(ca5);
RemoveNPC(ca8);RemoveNPC(ca6);
trg0++;timer0 = now + 5;}

if (trg0==7 && now>timer0){
AddNPC("9关人1");
trg0++;}}



scene2(){
if (trg1 == 0 &&  m1>=0 && GetDistance(player,m1)<=200 ){

ChangeBehavior(m1, "follow", player);
PlayerPerform("use", 15);
PlayerPerform("use", 15);
PlayerPerform("use", 34);
PlayerPerform("use", 19);
Perform(m1,"use",30);	
Perform(m1,"use",19);	
Perform(m1,"say","   为什么要跟你解！受死！....");  // 时刻:4
Perform(m1,"pause",4);
PlayerPerform("say","   你是谁！有本事的话你把我身上的毒先解掉跟我打。你敢不敢！.. ");  // 时刻:2

trg1++;}


if (GetHP(m1)<3000 && trg1 == 1){

Perform(m1,"use",15);	
Perform(m1,"use",15);	
Perform(m1,"say","   有一套！..  不过你是去不了金华了！.");  // 时刻:4

trg1++;}


if (m1<0 && trg1 == 2){

AddNPC("9关蒙面");
RemoveNPC(ma1);

trg1++;}

if (trg1 == 3 &&  m2>=0 && GetDistance(player,m2)<=200 ){

ChangeBehavior(m2, "follow", player);
Perform(m2,"use",30);	
Perform(m2,"use",19);	
Perform(m2,"say","   为什么要跟你解！受死！....");  // 时刻:4
Perform(m2,"pause",4);
PlayerPerform("say","   你是谁！有本事的话你把我身上的毒先解掉跟我打。你敢不敢！.. ");  // 时刻:2

trg1++;}

if (GetHP(m2)<3000 && trg1 == 4){

Perform(m2,"use",15);	
Perform(m2,"use",15);	
Perform(m2,"say","   哼... 你走不出去的！ ");  // 时刻:4

trg1++;}


if (m2<0 && trg1 == 5){

AddNPC("9关");
RemoveNPC(ma2);
trg1++;}}


scene3(){
if (trg2 == 0 &&  shang>=0 && GetDistance(player,shang)<=200 ){

ChangeBehavior(shang, "follow", player);
Perform(shang,"use",30);	
Perform(shang,"use",19);
PlayerPerform("use", 15);
PlayerPerform("use", 15);
PlayerPerform("say", "  很好！。接招了！ "); // 13
PlayerPerform("pause", 6);
Perform(shang,"say","  口气好大！纳命吧！杀死我，你就可以去金华找兵兵！.");  // 时刻:10
Perform(shang,"pause",6);	
PlayerPerform("say", "  叫人也是没有用的，命不如此！即使我不挣扎也死不在你的手里。 ");
PlayerPerform("pause", 7);	
Perform(shang,"say","   佩服！..  既然你这么厉害！那我在叫两人人过来！.");  // 时刻:4
Perform(shang,"pause",4);
PlayerPerform("say","   又见面了！就算是中毒，也一定会出去跟兵兵说清楚！.. ");  // 时刻:2
trg2++;timer0 = now + 15;}

if (trg2==1 && now>timer0){

AddNPC("9关蒙面");AddNPC("9关人1");

trg2++;xhs=1;}


if (GetHP(shang)<15000 && xhs == 1){

Perform(shang,"use",15);	
Perform(shang,"use",15);
Perform(shang,"use",15);	
Perform(shang,"use",15);	
Perform(shang,"say","   吗的！  你小子真是有种！ ");  // 时刻:4

xhs=2;}

if (GetHP(shang)<10000 && xhs == 2){
	
Perform(shang,"use",7);	
Perform(shang,"say","   我也玩玩这感觉！ ");  // 时刻:4

xhs=3;}


if (shang<0 && xhs == 3){
	
GameOver(1);xhs=4;}


if (trg2 == 2 &&  m2>=0 && m1>=0){

ChangeBehavior(shang, "follow", player);
ChangeBehavior(m2, "follow", player);
ChangeBehavior(m1, "follow", player);

trg2++;}

if (trg2 == 3 && yinshen+30<=GetGameTime()) {yinshen = GetGameTime();	

Perform(m2,"use",7);
Perform(m1,"use",7);
Perform(m1,"use",5);
Perform(m2,"use",5);
Perform(m2,"use",15);
Perform(m1,"use",15);
Perform(m1,"use",15);
Perform(m2,"use",15);
Perform(shang,"use",40);
Perform(shang,"use",41);
Perform(shang,"use",34);
Perform(shang,"use",5);}}

ziji(){
kuaihuolin(za1,z1);
kuaihuolin(za2,z2);
kuaihuolin(za3,z3);
kuaihuolin(za4,z4);
kuaihuolin(za5,z5);
kuaihuolin(za6,z6);
if (GetHP(player)<=0) 
{ GameOver(-1);}}
OnStart(){

// 闪电镖客
AddNPC("9关1");
AddNPC("9关2");
AddNPC("9关3");
AddNPC("9关4");
AddNPC("9关5");
AddNPC("9关6");
AddNPC("9关7");
AddNPC("9关8");

//  下面是自己人
AddNPC("9关自己1");
AddNPC("9关自己2");
AddNPC("9关自己3");
AddNPC("9关自己4");
AddNPC("9关自己5");
AddNPC("9关自己6");
}
OnUpdate()
{	
	player = GetAnyChar("player");
	if (player < 0){return 0;}
        now = GetGameTime();
        GetNPCChar() ; 
        xunhuan(); 
	ziji();
	scene1();
        scene2();
        scene3();
}
