// 四方阵
int Rule = 4;
int RoundTime = 99;
int PlayerSpawn = 15;
int PlayerSpawnDir = 1;
int PlayerWeapon = 42;
int PlayerWeapon2 = 50;
int PlayerHP = 15000;

int trg0 = 0;
int trg1 = 0;
int trg2 = 0;
int trg3 = 0;
int trg4 = 0;
int trg5 = 0;
int trg6 = 0;
int trg7 = 0;
int trg8 = 0;
int trg9 = 0;
int trg10 = 0;
int trg11 = 0;
int trg12 = 0;
int trg13 = 0;
int trg14 = 0;
int trg15 = 0;
int trg16 = 0;
int trg17 = 0;
int trg18 = 0;
int trg19 = 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("律香彬1");
	        AddNPC("伊人梦1");


}



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("律香彬");
		c1 = GetAnyChar("伊人梦");
		if (c >= 0)
		{

			Perform(c, "faceto", player);
			Perform(c, "use", 19);	
			Perform(c, "use", 5);	
			Perform(c1, "use", 11);
			Perform(c1, "use", 12);
			Perform(c1, "use", 13);	
			Perform(c1, "use", 14);		
			trg0 = 1;
		}
	}

	if (trg1 == 0)
	{
		c = GetAnyChar("律香彬");
		c1 = GetAnyChar("伊人梦");
		if (c>=0 && GetEnemy(c)==player && GetHP(player)>0)
		{
			ChangeBehavior(c,"follow",player);
                        Perform(c, "say", "她没有死，不过想救她，先打败我。哼哼，来吧，跟你好好的打一场。。");
			Perform(c, "pause", 7);
                        Perform(c, "faceto", player);
                        Perform(c, "say", "哈哈，好好看你的梦吧。。。");
			Perform(c, "pause", 3);
			Perform(c, "say", "哈哈。。你的梦在我的手上，我想放才会放，不过我是不会放你的梦。");
                        Perform(c, "faceto", player);
			Perform(c, "pause", 3);
			Perform(c, "faceto", c1);
			Perform(c, "say", "哈哈，你看看这是谁阿。。。。");
			Perform(c, "pause", 3);
                        Perform(c, "faceto", player);
			Perform(c, "say", "呵呵，我侥幸才活过来了。要不是孙玉伯急时救我，我现在还看不到你。");
			Perform(c, "faceto", player);

			Perform(c1, "use", 35);
			Perform(c1, "say", "阿。。。老公。");
			Perform(c1, "pause", 12);
			Perform(c1, "faceto", player);

			PlayerPerform("use", 41);	
			PlayerPerform("use", 40);
			PlayerPerform("use", 33);	
			PlayerPerform("use", 3);
			PlayerPerform("use", 5);	
			PlayerPerform("use", 19);
			PlayerPerform("say", "梦，梦，你怎么了。。我要你的命。，操。");
			PlayerPerform("pause", 6);
			PlayerPerform("block", 1);
			PlayerPerform("say", "你这个贱人，老子今天一定要杀了你。");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "梦，梦，赶紧把梦放了。。");
			PlayerPerform("pause", 3);
			PlayerPerform("block", 1);
			PlayerPerform("say", "阿？为什么。难道你们就是杀不死。");
			PlayerPerform(player, "faceto",c);
			PlayerPerform("pause", 2);
			PlayerPerform("block", 1);
			

			trg1 = 1;
		}
	}


	if (trg2 == 0)
	{
		c = GetAnyChar("律香彬");
		if (c>=0 && GetHP(c)<10000)
		{
			Perform(c, "follow", player);
			Perform(c, "use", 34);

			Perform(c, "say", "你.....我们一心服从我们老大，你想杀他，也就是杀我们，你受死吧。。我要为老大报仇。");
			Perform(c, "pause", 5);
                        Perform(c, "faceto", player);
			Perform(c, "say", "是你对他出手太重了，我也差点死在你的手下，要不是孙玉伯及时赶到。我也见不到你。，..");
			Perform(c, "pause", 4);
                        Perform(c, "faceto", player);
			Perform(c, "say", "阿？我不能死。我要为孙老大报仇，我一定要杀了你。");
			Perform(c, "faceto", player);



			PlayerPerform("say", "你是执迷不误阿，那只好得罪了。。");
			PlayerPerform("pause", 5);
			PlayerPerform("block", 1);
			PlayerPerform("say", "我当年只是奉命行事，只是想杀孙剑。不想杀他身边的任何人，");
			PlayerPerform("pause", 4);
			PlayerPerform("block", 1);
			PlayerPerform("say", "孙剑都死了。但为什么他死了，你却没死。");
			PlayerPerform("pause", 2);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			trg2 = 1;
		}
	}
	if (trg2 == 1)
	{
		c = GetAnyChar("律香彬");
		if (c>=0 && GetHP(c)<8000)
		{
			Perform(c, "use", 19);
			Perform(c, "use", 34);
			Perform(c, "use", 5);
			Perform(c, "use", 4);
			Perform(c, "use", 15);
			Perform(c, "use", 15);
			Perform(c, "use", 15);
			Perform(c, "use", 20);
			Perform(c, "say", "忍者孩子们，出来吧。。一起杀了这小子。");
			Perform(c, "pause", 2);
                        Perform(c, "faceto", player);
			Perform(c, "say", "你这家伙，我知道一个人打不过你，不过后面还有。");
			Perform(c, "faceto", player);

			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("block", 1);
			PlayerPerform("say", "把梦交出来。。。我饶你不死。");
			PlayerPerform("pause", 1);
			PlayerPerform("block", 1);
			trg2 = 2;
		        timer0 = now + 10;
		}
	}
	if (trg2 == 2 && now>timer0)
	{
			AddNPC("忍者2");
			AddNPC("忍者3");
			AddNPC("忍者4");
			AddNPC("忍者5");
			AddNPC("忍者6");
			AddNPC("忍者7");
			AddNPC("忍者1");


			trg2 = 3;
	}

if (trg3==0 && trg2==3)
	{
		c2 = GetAnyChar("忍者1");
		if (c2>=0 && GetHP(c2)<=0)
		{
			reborn = c2;
			rebornName = "忍者1";
			trg3 = 1;
			timer1 = now + 1;
		}
		c3 = GetAnyChar("忍者2");
		if (c3>=0 && GetHP(c3)<=0)
		{
			reborn = c3;
			rebornName = "忍者2";
			trg3 = 1;
			timer1 = now + 1;
		}
		c4 = GetAnyChar("忍者3");
		if (c4>=0 && GetHP(c4)<=0)
		{
			reborn = c4;
			rebornName = "忍者3";
			trg3 = 1;
			timer1 = now + 1;
		}
		c5 = GetAnyChar("忍者4");
		if (c5>=0 && GetHP(c5)<=0)
		{
			reborn = c5;
			rebornName = "忍者4";
			trg3 = 1;
			timer1 = now + 1;
		}
		c6 = GetAnyChar("忍者5");
		if (c6>=0 && GetHP(c6)<=0)
		{
			reborn = c6;
			rebornName = "忍者5";
			trg3 = 1;
			timer1 = now + 1;
		}
		c7 = GetAnyChar("忍者6");
		if (c7>=0 && GetHP(c7)<=0)
		{
			reborn = c7;
			rebornName = "忍者6";
			trg3 = 1;
			timer1 = now + 1;
		}
		c8 = GetAnyChar("忍者7");
		if (c8>=0 && GetHP(c8)<=0)
		{
			reborn = c8;
			rebornName = "忍者7";
			trg3 = 1;
			timer1 = now + 1;
		}
	}				
	if (trg3==1 && now>timer1)
	{
		RemoveNPC(reborn);
		timer1 = now + 1;
		trg3 = 2;
	}
	if (trg3==2 && now>timer1)
	{
		AddNPC(rebornName);
		trg3 = 0;
	}

	if (trg4 == 0)
	{
		c = GetChar("忍者1");
		c1 = GetChar("忍者2");
		c2 = GetChar("忍者3");
		c3 = GetChar("忍者4");
		c4 = GetChar("忍者5");
		c5 = GetChar("忍者6");
		c6 = GetChar("忍者7");
		if (c >= 0)
		{
			Perform(c, "faceto", player);	
                        Perform(c, "use", 5);
                        Perform(c, "use", 19);
                        Perform(c1, "use", 5);
                        Perform(c1, "use", 19);
                        Perform(c2, "use", 5);
                        Perform(c2, "use", 19);
                        Perform(c3, "use", 5);
                        Perform(c3, "use", 19);
                        Perform(c4, "use", 5);
                        Perform(c4, "use", 19);
                        Perform(c5, "use", 5);
                        Perform(c5, "use", 19);
                        Perform(c6, "use", 5);
                        Perform(c6, "use", 19);
			PlayerPerform("use", 19);
			PlayerPerform("use", 33);
			PlayerPerform("use", 34);
			PlayerPerform("use", 5);
			trg4 = 1;
		}
	} 




      if (trg4 == 1)
	{
		c = GetAnyChar("律香彬");
		if (c>=0 && GetHP(c)<5000)
		{
			Perform(c, "say", "你有能耐就去救你的梦吧。。哼。。");
                        Perform(c, "faceto", player);
			Perform(c, "say", "你这家伙。我今天杀不了你，改天在找你算帐，君子报仇，十年不晚，总有一天我会为我们孙老大报仇的");
			Perform(c, "faceto", player);

                        PlayerPerform("block", 1);
                        PlayerPerform("block", 1);
                        PlayerPerform("block", 1);
                        PlayerPerform("block", 1);
                        PlayerPerform("block", 1);
                        PlayerPerform("block", 1);
                        PlayerPerform("block", 1);
                        PlayerPerform("block", 1);
			trg4 = 2;
			timer0 = now + 6;
		}
	}  

	if (trg4 == 2 && now>timer0)
	{
		c = GetAnyChar("律香彬");
		if (c>=0)
		{

                        RemoveNPC(c);
			trg4 = 3;
		}
	} 

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