// 五爪峰 //第2关
int Rule = 1;
int RoundTime = 80;
int PlayerSpawn = 14;
int PlayerSpawnDir = 180;
int PlayerWeapon = 17;
int PlayerWeapon2 = 16;
int PlayerHP = 6000;

int trg0; 
int shi0; 
int trg1;
int trg2;

int now;  
int player;
int timer0;  
int gameover;

int c1;   
int c1shi;    
int ca1;      
int c2;      
int ca2;   
int c3;   
int ca3; 
int c4;
int ca4;
int c6;   
int ca6; 
int c7;
int ca7;  // NPC代码
int j1; int j2; 
int d0; int d1; int d2; int d3;
GetDistance(int k1,int k2)
{
   SetTarget(0, "char", k1);
   SetTarget(1, "char", k2);
   return Distance(0,1);
}

GetManPlaceDistance(int man,int place)
{
   SetTarget(0, "char", man);
   SetTarget(1, "waypoint", place);
   return Distance(0,1);
}
GetNPCChar() {
   c1=GetChar("2o10年、兵兵");
   ca1=GetAnyChar("2o10年、兵兵");

   c2=GetChar("只痛笑ZJ  ☆");
   ca2=GetAnyChar("只痛笑ZJ  ☆");

   c3=GetChar("大刀侍卫");
   ca3=GetAnyChar("大刀侍卫");

   c4=GetChar("夺命枪");
   ca4=GetAnyChar("夺命枪");

   c6=GetChar("剑");
   ca6=GetAnyChar("剑");

   c7=GetChar("刺");
   ca7=GetAnyChar("刺");

}

diannao(){
if (c1shi+150<=GetGameTime()) {
c1shi = GetGameTime();	
Perform(c1,"use",40);
Perform(c1,"use",41);
Perform(c1,"use",5);
Perform(c1,"use",3);	
Perform(c1,"use",4);
Perform(c1,"use",34);}}

scene1(){
if (trg0 == 0 &&  c2>=0 && GetDistance(player,c2)<=200 ){

ChangeBehavior(c2,"kill",player);
Perform(c2,"use",19);
Perform(c2,"use",34);
Perform(c2,"use",4);
Perform(c2,"use",40);
Perform(c2,"use",41);
Perform(c2,"use",3);	
Perform(c2, "aggress");
PlayerPerform("block",0);	
Perform(c2,"say","   哼！废物！. 看看我的厉害吧！....");  // 时刻:14
Perform(c2,"pause",4);
PlayerPerform("say","  真的不是怎么懂阿！... ");  // 时刻:12
PlayerPerform("pause",4);
Perform(c2,"say","   意思就是打败一直支持你的人！以自己为王！...");  // 时刻:10
Perform(c2,"pause",4);
PlayerPerform("say","  什么意思！.说明白可以么. ");  // 时刻:8
PlayerPerform("pause",4);
Perform(c2,"say","   很好！既然尊重.就接下这个任务！如果你过了，那就证明你真的很强！.");  // 时刻:6
Perform(c2,"pause",4);
PlayerPerform("say","  这话说的不对啊！我很尊重兵兵的.. ");  // 时刻:4
PlayerPerform("pause",4);
Perform(c2,"say","  你不是很厉害吗？看看你究竟有多厉害...貌似你连兵兵也不害怕！.");  // 时刻:2
Perform(c2,"pause",2);
PlayerPerform("say"," 能不能告诉我！你怎么会以我为敌人..你不是兵兵的助理么？.." );  // 时刻:0
Perform(c2,"faceto",player);
PlayerPerform("block",1);
trg0++;shi0=GetGameTime();}


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

if (trg0==1 && GetHP(c2)<GetMaxHP(c2)/2 && j1==0)  {
PlayerPerform("block",0);
Perform(c2,"use",15);
Perform(c2,"use",15);
Perform(c2,"use",34);	
Perform(c2, "aggress");
PlayerPerform("use", 16);
PlayerPerform("use", 16);
Perform(c2,"say","   已经很明白了！  还用问吗.");  // 时刻:6
Perform(c2,"pause",6);
PlayerPerform("say","  事情怎么会变成这样！你究竟想怎样.. ");  // 时刻:4
PlayerPerform("pause",4);
Perform(c2,"say","  很好！！  不过你不是我的对手...");  // 时刻:2
Perform(c2,"faceto",player);
PlayerPerform("block",1);
j1=1;}

if (c2>=0 && GetHP(c2)<1000 && j1==1) {


SetTarget(0, "waypoint", 19);
ChangeBehavior(c2, "attacktarget", 0);
Perform(c2,"use",5);
Perform(c2,"use",41);	
PlayerPerform("block",0);
PlayerPerform("say","  阿！搞什么鬼！.... "); 
PlayerPerform("pause",2);
Perform(c2,"say","  不错  看来真的是小看你了！跟我来！.....");  // 时刻:2
Perform(c2,"faceto",player);
PlayerPerform("block",1);j1=2;}

if (c2<0 && j1==2) {GameOver(-1);}

if (j1==2 && GetManPlaceDistance(c2,19)<50) {
Perform(c2,"pause",60);
PlayerPerform("say"," 到底发生了什么事情！.... "); 
PlayerPerform("pause",4);
Perform(c2,"say","  后面的！哼！........");  // 时刻:2
Perform(c2,"faceto",player);
Perform(c2,"say","  伊人君！你好自为之吧！你的困难还多着呢！这只是一个简单的考验！.....");  // 时刻:2
Perform(c2,"faceto",player);
j1=3;timer0 = now + 5;}
if (j1==3 && now>timer0){
AddNPC("2关1");
AddNPC("2关2");
AddNPC("2关6");
AddNPC("2关7");
PlayerPerform("use", 16);
PlayerPerform("use", 16);
PlayerPerform("say","  到底是什么事情！不行，我一定要查明清楚！应该先找到兵兵问问事情！..... "); 
RemoveNPC(ca2);j1++;}

if (GetHP(player)<GetMaxHP(player)/5 && j2==0)  {

Perform(c2,"pause",60);
PlayerPerform("pause",2);
PlayerPerform("use",35);
PlayerPerform("pause",2);
PlayerPerform("say","  不  在给我一次机会！我会回来的！.... "); 
PlayerPerform("pause",2);
Perform(c2,"say","  废物！就你怎么给我斗！...  真是太高估你了！1..");  // 时刻:2
Perform(c2,"faceto",player);
j2=1;}}

scene2(){
if (trg1 == 0 &&  c3>=0 && c4>=0 && c6>=0 && c7>=0){

ChangeBehavior(c7, "patrol", 1, 97, 78,  15, 14, 51, 23);
ChangeBehavior(c6, "patrol", 1, 97, 78,  15, 14, 51, 23);
Perform(c6,"pause",2);
Perform(c4,"pause",6);
Perform(c3,"pause",10);
Perform(c7,"say","   别说了.  看看那小子吧！别几八在让他跑掉了，今天一定要把仇报了！...");  // 时刻:4
Perform(c7,"pause",10);
Perform(c6,"say","   汗！就算死也要让他痛苦一点！难免我们有这样的机会·....");  // 时刻:4
Perform(c6,"pause",8);
Perform(c4,"say","   难免有我们报仇的机会，这次我们不会在失败了，因为我们的幕后人是这小子的！阿。哈哈....");  // 时刻:4
Perform(c4,"pause",4);
PlayerPerform("say"," 什么人！这是，貌似很有权利·.... ");  // 2
PlayerPerform("pause",2);
Perform(c3,"say","  哼哼！是我们收拾你的时候了！他也真是厉害！.....");
Perform(c3,"pause",2);
trg1++;}

if (trg1 == 1 && c1>=0 && GetDistance(player,c1)<=200 ){

PlayerPerform("block",0);
PlayerPerform("say","  但是我伊人君不是怕死之人！即使不是兵兵的对手，我也要斗一斗，我马上就去！.. ");  // 40
PlayerPerform("pause",2);
PlayerPerform("say","  我答应你！去圆满楼跟你一决高下！。 看来非这么做不可的了！ ");  // 38
PlayerPerform("pause",2);
PlayerPerform("say","  听你说了这么多！貌似是非听你的不可了！看来这就是命！注定会是这样。逃也是没用的。 ");  // 36
PlayerPerform("pause",30);
Perform(c1,"say","   乖乖的在那受死吧！看看你到底有多厉害！（10）部任务都难不到你吗？哼！我还真是不信了...");  // 时刻:32
Perform(c1,"pause",2);
Perform(c1,"say","   因为你永远不是兵兵的对手！我在圆满楼等你...");  // 时刻:30
Perform(c1,"pause",2);
Perform(c1,"say","   哼  ！ 我也不能太低估你！反正你想见到兵兵都是很不容易的！不过你绝对会败！你也一定要败...");  // 时刻:28
Perform(c1,"pause",2);
Perform(c1,"say","   我在圆满楼等着你！看看你是不是我的对手！如果连我都打不过的话，我想你是杀不死兵兵的！...");  // 时刻:26
Perform(c1,"pause",2);
Perform(c1,"say","   你要知道！ 兵兵的手下也不是好杀的！哼！好自为之吧！...");  // 时刻:24
Perform(c1,"pause",2);
Perform(c1,"say","   现在你必须先看看他手下的厉害！恐怕你是见不到兵兵的！...");  // 时刻:22
Perform(c1,"pause",2);
Perform(c1,"say","   你此次的任务！ 哼..  我看你还是先闯入兵兵的阵营在跟兵兵交手吧！...");  // 时刻:20
Perform(c1,"pause",2);
Perform(c1,"say","   我知道你现在很想见到兵兵！但是现在还不是见他的时候·因为你现在还没有资格！...");  // 时刻:18
Perform(c1,"pause",2);
Perform(c1,"say","   我在这里要告诉你！ 不要想的太天真！你现在的本领根本不是兵兵的对手！.");  // 时刻:16
Perform(c1,"pause",2);
Perform(c1,"say","   兵兵的武功是你想不到的，你不要以为兵兵帮过你，你也见识到了他的本事！.");  // 时刻:14
Perform(c1,"pause",2);
Perform(c1,"say","   但是我要告诉你！！ 此次可不像往常一样！. 你要知道，没有人知道兵兵的力量有多大.");  // 时刻:12
Perform(c1,"pause",2);
Perform(c1,"say","   如果你打败兵兵了！那真是证明了你的技术跟力量！证明你真的很强！....");  // 时刻:10
Perform(c1,"say","   哈哈！这就证明了你的存在！这是兵兵对你最后的一次考验！与兵兵为敌！看你究竟如何！..");  // 时刻:9
Perform(c1,"pause",5);
PlayerPerform("say","   为什么会这样对我！兵兵不是一直都是很支持我的吗，怎么会杀害我？为什么· ");  // 6
PlayerPerform("pause",4);
Perform(c1,"say","   我是兵兵的替身而已！此次来是专门要你的性命！....");  // 时刻:4
Perform(c1,"pause",4);
PlayerPerform("say","   怎么没有见过你！你是谁？... ");  // 2
PlayerPerform("pause",2);
Perform(c1,"say","  是不是感觉很模糊试的！呵呵！你的感觉一点没错，不错，就是我要杀你！.....");
Perform(c1,"faceto",player);
PlayerPerform("block",1);
trg1++;shi0=GetGameTime();timer0 = now + 45;}

if (trg1==2 && c1>=0 && GetHP(c1)<GetMaxHP(c1) && shi0+50>GetGameTime()) {
GameOver(-1);}

if (trg1==2 && now>timer0){GameOver(1);}

if (d0==0 &&  c6>=0 && GetDistance(player,c6)<=200 ){

ChangeBehavior(c6,"kill",player);
ChangeBehavior(c7,"kill",player);
PlayerPerform("say","  不行！一定要查明事情原因到底是怎么回事.... "); 
PlayerPerform("pause",2);
Perform(c6,"say","  哼..  总算看到你了！..受死吧！.. ");  // 时刻:2
Perform(c6,"faceto",player);

d0=1;}

if (d0==0 &&  c7>=0 && GetDistance(player,c7)<=200 ){

ChangeBehavior(c6,"kill",player);
ChangeBehavior(c7,"kill",player);
PlayerPerform("say","  不行！一定要查明事情原因到底是怎么回事.... "); 
PlayerPerform("pause",2);
Perform(c7,"say","  哼..  总算看到你了！..受死吧！.. ");  // 时刻:2
Perform(c7,"faceto",player);

d0=1;}

if (d0==1 && c3<0 && c4<0 && c6<0  && c7<0) { 

AddNPC("2关4");
RemoveNPC(ca3);
RemoveNPC(ca4);
RemoveNPC(ca6);
RemoveNPC(ca7);
PlayerPerform("say","  兵兵吗？真的会是他吗？！！为什么！..... "); 
d0=2;}

if (d1==0 &&  c3>=0 && GetDistance(player,c3)<=200 ){

ChangeBehavior(c3,"kill",player);
ChangeBehavior(c4,"kill",player);
ChangeBehavior(c6,"kill",player);
ChangeBehavior(c7,"kill",player);
Perform(c4,"use",34);
Perform(c3,"use",40);
Perform(c4,"use",34);
Perform(c3,"use",40);
Perform(c3, "aggress");
Perform(c4, "aggress");
PlayerPerform("say","  难道是兵兵要杀我吗/他为什么会这么做呢！为什么！.... "); 
PlayerPerform("pause",2);
Perform(c3,"say","  这次我们不会失败的！因为支持我们的人是你崇拜的！.... ");  // 时刻:2
Perform(c3,"faceto",player);

d1=1;}

if (d1==0 &&  c4>=0 && GetDistance(player,c4)<=200 ){

ChangeBehavior(c3,"kill",player);
ChangeBehavior(c4,"kill",player);
ChangeBehavior(c6,"kill",player);
ChangeBehavior(c7,"kill",player);
Perform(c4,"use",34);
Perform(c3,"use",40);
Perform(c4,"use",34);
Perform(c3,"use",40);
Perform(c3, "aggress");
Perform(c4, "aggress");
PlayerPerform("say","  难道是兵兵要杀我吗/他为什么会这么做呢！为什么！.... "); 
PlayerPerform("pause",2);
Perform(c4,"say","  这次我们不会失败的！因为支持我们的人是你崇拜的！.... ");  // 时刻:2
Perform(c4,"faceto",player);

d1=1;}}

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