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


}
if(NewX-1>=0&&NewX-1<WINDOWC){
TP(me.x-1,me.y-1,fwhite+flight+bblack," ");
if(me.isExist) TP(NewX-1,NewY-1,fwhite+flight+bblack,"\\-/");
}
me.BloodRefresh(NewX,NewY);
me.x=NewX,me.y=NewY;
}
int UFORefreshTime=3000,LastUFORefreshTime=0;
void UFORefresh{
int t=clock;
if(LastUFORefreshTime<t-UFORefreshTime){
UFO *tmp=new UFO;
Enemy.insert(tmp);
LastUFORefreshTime=t;
}
vector<set<UFO*>::iterator> Throw;
for(set<UFO*>::iterator it=Enemy.begin;it!=Enemy.end;it++){
UFO *New=*it;
if(!New->isExist)
Throw.push_back(it);
UFOMovePrint(*New,it);
New->Shot;
}
for(int i=0;i<int(Throw.size);i++)
Enemy.erase(Throw[i]);
}

#define MAX_BUFF_NUM 5
const int ConstBuffAppearPossibility[2][1000]={
{1,2,2,2,2,2,2,3,4,5},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,5}
};
const int ConstBuffAppearTime[MAX_BUFF_NUM+5]={0,5000,5000,5000,5000,5000};
const int ConstBuffLastTime[MAX_BUFF_NUM+5]={0,5000,0,5000,10000,5000};
const char ConstBuffName[MAX_BUFF_NUM+5]={0,\'B\',\'C\',\'P\',\'D\',\'S\'};
const char ConstBuffColor[MAX_BUFF_NUM+5]={0,fblue+flight,fgreen+flight,fred+flight,fyellow+flight,fpurple+flight};

struct Plane{
/*
Shape of the plane:
^ (x,y)
/ \ (x+1,y-1) to (x+1,y+1)
|---------| (x+2,y-5) to (x+2,y+5)
| (x+3,y)
--- (x+4,y-1) to (x+4,y+1)
@@@@@@@@@ (x+5,y-4) to (x+5,y+4)
(OOOOOOOOO)
000000/000000 (x+6,y-6) to (x+6,y+6) (Blood and full blood)
*/
int x,y;//position of the head
int Blood,FullBlood;
int LastShotTime;
int ShotSpeed;
LL Score,BossScore;
int Buffs[10],GetBuffTime[10];
double AddAtack,AddShotSpeed;
int Money;
int MeetBossTimes;
void Init(bool isDebug){
if(isDebug){
Ammo.clear;
LastShotTime=-INF;
/*It shot one time in at most 1000-ShotSpeed ms*/
ShotSpeed=20;
Blood=10000,FullBlood=10000;
x=WINDOWC/2,y=WINDOWW-8;
Score=BossScore=0;
AddAtack=AddShotSpeed=50.0;
MeetBossTimes=1;
memset(Buffs,0,sizeof Buffs);
}
else{
Ammo.clear;
LastShotTime=-INF;
/*It shot one time in at most 1000-ShotSpeed ms*/
ShotSpeed=500;
Blood=500,FullBlood=500;
x=WINDOWC/2,y=WINDOWW-8;
Score=BossScore=0;
AddAtack=AddShotSpeed=1.0;
MeetBossTimes=1;
memset(Buffs,0,sizeof Buffs);
}
}
bool NeedBoss{
if(Score>=ConstBossNeedScore[MeetBossTimes])
return MeetBossTimes++,1;
return 0;
}
void Flash(int fcolor){
TP(x,y,fcolor+bwhite,\'^\');
TP(x+1,y-1,fcolor+bwhite,\'/\'),TP(x+1,y+1,fcolor+bwhite,\'\\\');
TP(x+2,y-5,fcolor+bwhite,\'|\');for(int i=y-4;i<=y+4;i++)TP(x+2,i,fcolor+bwhite,\'-\');TP(x+2,y+5,fcolor+bwhite,\'|\');
TP(x+3,y,fcolor+bwhite,\'|\');
TP(x+4,y-1,fcolor+bwhite,\'-\'),TP(x+4,y,fcolor+bwhite,\'-\'),TP(x+4,y+1,fcolor+bwhite,\'-\');
Sleep(200);
TP(x,y,OC,\'^\');
TP(x+1,y-1,OC,\'/\'),TP(x+1,y+1,OC,\'\\\');
TP(x+2,y-5,OC,\'|\');for(int i=y-4;i<=y+4;i++)TP(x+2,i,OC,\'-\');TP(x+2,y+5,OC,\'|\');
TP(x+3,y,OC,\'|\');
TP(x+4,y-1,OC,\'-\'),TP(x+4,y,OC,\'-\'),TP(x+4,y+1,OC,\'-\');
}
/*Check if hit only on the body*/
bool Hit(int tx,int ty){
return (tx==x&&ty==y)||
(tx==x+1&&ty>=y-1&&ty<=y+1)||
(tx==x+2&&ty>=y-5&&ty<=y+5)||
(tx==x+3&&ty==y)||
(tx==x+4&&ty>=y-1&&ty<=y+1);
}
/*Move the blood line(just move)*/
/*Remember to check if the position is OK before using*/
/*And it won\'t update the plane\'s position (x and y)*/
void BloodRefresh(int NewX,int NewY){
TP(x+5,y-4,OC," ");
TP(x+6,y-6,OC," ");
/*Round up*/
int FullBlock=(Blood*9+FullBlood-1)/FullBlood; //Number of "@"
int EmptyBlock=9-FullBlock; //Number of "O"
int BloodColor=ConstBloodColor[(FullBlock+2)/3];
/*Print the blood line*/
for(int i=1;i<=FullBlock;i++)
TP(NewX+5,NewY-5+i,BloodColor+bblack,\'@\');


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