// 圆满楼

//  第3关
int Rule = 1;
int RoundTime = 900;
int PlayerSpawn = 0;
int PlayerSpawnDir = 90;
int PlayerWeapon = 52;
int PlayerWeapon2 =50;
int PlayerHP = 8000;


int trg0; 
int shi0; 
int trg1;

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

int c1;   
int c1shi;    
int ca1;      
int c2;      
int ca2;  
int c2shi;   
int c3;   
int ca3; 
int c4;
int ca4;
int c5;   
int ca5; 
int c6;   
int ca6; 
int j1; int j2; int j3; int j4; 
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("夺命枪-1");
   ca3=GetAnyChar("夺命枪-1");

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

   c5=GetChar("血刀-1");
   ca5=GetAnyChar("血刀-1");

   c6=GetChar("血刀-2");
   ca6=GetAnyChar("血刀-2");

}
bingxunhuan(){
if (c1shi+50<=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);}

if (j4+50<=GetGameTime()) {
j4 = GetGameTime();	
PlayerPerform("use", 4);
PlayerPerform("use", 41);
PlayerPerform("use", 5);}

if (c2shi+50<=GetGameTime()) {
c2shi = GetGameTime();	
Perform(c2,"use",40);
Perform(c2,"use",41);
Perform(c2,"use",5);
Perform(c2,"use",3);	
Perform(c2,"use",4);
Perform(c2,"use",34);}}

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


ChangeBehavior(c1,"kill",player);
PlayerPerform("block",0);	
Perform(c1,"use",19);
Perform(c1,"say"," 很好！！ 看招！...");  // 时刻:20
Perform(c1,"pause",8);
PlayerPerform("say","  没有你想象的那么的软弱！我不一定会输！. ");  // 时刻:16
PlayerPerform("pause",6);
Perform(c1,"say"," 因为你的力量还跟兵兵差的远呢！.");  // 时刻:12
Perform(c1,"pause",6);
PlayerPerform("say","  为什么判断我会输！..！. ");  // 时刻:10
PlayerPerform("pause",6);
Perform(c1,"say"," 意思就是最后兵兵要看看的厉害！但是你一定是输！.");  // 时刻:6
Perform(c1,"pause",4);
PlayerPerform("say","  最后是怎样/..我理解能力很苯，说明白点！. ");  // 时刻:4
PlayerPerform("pause",4);
Perform(c1,"say","  知道你的厉害！要不说我不能低估你！毕竟你闯过去兵兵制作的（10）部任务。所以最后就是这样..");  // 时刻:2
Perform(c1,"pause",2);
PlayerPerform("say"," 我来了！告诉你，我虽然不是你的对手，不过我也不是怕死之人！.." );  // 时刻:0
Perform(c1,"faceto",player);
PlayerPerform("block",1);
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)) {
GameOver(-1);}

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

SetTarget(0, "waypoint", 390);
ChangeBehavior(c2, "attacktarget", 0);
Perform(c1,"use",15);
Perform(c1,"use",15);
Perform(c1,"use",15);
Perform(c1,"use",20);
PlayerPerform("use", 15);
Perform(c1,"say","  你去在给我喊两个人过来！哼！..还真是邪门了！....");  // 时刻:2
Perform(c1,"faceto",player);

trg0++;}

if (trg0==2 && GetManPlaceDistance(c2,390)<50) {

AddNPC("3关3");AddNPC("3关5");
AddNPC("3关4");AddNPC("3关6");

trg0++;}

if (trg0==3 && c3>=0  && c4>=0  && c5>=0  && c6>=0  && c2>=0 ) {

ChangeBehavior(c2,"kill",player);
ChangeBehavior(c3,"kill",player);
ChangeBehavior(c4,"kill",player);
ChangeBehavior(c5,"kill",player);
ChangeBehavior(c6,"kill",player);
Perform(c2,"use",15);
Perform(c2,"use",15);
Perform(c2,"use",20);	
Perform(c2,"use",20);
Perform(c3,"use",34);
Perform(c4,"use",34);
Perform(c5,"use",34);	
Perform(c6,"use",34);
Perform(c3,"use",5);
Perform(c4,"use",5);	
Perform(c5,"use",5);
Perform(c6,"use",5);
trg0++;j2=1;}

if (j2==1 && now>timer0){
Perform(c3,"use",34);
Perform(c4,"use",34);
Perform(c5,"use",34);	
Perform(c6,"use",34);
Perform(c3,"use",5);
Perform(c4,"use",5);	
Perform(c5,"use",5);
Perform(c6,"use",5);
j2=1;timer0 = now + 30;}

if (trg0==1 && GetHP(c1)<GetMaxHP(c1)/2 && j1==0)  {
PlayerPerform("block",0);
Perform(c1,"use",15);
Perform(c1,"use",15);
Perform(c1,"use",30);	
Perform(c1, "aggress");
PlayerPerform("use", 16);
PlayerPerform("use", 16);
Perform(c1,"say","  好！那我就快速解决你！.");  // 时刻:6
Perform(c1,"pause",6);
PlayerPerform("say","  呵呵！你以为我出力勒？... ");  // 时刻:4
PlayerPerform("pause",4);
Perform(c1,"say","  哼  废物一个！我还没有出力！竟然都这么窝囊！...");  // 时刻:2
Perform(c1,"faceto",player);
PlayerPerform("block",1);
j1=1;}

if (c1>=0 && GetHP(c1)<3000 && j1==1) {

ChangeBehavior(c1,"kill",player);
ChangeBehavior(c2,"kill",player);
PlayerPerform("block",0);
PlayerPerform("say","  看来你也没什么本事！... "); 
PlayerPerform("pause",2);
Perform(c1,"say","  只痛笑ZJ  ☆ 来了！.你先看着点！不行的话你在冲动！.....");  // 时刻:2
Perform(c1,"faceto",player);
Perform(c1,"use",15);
Perform(c1,"use",15);
PlayerPerform("block",1);
AddNPC("3关2");j1=2;}}

scene2(){

if (trg0==4 && c1>=0 && GetHP(c1)<1000 && trg1==0) {

Perform(c1,"pause",20);
Perform(c2,"pause",20);
Perform(c3,"pause",20);
Perform(c4,"pause",20);
Perform(c5,"pause",20);
Perform(c6,"pause",20);
Perform(c3,"say"," 是！！.");  // 时刻:5
Perform(c3,"pause",5);
Perform(c2,"say"," 也好！ 我们走..！.");  // 时刻:2
Perform(c2,"pause",2);
Perform(c1,"say","  这小子有一套！我们走！.！看看有什么法子没有！现在暂且先放过他！.....");  // 时刻:2
Perform(c1,"faceto",player);
trg1++;timer1 = now + 8;}

if (c1<0 && trg1==1) {GameOver(-1);}

if (trg1==1 && now>timer1){
RemoveNPC(ca1);
RemoveNPC(ca2);
RemoveNPC(ca3);
RemoveNPC(ca4);
RemoveNPC(ca5);
RemoveNPC(ca6);
trg1++;timer1 = now + 2;}

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

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