//  暗月s-无名杀手-决战-PK
int Rule = 1;
int RoundTime = 900;
int PlayerSpawn =113;
int PlayerSpawnDir = 90;
int PlayerWeapon = 15;
int PlayerWeapon2 = 14;
int PlayerHP = 15000;

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 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 wu; // 无名杀手循环
int shizhe; // 蒙面循环
int nv;     // 暗月女-吸血

/*
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);
}


npc() 
{
   c1=GetChar("暗月-使者！1");
   c2=GetChar("暗月-使者！2");
   c3=GetChar("暗月-使者！3");
   c4=GetChar("暗月-使者！4");
   c5=GetChar("暗月-使者！5");
   c6=GetChar("暗月女-吸血");
   c7=GetChar("暗月魔女-1");
   c8=GetChar("暗月魔女-2");
   ca1=GetAnyChar("暗月-使者！1");
   ca2=GetAnyChar("暗月-使者！2");
   ca3=GetAnyChar("暗月-使者！3");
   ca4=GetAnyChar("暗月-使者！4");
   ca5=GetAnyChar("暗月-使者！5");
   ca6=GetAnyChar("暗月女-吸血");
   ca7=GetAnyChar("暗月魔女-1");
   ca8=GetAnyChar("暗月魔女-2");  //


   e1=GetChar("暗月s-无名杀手");
   e2=GetChar("无名杀手-1");
   e3=GetChar("无名杀手-2");
   e4=GetChar("无名杀手-3");
   e5=GetChar("无名杀手-4");
   e6=GetChar("无名杀手-5");
   e7=GetChar("无名杀手-6");
   e8=GetChar("无名杀手-7");
   ea1=GetAnyChar("暗月s-无名杀手");
   ea2=GetAnyChar("无名杀手-1");
   ea3=GetAnyChar("无名杀手-2");
   ea4=GetAnyChar("无名杀手-3");
   ea5=GetAnyChar("无名杀手-4");
   ea6=GetAnyChar("无名杀手-5");
   ea7=GetAnyChar("无名杀手-6");
   ea8=GetAnyChar("无名杀手-7");

}

zong1(){
if (trg0==0 && c1>=0 && c2>=0 && c3>=0 && c4>=0 && c5>=0){ 

ChangeBehavior(c2, "run");
ChangeBehavior(c3, "run");
ChangeBehavior(c4, "run");
ChangeBehavior(c5, "run");
ChangeBehavior(c1, "run");
Perform(c2,"say","  是！遵命！！ ");  // 时刻:2
Perform(c2,"pause",2);
Perform(c1,"say"," 一定不要让这小子在过了，都给我去巡逻的点。发现了，就杀无赦！ ");  
Perform(c1,"say"," 走！那小子来了，我们不要大意，他已经闯进我们的组织了 ");  
trg0++;}

if (trg0==1 && shizhe+50<=GetGameTime()){ 

// +速度+攻击=使者
shizhe=GetGameTime();
Perform(c1,"use",34);
Perform(c1,"use",41);
Perform(c2,"use",41);
Perform(c2,"use",34);
Perform(c3,"use",41);
Perform(c3,"use",34);
Perform(c4,"use",41);
Perform(c4,"use",34);
Perform(c5,"use",41);
Perform(c5,"use",34);}

if (trg0==1  &&  c6>=0 && GetDistance(player,c6)<=100 ){  // 暗月女-吸血


ChangeBehavior(c2,"follow",c6);
ChangeBehavior(c3,"follow",c6);
ChangeBehavior(c4,"follow",c6);
ChangeBehavior(c5,"follow",c6);
ChangeBehavior(c1,"follow",c6);
ChangeBehavior(c7,"follow",c6);
ChangeBehavior(c8,"follow",c6);
ChangeBehavior(c6,"follow",player);
Perform(c6,"use",41);
Perform(c6,"use",40);
Perform(c6,"use",34);
Perform(c6,"use",19);
Perform(c6,"use",4);
Perform(c6,"use",3);
Perform(c6,"use",5);
Perform(c1,"say","  那家伙在那..我们走！.");  // 时刻:6
Perform(c1,"pause",6);
Perform(c6,"say","  我也正有此意..上！ ");  // 时刻:4
Perform(c6,"pause",4);
Perform(c7,"say","  老大。杀了他，拿他的人头回去领功.. ");
Perform(c7,"guard",2);
Perform(c8,"guard",2);
Perform(c6,"say","  好小子！你也真是有能耐阿！哼哼..不过我们暗月组织怎么会看的起你。 ");  // 时刻:2
PlayerPerform("block", 1);

trg0++;trg1=1;trg3=1;}


if (trg0==2 && nv+50<=GetGameTime()){   // 暗月女-吸血

// 速度+攻击=nv
nv=GetGameTime();
Perform(c6,"use",41);
Perform(c6,"use",40);
Perform(c6,"use",34);
Perform(c6,"use",7);
Perform(c6,"use",4);
Perform(c6,"use",3);
Perform(c6,"use",5);
Perform(c7,"use",41);
Perform(c7,"use",34);
Perform(c7,"use",4);
Perform(c7,"use",40);
Perform(c8,"use",41);
Perform(c8,"use",34);
Perform(c8,"use",4);
Perform(c8,"use",40);
Perform(c6,"say","  你是跑不掉的了。哼！认命吧！ ");}


if (trg0==2 && GetHP(c6)<6000) {

Perform(c6,"use",15);
Perform(c7,"use",15);
Perform(c8,"use",15);
Perform(c6,"say"," 好家伙！这么厉害。给你点颜色看看.. ");


trg0++;}


if (trg0==3 && GetHP(c6)<2000) {

Perform(c6,"use",15);
Perform(c7,"use",15);
Perform(c8,"use",15);
Perform(c6,"say"," 看来真是小看你了... ");

trg0++;}


if (trg0==4 && c6<0 && ca6>=0) {   // 暗月女-吸血=死亡

Perform(c8,"say","  是！ "); 
Perform(c8,"guard",4);
Perform(c7,"say","  是！ "); 
Perform(c7,"guard",2);
Say(ca6,"  真是不敢想象你会如此厉害！你们两个快回去禀报..  说。。。。说。，。他！  ");

trg0++;   
shi0 = sj + 6;}

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

RemoveNPC(ca7);RemoveNPC(ca8);
PlayerPerform("say"," 阿..可恶，被跑掉了！ "); 
    trg0++;
   }
}

zong2(){

if (trg3==0  && c1>=0 && GetDistance(player,c1)<=100 ){  // 蒙面老大第2次


ChangeBehavior(c2,"follow",c1);
ChangeBehavior(c3,"follow",c1);
ChangeBehavior(c4,"follow",c1);
ChangeBehavior(c5,"follow",c1);
ChangeBehavior(c1,"follow",player);
Perform(c1,"say","  很好！  终于见到你的摸样了！尽管杀吧！ .. "); 
Perform(c1, "faceto", player);
trg3++;trg1=1;}


if (trg1==0  && c1>=0 && GetDistance(player,c1)<=100 ){  // 蒙面组织


ChangeBehavior(c2,"follow",c1);
ChangeBehavior(c3,"follow",c1);
ChangeBehavior(c4,"follow",c1);
ChangeBehavior(c5,"follow",c1);
ChangeBehavior(c1,"follow",player);
Perform(c1,"say","  忽忽！都给我过来，这家伙被我找到了！.. "); 
Perform(c1, "faceto", player);
trg1++;}


if (trg1==0  && c2>=0 && GetDistance(player,c2)<=100 ){  // 蒙面组织


ChangeBehavior(c2,"follow",c1);
ChangeBehavior(c3,"follow",c1);
ChangeBehavior(c4,"follow",c1);
ChangeBehavior(c5,"follow",c1);
ChangeBehavior(c1,"follow",player);
Perform(c2,"say","  你给我等着吧！哼！一会有你好看的。.. "); 
Perform(c2, "faceto", player);
trg1++;}

if (trg1==0  && c3>=0 && GetDistance(player,c3)<=100 ){  // 蒙面组织


ChangeBehavior(c2,"follow",c1);
ChangeBehavior(c3,"follow",c1);
ChangeBehavior(c4,"follow",c1);
ChangeBehavior(c5,"follow",c1);
ChangeBehavior(c1,"follow",player);
Perform(c3,"say","  你给我等着吧！哼！一会有你好看的。.. "); 
Perform(c3, "faceto", player);
trg1++;}

if (trg1==0  && c4>=0 && GetDistance(player,c4)<=100 ){  // 蒙面组织


ChangeBehavior(c2,"follow",c1);
ChangeBehavior(c3,"follow",c1);
ChangeBehavior(c4,"follow",c1);
ChangeBehavior(c5,"follow",c1);
ChangeBehavior(c1,"follow",player);
Perform(c4,"say","  你给我等着吧！哼！一会有你好看的。.. "); 
Perform(c4, "faceto", player);
trg1++;}

if (trg1==0  && c5>=0 && GetDistance(player,c5)<=100 ){  // 蒙面组织


ChangeBehavior(c2,"follow",c1);
ChangeBehavior(c3,"follow",c1);
ChangeBehavior(c4,"follow",c1);
ChangeBehavior(c5,"follow",c1);
ChangeBehavior(c1,"follow",player);
Perform(c5,"say","  你给我等着吧！哼！一会有你好看的。.. "); 
Perform(c5, "faceto", player);
trg1++;}


if (trg1==1 && c1<0 && ca1>=0) {    

Say(ca1,"  果然厉害..能死在你的手里，不枉费我的忠心！  ");trg1++;}}


zong3(){ 
if (trg1==2 && c1<0 && c2<0 && c3<0 && c4<0 && c5<0 && c6<0 && c7<0 && c8<0 && ca6>=0  && trg2==0 ) {  // 全部死亡

Say(ca6,"  这家伙真是超越了我的想象！ 此仇我一定回报的！  ");
RemoveNPC(ca1);RemoveNPC(ca3);
RemoveNPC(ca2);RemoveNPC(ca4);
RemoveNPC(ca5);RemoveNPC(ca6);
RemoveNPC(ca7);RemoveNPC(ca8);
trg2++;    
shi2 = sj + 3;
   }

if (sj>shi2 && trg2==1) {

AddNPC("7关无名1");
AddNPC("7关无名2");
AddNPC("7关无名3");
AddNPC("7关无名4");
AddNPC("7关无名5");
AddNPC("7关无名6");
AddNPC("7关无名7");
AddNPC("7关无名8"); // 无名杀手加入
PlayerPerform("say","   无名！他又回来了，想必这次又要领教他的高招了！. "); 
PlayerPerform("use", 15);
    trg2++;
   }

if (trg2==2  && e1>=0 && GetDistance(player,e1)<=100 ){ 

SetTarget(0, "waypoint", 119);
ChangeBehavior(e2, "attacktarget", 0);
ChangeBehavior(e3,"follow",e2);
ChangeBehavior(e4,"follow",e2);
ChangeBehavior(e5,"follow",e2);
ChangeBehavior(e6,"follow",e2);
ChangeBehavior(e7,"follow",e2);
ChangeBehavior(e8,"follow",e2);
Perform(e1,"pause",40);
Perform(e2,"pause",8);
Perform(e3,"pause",8);
Perform(e4,"pause",8);
Perform(e5,"pause",8);
Perform(e6,"pause",8);
Perform(e7,"pause",8);
Perform(e8,"pause",8);
PlayerPerform("block", 1);
PlayerPerform("pause",1);
PlayerPerform("block", 1);
PlayerPerform("pause",1);
PlayerPerform("block", 1);
PlayerPerform("pause",1);
PlayerPerform("block", 1);
PlayerPerform("say","  不要废话了，放马过来吧！... ");  // 时刻:6
PlayerPerform("pause",6);
PlayerPerform("block", 1);
Perform(e1,"say","  果然爽快... 不愧是快活林的人，性格有气质！ PF！ ");  // 时刻:4
Perform(e1,"pause",4);
PlayerPerform("block", 1);
PlayerPerform("say","  你什么也不必要说！ 尽管放马过来！ .");  // 时刻:0
PlayerPerform("block", 1);

    trg2++;
   }

if (trg2==3  && e2>=0 && GetDistance(player,e2)<=120 ){ 

PlayerPerform("use", 40);
PlayerPerform("use", 41);
PlayerPerform("use", 34);
PlayerPerform("say","  原来是用暗器的，看来不太好对付，要用心了！. ");  // 时刻:6
PlayerPerform("pause",18);
ChangeBehavior(e1,"follow",player);
ChangeBehavior(e2,"follow",player);
ChangeBehavior(e3,"follow",player);
ChangeBehavior(e4,"follow",player);
ChangeBehavior(e5,"follow",player);
ChangeBehavior(e6,"follow",player);
ChangeBehavior(e7,"follow",player);
ChangeBehavior(e8,"follow",player);
Perform(e1,"use",19);
Perform(e1,"use",34);
Perform(e1,"use",40);
Perform(e1,"pause",1);
Perform(e2,"pause",3);
Perform(e3,"pause",15);
Perform(e4,"pause",15);
Perform(e5,"pause",15);
Perform(e6,"pause",15);
Perform(e7,"pause",15);
Perform(e8,"pause",15);
PlayerPerform("block", 0);
Perform(e2,"say"," 是！放镖...  ");  // 时刻:14
Perform(e2,"pause",5);
Perform(e1,"say"," 别废话了！赶紧解决掉！  ");  // 时刻:12
Perform(e1,"pause",8);
Perform(e2,"say"," 既然这样！。 那我们干脆干掉你算了，免的留下垃圾！  ");  // 时刻:9
Perform(e2,"pause",2);
Perform(e2,"say","  此次来，是专程要你的狗命，你有多大的能耐，竟敢与暗月组织作对，真是活的不耐烦了。 ");  // 时刻:7
Perform(e2,"pause",1);
Perform(e2,"say","  哼！  上次在组织基地里杀伤我们的老大，我们无名可不是吃干饭的。 ");  // 时刻:6
Perform(e2,"pause",6);
Perform(e1,"say","  干我们这航的，没有什么佩服不佩服，尽管来吧！ 分个高低吧！ ");  // 时刻:4
Perform(e1,"pause",4);
PlayerPerform("say","  哈哈 .  还带了这么多的帮手，看来你也不过如此！亏我还景仰你.. ");  // 时刻:0
PlayerPerform("block", 1);

    trg2++;
   }

if (trg2==4 && wu+50<=GetGameTime()){   // 无名杀手

// 速度+攻击=无名杀手
wu=GetGameTime();
Perform(e1,"use",41);
Perform(e1,"use",40);
Perform(e1,"use",34);
Perform(e1,"use",16);
Perform(e1,"use",4);
Perform(e1,"use",3);
Perform(e1,"use",5);
Perform(e2,"use",41);
Perform(e2,"use",34);
Perform(e2,"use",4);
Perform(e3,"use",41);
Perform(e3,"use",34);
Perform(e3,"use",4);
Perform(e4,"use",41);
Perform(e4,"use",34);
Perform(e4,"use",4);
Perform(e5,"use",41);
Perform(e5,"use",34);
Perform(e5,"use",4);
Perform(e6,"use",41);
Perform(e6,"use",34);
Perform(e6,"use",4);
Perform(e7,"use",41);
Perform(e7,"use",34);
Perform(e7,"use",4);
Perform(e8,"use",41);
Perform(e8,"use",34);
Perform(e8,"use",4);  // 无名杀手+攻击+防御+速度=超强

PlayerPerform("say","  无名杀手果然厉害！ 他的手下也真是毒辣！ ");  // 时刻:6
PlayerPerform("pause",3);
Perform(e1,"say","  你死定了！ 杀杀杀杀杀杀杀..  ");}

if (trg2==4 && GetHP(e1)<8000) {

Perform(e1,"say","  哈哈！... ");  // 时刻:3
Perform(e1,"pause",3);
PlayerPerform("say","    真是毒辣...555555 ");  // 时刻:2
Perform(e1, "faceto", player);

    trg2++;
   }


if (trg2==5 && GetHP(e1)<5000) {

Perform(e1,"use",15);
Perform(e1,"use",15);
Perform(e2,"use",15);
Perform(e3,"use",15);
Perform(e4,"use",15);
Perform(e5,"use",15);
Perform(e6,"use",15);
Perform(e7,"use",15);
Perform(e8,"use",15);
Perform(e1,"say","  别着急，好戏还多着呢！ ");  // 时刻:3
Perform(e1,"pause",3);
PlayerPerform("say","    即使你们厉害，不过也休想活命..因为你们根本就不是我的对手。");  // 时刻:2
Perform(e1, "faceto", player);

    trg2++;
   }

if (trg2==6 && e1<0 && ea1>=0) {  // 无名死亡

PlayerPerform("use", 34);
PlayerPerform("use", 15);
PlayerPerform("say","  阿！  着魔了！靠..这暗月的人果然毒辣狡猾..越来越不敢相信了！  ");  // 时刻:4
PlayerPerform("pause",4);
Perform(e2,"use",19);
Perform(e2,"use",30);
Perform(e2,"use",15);
Perform(e2,"use",15);
Perform(e2,"use",15);
Perform(e2,"use",20);
Perform(e2,"say","  老大！妈的，你这家伙..杀死我的老大，我跟你拼了！ ");  // 时刻:3
Perform(e2,"pause",3);
Perform(e2, "faceto", e1);
Say(ea1,"   我想我真的不是你的对手，永远没有你强...   可恨！  ");

trg2++;
   }

if (trg2==7 && e3<0  && e2<0  && e4<0  && e5<0  && e6<0  && e7<0  && e8<0  && ea2>=0) {  // 全部死亡过关

GameOver(1);}}






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


////////////////////////////////////////////////////////
OnStart()
{   
	AddNPC("7关1");AddNPC("7关3");
	AddNPC("7关2");AddNPC("7关4");
	AddNPC("7关5");AddNPC("7关6");
	AddNPC("7关7");AddNPC("7关8");
}
/////////////////////////////////////////////////////////
OnUpdate()
{	
	player = GetAnyChar("player");
	sj = GetGameTime();
	if (player < 0)
	{
		return 0;
	}

        npc(); 
	yiren();
	zong1();
        zong2();
        zong3();
}
