// 决战灵魂亡灵
int Rule = 1;
int RoundTime = 990;
int PlayerSpawn = 39;
int PlayerSpawnDir = 90;
int PlayerWeapon = 17;
int PlayerWeapon2 = 6;
int PlayerHP = 25000;

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 trg20 = 0;
int trg21 = 0;
int trg22 = 0;
int trg23 = 0;
int trg24 = 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("制作人3");


}
OnUpdate()
{
	int player = GetAnyChar("player");
	if (player < 0)
	{
		return 0;
	}
	if (gameover == 2)
	{
		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("(兵兵)");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && Distance(0, 1)<300)
		{	
                        Perform(c, "use", 34);
                        Perform(c, "use", 33);
                        Perform(c, "use", 41);
                        Perform(c, "use", 3);
                        Perform(c, "use", 19);
                        Perform(c, "use", 5);
			Perform(c, "pause", 200);
			Perform(c, "say", "我要走了....你自己..加油喽....");
			Perform(c, "say", "好思想...努力。。");
			Perform(c, "pause", 2);
			Perform(c, "say", "对，你就该这么想的，哼哼..希望你能顺利通关。。");
			Perform(c, "pause", 2);
			Perform(c, "say", "我不是这个意思，我的意思是，让你亲手杀死灵魂。你用心是可以的。");
			Perform(c, "pause", 2);
			Perform(c, "say", "呵呵。这是你跟他的个人恩怨，我不会插手的小兄弟。");
			Perform(c, "pause", 2);
			Perform(c, "say", "呵呵。小兄弟，一切劲在其中，靠你自己了，我不能帮你了。");
			Perform(c, "pause", 2);
			Perform(c, "say", "恩.对。这里就是大决战了。你要自己掌握了。。");
			Perform(c, "pause", 3);
			Perform(c, "faceto", player);
			

			PlayerPerform("use", 33);
			PlayerPerform("use", 34);
			PlayerPerform("use", 19);
			PlayerPerform("use", 5);
			PlayerPerform("say", "（恩...我不送你了。）");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "（恩，我一定通关给你看的。灵魂就灵魂，今天就是他的死期...）");
			PlayerPerform("pause", 2);
			PlayerPerform("say", "（恩，我相信自己，都已经见到他了，怕什么..）");
			PlayerPerform("pause", 2);	
			PlayerPerform("say", "（你说的也对﹒﹒这是我的个人恩怨，不该连累你。）");
			PlayerPerform("pause", 2);			
			PlayerPerform("say", "（阿？我肯定不行了，当年杀孙剑的时候我就够呛了。）");
			PlayerPerform("pause", 2);			
			PlayerPerform("say", "（你不帮我了..那我能过去吗？）");
			PlayerPerform("pause", 4);			
			PlayerPerform("say", "﹒我已经知道他们的主谋是谁了，（灵魂亡灵）孙剑都是他的手下。");
			PlayerPerform("block", 1);
		
			trg0 = 1; 
			timer0 = now + 15;			
		}		
	}
	if (trg0 == 1 && now>timer0)
	{
		AddNPC("大决战1");
		RemoveNPC(GetAnyChar("(兵兵)"));

		trg0 = 2;
	}

if (trg1 == 0)
	{
		c = GetAnyChar("灵魂亡灵");
		SetTarget(0, "char", c);
		SetTarget(1, "char", player);
		if (c>=0 && GetEnemy(c)==player && Distance(0, 1)<200)
		{
                        Perform(c, "use", 30);
                        Perform(c, "use", 19);
                        Perform(c, "use", 34);
                        Perform(c, "use", 4);
                        Perform(c, "use", 40);
                        Perform(c, "use", 41);
                        Perform(c, "use", 5);
                        Perform(c, "use", 3);
                        Perform(c, "use", 33);
			Perform(c, "say", "先杀了你在说。..");
			Perform(c, "guard", 3);
			Perform(c, "say", "今天就先杀了你这小子，然后血洗快活林。..");
			Perform(c, "guard", 3);
			Perform(c, "say", "哦..伊人君阿，伊人君，你果真是很猖狂阿..");
			Perform(c, "guard", 3);
			Perform(c, "say", "你以为我（灵魂亡灵）像孙剑他们吗？");
			Perform(c, "guard", 3);
			Perform(c, "say", "你不要嘴硬了。快死了...");
			Perform(c, "guard", 3);
			Perform(c, "faceto", player);
			Perform(c, "say", "游戏要结束了...我今天就为死去的所有兄弟报仇了。");
			Perform(c, "faceto", player);

			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 20);
			PlayerPerform("say", "妄想。休想杀害快活林一个人，拿你命吧..");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "不猖狂能来到这里?。");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "当然你是比他们厉害。。。。不过我不一定会败给你。");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "你这么肯定我不是你的对手。。。。");
			PlayerPerform("pause", 3);
			PlayerPerform("say", "哼..。是吗？我倒要看看你是怎么报仇的..");
			PlayerPerform("pause", 2);
			PlayerPerform("block", 1);

			trg1 = 1;
		}
	}
	if (trg2 == 0 && now>timer1)
	{
		c = GetChar("灵魂亡灵");
		if (c>=0 && c1>0)

                {

			ChangeBehavior(c, "follow", player);
                        Perform(c, "use", 8);
                        Perform(c, "use", 3);
                        Perform(c, "use", 4);
                        Perform(c, "use", 41);
                        Perform(c, "use", 5);


		        trg2 = 1;
			timer1 = now + 60;

	    }

       }
	if (trg2 == 1 && now>timer1)
	{
		c = GetChar("灵魂亡灵");
		if (c>=0 && c1>0)

                {

			ChangeBehavior(c, "follow", player);
                        Perform(c, "use", 8);
                        Perform(c, "use", 3);
                        Perform(c, "use", 4);
                        Perform(c, "use", 41);
                        Perform(c, "use", 5);


		        trg2 = 0;
			timer1 = now + 60;

	    }

       }

if (trg0==2 && now>timer1)
	{
		c = GetChar("灵魂亡灵");
		if (c >= 0)
		{

                        Perform(c, "use", 8);
                        Perform(c, "use", 3);
			Perform(c, "say", "哈哈哈哈！！凭你这一点能耐是杀不了我的！！");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			
			trg0 = 3;
			timer1 = now + 50;
		}				
	}
	if (trg0==3 && now>timer1)
	{
		c = GetChar("灵魂亡灵");
		if (c >= 0)
		{

                        Perform(c, "use", 8);
                        Perform(c, "use", 3);
                        Perform(c, "use", 4);
			Perform(c, "say", "你尽管放马过来吧！我先来陪你玩一玩再让你死！！");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			
			trg0 = 4;
			timer1 = now + 50;
		}				
	}	
	if (trg0==4 && now>timer1)
	{
		c = GetChar("灵魂亡灵");
		if (c >= 0)
		{
			Perform(c, "say", "哼哼..快不行了吧...");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			
			trg0 = 5;
			timer1 = now + 50;
		}				
	}		
	if (trg0==5 && now>timer1)
	{
		c = GetChar("灵魂亡灵");
		if (c >= 0)
		{

                        Perform(c, "use", 8);
                        Perform(c, "use", 3);
                        Perform(c, "use", 4);
			Perform(c, "say", "你这家伙。..说什么也的杀死你。");			
			Perform(c, "aggress");
			Perform(c, "faceto", player);
			
			trg0 = 2;
			timer1 = now + 50;
		}				
	}

	if (trg3 == 0)
	{
		c = GetChar("灵魂亡灵");
		if (c>=0 && GetHP(c)<30000)
		{
			Perform(c, "attack");
			Perform(c, "faceto", player);
			Perform(c, "say", "蒙面亡灵！出来干掉他...");
			Perform(c, "pause", 3);
			Perform(c, "say", "你这家伙，！竟然伤的了我。看我怎么收拾你。");
			Perform(c, "faceto", player);
					
			trg3 = 1;
			timer0 = now + 6;
		}	
	}
	if (trg3==1 && now>timer0)
	{
		AddNPC("大决1");
		AddNPC("大决2");
		AddNPC("大决3");
		AddNPC("大决4");
		AddNPC("大决5");
		AddNPC("大决6");
		
		trg3 = 2;
	}


if (trg4==0 && trg3==2)
	{
		c2 = GetAnyChar("蒙面灵魂1");
		if (c2>=0 && GetHP(c2)<=0)
		{
			reborn = c2;
			rebornName = "大决1";
			trg4 = 1;
			timer4 = now + 1;
		}
		c3 = GetAnyChar("蒙面灵魂2");
		if (c3>=0 && GetHP(c3)<=0)
		{
			reborn = c3;
			rebornName = "大决2";
			trg4 = 1;
			timer4 = now + 1;
		}
		c4 = GetAnyChar("蒙面灵魂3");
		if (c4>=0 && GetHP(c4)<=0)
		{
			reborn = c4;
			rebornName = "大决3";
			trg4 = 1;
			timer4 = now + 1;
		}
		c5 = GetAnyChar("蒙面灵魂4");
		if (c5>=0 && GetHP(c5)<=0)
		{
			reborn = c5;
			rebornName = "大决4";
			trg4 = 1;
			timer4 = now + 1;
		}
		c6 = GetAnyChar("蒙面灵魂5");
		if (c6>=0 && GetHP(c6)<=0)
		{
			reborn = c6;
			rebornName = "大决5";
			trg4 = 1;
			timer4 = now + 1;
		}
		c7 = GetAnyChar("蒙面灵魂6");
		if (c7>=0 && GetHP(c7)<=0)
		{
			reborn = c7;
			rebornName = "大决6";
			trg4 = 1;
			timer4 = now + 1;
		}
	}				
	if (trg4==1 && now>timer4)
	{
		RemoveNPC(reborn);
		timer4 = now + 1;
		trg4 = 2;
	}
	if (trg4==2 && now>timer4)
	{
		AddNPC(rebornName);
		trg4 = 0;
	}


if (trg5 == 0 && now>timer1)
	{
		c = GetChar("蒙面灵魂1");
		c1 = GetChar("蒙面灵魂2");
		c3 = GetChar("蒙面灵魂3");
		c4 = GetChar("蒙面灵魂4");
		c5 = GetChar("蒙面灵魂5");
		c6 = GetChar("蒙面灵魂6");
		if (c>=0 && c1>0 && c3>0 && c4>0 && c5>0 && c6>0 && c7>0 )
		{

			ChangeBehavior(c, "follow", player);
			Perform(c, "faceto", player);	
                        Perform(c, "use", 5);
                        Perform(c, "use", 19);
			ChangeBehavior(c1, "follow", player);
                        Perform(c1, "use", 19);
                        Perform(c1, "use", 5);
			ChangeBehavior(c3, "follow", player);
                        Perform(c3, "use", 19);
                        Perform(c3, "use", 5);
			ChangeBehavior(c4, "follow", player);
                        Perform(c4, "use", 19);
                        Perform(c4, "use", 5);
			ChangeBehavior(c5, "follow", player);
                        Perform(c5, "use", 5);
                        Perform(c5, "use", 19);
			ChangeBehavior(c6, "follow", player);
                        Perform(c6, "use", 5);
                        Perform(c6, "use", 19);

		        trg5 = 1;
			timer1 = now + 10;

	    }

       }

	if (trg5 == 1 && now>timer1)
	{
		c = GetChar("蒙面灵魂1");
		c1 = GetChar("蒙面灵魂2");
		c3 = GetChar("蒙面灵魂3");
		c4 = GetChar("蒙面灵魂4");
		c5 = GetChar("蒙面灵魂5");
		c6 = GetChar("蒙面灵魂6");
		if (c>=0 && c1>0 && c3>0 && c4>0 && c5>0 && c6>0 && c7>0 )
		{

			ChangeBehavior(c, "follow", player);
			Perform(c, "faceto", player);	
                        Perform(c, "use", 19);
                        Perform(c, "use", 5);
			ChangeBehavior(c1, "follow", player);
                        Perform(c1, "use", 5);
                        Perform(c1, "use", 19);
			ChangeBehavior(c3, "follow", player);
                        Perform(c3, "use", 5);
                        Perform(c3, "use", 19);
			ChangeBehavior(c4, "follow", player);
                        Perform(c4, "use", 5);
                        Perform(c4, "use", 19);
			ChangeBehavior(c5, "follow", player);
                        Perform(c5, "use", 19);
                        Perform(c5, "use", 5);
			ChangeBehavior(c6, "follow", player);
                        Perform(c6, "use", 19);
                        Perform(c6, "use", 5);
		        trg5 = 0;
			timer1 = now + 10;

	           }

             }


      if (trg6 == 0)
	{
		c = GetAnyChar("灵魂亡灵");
		if (c>=0 && GetHP(c)<28000)
		{		
                        Perform(c, "use", 8);
                        Perform(c, "use", 3);
                        Perform(c, "use", 4);
                        Perform(c, "use", 15);
                        Perform(c, "use", 15);
			Perform(c, "say", "你这家伙..。真是过分呢！！");
			trg6 = 1;
		}

       } 
      if (trg6 == 1)
	{
		c = GetAnyChar("灵魂亡灵");
		if (c>=0 && GetHP(c)<25000)
		{		
                        Perform(c, "use", 8);
                        Perform(c, "use", 3);
                        Perform(c, "use", 4);
			Perform(c, "say", "好小子你真行阿！");
			trg6 = 2;
		}

       } 
      if (trg6 == 2)
	{
		c = GetAnyChar("灵魂亡灵");
		if (c>=0 && GetHP(c)<20000)
		{		

			Perform(c, "say", "好家伙..怪不得杀死我这么多手下，不过想杀我还早着呢。");

			PlayerPerform("use", 5);
			PlayerPerform("use", 41);
			PlayerPerform("use", 34);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			trg6 = 3;
		}

       } 
      if (trg6 == 3)
	{
		c = GetAnyChar("灵魂亡灵");
		if (c>=0 && GetHP(c)<15000)
		{			

                        Perform(c, "use", 15);
                        Perform(c, "use", 15);
                        Perform(c, "use", 15);
                        Perform(c, "use", 15);
			Perform(c, "say", "不可能的.我不可能会败给你这家伙。");

			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 20);
			trg6 = 4;
		}

       } 
      if (trg6 == 4)
	{
		c = GetAnyChar("灵魂亡灵");
		if (c>=0 && GetHP(c)<5000)
		{			
                        Perform(c, "use", 15);
                        Perform(c, "use", 15);
                        Perform(c, "use", 15);
                        Perform(c, "use", 15);
			Perform(c, "say", "今天你别想活着出去。。。也别想在做高官了。");

			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 15);
			PlayerPerform("use", 20);
			trg6 = 5;
		}

       } 
      if (trg6 == 5)
	{
		c = GetAnyChar("灵魂亡灵");
		if (c>=0 && GetHP(c)<2000)
		{			
                        Perform(c, "use", 15);
                        Perform(c, "use", 15);
			Perform(c, "say", "小子真厉害....看来真是低估你了。。");
			trg6 = 6;
		}

       } 

	if (trg6 == 6)
	{
		c = GetAnyChar("灵魂亡灵");
		if (GetHP(c) <= 0)
		{
			Say(c, "没想到....！！这一切...真的是无法想象的...真的很佩服你，游戏，，，结-----束.....了");

			PlayerPerform("block", 0);
			PlayerPerform("say", "如果还想玩..联系方式（QQ765739946）");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "如果还想玩..联系方式（QQ765739946）");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "如果还想玩..联系方式（QQ765739946）");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "谢谢大家玩我的任务。希望你们玩的快乐。，玩的愉快...");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "请大家期待着我的下个作品吧。..兵兵永远陪在你的身边..");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "所以我也要编写一下。.真武林真刀快剑的打斗..");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "下一个版本会很精彩。。...本人玩了一下真武林发现里面的剧情不错。");
			PlayerPerform("pause", 1);
			PlayerPerform("say", "好了.这一切结束了，下一个版本不在按着这个剧情写了");
			PlayerPerform("pause", 2);
			PlayerPerform("block", 1);

			trg6 = 7;
		        timer0 = now + 12; 
		}
	}

	if (trg6==7 && now>timer0)
	{

		gameover = 1;

			trg6 = 8;

                }



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

}
