//  大战英雄豪杰
int Rule = 1;
int RoundTime = 600;
int PlayerSpawn = 104;
int PlayerSpawnDir = 180;
int PlayerWeapon = 15;
int PlayerWeapon2 = 6;
int PlayerHP = 18000;

int trg0;
int trg1;
int trg2;
int trg3;
int trg4;
int tiao0;
int tiao1;
int tiao2;
int tiao3;
int tiao4;
int sj0;
int sj1;
int sj2;
int sj3;
int cc1;
int cc2;
int cc3;
int cc4;
int cc5;
int cc6;
int cc7;
int cc8;
int cc9;
int cc10;
int cc11;
int cc12;
int cc13;
int cc14;
int cc15;
int cc16;
int now = 0;
int gameover = 0;
int timer0 = 0;
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 c8;
int ca8;
int c9;            
int ca9;      
int c10;      
int ca10;   
int c11;   
int ca11; 
int c12;
int ca12;
int c13;
int ca13;
int c14;
int ca14;
int c15; 
int ca15;
int c16;
int ca16;

int e1; 
int ea1;      
int e2;      
int ea2;   
int e3;   
int ea3; 
int e4;
int ea4;
int e5;
int ea5;
int e6;
int ea6;
int e7;
int ea7;
int e8;
int ea8;

int g;
int ga;
int g1;
int ga1;
int g2;
int ga2;
int g3;
int ga3;

GetDistance(int k1,int k2)
{
   SetTarget(0, "char", k1);
   SetTarget(1, "char", k2);
   return Distance(0,1);
}


GetNPCChar() 
{
   c1=GetChar("胡斐");
   c2=GetChar("东方不败");
   c3=GetChar("武当掌门");
   c4=GetChar("少林高僧");
   c5=GetChar("灭绝师太");
   c6=GetChar("逍遥侯");
   c7=GetChar("崆铜洞主");
   c8=GetChar("布衣大侠");
   c9=GetChar("扬逍");
   c10=GetChar("张无忌");
   c11=GetChar("周止若");
   c12=GetChar("昆仑掌门");
   c13=GetChar("恶灌满盈");
   c14=GetChar("一刀");
   c15=GetChar("无双");
   c16=GetChar("海棠");

   ca1=GetAnyChar("胡斐");
   ca2=GetAnyChar("东方不败");
   ca3=GetAnyChar("武当掌门");
   ca4=GetAnyChar("少林高僧");
   ca5=GetAnyChar("灭绝师太");
   ca6=GetAnyChar("逍遥侯");
   ca7=GetAnyChar("崆铜洞主");
   ca8=GetAnyChar("布衣大侠");
   ca9=GetAnyChar("扬逍");
   ca10=GetAnyChar("张无忌");
   ca11=GetAnyChar("周止若");
   ca12=GetAnyChar("昆仑掌门");
   ca13=GetAnyChar("恶灌满盈");
   ca14=GetAnyChar("一刀");
   ca15=GetAnyChar("无双");
   ca16=GetAnyChar("海棠");

   e1=GetChar("皇宫内奸");
   e2=GetChar("皇宫侍卫1");
   e3=GetChar("皇宫侍卫2");
   e4=GetChar("皇宫侍卫3");
   e5=GetChar("皇宫侍卫4");
   e6=GetChar("皇宫侍卫5");
   e7=GetChar("卫兵1");
   e8=GetChar("卫兵2");
   ea1=GetAnyChar("皇宫内奸");
   ea2=GetAnyChar("皇宫侍卫1");
   ea3=GetAnyChar("皇宫侍卫2");
   ea4=GetAnyChar("皇宫侍卫3");
   ea5=GetAnyChar("皇宫侍卫4");
   ea6=GetAnyChar("皇宫侍卫5");
   ea7=GetAnyChar("卫兵1");
   ea8=GetAnyChar("卫兵2");

   g=GetChar("公主");
   g1=GetChar("上官金洪");
   g2=GetChar("洛阳堂主");
   g3=GetChar("耶律总官");
   ga=GetChar("公主");
   ga1=GetChar("上官金洪");
   ga2=GetChar("洛阳堂主");
   ga3=GetChar("耶律总官");

} 

AlwaysDo()
{
        now = GetGameTime();

	    if (GetHP(player)>=0 && sj0<now) 
		{
		   sj0=sj0+30;		
		PlayerPerform("use", 41);
		PlayerPerform("use", 40);
		PlayerPerform("use", 19);
		PlayerPerform("use", 5);
		} 
if (GetHP(player)<=0) 
{ 
GameOver(-1); 
}} 


suiji(int man)
{

        ChangeBehavior(man, "kill", player);
	Perform(man, "pause", 5);
Perform(man,"use",34);
Perform(man,"use",4);
Perform(man,"use",19);
	Perform(man, "say", "那就拿命吧！.");
	Perform(man, "pause", 2);
	Perform(man, "faceto", 1);

	PlayerPerform("block", 0);
	PlayerPerform("pause", 2);
	PlayerPerform("say", "阿！惭愧！");
	PlayerPerform("pause", 5);
	PlayerPerform("say", "想不到我小小的晚辈竟招惹了重多武林人事！");
	PlayerPerform("block", 1);

}
scene1()
{
if (GetEnemy(c1) == player && cc1 == 0)
{
suiji(c1);
cc1 = 1;}

if (GetEnemy(c2) == player && cc2 == 0)
{
suiji(c2);
cc2 = 1;}
if (GetEnemy(c3) == player && cc3 == 0)
{
suiji(c3);
cc3 = 1;}
if (GetEnemy(c4) == player && cc4 == 0)
{
suiji(c4);
cc4 = 1;}

if (GetEnemy(c5) == player && cc5 == 0)
{
suiji(c5);
cc5 = 1;}

if (GetEnemy(c6) == player && cc6 == 0)
{
suiji(c6);
cc6 = 1;}

if (GetEnemy(c7) == player && cc7 == 0)
{
suiji(c7);
cc7 = 1;}

if (GetEnemy(c8) == player && cc8 == 0)
{
suiji(c8);
cc8 = 1;}

if (GetEnemy(c9) == player && cc9 == 0)
{
suiji(c9);
cc9 = 1;}

if (GetEnemy(c10) == player && cc10 == 0)
{
suiji(c10);
cc10 = 1;}

if (GetEnemy(c11) == player && cc11 == 0)
{
suiji(c11);
cc11 = 1;}

if (GetEnemy(c12) == player && cc12 == 0)
{
suiji(c12);
cc12 = 1;}

if (GetEnemy(c13) == player && cc13 == 0)
{
suiji(c13);
cc13 = 1;}
if (GetEnemy(c14) == player && cc14 == 0)
{
suiji(c14);
cc14 = 1;}

if (GetEnemy(c15) == player && cc15 == 0)
{
suiji(c15);
cc15 = 1;}

if (GetEnemy(c16) == player && cc16 == 0)
{
suiji(c16);
cc16 = 1;}

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

	PlayerPerform("say", "一转眼竟被蒙蔽！");
	PlayerPerform("say", "看来难免要跟各位英雄一战了！！");
        Perform(c1, "say", "速速上来受死！");
	PlayerPerform("block", 1);trg0++;}



if (trg0==1 && c1<0 && c2<0 && c3<0  && c4<0 && c5<0 && c6<0 && c7<0 && c8<0 ) 
{ 

   PlayerPerform("use", 16);
   PlayerPerform("use", 16);
	PlayerPerform("block", 0);
	PlayerPerform("say", "今天真是大开眼界！！");
	PlayerPerform("block", 1);
   RemoveNPC(ca1);   RemoveNPC(ca2);
   RemoveNPC(ca3);   RemoveNPC(ca4);
   RemoveNPC(ca5);   RemoveNPC(ca6);
   RemoveNPC(ca7);   RemoveNPC(ca8);trg0++;timer0 = now + 5;}


if (trg0 == 2 && now>timer0)
{
	AddNPC("6关9");
	AddNPC("6关10");
	AddNPC("6关11");
	AddNPC("6关12");
	AddNPC("6关13");
	AddNPC("6关14");
	AddNPC("6关15");
	AddNPC("6关16");trg0++;}

if (trg0==3 &&  c9>=0 && c10>=0 && c11>=0  &&  c12>=0 && c13>=0 && c14>=0 &&  c15>=0 && c16>=0)
{ 
Perform(c9, "guard", 3);
Perform(c9, "say", "点子很强！");
Perform(c9, "faceto", player);trg0++;}

if (trg0==4 && c9<0 && c10<0 && c11<0  && c12<0 && c13<0 && c14<0 && c15<0 && c16<0 ) 
{ 

   PlayerPerform("use", 16);
   PlayerPerform("use", 16);
	PlayerPerform("block", 0);
	PlayerPerform("say", "今天就算一死！也不能让奸人得逞！");
	PlayerPerform("block", 1);
   RemoveNPC(ca9);   RemoveNPC(ca13);
   RemoveNPC(ca10);   RemoveNPC(ca14);
   RemoveNPC(ca11);   RemoveNPC(ca15);
   RemoveNPC(ca12);   RemoveNPC(ca16);trg0++;timer0 = now + 5;}

if (trg0 == 5 && now>timer0)
{
	AddNPC("6关人1");
	AddNPC("6关人2");
	AddNPC("6关人3");
	AddNPC("6关人4");
	AddNPC("6关人5");
	AddNPC("6关人6");
	AddNPC("6关人7");
	AddNPC("6关人8");trg0++;}


if (tiao0==0 && e1>=0 && e2>=0 &&  e3>=0 &&  e4>=0 &&  e5>=0 &&  e6>=0 &&  e7>=0 &&  e8>=0 && GetDistance(player,e1)<=300 )
{ 

ChangeBehavior(e1, "kill", player);
ChangeBehavior(e2, "kill", player);
ChangeBehavior(e3, "kill", player);
ChangeBehavior(e4, "kill", player);
ChangeBehavior(e5, "kill", player);
ChangeBehavior(e6, "kill", player);
ChangeBehavior(e7, "kill", player);
ChangeBehavior(e8, "kill", player);
Perform(e1,"use",34);
Perform(e1,"use",40);
Perform(e1,"use",19);
Perform(e2, "pause", 20);
Perform(e3, "pause", 20);
Perform(e4, "pause", 20);
Perform(e5, "pause", 20);
Perform(e6, "pause", 20);
Perform(e7, "pause", 20);
Perform(e8, "pause", 20);
Perform(e1, "pause", 3);
PlayerPerform("block", 0);
PlayerPerform("say","来吧！！。"); // 时间= 18
PlayerPerform("pause",3);
Perform(e1,"say","好家伙！看谁死在这里！一起上！"); // 时间= 17
Perform(e1,"pause",6);
PlayerPerform("say","我杀的是你们。不是江湖的英雄！今天你跑不掉了。"); // 时间= 15
PlayerPerform("pause",5);
Perform(e1,"say","妈的。那今天你老爷来收拾你这家伙！看你有多猖狂！"); // 时间= 11
Perform(e1,"pause",3);
PlayerPerform("say","废话！我岂是怕死之人，他们闯荡江湖多年，连这点破绽都看不出来，还怎么混阿。煞笔。"); // 时间= 10
PlayerPerform("pause",3);
Perform(e1,"say","哦？。他们怎么会知道被利用，难道是你说的不成，不敢跟他们打，就说出真相！哼，小人。"); // 时间= 8
Perform(e1,"pause",2);
PlayerPerform("say","不管怎么说。他们的武功远胜于我！只不过他们能够看出来，他们已经被利用！"); // 时间= 7 
PlayerPerform("pause",2);
Perform(e1,"say","大胆的家伙！什么破英雄！原来只是传闻而已，连你这个家伙也对付不了。"); // 时间= 6
Perform(e1,"pause",2);
PlayerPerform("say","我没有吓你，也没有骗你！老天注定我命不该死，该死的是你们。");  
PlayerPerform("pause",3);
Perform(e1,"say","哈哈！！江湖上的人打不过你？你吓我阿。我好怕阿！！"); // 时间= 4
Perform(e1,"pause",4);
PlayerPerform("say","很简单，其实每个人都怕死的，他们打不过我，自然就跑了！");  
PlayerPerform("pause",2);
Perform(e1,"say","好家伙！竟没有死！你又什么方法解脱的！"); 
PlayerPerform("block", 1);
tiao0++;}

if (tiao0==1 && e1<0 && e2<0 && e3<0  && e4<0 && e5<0 && e6<0 && e7<0 && e8<0 ) 
{ 

   PlayerPerform("use", 16);
   PlayerPerform("use", 16);
   Say(e1, "呜﹒﹒﹒想不到﹒﹒﹒﹒﹒﹒");
   RemoveNPC(ea1);   RemoveNPC(ea2);
   RemoveNPC(ea3);   RemoveNPC(ea4);
   RemoveNPC(ea5);   RemoveNPC(ea6);
   RemoveNPC(ea7);   RemoveNPC(ea8);tiao0++;timer0 = now + 5;}

if (tiao0==2 && now>timer0)
{
	AddNPC("6关人9");
	AddNPC("6关人10");
	AddNPC("6关人11");
	AddNPC("6关人12");tiao0++;}



if (tiao0==3 && g>=0 && GetDistance(player,g)<=300 )
{ 
ChangeBehavior(g, "kill", player);
ChangeBehavior(g1, "kill", player);
ChangeBehavior(g2, "kill", player);
ChangeBehavior(g3, "kill", player);

PlayerPerform("block", 0);
Perform(g, "use",19);
Perform(g1,"use",19);
Perform(g2,"use",19);
Perform(g3,"use",19);
Perform(g, "use",40);
Perform(g1,"use",40);
Perform(g2,"use",40);
Perform(g3,"use",40);
Perform(g, "use",34);
Perform(g,"use",4);
Perform(g,"use",3);
Perform(g,"use",30);
Perform(g2,"pause",21);
Perform(g3,"pause",21);
Perform(g,"pause",2);
PlayerPerform("say"," 报仇也只是在死一次！"); // 时间= 21
PlayerPerform("pause",3);
Perform(g1,"say",".小子！我们来报仇了！受死吧.. ."); // 时间= 20
Perform(g1,"pause",20);
Perform(g,"say",". 哼！！受死吧！！ ."); // 时间= 19
Perform(g,"pause",2);
PlayerPerform("say"," 那你也要死了，  来吧！"); // 时间= 18
PlayerPerform("pause",3);
Perform(g,"say","杀我手下数人！我岂能饶你..."); // 时间= 17
Perform(g,"pause",6);
PlayerPerform("say","料想你们来这里是有目的的。。"); // 时间= 15
PlayerPerform("pause",5);
Perform(g,"say","好好！你尽管查！不过先把这比帐算算吧！！"); // 时间= 11
Perform(g,"pause",3);
PlayerPerform("say","没有奸细。我蛋疼阿。拼着命来这里！还差点被江湖人误会！"); // 时间= 10
PlayerPerform("pause",3);
Perform(g,"say","皇宫没有你说的奸细。你马上给我滚，我不追究！"); // 时间= 8
Perform(g,"pause",2);
PlayerPerform("say","不是给你说了吗！杀   奸细！！！"); // 时间= 7 
PlayerPerform("pause",2);
Perform(g,"say","你要去哪里？干什么去？"); // 时间= 6
Perform(g,"pause",2);
PlayerPerform("say","我没工夫跟你耍嘴皮，我要做的事情还多着呢！。如果不想死的话，请让开。");  
PlayerPerform("pause",3);
Perform(g,"say","哈哈！果真是条好狗阿！ 说穿了就是一条狗。 "); // 时间= 4
Perform(g,"pause",4);
PlayerPerform("say","对不起！这是命令！也是任务。，我的任务就是杀人..");  
PlayerPerform("pause",2);
Perform(g,"say","你这小子！真的是把我给惹急了！竟杀我宫中数人！你你..."); 
PlayerPerform("block", 1);
tiao0++;}

if (tiao0==4 && g1<0 && g2<0 && g3<0  && g<0) 
{
 GameOver(1);tiao0++;}} 

OnStart()
{   
	AddNPC("6关1");
	AddNPC("6关2");
	AddNPC("6关3");
	AddNPC("6关4");
	AddNPC("6关5");
	AddNPC("6关6");
	AddNPC("6关7");
	AddNPC("6关8");
}

OnUpdate()
{	
	player = GetAnyChar("player");
	now = GetGameTime();
	if (player < 0)
	{
		return 0;
	}

    GetNPCChar() ; 

	AlwaysDo();

	scene1();
scene2();
scene3();
}
