#include "..\Npc_Lxqj\NPCXLhs\NpcLxqj.pst"
//  秦王府03
int Rule = 10;
int RoundTime = 60;
int PlayerSpawn = 144;
int PlayerSpawnDir = 180;
int PlayerWeapon = 25;
int PlayerWeapon2 = 24;
int PlayerHP = 4000;
NpcGetAnyCharGet()
{
    c1=GetChar("秦护花");
    ca1=GetAnyChar("秦护花");
    c2=GetChar("蓝天猛");
    ca2=GetAnyChar("蓝天猛");
    c3=GetChar("青衣少年·甲");
    ca3=GetAnyChar("青衣少年·甲");
    c4=GetChar("青衣少年·乙");
    ca4=GetAnyChar("青衣少年·乙");
    c5=GetChar("青衣少年·丙");
    ca5=GetAnyChar("青衣少年·丙");
    c6=GetChar("青衣少年·丁");
    ca6=GetAnyChar("青衣少年·丁");
    c7=GetChar("青衣少年·戊");
    ca7=GetAnyChar("青衣少年·戊");
    c8=GetChar("青衣少年·己");
    ca8=GetAnyChar("青衣少年·己");

    c9=GetChar("胡月儿");
    ca9=GetAnyChar("胡月儿");
}
playerzong0()
{
	if(lx_bb != 0)
	{
		return 0;
	}
	if(lxqj_b0==0)
	{

               PlayerPerform("say", " 蓝天猛那家伙跑到这里怎么不见了？？？");
	       lxqj_b0++;
     }
     if(lxqj_b0 == 1 )
     {
          if (c9>0 && julipanduan(c9,player)<100)
          {

	       Perform(c9, "say", " 嘿嘿，反正我一个人，不如跟着你。   ");
	       Perform(c9, "pause", 6);
	       Perform(c9, "say", " 若不是你，恐怕我已经死在天香楼了。  ");
	       Perform(c9, "pause", 4);
               Perform(c9, "faceto", player);

               PlayerPerform("say", " 。。。。。。。"); 
               PlayerPerform("pause", 3);
	       PlayerPerform("block", 0);
               PlayerPerform("pause", 3);
               PlayerPerform("say", " 那又如何？   "); 
               PlayerPerform("pause", 6);
               PlayerPerform("say", " 你怎么跟着我？  "); 
               PlayerPerform("pause", 1);
	       PlayerPerform("block", 1);

                        for(i=2; i<=16; i++)
                        {
                           if(i!=c9)
                           {
                                  Perform(i, "guard", 12);
                            }
                       }
	       lxqj_b0++;
               lxqj0++;
               lxqj5++;
             }
        }
        if(lxqj5 == 1)
        {
	     if (c9>=0 && GetHP(c9)<GetMaxHP(c9)/2)
	     {
	       Perform(c9, "say", "本姑娘今天跟你们不客气了﹒﹒");
	       lxqj5++;

             }
        }
        if(lxqj5 == 2 && c9<0)
        {
		Say(ca9, " 我不行了﹒﹒﹒﹒﹒");
		gameover = -1;
	        lxqj5++;
		lxqjsj 	= lxsj;	
        }
     if(lxqj1 == 0 )
     {
          if (c4>0 && GetEnemy(c4)==player)
          {

			ChangeBehavior(c5, "follow", c4);
			Perform(c4, "aggress");
			Perform(c4, "guard", 4);
			Perform(c4, "say", " 来人阿，这家伙又来了。 ");
			Perform(c4, "faceto", player);
                        lxqj1++;
          }
          if (c5>0 && GetEnemy(c5)==player)
          {

			ChangeBehavior(c4, "follow", c5);
			Perform(c5, "aggress");
			Perform(c5, "guard", 4);
			Perform(c5, "say", " 来人阿，这家伙又来了。 ");
			Perform(c5, "faceto", player);
                        lxqj1++;
          }
     }
     if(lxqj2 == 0 )
     {
          if (c6>0 && GetEnemy(c6)==player)
          {
			Perform(c6, "aggress");
			Perform(c6, "say", " 你还是来了， 受死吧。 ");
			Perform(c6, "faceto", player);
                        lxqj2++;
           }
     }
     if(lxqj3 == 0 )
     {
          if (c3>0 && GetEnemy(c3)==player)
          {
			Perform(c3, "aggress");
			Perform(c3, "say", " 你竟然跟着来了！不过这里可不是你来的地方，受死吧。。 ");
			Perform(c3, "faceto", player);
                        lxqj3++;
           }
     }
     if(lxqj_b1 == 0 )
     {
          if (c1>0 && GetEnemy(c1)==player)
          {

			Perform(c1, "say", "口气真是不小， 那我就送你上西天。  ");
			Perform(c1, "pause", 5);
			Perform(c1, "say", " 你是谁派来的？  ");
			Perform(c1, "pause", 1);
			Perform(c1, "aggress");
			Perform(c1, "say", "你,,听说就是你？");
			Perform(c1, "faceto", player);

			Perform(c2, "guard", 9);
			Perform(c2, "say", "就是他！！秦大哥，就是他在天香楼...");
			Perform(c2, "faceto", c1);
			Perform(c2, "pause", 3);

			PlayerPerform("block", 0);
			PlayerPerform("pause", 2);
			PlayerPerform("say", "去问阎王吧﹒");
			PlayerPerform("pause", 10);
			PlayerPerform("block", 1);
                        for(i=2; i<=16; i++)
                        {
                           if(i!=c1 && i!=c2)
                           {
                                  Perform(i, "pause", 15);
                            }
                       }
                lxqj4=1;
                lxqj_b1++;
            }
        }
        if(lxqj_b1 == 1)
        {
	     if (c1>=0 && GetHP(c1)<GetMaxHP(c1)/2)
	     {
	                Perform(c2, "guard", 5);
	                Perform(c1, "guard", 5);
			Perform(c1, "say", " 都给我过来把他给我剁了！！ ");
			Perform(c1, "say", " 这小子果然有两下子。 ");
			Perform(c1, "faceto", player);
	     if (c3>0)
	     {
                        ChangeBehavior(c3, "follow", player);
			Perform(c3, "say", " 是。 ");
	                Perform(c3, "guard", 5);
             }
	     if (c4>0)
	     {
                        ChangeBehavior(c4, "follow", player);
			Perform(c4, "say", " 是。 ");
	                Perform(c4, "guard", 5);
             }
	     if (c5>0)
	     {
                        ChangeBehavior(c5, "follow", player);
			Perform(c5, "say", " 是。 ");
	                Perform(c5, "guard", 5);
             }
	     if (c6>0)
	     {
                        ChangeBehavior(c6, "follow", c1);
			Perform(c6, "say", " 是。 ");
	                Perform(c6, "guard", 5);
             }
	     if (c7>0)
	     {
                        ChangeBehavior(c7, "follow", c1);
			Perform(c7, "say", " 是。 ");
	                Perform(c7, "guard", 5);
             }
	     if (c8>0)
	     {
                        ChangeBehavior(c8, "follow", c1);
			Perform(c8, "say", " 是。 ");
	                Perform(c8, "guard", 5);
             }
             lxqj1=1;
             lxqj2=1;
             lxqj3=1;
	     lxqj_b1++;
             }
        }
        if(lxqj_b1 == 2)
        {
           if(GetHP(c1)<0)
           {
	        Say(ca1, " 可恶，没有想到我竟然败在你的手上。。 ");
                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);
	        lxqj_b1++;
                lxqj0=4;
            }
        }
        if(lxqj0 == 1)
        {
           if(c3<0 && c4<0 && c5<0 && c6<0 && c7<0 && c8<0)
           {
               RemoveNPC(ca3);RemoveNPC(ca6);
               RemoveNPC(ca4);RemoveNPC(ca7);
               RemoveNPC(ca5);RemoveNPC(ca8);
               lxqj0++;
	       lxx0 	= lxsj;	
             }
        }
        if(lxqj0 == 2 && lxx0+5 <= lxsj)
        {
	       AddNPC("3关");
               lxqj0++;
	       lxx0 	= lxsj;	
        }
        if(lxqj0 == 3 && lxx0+10 <= lxsj)
        {
          c10=GetChar("蒙面灰衣人");
          if (c10>0 && julipanduan(c10,player)<150)
          {
			Perform(c9, "aggress",2);

			Perform(c10, "aggress");
			Perform(c10, "say", " ········· ");
			Perform(c10, "pause", 1);
			Perform(c10, "faceto" ,player);

                        PlayerPerform("use", 16);
                        PlayerPerform("use", 16);
			PlayerPerform("say", "？？？？？？？？. ");
			PlayerPerform("pause", 5);

               lxqj0++;
	       lxx0 	= lxsj;	
             }
        }
        if(lxqj0 == 4 && lxx0+10 <= lxsj)
        {
           c10=GetChar("蒙面灰衣人");
           if(GetHP(c10)<3000)
           {
                        zhidingdidian(c10,20);
			Perform(c10, "say", " 我们还会在见面的 ···");
			Perform(c10, "pause", 3);
                        lxqj0++;
           }
           if(GetHP(c2)<0 && GetHP(c1)<0 && GetHP(c10)>0)
           {
                        zhidingdidian(c10,20);
			Perform(c10, "say", " 做的很好·我们还会在见面的。");
			Perform(c10, "pause", 3);

			PlayerPerform("say", "什么人？？？？？  好厉害！！");
			PlayerPerform("pause", 5);

	       gameover = 1;
               lxqj0++;
	       lxqjsj 	= lxsj;	
             }

        }
        if(lxqj4 == 1)
        {
           if(GetHP(c2)<0)
           {
	        Say(ca2, " 我不行了。。 。。");
	        lxqj4++;
             }
       }
}
///////////////////////////////////////////////////////////////////////////
OnStart()
{
	AddNPC("3关自己1");

	AddNPC("3关1");
	AddNPC("3关2");
	AddNPC("3关3");
	AddNPC("3关4");
	AddNPC("3关5");
	AddNPC("3关6");
	AddNPC("3关7");
	AddNPC("3关8");
}
OnUpdate()
{	
	player = GetAnyChar("player");
	lxsj = GetGameTime();
	if (player < 0)
	{
		return 0;
	}
        playerzong0();
        NpcGetAnyCharGet();
	if (gameover!=-1 && GetHP(player)<=0)
	{
		gameover = -1;
		lxqjsj 	= lxsj;	
	}
	if ((gameover == 1 || gameover == -1) && lxqjsj+10<=lxsj)
	{
		GameOver(gameover);
		gameover = 2;
	}
}