// 1金华城接受任务; 

int Rule = 1;
int RoundTime = 300;
int PlayerSpawn = 0;
int PlayerSpawnDir = 0;
int PlayerWeapon = 17;
int PlayerWeapon2 =48;
int PlayerHP = 5000;

int trg0; 
int shi0; // 时间

int now; 
int player;   // 玩家
int timer0;  //时间计算
int timer1; 
int gameover; // 胜负

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 j1; int j2; int j3; 
GetDistance(int k1,int k2)
{
   SetTarget(0, "char", k1);
   SetTarget(1, "char", k2);
   return Distance(0,1);
}

GetNPCChar() {
   c1=GetChar("兵兵");
   ca1=GetAnyChar("兵兵");
   c2=GetChar("晶晶");
   ca2=GetAnyChar("晶晶");
   c3=GetChar("暗月-1");
   ca3=GetAnyChar("暗月-1");
   c4=GetChar("暗月-2");
   ca4=GetAnyChar("暗月-2");
   c5=GetChar("暗月组织");
   ca5=GetAnyChar("暗月组织");

   c6=GetChar("伊人梦");
   ca6=GetAnyChar("伊人梦");
   c7=GetChar("凤凤");
   ca7=GetAnyChar("凤凤");
   c8=GetChar("高老大");
   ca8=GetAnyChar("高老大");
}

scene1(){
if (trg0==0  && c1>=0 && GetDistance(player,c1)<=100 ){ 

ChangeBehavior(c1,"kill",player);
ChangeBehavior(c2,"kill",player);
Perform(c1,"use",41);Perform(c1,"use",40);
Perform(c2,"use",34);Perform(c2,"use",40);
Perform(c2,"use",41);Perform(c1,"use",34);
PlayerPerform("block",0);
Perform(c1,"pause",2);
Perform(c2,"say","  恩！上. ");  // 时刻:20
Perform(c2,"pause",8);
Perform(c1,"say","  看招了！看看你有没有资格接受任务！. ");  // 时刻:18
Perform(c1,"pause",4);
PlayerPerform("say"," 呵呵.. 我也想在次领教你们两个幸福的GG与MM！. 来吧！  ");  // 时刻:16
Perform(c2, "faceto", player);
Perform(c1, "faceto", player);
PlayerPerform("pause",8);
Perform(c1,"say","   也好！先考验一下他也是应该的！.. ");  // 时刻:14
Perform(c1, "faceto", c2);
Perform(c1,"pause",4);
Perform(c2,"say"," 呵呵！既然这是你安排的组织，一定有难度，先考验一下他吧！  ");  // 时刻:12 
Perform(c2, "faceto", c1);
Perform(c2,"pause",12);
Perform(c1,"say"," 是吗？！要不要在来一次阿！ ");  // 时刻:10
Perform(c1,"pause",4);
PlayerPerform("say"," 呵呵.. 不敢，要不是你让着我们，我怎么是你的对手！.  ");  // 时刻:8
PlayerPerform("pause",3);
Perform(c1,"say"," 不过我相信你是可以的！ 连我都战胜了！此任务应该难不到你！ ");  // 时刻:6
Perform(c1,"pause",2);
PlayerPerform("say","  哦！看来此次的任务不简单阿！.. ");  // 时刻:5
PlayerPerform("pause",3);
Perform(c1,"say","  刺杀（暗月）但是这是一个强大的杀手集团！");  // 时刻:4
Perform(c1,"pause",4);
PlayerPerform("say","  当然要接受了。 什么任务.. ");  // 时刻:2
PlayerPerform("pause",2);
Perform(c1,"say","  安排一个任务，接受不接受..");  // 时刻:0
PlayerPerform("block",1);
Perform(c2, "faceto", player);
Perform(c1, "faceto", player);
trg0++;shi0=GetGameTime();}

if (trg0==1 && c1>=0 && GetHP(c1)<GetMaxHP(c1) && shi0+20>GetGameTime()) {
GameOver(-1);}
if (trg0==1 && c2>=0 && GetHP(c2)<GetMaxHP(c2) && shi0+20>GetGameTime()) {
GameOver(-1);}

if (trg0==1 && GetHP(c1)<1000 && j1==0) {

Perform(c1,"pause",40);
Perform(c2,"pause",40);
PlayerPerform("say","  绝对给你完成任务！ ");  // 时刻:2
PlayerPerform("pause",2);
Perform(c1,"say","  好！此任务交给你，失败的话，你就的死！."); 
j1=1;timer0 = now + 5;}

if (now>timer0 && j1==1) {
//
RemoveNPC(ca1);
RemoveNPC(ca2);
AddNPC("1关3");
AddNPC("1关4");
AddNPC("1关");
//
j1=2;}

if (trg0==1 && c5>=0 && GetDistance(player,c5)<=100 ){ 

ChangeBehavior(c5,"kill",player);
ChangeBehavior(c3,"kill",player);
ChangeBehavior(c4,"kill",player);
PlayerPerform("block",0);
Perform(c5,"use",7);Perform(c5,"use",34);
Perform(c3,"use",34);
Perform(c4,"use",34);
PlayerPerform("use", 16);
PlayerPerform("use", 16);
PlayerPerform("say","  暗月组织..强大的杀手集团！好家伙.. ");  // 时刻:2
PlayerPerform("pause",2);
Perform(c5,"say","  杀死他！..  ");  // 时刻:0
PlayerPerform("block",1);
trg0++;timer1 = now + 25;}

if (now>timer1 && trg0==2) {
//
PlayerPerform("say","  果然是厉害的家伙！. ");  // 时刻:2
PlayerPerform("pause",2);//
Perform(c5,"say","  绝对不能让他跑掉了！.  "); 
trg0++;timer1 = now + 50;}

if (now>timer1 && trg0==3) {
Perform(c3,"use",15);
Perform(c4,"use",15);
PlayerPerform("say","  哈哈！我也有帮手了！老大来了.. ");  // 时刻:2
PlayerPerform("pause",2);
Perform(c5,"say","  怎么这么没用！杀杀杀杀.  "); 
AddNPC("1关5");
AddNPC("1关6");
AddNPC("1关7");
trg0++;}

if (trg0==4 && c6>=0 && c7>=0 && c8>=0){

ChangeBehavior(c3, "follow", c5);
ChangeBehavior(c4, "follow", c5);
ChangeBehavior(c6, "follow", c5);
ChangeBehavior(c7, "follow", c5);
ChangeBehavior(c8, "follow", c5);
Perform(c5,"use",15);
Perform(c5,"use",15);
Perform(c5,"use",20);
Perform(c5,"use",34);
Perform(c5,"say","  哈哈！想见我们的身手.. 恐怕你还不够资格！  ");  // 时刻:4
Perform(c5,"pause",4);
Perform(c6,"say","  暗月是吧！听见兵兵的命令，我们来看看你们的组织.. ");  // 时刻:2
Perform(c6,"pause",2);
trg0++;}

if (trg0==5 && c3<0 && c4<0 && c5<0){

Perform(c6,"say","  你要小心应付. 顶不住就回快活林求助.我们先回去了  ");  // 时刻:2
Perform(c6,"pause",2);
Perform(c6,"say","  看来暗月的组织果然强大！特别有杀气.. ");  // 时刻:2
Perform(c6, "faceto", player);
Perform(c7, "faceto", player);
Perform(c8, "faceto", player);
trg0++;timer1 = now + 5;}

if (now>timer1 && trg0==6) {GameOver(1);}}

ziji(){
if (GetHP(player)<=0) 
{ GameOver(-1);}}
OnStart(){
AddNPC("1关1");
AddNPC("1关2");}
OnUpdate()
{	
	player = GetAnyChar("player");
	if (player < 0){return 0;}
        now = GetGameTime();
        GetNPCChar() ; 
        diannao() ; 
	ziji();
	scene1();
}

