//  大战美女宫
int Rule = 1;
int RoundTime = 450;
int PlayerSpawn = 0;
int PlayerSpawnDir = 80;
int PlayerWeapon = 15;
int PlayerWeapon2 = 24;
int PlayerHP = 12000;

int trg0;
int trg1;
int trg2;
int tiao0;
int tiao1;
int tiao2;
int j1;
int j2;
int j3;
int now;
int sj;
int gameover;
int timer0;
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;

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("贴身护卫1");
   c7=GetChar("贴身护卫2");
   c8=GetChar("公主");
   ca1=GetAnyChar("皇宫护卫1");
   ca2=GetAnyChar("皇宫护卫2");
   ca3=GetAnyChar("皇宫护卫3");
   ca4=GetAnyChar("皇宫护卫4");
   ca5=GetAnyChar("皇宫护卫5");
   ca6=GetAnyChar("贴身护卫1");
   ca7=GetAnyChar("贴身护卫2");
   ca8=GetAnyChar("公主");

   e1=GetChar("女蒙面1");
   e2=GetChar("女蒙面2");
   e3=GetChar("女蒙面3");
   e5=GetChar("大厅护法1");
   e6=GetChar("大厅护法2");
   e7=GetChar("大厅护法3");
   e8=GetChar("大厅护法4");
   ea1=GetAnyChar("女蒙面1");
   ea2=GetAnyChar("女蒙面2");
   ea3=GetAnyChar("女蒙面3");
   ea5=GetAnyChar("大厅护法1");
   ea6=GetAnyChar("大厅护法2");
   ea7=GetAnyChar("大厅护法3");
   ea8=GetAnyChar("大厅护法4");
}
AlwaysDo()
{now = GetGameTime();if (GetHP(player)>=0 && sj<now) {
sj=sj+20;		
PlayerPerform("use", 41);
PlayerPerform("use", 34);
PlayerPerform("use", 5);
PlayerPerform("use", 19);} 
if (GetHP(player)<=0) 
{GameOver(-1);}} 
scene1(){
if (trg0==0 ){ 
PlayerPerform("block", 0);
PlayerPerform("say","行动吧！。  （可谋） ");  // 时刻:19
PlayerPerform("pause",2);
PlayerPerform("block", 1);
PlayerPerform("say","你 听好了。是解决，不是杀了她！否则后过自付！");  // 时刻:17
PlayerPerform("pause",2);
PlayerPerform("block", 1);
PlayerPerform("say","好了。找不到皇上，就把他的女儿先解决！");  // 时刻:15
PlayerPerform("pause",2);
PlayerPerform("block", 1);
PlayerPerform("say","此次的任务决不能失败！我要是杀了这家伙，老大肯定更看中我！蛤！");  // 时刻:13
PlayerPerform("pause",2);
PlayerPerform("block", 1);
PlayerPerform("say","想收拾他也不是说做到就做到的。汗！！我不想那么多了！");  // 时刻:11
PlayerPerform("pause",2);
PlayerPerform("block", 1);
PlayerPerform("say","现在先收拾她。免的碍我的大事！不过这宫中界备森严！");  // 时刻:9
PlayerPerform("pause",2);
PlayerPerform("block", 1);
PlayerPerform("say","反正对付他父皇公主肯定也会动手！前面已经给她交过手了。。");  // 时刻:7
PlayerPerform("pause",2);
PlayerPerform("block", 1);
PlayerPerform("say","哼！。这里是公主的地方！我就先收拾他的女儿，哈哈，这个想法太好了。");  // 时刻:5
PlayerPerform("pause",2);
PlayerPerform("block", 1);
PlayerPerform("say","你们太卑鄙了。我也要卑鄙一点，否则不会成功的，这宫中的人太多了。");  // 时刻:3
PlayerPerform("pause",1);
PlayerPerform("block", 1);
PlayerPerform("say","皇宫的人还真是狡猾。利用这种方法来收拾我！哼");  // 时刻:2
PlayerPerform("pause",2);
PlayerPerform("block", 1);
PlayerPerform("say","哈哈。总算把江湖的英雄摆平了。现在该办正经事了，这次耽误的我时间不少了。"); 
PlayerPerform("block", 1);
trg0++;timer0 = now + 25;}
if (trg0 == 1 && now>timer0){
PlayerPerform("say","哦！目标出现了！行动B计划！"); 
AddNPC("8关1");AddNPC("8关5");
AddNPC("8关2");AddNPC("8关6");
AddNPC("8关3");AddNPC("8关7");
AddNPC("8关4");AddNPC("8关");trg0++;}

if (j1==0 && c1>=0 && GetDistance(player,c1)<=200 ){ 
ChangeBehavior(c1, "kill", player);
ChangeBehavior(c2, "kill", player);
Perform(c1, "aggress");
Perform(c2, "aggress");
Perform(c1,"say","你你你。是谁..  竟敢闯如公主的地方。找死！");
Perform(c1, "faceto", player);
Perform(c2, "faceto", player);j1++;}

if (j2==0 && c3>=0 && GetDistance(player,c3)<=200 ){ 
ChangeBehavior(c3, "kill", player);
ChangeBehavior(c4, "kill", player);
Perform(c3, "aggress");
Perform(c4, "aggress");
Perform(c3,"say","竟敢闯如公主的地方。找死！");
Perform(c3, "faceto", player);
Perform(c4, "faceto", player);j2++;}

if (j3==0 && c5>=0 && GetDistance(player,c5)<=200 ){ 
ChangeBehavior(c1, "kill", player);
ChangeBehavior(c2, "kill", player);
ChangeBehavior(c3, "kill", player);
ChangeBehavior(c4, "kill", player);
ChangeBehavior(c5, "kill", player);
Perform(c5, "aggress");
PlayerPerform("say","就凭你们。自作孽阿！哼"); 
PlayerPerform("pause",2);
Perform(c5,"say","都过来！决不能让他靠近宫中半步！");
Perform(c5, "faceto", player);j3++;}

if (j3==1 && c1>=0 && GetHP(c1)<2500){ 
ChangeBehavior(c2, "follow", c8);
ChangeBehavior(c3, "follow", c8);
ChangeBehavior(c4, "follow", c8);
ChangeBehavior(c5, "follow", c8);
PlayerPerform("say","你这么想死就帮帮你！"); 
PlayerPerform("pause",3);
Perform(c1, "say", "你休想动公主半根毫毛！！拿命！");
Perform(c1, "pause", 3);
PlayerPerform("say","公主在！哈哈..我去找他！"); 
PlayerPerform("pause",2);
Perform(c1,"say","快去掩护公主！不要管我！快去阿！");
Perform(c1, "faceto", c2);j3++;}

if (trg0==2 && c8>=0 && GetDistance(player,c8)<=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", 20);
Perform(c3, "pause", 20);
Perform(c4, "pause", 20);
Perform(c5, "pause", 20);
Perform(c1, "pause", 20);
PlayerPerform("block", 0);
Perform(c8,"use",34);
Perform(c8,"use",19);
Perform(c8,"use",4);
Perform(c8,"use",30);
Perform(c8, "aggress");
Perform(c7,"say","淫贼！ ");  // 时刻:18
Perform(c7,"pause",20);
Perform(c6,"pause",2);
Perform(c6,"say","淫贼。不知道羞耻  想玩是吗。有本事就来玩.. ");  // 时刻:18
Perform(c6,"pause",18);
PlayerPerform("say","是我玩死你才对，因为我是男人！哈哈！");  // 时刻:16
PlayerPerform("pause",4);
Perform(c8,"pause",6);
Perform(c8,"say","淫贼。 老娘今天玩死你。 ");  // 时刻:14
Perform(c8,"pause",4);
PlayerPerform("say","是啊是啊。。我充满了博力！你们一起玩！");  // 时刻:12
PlayerPerform("pause",4);
Perform(c8,"say","听见了吗？你们还不玩他，这么好的男人，不玩可惜阿！");  // 时刻:10
Perform(c8,"pause",4);
PlayerPerform("say","（惊讶）有这好事..那你们一起来吧。。");  // 时刻:8
PlayerPerform("pause",4);
Perform(c8,"say","玩玩..好阿，本公主让你玩，不过在玩我之前，先让我的小子们解解渴..一起玩玩你。");  // 时刻:6
Perform(c8,"pause",4);
PlayerPerform("say","哈哈。泡你就不敢说了，想玩玩你，应该这么说！");  // 时刻:4
PlayerPerform("pause",4);
Perform(c8,"say","你不怕伊人梦打你啊，怎么，我没去找你。来找我干什么，想泡我阿！你想的美！");  // 时刻:2
Perform(c8,"pause",2);
PlayerPerform("say","哈哈，总算找到你了。小闺女，找的你好苦阿！上次我并不是有意伤害你，我心疼阿！");  // 时刻:0
PlayerPerform("block", 1);
trg0++;}

if (j1==1 && c1<0 && c2<0 && c3<0  && c4<0 && c5<0){ 
PlayerPerform("block", 0);
PlayerPerform("say","别着急吗！着急玩不出兴趣");
PlayerPerform("pause",3);
Perform(c8, "aggress");
Perform(c8,"say","可恶！！今天杀不死你，我就不做这个公主！");
Perform(c8,"pause",2);
PlayerPerform("say","哈哈，玩了5个了。剩下的我要慢慢玩！");
PlayerPerform("block", 1);
   RemoveNPC(ca1);   RemoveNPC(ca2);
   RemoveNPC(ca3);   RemoveNPC(ca4);
   RemoveNPC(ca5);   j1++;timer0 = now + 10;}  

if (j1==2 && now>timer0){
Perform(c8,"use",34);
Perform(c8,"use",40);
Perform(c8,"use",15);
Perform(c8,"use",15);
PlayerPerform("say","那是当然的！");
PlayerPerform("pause",3);
Perform(c8, "aggress");
Perform(c8,"say","哈哈！玩吧，又来了4个！有本事你接着玩阿！");
	AddNPC("8关12");
	AddNPC("8关13");
	AddNPC("8关14");
	AddNPC("8关15");j1++;}

if (j1==3 && c8>=0 &&  e5>=0 && e6>=0 && e7>=0 && e8>=0){

ChangeBehavior(e5, "kill", player);
ChangeBehavior(e6, "kill", player);
ChangeBehavior(e7, "kill", player);
ChangeBehavior(e8, "kill", player);
Perform(e5,"say","是！！");
Perform(e5,"pause",2);
Perform(c8,"say","快过来杀了他！");
j1++;}

if (j2==1 && c6<0 && c7<0){ 

   RemoveNPC(ca6); 
   RemoveNPC(ca7);
j2++;timer0 = now + 3;}
if (j2==2 && now>timer0){

	AddNPC("8关8");
	AddNPC("8关9");
	AddNPC("8关10");
j2++;}

if (j2==3 && e1>=0 && e2>=0 && e3>=0){
ChangeBehavior(e1, "kill", player);
ChangeBehavior(e2, "kill", player);
ChangeBehavior(e3, "kill", player);
j2++;}

if (tiao0==0 && c8>=0 && GetHP(c8)<8000 ){
Perform(c8, "aggress");
Perform(c8, "say", "哼！就你这么没力气..怎么玩！ ");
PlayerPerform("block", 1);
tiao0++;}

if (tiao0==1 && c8>=0 && GetHP(c8)<6000 ){
Perform(c8, "aggress");
Perform(c8, "say", "有两下阿 ");
PlayerPerform("block", 1);
tiao0++;}

if (tiao0==2 && c8>=0 && GetHP(c8)<4000 ){
Perform(c8,"use",34);
Perform(c8,"use",40);
Perform(c8,"use",15);
Perform(c8,"use",15);
Perform(c8, "aggress");
Perform(c8, "say", "你！！ ");
PlayerPerform("block", 1);
tiao0++;}
if (tiao0==3 && c8>=0 && GetHP(c8)<1000 ){
Perform(c8, "aggress");
Perform(c8,"say","我要把这件事告诉父皇。你欺负我！不会有好结果的，你等着吧！");
Perform(c8,"pause",4);
PlayerPerform("say","嘿嘿.不行了吧！"); 
PlayerPerform("pause",2);
Perform(c8, "say", "可恶！气死了！ ");
PlayerPerform("block", 1);
tiao0++;timer0 = now + 5;}
if (tiao0==4 && now>timer0){
GameOver(1); tiao0++;}}


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

    GetNPCChar() ; 

	AlwaysDo();

	scene1();
}

