// 圆满楼
int Rule = 1;
int RoundTime = 30;
int PlayerSpawn = 108;
int PlayerSpawnDir = 1;
int PlayerWeapon = 50;
int PlayerWeapon2 = 17;
int PlayerHP = 20000;

int trg0 = 0;
int timer0 = 0;
int timer1 = 0;
int timer2 = 0;
int timer3 = 0;
int timer4 = 0;
int timer5 = 0;
int gameover = 0;
int reborn = -1;
string rebornName;


OnStart()
{


	        AddNPC("律香彬2");


}



OnUpdate()
{
	int player = GetChar("player");
	if (player < 0)
	{
		return 0;
	}
	
	int c;
	int c1;
	int c2;
	int c3;
	int c4;
	int c5;
	int c6;
	int c7;
	int c8;
	int c9;
	int c10;
	int now = GetGameTime();
	if (trg0 == 0)
	{

		c = GetChar("律香彬");
		if (c>=0 && GetHP(player)>0)
		{
			Perform(c, "pause", 100);
                        Perform(c, "use", 5);
                        Perform(c, "use", 19);

			PlayerPerform("block", 0);
			PlayerPerform("crouch", 0);
			PlayerPerform("pause", 3);
			PlayerPerform("say", "（这回他是跑不了了，找的挨杀吗这不是。）");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "（这家伙在果然在这，哼哼。。）");
			PlayerPerform("crouch", 1);
			PlayerPerform("say", "（我想这家伙的死期快到了。..他不死我的（梦）就一天不得安宁。一定要杀死他。");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "（但是这家伙似乎不好杀，杀了好几次，他都没死，孙剑都死在我的手上了。）");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "（不管怎么说，只要打的他怕了，也许他就会说出（梦）的下落。。）");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "（但是我杀了孙剑，想让他乖乖的交出（梦）恐怕没那么容易。）");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "（律香彬-只有找到他才可以救(梦)");
			PlayerPerform("block", 1);
			PlayerPerform("crouch", 1);

			trg0 = 1;
		}
	}
if (trg0==1)
	{
		c = GetChar("律香彬");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && GetEnemy(c)==player && Distance(0, 1)<150)
		{
			StopPerform(player);
			StopPerform(c);

			Perform(c, "say", "我等你很久了...就是要在这里跟你决一死战。。");
			Perform(c, "pause", 4);
			Perform(c, "faceto", player);
			Perform(c, "say", "别着急，我不是说了，打败我，你的梦就回到你的身边了。");
			Perform(c, "pause", 2);
			Perform(c, "faceto", player);

			PlayerPerform("block", 0);
			PlayerPerform("say", "哈哈，好阿，我奉陪，领教了。。");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "那你这个小人就跟我打一场，不要跑了。卑鄙。");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "哼，我来找我的（梦）的。");
			PlayerPerform("block", 1);

			timer1 = now + 100;
			trg0 = 2;
		}
	}	
	if (trg0==2 && now>timer1)
	{
		c = GetChar("律香彬");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && Distance(0, 1)<150)
		{				
			Perform(c, "pause", 100);
			Perform(c, "faceto", player);
			Perform(c, "say", "那我就先告辞了。。");
			Perform(c, "pause", 6);
			Perform(c, "faceto", player);
			Perform(c, "say", "大侠饶命，我说的都是事实。。.你可以去洛阳看看。不过里面都是高手，你要小心。");
			Perform(c, "pause", 4);
			Perform(c, "faceto", player);
			Perform(c, "say", "停，我告诉你，你的梦在洛阳城的高塔里。不过那里面是孙玉伯的禁地。");
			Perform(c, "pause", 3);
			Perform(c, "faceto", player);

			PlayerPerform("block", 0);
			PlayerPerform("say", "今天就先饶恕你一次。如果骗我有你好看的。");
			PlayerPerform("pause", 7);
			PlayerPerform("block", 1);
			PlayerPerform("say", "好，我就信你一次。。");
			PlayerPerform("pause", 5);
			PlayerPerform("block", 1);
			PlayerPerform("say", "哼，骗我阿，你是想死是不是。");
			PlayerPerform("pause", 5);
			PlayerPerform("block", 1);
			PlayerPerform("say", "不行了吧。。说，（梦）在哪里？？？");
			PlayerPerform("block", 1);

			timer2 = now + 16;
			trg0 = 3;
		}
	}

	if (trg0==3 && now>timer2)
	{
		c = GetChar("律香彬");

		if (c>=0)
		{
		AddNPC("刺客1");
		AddNPC("刺客2");
		AddNPC("刺客3");
		AddNPC("刺客4");
		AddNPC("刺客5");
		AddNPC("刺客6");
		AddNPC("刺客7");
		AddNPC("刺客8");
		RemoveNPC(c);
			trg0 = 4;
		}
	}

if (trg0==4)
	{
		c = GetAnyChar("圆满楼刺客1");
		c2 = GetAnyChar("圆满楼刺客2");
		c3 = GetAnyChar("圆满楼刺客3");
		c4 = GetAnyChar("圆满楼刺客4");
		c5 = GetAnyChar("圆满楼刺客5");
		c6 = GetAnyChar("圆满楼刺客6");
		c7 = GetAnyChar("圆满楼刺客7");
		c8 = GetAnyChar("圆满楼刺客8");
		if (c>=0 && c2>=0 && c3>=0 && c4>=0 && c5>=0 && c6>=0 &&  c7>=0 && c8>=0 && GetHP(player)>0)
		{

                        ChangeBehavior(c,"follow",player);
                        Perform(c, "use", 5);
                        Perform(c, "use", 19);
			Perform(c, "say", "一起杀了他，.就这小子作恶。");

                        ChangeBehavior(c2,"follow",player);
                        Perform(c2, "use", 5);
                        Perform(c2, "use", 19);
		        Perform(c2, "say", "是！");
			Perform(c2, "pause", 2);
			Perform(c2, "faceto", c);

                        ChangeBehavior(c3,"follow",player);
                        Perform(c3, "use", 5);
                        Perform(c3, "use", 19);
		        Perform(c3, "say", "是！");
			Perform(c3, "pause", 2);
			Perform(c3, "faceto", c);
				
                        ChangeBehavior(c4,"follow",player);
                        Perform(c4, "use", 5);
                        Perform(c4, "use", 19);
			Perform(c4, "say", "是！");
			Perform(c4, "pause", 2);
			Perform(c4, "faceto", c);		
			
                        ChangeBehavior(c5,"follow",player);
                        Perform(c5, "use", 5);
                        Perform(c5, "use", 19);
			Perform(c5, "say", "是！");
			Perform(c5, "pause", 2);
			Perform(c5, "faceto", c);
			
                        ChangeBehavior(c6,"follow",player);
                        Perform(c6, "use", 5);
                        Perform(c6, "use", 19);
			Perform(c6, "say", "是！");
			Perform(c6, "pause", 2);
			Perform(c6, "faceto", c);

                        ChangeBehavior(c7,"follow",player);
                        Perform(c7, "use", 5);
                        Perform(c7, "use", 19);
			Perform(c7, "say", "是！");
			Perform(c7, "pause", 2);
			Perform(c7, "faceto", c);
			
                        ChangeBehavior(c8,"follow",player);
                        Perform(c8, "use", 5);
                        Perform(c8, "use", 19);
			Perform(c8, "say", "是！");
			Perform(c8, "pause", 2);
			Perform(c8, "faceto", c);


			PlayerPerform("block", 0);
			PlayerPerform("pause", 7);
			PlayerPerform("use", 15);	
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);	
			PlayerPerform("use", 15);
			PlayerPerform("use", 5);	
			PlayerPerform("use", 19);
			PlayerPerform("say", "阿，上当了，可恶。。为什么我这么心软。。");
			PlayerPerform("pause", 5);
			PlayerPerform("block", 1);

			trg0 = 5;
		}
	}

	if (trg0 == 5)
	{
		c = GetAnyChar("圆满楼刺客1");
		if (c>=0 && GetHP(c)<GetMaxHP(c)/2)
		{			
			Perform(c, "say", "还真有两下子...");
			trg0 = 6;
		}
	}
	if (trg0 == 6)
	{
		c = GetAnyChar("圆满楼刺客1");
		if (GetHP(c) <= 0)
		{
			Say(c, "当刺客20年，这是我第一次失败，不F.");
			trg0 = 7;
		}
	}

if (trg0 == 7)
	{
		c = GetAnyChar("圆满楼刺客1");
		c1 = GetAnyChar("圆满楼刺客2");
		c2 = GetAnyChar("圆满楼刺客3");
		c3 = GetAnyChar("圆满楼刺客4");
		c4 = GetAnyChar("圆满楼刺客5");
		c5 = GetAnyChar("圆满楼刺客6");
		c6 = GetAnyChar("圆满楼刺客7");
		c7 = GetAnyChar("圆满楼刺客8");
		
		if (GetHP(c)<=0 && GetHP(c1)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && GetHP(c4)<=0 && GetHP(c5)<=0 && GetHP(c6)<=0 && GetHP(c7)<=0 && player>=0 && GetHP(player)>0)
		{

                        RemoveNPC(c);
                        RemoveNPC(c1);
                        RemoveNPC(c2);
                        RemoveNPC(c3);
                        RemoveNPC(c4);
                        RemoveNPC(c5);
                        RemoveNPC(c6);
                        RemoveNPC(c7);
	          AddNPC("无名1");
	          AddNPC("无名2");
	          AddNPC("无名3");
	          AddNPC("无名4");
	          AddNPC("无名5");


		  PlayerPerform("say", "阿.--分量，..圆满楼不过如此。");
		  PlayerPerform("pause", 5);

			trg0 = 8;
		}
	}

if (trg0==8)
	{
		c = GetAnyChar("无名1");
		c2 = GetAnyChar("无名2");
		c3 = GetAnyChar("无名3");
		c4 = GetAnyChar("无名4");
		c5 = GetAnyChar("无名5");
		if (c>=0 && c2>=0 && c3>=0 && c4>=0 && c5>=0 && GetHP(player)>0)
		{
                        ChangeBehavior(c,"follow",player);
                        Perform(c, "use", 5);
                        Perform(c, "use", 19);
			Perform(c, "say", "轮到我们了，受死吧。。我们可不是你想象的那样软弱。");
			Perform(c, "faceto", player);

                        ChangeBehavior(c2,"follow",player);
                        Perform(c2, "use", 5);
                        Perform(c2, "use", 19);
		        Perform(c2, "say", "你这家伙，死期到了。");
			Perform(c2, "pause", 4);
			Perform(c2, "faceto", c);

                        ChangeBehavior(c3,"follow",player);
                        Perform(c3, "use", 5);
                        Perform(c3, "use", 19);
		        Perform(c3, "say", "竟敢闯入圆满楼，是你自己找死！");
			Perform(c3, "pause", 3);
			Perform(c3, "faceto", c);
				
                        ChangeBehavior(c4,"follow",player);
                        Perform(c4, "use", 5);
                        Perform(c4, "use", 19);
			Perform(c4, "say", "不想活了你。");
			Perform(c4, "pause", 2);
			Perform(c4, "faceto", c);		
			
                        ChangeBehavior(c5,"follow",player);
                        Perform(c5, "use", 5);
                        Perform(c5, "use", 19);
			Perform(c5, "say", "竟不把我们放在眼里。");
			Perform(c5, "pause", 1);
			Perform(c5, "faceto", c);

			PlayerPerform("block", 0);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("use", 15);	
			PlayerPerform("use", 15);
			PlayerPerform("use", 33);	
			PlayerPerform("use", 15);
			PlayerPerform("use", 5);	
			PlayerPerform("use", 15);
			PlayerPerform("say", "哼哼。看你们有多大的能耐。");
			PlayerPerform("pause", 6);
			PlayerPerform("block", 1);

			trg0 = 9;
		}
	}
if (trg0 == 9)
	{
		c = GetAnyChar("无名1");
		c1 = GetAnyChar("无名2");
		c2 = GetAnyChar("无名3");
		c3 = GetAnyChar("无名4");
		c4 = GetAnyChar("无名5");	
if (GetHP(c)<=0 && GetHP(c1)<=0 && GetHP(c2)<=0 && GetHP(c3)<=0 && GetHP(c4)<=0 && player>=0 && GetHP(player)>0)
		{

	          AddNPC("律香彬2");

			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
		        PlayerPerform("say", "你还敢来....竟然骗我。");
		        PlayerPerform("block", 1);
 
			trg0 = 10;
		}
	}

	if (trg0==10)
	{
		c = GetChar("律香彬");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && Distance(0, 1)<150)
		{				
			Perform(c, "pause", 100);
			Perform(c, "say", "我就不去那里了，你去那我想你不会那么容易过去的，伊人君，后会有期了。");
			Perform(c, "faceto", player);
			Perform(c, "say", "你到那里就知道了，至于你跟我，到最后才能分出胜负。。不过我要告诉你，洛阳城里全是高手。");
			Perform(c, "pause", 6);
			Perform(c, "faceto", player);
			Perform(c, "say", "你的梦到洛阳城你不要打听，你去那里就知道怎么回事了。");
			Perform(c, "pause", 4);
			Perform(c, "faceto", player);
			Perform(c, "say", "我没有骗你，。骗你就不会在回来了，我们终究是敌人。我始终都要报仇的。");
			Perform(c, "pause", 3);
			Perform(c, "faceto", player);

			PlayerPerform("block", 0);
			PlayerPerform("say", "好，我这就赶去洛阳。。看那里究竟有多少高手，有多厉害。");
			PlayerPerform("pause", 8);
			PlayerPerform("say", "是吗？此话怎讲。");
			PlayerPerform("pause", 5);
			PlayerPerform("say", "我们是敌人，不过你交出（梦），我不杀你。");
			PlayerPerform("pause", 5);
			PlayerPerform("block", 1);

			timer4 = now + 18;
			trg0 = 11;
		}
	}

if (trg0 == 11 && now>timer4)
	{
		c = GetAnyChar("律香彬");
		if (c>=0)
		{
			RemoveNPC(c);
		}

		timer5 = now + 1;
		trg0 = 12;
	}
	if (trg0 == 12 && now>timer5)
	{
		trg0 = 13;
		gameover = 1;
	}


	if (gameover!=-1 && GetHP(player)<=0)
	{
		gameover = -1;
		timer1 = now + 2; 
	}
	if ((gameover==1 || gameover==-1) && now>timer1)
	{
		GameOver(gameover);
		gameover = 2;
	}

}