//  闯入皇宫
int Rule = 1;
int RoundTime = 450;
int PlayerSpawn = 72;
int PlayerSpawnDir = 80;
int PlayerWeapon = 6;
int PlayerWeapon2 = 0;
int PlayerHP = 8000;

int trg0;
int trg1;

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 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 w;
int wu;
int g;
int go;
int bl;


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

GetNPCChar() 
{
   c1=GetChar("五毒镖客1");
   c2=GetChar("五毒镖客2");
   c3=GetChar("五毒镖客3");
   c4=GetChar("五毒镖客4");
   c5=GetChar("五毒镖客5");
   c6=GetChar("五毒镖客6");
   c7=GetChar("五毒镖客7");
   c8=GetChar("五毒镖客8");
   ca1=GetAnyChar("五毒镖客1");
   ca2=GetAnyChar("五毒镖客2");
   ca3=GetAnyChar("五毒镖客3");
   ca4=GetAnyChar("五毒镖客4");
   ca5=GetAnyChar("五毒镖客5");
   ca6=GetAnyChar("五毒镖客6");
   ca7=GetAnyChar("五毒镖客7");
   ca8=GetAnyChar("五毒镖客8");

   e1=GetChar("暗影1");
   e2=GetChar("暗影2");
   e3=GetChar("暗影3");
   e4=GetChar("暗影4");
   e5=GetChar("暗影5");
   e6=GetChar("暗影6");
   e7=GetChar("暗影7");
   e8=GetChar("暗影8");
   ea1=GetAnyChar("暗影1");
   ea2=GetAnyChar("暗影2");
   ea3=GetAnyChar("暗影3");
   ea4=GetAnyChar("暗影4");
   ea5=GetAnyChar("暗影5");
   ea6=GetAnyChar("暗影6");
   ea7=GetAnyChar("暗影7");
   ea8=GetAnyChar("暗影8");
   w=GetChar("暗影蒙面");
   wu=GetAnyChar("暗影蒙面");
   g=GetChar("公主");
   go=GetAnyChar("公主");
}

AlwaysDo()
{
now = GetGameTime();

if (GetHP(player)<=0) 
{ 
GameOver(-1); 
}} 

scene1()
{
if (trg0==0 && c1>=0 && GetDistance(player,c1)<=300 )
{ 
ChangeBehavior(c1, "kill", player);
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);
Perform(c2, "pause", 18);
Perform(c3, "pause", 18);
Perform(c4, "pause", 18);
Perform(c5, "pause", 18);
Perform(c6, "pause", 18);
Perform(c7, "pause", 18);
Perform(c8, "pause", 18);
PlayerPerform("block", 0);
PlayerPerform("say","那我就先收拾收拾你们这些小人。");  // 时刻:16
PlayerPerform("pause",4);
Perform(c1,"say","想见我们主子，先杀死我们。。即使我们死在你的手下，你也休想伤害我们主子半根毫毛。");  // 时刻:14
Perform(c1,"pause",4);
PlayerPerform("say","哼。...乖乖的让他出来受死。");  // 时刻:12
PlayerPerform("pause",4);
Perform(c1,"say","好大的胆子。");  // 时刻:10
Perform(c1,"pause",4);
PlayerPerform("say","我既然来到这里，也没打算活着出去。不过在我死之前，你主子也要死。");  // 时刻:8
PlayerPerform("pause",4);
Perform(c1,"say","好你个家伙，竟敢说我们主子是内奸，哼。。不过你算说对了！但是你说这句话把你的命也搭上了。");  // 时刻:6
Perform(c1,"pause",4);
PlayerPerform("say","高手如云阿？这里的煞气很大，我要小心应付，恩，我是来找你们皇宫的内奸，本人伊人君。");  // 时刻:4
PlayerPerform("pause",4);
Perform(c1,"say","你是谁。竟敢闯入皇宫！想死。");  // 时刻:2
Perform(c1,"pause",2);
PlayerPerform("say","哈哈。终于到这里了，看来皇宫内奸必在这里。");  // 时刻:0
PlayerPerform("block", 1);
trg0++;}
if (trg0==1 && c1<0 && c2<0 && c3<0  && c4<0 && c5<0 && c6<0 && c7<0 && c8<0 )  
{ 

PlayerPerform("say","哈哈..让你们不知好歹。。"); 
   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("3关镖客1");
	AddNPC("3关镖客2");
	AddNPC("3关镖客3");
	AddNPC("3关镖客4");
	AddNPC("3关镖客5");
	AddNPC("3关镖客6");
	AddNPC("3关镖客7");
	AddNPC("3关镖客8");trg0++;}


if (trg0==3 && c1>=0)
{
ChangeBehavior(c1, "kill", player);
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);
Perform(c2, "pause", 8);
Perform(c3, "pause", 8);
Perform(c4, "pause", 8);
Perform(c5, "pause", 8);
Perform(c6, "pause", 8);
Perform(c7, "pause", 8);
Perform(c8, "pause", 8);
PlayerPerform("block", 0);
Perform(c1,"say","好。哼哼！！"); 
Perform(c1,"pause",4);
PlayerPerform("say","受死的是你们吧，我看看你们有多少人。"); 
PlayerPerform("pause",3);
Perform(c1,"say","哼！。你不会活着走出去的，乖乖受死吧。"); 
Perform(c1,"pause",2);
PlayerPerform("say","有没有搞错？。");
PlayerPerform("block", 1);trg0++;}


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

PlayerPerform("say","还有多少人呀。这皇宫内果然戒备森严。"); 
   RemoveNPC(ca1);   RemoveNPC(ca2);
   RemoveNPC(ca3);   RemoveNPC(ca4);
   RemoveNPC(ca5);   RemoveNPC(ca6);
   RemoveNPC(ca7);   RemoveNPC(ca8);trg0++;timer0 = now + 5;}


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


if (trg0==6 && e1>=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(e2, "pause", 18);
Perform(e3, "pause", 18);
Perform(e4, "pause", 18);
Perform(e5, "pause", 18);
Perform(e6, "pause", 18);
Perform(e7, "pause", 18);
Perform(e8, "pause", 18);
PlayerPerform("block", 0);
PlayerPerform("say","今天我就把这里不知的小人全杀了。。让你们小看我！！");  // 时刻:16
PlayerPerform("pause",4);
Perform(e1,"say","不是我们想报复，是想报复的不只是我们，你死期到了，拿命来吧。。");  // 时刻:14
Perform(e1,"pause",4);
PlayerPerform("say","哼。...那又怎样，你们还想报复？");  // 时刻:12
PlayerPerform("pause",4);
Perform(e1,"say","谁死谁活现在还不知道呢。伊人君，你虽是杀手，但你也有顶不住的一天。");  // 时刻:10
Perform(e1,"pause",4);
PlayerPerform("say","是你们自己找死的，不要怪我。");  // 时刻:8
PlayerPerform("pause",4);
Perform(e1,"say","哼。我们也不是怕死的小人，想行刺公主，门都没有。，。");  // 时刻:6
Perform(e1,"pause",4);
PlayerPerform("say","我伊人君启是怕死之人。怕死还敢来这里吗/");  // 时刻:4
PlayerPerform("pause",4);
Perform(e1,"say","这句话好象应该是我们给你说吧，。");  // 时刻:2
Perform(e1,"pause",2);
PlayerPerform("say","你们是谁。不想死的滚开。。");  // 时刻:0
PlayerPerform("block", 1);
trg0++;}


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

PlayerPerform("say","这是你们自找的。吗的！！"); 
   RemoveNPC(ea1);   RemoveNPC(ea2);
   RemoveNPC(ea3);   RemoveNPC(ea4);
   RemoveNPC(ea5);   RemoveNPC(ea6);
   RemoveNPC(ea7);   RemoveNPC(ea8);trg0++;timer0 = now + 5;}



if (trg0 == 8 && now>timer0)
{
	AddNPC("3关");trg0++;}


if (trg0==9 && w>=0 && GetDistance(player,w)<=300 )
{ 
ChangeBehavior(w, "kill", player);
PlayerPerform("block", 0);
PlayerPerform("use", 41);
PlayerPerform("use", 15);
PlayerPerform("use", 15);
PlayerPerform("use", 34);
Perform(w,"say","小子真是猖狂！。那我就来领教你。。");  // 时刻:20
Perform(w,"pause",5);
PlayerPerform("say","我来的目的就是杀人！拿命来。");  // 时刻:16
PlayerPerform("pause",4);
Perform(w,"say","本误闯皇宫就该杀，况且你又杀我皇宫这么多人，你说如何。。");  // 时刻:14
Perform(w,"pause",4);
PlayerPerform("say","哼。..是又怎么样，你耐我如何。。");  // 时刻:12
PlayerPerform("pause",4);
Perform(w,"say","听说过你的大名。不过没听说你这么猖狂。。");  // 时刻:10
Perform(w,"pause",4);
PlayerPerform("say","看你比他们强一点，不过一看你不是我的对手。。");  // 时刻:8
PlayerPerform("pause",4);
Perform(w,"say","蛤，你以为我像他们那样不可取？。");  // 时刻:6
Perform(w,"pause",4);
PlayerPerform("say","你怎么能跟我比。你哪里能有我强。");  // 时刻:4
PlayerPerform("pause",4);
Perform(w,"say","无名杀手，跟你是同一个职位。。");  // 时刻:2
Perform(w,"pause",2);
PlayerPerform("say","你应该有个位置吧。。");  // 时刻:0
PlayerPerform("block", 1);
trg0++;timer0 = now + 20;}


if (trg0 == 10 && now>timer0)
{
	AddNPC("3关公主");trg0++;}



if (trg0==11 && w>=0 && g>=0)
{ 
ChangeBehavior(w, "kill", player);
ChangeBehavior(g, "kill", player);
Perform(w,"use",19);
Perform(g,"use",34);
Perform(g,"use",19);
Perform(g,"use",40);
PlayerPerform("block", 0);
Perform(w,"say","是！属下遵命。");   // 时间 12
Perform(w,"pause",6);
PlayerPerform("say","放马过来吧！！。");  // 时间 11
PlayerPerform("pause",3);
Perform(g,"say","哼。那还楞着干什么！杀！"); // 时间 10
Perform(g,"pause",6);
PlayerPerform("say","原来如此。怪不得老大让我来杀内奸，原来跟孙老头他们是有关系的。");  // 时间 8
PlayerPerform("pause",5);
Perform(w,"say","就是他。。他是伊人君..之前的孙堂主。以及孙堂主的儿子都是败在他的手下。");  // 时间 6
Perform(w,"pause",4);
Perform(w,"crouch", 1);
Perofrm(w, "faceto", g);
Perform(g,"say","我听镖客报告，说有人想杀我爹。并且在宫中大闹，我出来看看是谁。");   // 时间 4
Perform(g,"pause",4);
Perofrm(g, "faceto", w);
PlayerPerform("say","（犹豫思量）他是公主？");  // 时间 3
PlayerPerform("pause",3);
Perform(w,"say","公主。小子参见公主！！");   // 时间 2
Perform(w,"pause",2);
Perofrm(w, "faceto", g);
Perform(w,"crouch", 1);
PlayerPerform("say","这位妞是？...呵呵，您贵姓阿？");  // 时刻:0
PlayerPerform("block", 1);
trg0++;}
if (trg0==12 && g>=0 && GetHP(g)<1000 ){
Perform(g, "say", "你厉害，不过这件事不会就这么算了的，你等着吧！！ ");
PlayerPerform("block", 1);
trg0++;timer0 = now + 5;}
if (trg0 == 13 && now>timer0)
{
GameOver(1); trg0++;}}
OnStart()
{   
	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");
	now = GetGameTime();
	if (player < 0)
	{
		return 0;
	}

    GetNPCChar() ; 

	AlwaysDo();

	scene1();
}