#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
using namespace std;
typedef BOOL (WINAPI *PROCSETCONSOLEFONT)(HANDLE, DWORD);
PROCSETCONSOLEFONT SetConsoleFont;
POINT Windowpos(){POINT pt;GetCursorPos(&pt);HWND h=GetForegroundWindow();ScreenToClient(h,&pt);
pt.x=(pt.x+4)/8+0.5;pt.y=pt.y/16+0.5;//鼠标矫正此处
swap(pt.x,pt.y);return pt;}
int mouse;POINT pt;
void Print(int a){HMODULE hKernel32 = GetModuleHandle("kernel32");SetConsoleFont = (PROCSETCONSOLEFONT)GetProcAddress(hKernel32,"SetConsoleFont");SetConsoleFont(GetStdHandle(STD_OUTPUT_HANDLE),a);}
int ti(float a) {return ((int)(a*10+5))/10;}
void Setpos(float x,float y){COORD pos;pos.X=ti(y*4)/2;pos.Y=ti(x+2);SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);}
void Color(int a){if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==-1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_RED|BACKGROUND_GREEN|BACKGROUND_BLUE);
if(a==-8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_RED);if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==-11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_GREEN|BACKGROUND_BLUE);if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(a==-5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_RED|BACKGROUND_GREEN);if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
if(a==-6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_BLUE);
if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);if(a==9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_GREEN|BACKGROUND_BLUE);if(a==10) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_RED|BACKGROUND_BLUE);if(a==11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);if(a==12) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN);if(a==13) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);if(a==14) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_BLUE);}
void Slow(char *p,int a) {while(1){if(*p!=0) printf("%c",*p++);else break;Sleep(a);}}
int to(float a) {if(a>0) return int(a+0.5);else if(a<0) return int(-a-0.5);if(a==0) return 0;}
float Sin(int a) {return sin(3.1416*a/180);}float Cos(int a) {return cos(3.1416*a/180);}
float Sin0(int a) {return sin(3.1416*a);}float Cos0(int a) {return cos(3.1416*a);}//多少pai
//------------------------------------杂七杂八的图像函数。。。------------------------------------
int m[51][101],n[51][101],s[51][101];
int bl,br,Life,level,T,Turnx,Turny,End,Lev,people,unkillT,unkillTmax,Tempty;
float X,X2,Y,Y2,speed=30,Attack=1,Anc,Anv,Anb,cMin,vMin,bMin,skillC,skillV,skillB,Blood,Bloodmax,EXP,EXPmax;
int D[2][5]={
{0,1,-1,0,0},{0,0,0,-1,1}};//上下右左
float Sx=18,Sy=60,Svx=0,Svy=0,Stx,Sty,Sr=0,Sm=0,Svmax=2,Srmax=5;
int Sleep_1,Sleep_1max,Sleep_2,Sleep_3;
int Bean,BeanBoo,BeanBoom,TimeStop,Thunder,ThunderTime,ThunderTurn,Crab;
struct bullet{float x,y,vx,vy,fx1,fx2,fx3;int w,t,k,l,ex1,ex2,ex3;//what,time,kill,life;
float maxsize,angle,maxangle,minangle,xr,ybig,ysmall,v;
int turn,staytime,num,source;
}B[1000001];//改时别忘了Delete!
void Delete_B(int i) {
B[i].x=B[i].y=B[i].vx=B[i].vy=B[i].fx1=B[i].fx2=B[i].fx3=B[i].w=B[i].t=B[i].k=B[i].l=B[i].ex1=B[i].ex2=B[i].ex3=0;
B[i].maxsize=B[i].angle=B[i].maxangle=B[i].minangle=B[i].xr=B[i].ybig=B[i].ysmall=B[i].v=B[i].turn=B[i].staytime=B[i].num=B[i].source=0;}
void S(float x,float y){int i=(int)x,j=(int)y;Setpos(i,j/2.0);printf("a");}
void C(float x,float y){int i=(int)x,j=(int)y;Setpos(i,j/2.0);//直接输出该点
if(n[i][j]==0) printf(" ");
if(n[i][j]==1) Color(-1),printf(" ");
//以下无伤
if(n[i][j]==-1) Color(-8),printf(" ");
if(n[i][j]==-2) Color(-11),printf(" ");
if(n[i][j]==-3) Color(-5),printf(" ");
Color(0);
}
void Map(int a){if(a==1){for(register int i=1;i<=50;i++)for(register int j=1;j<=100;j++){if(n[i][j]!=m[i][j]){C(i,j);}}for(register int i=1;i<=50;i++)for(register int j=1;j<=100;j++){m[i][j]=n[i][j];}}}
//Map1:更新地图
void N(float x,float y,int w){int xx=(int)x,yy=(int)y;//放置点在地图上
if(xx>40||yy>80||xx<1||yy<1) return;
else if(w<0&&n[xx][yy]>=1) return;//白色盖住红色
else n[xx][yy]=w;}
void Die(){
system("cls");system("color 0F");
Slow("You Die !",50);
system("color 3B");Sleep(10);system("cls");system("color 0F");}
void Win(){
system("cls");
for(register int i=0;i<=3;i++)
{printf("You Win !");
system("color 1A");Sleep(10);
system("color 2B");Sleep(10);
system("color 3C");Sleep(10);
system("color 4D");Sleep(10);
system("color 5D");Sleep(10);
system("color 6E");Sleep(10);
system("color 7F");Sleep(10);
}printf(" 好敷衍啊...");Lev=1;system("color 0F");Sleep(5000);system("cls");
}
void Circle(int x,int y,int r,int num,int start,int whatnumber,int source){if(r<0) return;if(r==0) num=1;int next=360/num;for(register int i=0;i<num;i++){br++;
B[br].w=3;B[br].staytime=3;if(whatnumber==0) whatnumber=1;B[br].num=whatnumber;B[br].source=source;
B[br].t=0;B[br].l=1;B[br].x=x+Sin(i*next+start)*r;B[br].y=y+2*Cos(i*next+start)*r;}}
void Rock_Circle(float x0,float y0,float xr,float ybig,int staytime,int source,int num){
if(xr<0) return;
for(register int i=x0-xr;i<=x0+xr;i++){float Ay=ybig*2*sqrt(xr*xr-(i-x0)*(i-x0));for(register float j=y0-Ay;j<y0+Ay;j++){br++;B[br].w=3;B[br].staytime=staytime;B[br].t=0;B[br].l=1;B[br].x=i;B[br].y=to(j);B[br].staytime=staytime;B[br].num=num;
if(num==-3) B[br].num=-2,B[br].ex2=1;
B[br].source=source;B[br].ex1=B[B[br].source].ex