//  剑气+追风=暗月基地
int Rule = 1;
int RoundTime = 450;
int PlayerSpawn = 124;
int PlayerSpawnDir = 80;
int PlayerWeapon = 15;
int PlayerWeapon2 =14;
int PlayerHP = 12000;

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 cshi7;int cshi8;
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 ta;
int ta1; // 探子

int p1;
int pa1; 
int p2;
int pa2; int p1s1; 
int p3;
int pa3; 
////////////////
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);
}

GetManPlaceDistance(int man,int place)
{
   SetTarget(0, "char", man);
   SetTarget(1, "waypoint", place);
   return Distance(0,1);
}


npcjia() {
if (cshi7+50<=GetGameTime()){ 
cshi7=GetGameTime();
Perform(c7,"use",34);
Perform(c7,"use",41);
Perform(c7,"use",5);
Perform(c7,"use",4);
Perform(c7,"use",3);
Perform(c7,"use",40);
Perform(c8,"use",34);
Perform(c8,"use",41);
Perform(c8,"use",5);
Perform(c8,"use",4);
Perform(c8,"use",40);
Perform(c8,"use",3);}

if (cshi8+30<=GetGameTime()){ 
cshi8=GetGameTime();
ChangeBehavior(c9,"follow",player);
ChangeBehavior(c10,"follow",player);
Perform(c9,"use",41);
Perform(c9,"use",34);
Perform(c9,"use",7);
Perform(c10,"use",41);
Perform(c10,"use",34);
Perform(c10,"use",7);}}

npc() {
   
   c1=GetChar("超级组织-1");
   c2=GetChar("超级组织-2");
   c3=GetChar("超级组织-3");
   c4=GetChar("超级组织-4");
   c5=GetChar("超级组织-5");
   c6=GetChar("超级组织-6");
   c7=GetChar("暗月s-追风");
   c8=GetChar("暗月s-剑气");
   ca1=GetAnyChar("超级组织-1");
   ca2=GetAnyChar("超级组织-2");
   ca3=GetAnyChar("超级组织-3");
   ca4=GetAnyChar("超级组织-4");
   ca5=GetAnyChar("超级组织-5");
   ca6=GetAnyChar("超级组织-6");
   ca7=GetAnyChar("暗月s-追风");
   ca8=GetAnyChar("暗月s-剑气");

   c9=GetChar("暗月vs护月-1");
   ca9=GetAnyChar("暗月vs护月-1");
   c10=GetChar("暗月vs护月-2");
   ca10=GetAnyChar("暗月vs护月-2"); // 蒙面护月

   c11=GetChar("暗月成员-1");
   ca11=GetAnyChar("暗月成员-1");
   c12=GetChar("暗月成员-2");
   ca12=GetAnyChar("暗月成员-2");
   c13=GetChar("暗月成员-3");
   ca13=GetAnyChar("暗月成员-3");

   ta=GetChar("暗月s-探子");
   ta1=GetAnyChar("暗月s-探子"); // 探子

   p1=GetChar("lp-梦");
   pa1=GetAnyChar("lp-梦");
   p2=GetChar("JQ-小何");
   pa2=GetAnyChar("JQ-小何");
   p3=GetChar("cq-叶翔");
   pa3=GetAnyChar("cq-叶翔");
}


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

ChangeBehavior(c2, "patrol", 5, 26, 4, 98, 91, 88, 99, 53, 0);
ChangeBehavior(c3, "patrol", 0, 20, 24, 10, 11, 13, 17, 16);
ChangeBehavior(c4, "patrol", 5, 26, 4, 98, 91, 88, 99, 53, 0);
ChangeBehavior(c5, "patrol", 0, 1, 2, 3, 4, 5);
ChangeBehavior(c6, "patrol", 2, 43, 38, 39, 28, 36, 53);
ChangeBehavior(c1, "patrol", 70, 67, 50, 48, 62, 58, 54, 105, 50);
PlayerPerform("block", 0);
PlayerPerform("say","  我还是用心闯关吧！ ");  // 时刻:6
PlayerPerform("pause",2);
PlayerPerform("say","  先不想了。走一步算一步吧，好不容易闯进这里，我怎么有起了这点的疑心！ ");  // 时刻:4
PlayerPerform("pause",2);
PlayerPerform("say","  在加上首领，恐怕真是吃不消的。 ");  // 时刻:2
PlayerPerform("pause",2);
PlayerPerform("say","  暗月真是毒辣  现在还不知道首领是什么人物，但是这些人就够厉害的了 .");  // 时刻:0
PlayerPerform("block", 1);
trg0++;}

if (trg0==1  && c1>=0 && GetDistance(player,c1)<=100 ){ 
//
ChangeBehavior(c2,"follow",c1);
ChangeBehavior(c3,"follow",c1);
ChangeBehavior(c4,"follow",c1);
ChangeBehavior(c5,"follow",c1);
ChangeBehavior(c6,"follow",c1);//
ChangeBehavior(c1,"follow",player);
Perform(c2,"pause",5);
Perform(c3,"pause",5);
Perform(c4,"pause",5);
Perform(c5,"pause",5);
Perform(c6,"pause",5); //
Perform(c1,"use",19);
Perform(c1,"use",34);
Perform(c1,"use",41);
PlayerPerform("block", 0);
Perform(c1,"say","  口气不小！看看你的能耐！ "); 
Perform(c1,"pause",3);
PlayerPerform("say","  看来暗月战领的地方已经太多了，我要赶紧阻止！这样下去真是太可怕了。 ");  // 时刻:3
PlayerPerform("pause",3);
Perform(c1,"say","  你还没到那种资格！ 该见你的时候自然会出来，现在你连首领的基地都没踏入！还想见首领 "); 
Perform(c1,"pause",2);
PlayerPerform("say","  你们首领到底是什么人物.  有本事叫他出来见我 ");  // 时刻:0
PlayerPerform("block", 1);
Perform(c1, "faceto", player);

trg0++;j1=1;j2=1;} // 一切结束函数


if (j2==3 && GetHP(player)<10000 && trg0==2) {

PlayerPerform("block", 0);
PlayerPerform("use", 5);
PlayerPerform("use", 41);
PlayerPerform("use", 15);
PlayerPerform("say","  谁...！探子，也许他知道首领，抓住他问问！ ");  // 时刻:0
PlayerPerform("block", 1);
AddNPC("8关");
trg0++;}

if (trg0==3  && ta>=0){ 

ChangeBehavior(ta,"run");

trg0++;}


if (trg0==4  && ta>=0 && GetDistance(player,ta)<=100 ){ 

PlayerPerform("use", 5);
PlayerPerform("say","  哼！我看你往哪跑！..  ");  // 时刻:24
PlayerPerform("pause",20);
SetTarget(0, "waypoint", 73);
ChangeBehavior(ta, "attacktarget", 0);
PlayerPerform("block", 0);
PlayerPerform("say","  跑。 休想！  ");  // 时刻:4
PlayerPerform("pause",4);
Perform(ta,"use",5);
Perform(ta,"use",41);	
Perform(ta,"say","  原来真在这里！好家伙..你等着吧，真是有意外收获，哈哈.. "); 
Perform(ta,"pause",2);
PlayerPerform("say","  站住！说，你们首领是什么人物！他在那里！ ");  // 时刻:0
PlayerPerform("block", 1);
Perform(ta, "faceto", player);

trg0++;}



if (trg0==5 && GetManPlaceDistance(ta,73)<50) {

Perform(ta,"pause",200);
PlayerPerform("say"," 可恶！把我弄蒙了！... ");  // 时刻:10
PlayerPerform("pause",10);
Perform(ta,"say","  你的时间不多了，好好的觉悟吧，哈哈哈哈.. "); 
Perform(ta,"pause",2);
Perform(ta,"say","  你等着吧，我们首领3天后会把你燧石万段！ "); 
Perform(ta,"pause",2);
Perform(ta,"say","  哼..  我们首领让我来的，看看你是不是在这里，好样的。 "); 
Perform(ta, "faceto", player);

trg0++;shi0 = sj + 8;}

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

AddNPC("8关11");
AddNPC("8关12");
AddNPC("8关13");
AddNPC("8关自己1");
AddNPC("8关自己2");
AddNPC("8关自己3");
RemoveNPC(ta1);
PlayerPerform("use", 19);
PlayerPerform("use", 40);
PlayerPerform("use", 15);
PlayerPerform("use", 15);
PlayerPerform("use", 20);
PlayerPerform("say"," 梦. 是梦！快活林的人前来帮助了！呵呵..  "); 
trg0++;}


if (trg0==7 && p1>=0 && p2>=0 && p3>=0 && c11>=0 && c12>=0 && c13>=0) {

ChangeBehavior(p3,"follow",c13);
ChangeBehavior(p2,"follow",c12);
ChangeBehavior(p1,"follow",c11);
ChangeBehavior(c13,"follow",p3);
ChangeBehavior(c12,"follow",p2);
ChangeBehavior(c11,"follow",p1);
Perform(c11,"say","  这小妞不错，快..强奸她！. "); 
Perform(c11,"guard",5);
Perform(p1,"say","  恩！.. "); 
Perform(p1,"guard",2);
PlayerPerform("say","  恩，好的！  你们把这些小样解决，我去杀头领  ");  // 时刻:2
PlayerPerform("pause",2);
Perform(p1,"guard",2);
Perform(p1,"say","  老公，先不要管我们！你先闯过去就行.. "); 
trg0++;p1s1=1;}

if (p1s1==1 && p1<0) {  // 梦死亡失败
GameOver(-1);}

if (trg0==8 && c11<0 && c12<0 && c13<0) {
//
ChangeBehavior(p1,"follow",player);
ChangeBehavior(p2,"follow",player);
ChangeBehavior(p3,"follow",player);//
PlayerPerform("say","  调皮！..西西 ");  // 时刻:2
PlayerPerform("pause",2);
Perform(p1,"guard",2);
Perform(p1,"say","  怎么样. 我厉害吧，我去帮你.  "); 

trg0++;}


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


ChangeBehavior(c3,"follow",c2);
Perform(c2,"guard",2);
Perform(c2,"say","  快来人，这小子总算被我找到了！ "); 
Perform(c2, "faceto", player);

j1=1;}

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


ChangeBehavior(c2,"follow",c3);
Perform(c3,"guard",2);
Perform(c3,"say","  快来人，这小子总算被我找到了！ "); 
Perform(c3, "faceto", player);

j1=1;}


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


ChangeBehavior(c5,"follow",c4);
Perform(c4,"guard",2);
Perform(c4,"say","  哼！  好家伙，近来就不要在出去了。 "); 
Perform(c4, "faceto", player);

j2=1;}

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


ChangeBehavior(c4,"follow",c5);
Perform(c5,"guard",2);
Perform(c5,"say","  哼！  好家伙，近来就不要在出去了。 "); 
Perform(c5, "faceto", player);

j2=1;}

if (j2==1 && c1<0 && c2<0 && c3<0 && c4<0 && c5<0 && c6<0) {

RemoveNPC(ca1);RemoveNPC(ca3);
RemoveNPC(ca2);RemoveNPC(ca4);
RemoveNPC(ca5);RemoveNPC(ca6);
Say(ca1,"   怎么会败给你这小子，不甘心阿...  ");

j2=2;   
sj2 = sj + 3;} // 超级组织死亡

if (sj>sj2  && j2==2) {

AddNPC("8关7");
AddNPC("8关8");
    j2++;
   }
}


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



zong2(){
if (trg1==0  && c7>=0 && GetDistance(player,c7)<=100 ){ 

ChangeBehavior(c8,"follow",player);
ChangeBehavior(c7,"follow",player);
Perform(c8,"use",19);
Perform(c8,"use",34);
Perform(c8,"use",41);
Perform(c7,"use",19);
Perform(c7,"use",34);
Perform(c7,"use",41);
Perform(c8,"say","  这次不信还会败给你... "); 
Perform(c8,"pause",4);
Perform(c7,"say","  应该说又是你来了吧，暗月是我们的地方..竟说我们.. "); 
Perform(c7,"pause",3);
PlayerPerform("say","  又是你们两个！.. ");  // 时刻:0
PlayerPerform("block", 1);
Perform(c7, "faceto", player);
Perform(c8, "faceto", player);

trg1++;}

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

Perform(c7,"use",15);
Perform(c7,"use",15);
Perform(c7,"use",34);
Perform(c7,"use",4);
Perform(c7,"use",41);
Perform(c7,"use",40);
Perform(c8,"use",15);
Perform(c8,"use",15);
Perform(c8,"use",34);
Perform(c8,"use",4);
Perform(c8,"use",41);
Perform(c8,"use",40);
AddNPC("8关9");AddNPC("8关10");
trg1++;}

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

Perform(c8,"use",15);
Perform(c8,"use",15);
Perform(c8,"use",34);
Perform(c8,"use",4);
Perform(c8,"use",41);
Perform(c8,"use",40);
Perform(c7,"use",15);
Perform(c7,"use",15);
Perform(c7,"use",34);
Perform(c7,"use",4);
Perform(c7,"use",41);
Perform(c7,"use",40);
AddNPC("8关9");AddNPC("8关10");
trg1++;}

if (trg1==2 && GetHP(c7)<1000) {


Perform(c7,"say","  吃不消了.. 竟然又被他打败了！走..  "); 
Perform(c7,"use",15);
Perform(c8,"use",15);
trg1++;shi1 = sj + 5;}

if (trg1==2 && GetHP(c8)<1000) {


Perform(c8,"say","  吃不消了.. 竟然又被他打败了！走..  "); 
Perform(c8,"use",15);
Perform(c7,"use",15);

trg1++;shi1 = sj + 5;}

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

RemoveNPC(ca7);
RemoveNPC(ca8);
PlayerPerform("say"," 你们跑掉有什么。，最后你们也一定会败给我。等着吧！.. ");  // 时刻:

trg1++;}

if (trg1==4 && c7<0 && c8<0 && c9<0 && c10<0 && c11<0 && c12<0 && c13<0) {

Perform(p1,"pause",50);
Perform(p2,"pause",50);
Perform(p3,"pause",50);
Perform(p3,"say","  走了... "); 
Perform(p3,"pause",5);
Perform(p1,"say","  恩！我们回去跟老大说一声，看来刺杀暗月即将成功了，嘿嘿.... "); 
Perform(p1,"pause",3);
PlayerPerform("say","  好了！那探子去报信了，想必他们的首领就在附近！你们回去禀报，我继续往前追查！.. ");  // 时刻:0
PlayerPerform("block", 1);
trg1++;shi1 = sj + 8;}

if (sj>shi1 && trg1==5) {GameOver(1);}}
////  胜利结束！

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

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

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