调度中心控制台 机场控制台游戏( 八 )


for(int i=1;i<=EmptyBlock;i++)
TP(NewX-6,NewY-8+FullBlock+i,fgray+bblack,\'O\');
}
}
if(x-7>=WINDOWC)
isExist=0;
}
/*Only one boss so we don\'t have to make the function out*/
void MovePrint{
int t=clock;
if(LastMoveTime>=t-(1000-MoveSpeed))
return;
LastMoveTime=t;
/*Change the direction*/
if(rand%10==0)
dy=ConstNewDy[rand()%3];
int NewX=x+dx,NewY=y+dy;
if(UFOCrash(NewX,NewY)||NewY-7<0||NewY+7>=WINDOWW)
for(int i=0;i<3;i++){
dy=ConstNewDy[rand()%3];
NewX=x+dx,NewY=y+dy;
if(!(UFOCrash(NewX,NewY)||NewY-7<0||NewY+7>=WINDOWW))
break;
}
if(UFOCrash(NewX,NewY)||NewY-7<0||NewY+7>=WINDOWW)
return;
if(InRange(x)) TP(x,y,OC,\' \');
if(InRange(NewX)) TP(NewX,NewY,OC,\'V\');
if(InRange(x-1)) TP(x-1,y-1,OC," ");
if(InRange(NewX-1))
TP(NewX-1,NewY-1,OC,\'\\\'),
TP(NewX-1,NewY,fgray+bblack,\'O\'),
TP(NewX-1,NewY+1,OC,\'/\');
if(InRange(x-2)) TP(x-2,y-7,OC," ");
if(InRange(NewX-2)) TP(NewX-2,NewY-7,fgray+bblack,\'V\'),TP(NewX-2,NewY-2,OC,\'\\\'),TP(NewX-2,NewY-1,fgray+bblack,"OOO"),TP(NewX-2,NewY+2,OC,\'/\'),TP(NewX-2,NewY+7,fgray+bblack,\'V\');
if(InRange(x-3)) TP(x-3,y-7,OC," ");
if(InRange(NewX-3)) TP(NewX-3,NewY-7,OC,"+---\\XX"),TP(NewX-3,NewY,fgray+bblack,\'O\'),TP(NewX-3,NewY+1,OC,"XX/---+");
if(InRange(x-4)) TP(x-4,y-4,OC," ");
if(InRange(NewX-4)) TP(NewX-4,NewY-4,OC,\'\\\'),TP(NewX-4,NewY-3,fgray+bblack,"OO"),TP(NewX-4,NewY-1,OC,"XXX"),TP(NewX-4,NewY+2,fgray+bblack,"OO"),TP(NewX-4,NewY+4,OC,"/");
if(InRange(x-5)) TP(x-5,y-6,OC," ");
if(InRange(NewX-5)) TP(NewX-5,NewY-6,OC,"[-----------]");
BloodRefresh(NewX,NewY);
x=NewX,y=NewY;
}
void Shot{
int t=clock;
if(LastShotTime1<t-(100-ShotSpeed1)){
LastShotTime1=t;
if(x-1>=0){
Ammo.insert(new Bullet(1,x-1,y-7,4,1,0));
Ammo.insert(new Bullet(1,x-1,y+7,4,1,0));
}
}
if(LastShotTime2<t-(100-ShotSpeed2-500)){
LastShotTime2=t,flag2=1;
TP(x,y,fred+flight+bgray,\'V\');
}
if(flag2&&t>=LastShotTime2+500){
flag2=0;
if(x+1>=0)
Ammo.insert(new Bullet(1,x+1,y,5,1,0));
}
}
}Boss;

/*There\'s an awful problem that set<UFO*>Enemy will be use in the struct UFO but it needs the declaration of struct UFO so we can neither put it in front of the struct UFO nor put it after the struct UFO...*/
/*So we have to get the function Crash out of the struct UFO.*/ /*Eating shit*/
/*To check if it will hit another UFO*/
void UFOMovePrint(UFO&,set<UFO*>::iterator);
bool UFOCrash(UFO me,int NewX,int NewY,set<UFO*>::iterator ID){
for(set<UFO*>::iterator it=Enemy.begin;it!=Enemy.end;it++){
int ox=(*it)->x,oy=(*it)->y;
if(it==ID||ox<NewX) continue;
if(NewX<=ox+4&&NewX>=ox-4&&NewY>=oy-8&&NewY<=oy+8){
/*avoid disfluency*/
UFO *New=*it;
UFOMovePrint(*New,it);
return 1;
}
}
if(BossFlag&&NewX<=Boss.x&&NewX>=Boss.x-5&&NewY>=Boss.y-9&&NewY<=Boss.y+9)
return 1;
return 0;
}
bool UFOCrash(int NewX,int NewY){
for(set<UFO*>::iterator it=Enemy.begin;it!=Enemy.end;it++){
int ox=(*it)->x,oy=(*it)->y;
if(ox<NewX) continue;
if(NewX<=ox+9&&NewX>=ox-9&&NewY>=oy-9&&NewY<=oy+9)
return 1;
}
return 0;
}

//OwnShotTimes,OwnLoseBlood,OwnShotOnTimes;
double Performance{//(0,5]
double p1=double(OwnShotOnTimes)/max(OwnShotTimes,1);
double p2=max(double(Own.FullBlood-OwnLoseBlood)/Own.FullBlood,0.0);
return min((p1+p2)*2.5,4.999999);
}

void BossRefresh{
Boss.MovePrint;
int t=clock;
if(!Boss.isStop)
Boss.Shot;
if(!Boss.isStop&&Boss.LastStopTime+Boss.StopTime+Boss.StopCD<=t)
Boss.LastStopTime=t,Boss.isStop=1;
if(Boss.isStop&&t-Boss.LastStopTime>=Boss.StopTime)
Boss.isStop=0;
}


特别声明:本站内容均来自网友提供或互联网,仅供参考,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。