锻炼手速小游戏

#include<bits/stdc++.h>
#include<windows.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME)&0x8000)?1:0)
using namespace std;
int N=15,Numk=50,Numl=5,Numd=100,Nan=40,Hp=10,Bebc=15,Bebh=16,Bebb=10,squ=3;
struct node
{
    int x,y,vf,bv;
    inline void init() {x=rand()%N+1,y=rand()%N+1,bv=rand()%3+1;}
    inline void move() {x++;if(x>N) init(),x=1;}
}k[10005],l[10005],d[10005];
int x,y,hp,score,mp[25][25],udf,numc,numh,numb,bulc,bulh,bulb,lanf;
inline void add(int &x,int y) {x+=y,x=max(x,1),x=min(x,N);}
void color(int a) {SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);}
inline int read()
{
    int r=0;char c=getchar();
    while(c>'9'||c<'0') c=getchar();
    while(c>='0'&&c<='9') (r*=10)+=c-'0',c=getchar();
    return r;
}
inline void print(int x,int y,string s)
{
    HANDLE hOut;COORD pos;
    hOut=GetStdHandle(STD_OUTPUT_HANDLE),pos.X=y,pos.Y=x;
    SetConsoleCursorPosition(hOut,pos),cout<<s;
}
inline char check_press(int x)
{
    Sleep(100);
    for(int i=1;i<=10;i++) {if(KEY_DOWN(x)) return 1;Sleep(10);}
    return 0;
}
inline void set_windows(int x1,int y1,int x2,int y2)
{
    HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);SMALL_RECT rc;
    rc.Left=x1,rc.Top=y1,rc.Right=x2,rc.Bottom=y2;
    SetConsoleWindowInfo(hOut, TRUE, &rc);
}
inline void disap_mouse()
{
    ShowCursor(false);
    HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO cci;
    GetConsoleCursorInfo(hOut,&cci);
    cci.bVisible=false;
    SetConsoleCursorInfo(hOut,&cci);
}
inline char check_die()
{
    for(int i=1;i<=Numk;i++) if(k[i].x==x&&k[i].y==y) return k[i].init(),k[i].x=1,0;
    return 1;
}
inline char check_luck()
{
    for(int i=1;i<=Numl;i++)
        if(l[i].x==x&&l[i].y==y)
        {
            l[i].init(),l[i].x=1;
            numc+=(rand()%10+5)*bulc;
            numh+=(rand()%5+5)*bulh;
            numb+=(rand()%5+5)*bulb;
            return 0;
        }
    return 1;
}
inline char check_dowm()
{
    for(int i=1;i<=Numd;i++)
        if(d[i].x==x&&d[i].y==y)
        {
            d[i].init(),d[i].x=1;
            numc+=(rand()%10+5)*bulc;
            numh+=(rand()%5+5)*bulh;
            numb+=(rand()%5+5)*bulb;
            return 0;
        }
    return 1;
}
inline void move_thi()
{
    for(int i=1;i<=Numk;i++) if(k[i].vf==0) k[i].move();
    for(int i=1;i<=Numl;i++) if(l[i].vf==0) l[i].move();
    for(int i=1;i<=Numd;i++) if(d[i].vf==0) d[i].move();
}
inline char move_peo()
{
    char c=0;
    if(KEY_DOWN(87)&&!udf) add(x,-1),c=1;
    if(KEY_DOWN(38)&&!udf) add(x,-1),c=1;
    if(KEY_DOWN(104)&&!udf) add(x,-1),c=1;
    if(KEY_DOWN(87)||KEY_DOWN(38)||KEY_DOWN(104)) color(112),print(11,N+5,"↑"),color(7);else print(11,N+5,"↑");
    if(KEY_DOWN(83)&&!udf) add(x,1),c=1;
    if(KEY_DOWN(40)&&!udf) add(x,1),c=1;
    if(KEY_DOWN(101)&&!udf) add(x,1),c=1;
    if(KEY_DOWN(83)||KEY_DOWN(40)||KEY_DOWN(101)) color(112),print(15,N+5,"↓"),color(7);else print(15,N+5,"↓");
    if(KEY_DOWN(65)) add(y,-1),c=1;
    if(KEY_DOWN(37)) add(y,-1),c=1;
    if(KEY_DOWN(100)) add(y,-1),c=1;
    if(KEY_DOWN(65)||KEY_DOWN(37)||KEY_DOWN(100)) color(112),print(13,N+3,"←"),color(7);else print(13,N+3,"←");
    if(KEY_DOWN(68)) add(y,1),c=1;
    if(KEY_DOWN(39)) add(y,1),c=1;
    if(KEY_DOWN(102)) add(y,1),c=1;
    if(KEY_DOWN(68)||KEY_DOWN(39)||KEY_DOWN(102)) color(112),print(13,N+7,"→"),color(7);else print(13,N+7,"→");
    return c;
}
inline void die()
{
    system("cls"),print(0,0," ");
    if(lanf==1)
    {
        puts("ZDT : HaHaHaaaaa! YOU DIED!!!\n"),Sleep(1000);
        printf("YOU SCORE IS:%d\n\n",score),Sleep(1000);
    }
    if(lanf==0)
    {
        puts("ZDT:你终于知道 死 这个字怎么写了!!!\n"),Sleep(1000);
        printf("你的分数是:%d\n\n",score),Sleep(1000);
    }
    if(lanf==1) puts("TRY AGAIN?\n");
    if(lanf==0) puts("再来一局?\n");
}
inline void init()
{
    system("cls"),srand(time(0)),printf(" ");
    for(int i=1;i<=N;i++) printf("~");
    puts("");
    for(int i=1;i<=N;i++)
    {
        printf("|");
        for(int i=1;i<=N;i++) printf(" ");
        puts("|");
    }
    printf(" ");
    for(int i=1;i<=N;i++) printf("~");
    puts(""),x=N,y=N/2,hp=Hp,score=0,numc=Bebc*bulc,numh=Bebh*bulh,numb=Bebb*bulb;
    for(int i=1;i<=Numk;i++) k[i].init(),k[i].y=N+1,k[i].vf=k[i].bv-1;
    for(int i=1;i<=Numl;i++) l[i].init(),l[i].y=N+1,l[i].vf=l[i].bv-1;
    for(int i=1;i<=Numd;i++) d[i].init(),d[i].y=N+1,d[i].vf=d[i].bv-1;
    print(1,N+2," "),printf("The bloods you still have");
    print(3,N+2," "),printf("The score you have now is");
    print(5,N+2," "),printf("The normal bullet you have is");
    print(7,N+2," "),printf("The high bullet you have is");
    print(9,N+2," "),printf("The big bullet you have is");
    for(int i=1;i<=Hp/30;i++)
    {
        print(16+i,N+2,"-");
        for(int i=2;i<=30;i++) printf("-");
    }
    print(17+Hp/30,N+2,"-");
    for(int i=2;i<=Hp%30;i++) printf("-");
    print(x,y,"*");
}
inline void Begin()
{
    disap_mouse(),set_windows(10,10,80,50),system("cls");
    printf("\n"),printf("WELCOME TO THE GAME:\n"),color(14);
    printf(
    "\n"
    "BBBBee  U    U  L       FFFFFF  L     Y    Y \n"
    "B    B  U    U  L       F       L     Y    Y \n"
    "B    B  U    U  L       F       L      Y  Y \n"
    "BBBBBB  U    U  L       FFFFFF  L       YY \n"
    "B    B  U    U  L       F       L       YY \n"
    "B    B  U    U  L       F       L       YY \n"
    "BBBB^^   UUUU   LLLLLL  F       LLLLLL  YY \n"
    "\n"
    );
    color(12),printf("烤蛙出品,侵权必究!QWQ\n\nBelieve_R_ 赞助开发\n\n");
    color(7),Sleep(500),puts("PLEASE PRESS 'Enter' TO CONTINUE");
    while(1) {if(KEY_DOWN(13)) break;}
    Sleep(200),system("cls"),puts("Your Language?/你的语言?"),lanf=0;
    while(1)
    {
        print(2,0," ");
        if(lanf==1) puts("  中文  ");else color(112),puts("  中文  "),color(7);
        print(3,0," ");
        if(lanf==0) puts(" English ");else color(112),puts(" English"),color(7);
        if(KEY_DOWN(13)||KEY_DOWN(108)) break;
        if(KEY_DOWN(87)||KEY_DOWN(83)||KEY_DOWN(38)||KEY_DOWN(40)||KEY_DOWN(104)||KEY_DOWN(101)) lanf=1-lanf;
        Sleep(100);
    }
    int t=0;
    Sleep(200),system("cls");
    if(lanf==1) puts("Do you know the rule of the game?");
    if(lanf==0) puts("你知道此游戏的规则吗\n");
    while(1)
    {
        if(lanf==1)
        {
            print(2,0," ");
            if(t==1) puts(" Yes ");else color(112),puts(" Yes "),color(7);
            print(3,0," ");
            if(t==0) puts(" No ");else color(112),puts(" No "),color(7);
        }
        if(lanf==0)
        {
            print(2,0," ");
            if(t==1) puts(" 是 ");else color(112),puts(" 是 "),color(7);
            print(3,0," ");
            if(t==0) puts(" 否 ");else color(112),puts(" 否 "),color(7);
        }
        if(KEY_DOWN(13)||KEY_DOWN(108)) break;
        if(KEY_DOWN(87)||KEY_DOWN(83)||KEY_DOWN(38)||KEY_DOWN(40)||KEY_DOWN(104)||KEY_DOWN(101)) t=1-t;
        Sleep(100);
    }
    if(t==1)
    {
        Sleep(200),system("cls");
        if(lanf==1)
        {
            puts("Before playing this game please read these carefully:\n"),Sleep(500);
            puts("\n1. You'll be asked to input 7 game parameters before the game starts.\n"),Sleep(500);
            puts("\n2. The symbol '!' is the Upgrade Roadblock. If you didn't shut it off before it get to the botton, your bloods will -1!\n"),Sleep(500);
            puts("\n3. The symbol '&' is the obstacle which means you cannot let '*' touch the '#'.\n"),Sleep(500);
            puts("\n4. The symbol '+' is the midic which means you can recover by touching the '!'.\n"),Sleep(500);
            puts("\n5. At first, you will have some bloods. You must go further before you died!\n"),Sleep(500);
            puts("\n6. If you press 'Q', the bullets will be fired. But the bullets was limited, it only can be increased by touching '+'\n"),Sleep(500);
            puts("\n7. If you press 'Space', the system will give you a sighting telescope. But it can't earse the Roadblock\n"),Sleep(500);
            puts("\n\nHappy Games......  QwQ\n"),Sleep(500);
            puts("PLEASE PRESS 'Enter' TO CONTINUE");
        }
        if(lanf==0)
        {
            puts("在玩之前,请认真阅读以下提示:\n"),Sleep(500);
            puts("\n1. 你将输入7个游戏参数。\n"),Sleep(500);
            puts("\n2. 符号'!'是恐怖障碍物。如果你没有在它到达底部之前射掉它,你将会扣一滴血!\n"),Sleep(500);
            puts("\n3. 符号'&'是障碍物,一旦你自己('*')碰到障碍物,生命值将会掉1个单位!\n"),Sleep(500);
            puts("\n4. 符号'+'可以给你补血,每次你自己('*')碰到'!'会恢复1个单位!\n"),Sleep(500);
            puts("\n5. 一开始你会有n个单位的生命,你必须在生命值耗完之前获得最高的分数!\n"),Sleep(500);
            puts("\n6. 如果你按下'Q',将会发射子弹。但是子弹的数量是有限的,你有你碰到了'+'才会回血!\n"),Sleep(500);
            puts("\n7. 如果你按下'空格',将会调出瞄准镜。但是瞄准镜并不能清除障碍物!\n"),Sleep(500);
            puts("\n\nHappy Games......  QwQ\n"),Sleep(500);
            puts("请按回车键以继续!");
        }
    }
    while(1) {if(KEY_DOWN(13)) break;}
    system("cls");
}
inline void choose()
{
    int t=5;
    Sleep(200);
    if(lanf==1) puts("Please choose the Difficulty: \n");
    if(lanf==0) puts("请选择游戏难度:\n");
    while(1)
    {
        if(lanf==1)
        {
            print(2,0," ");
            if(t!=5) puts(" Quick: No bullets ");else color(112),puts(" Quick: No bullets "),color(7);
            print(3,0," ");
            if(t!=4) puts(" Peaceful: Please play within 'int'! ");else color(112),puts(" Peaceful: Please play within 'int'! "),color(7);
            print(4,0," ");
            if(t!=3) puts(" Easy: Suitable for the Freshmen ");else color(112),puts(" Easy: Suitable for the Freshmen! "),color(7);
            print(5,0," ");
            if(t!=2) puts(" Middle: Time to race! ");else color(112),puts(" Middle: Time to race! "),color(7);
            print(6,0," ");
            if(t!=1) puts(" Hard: Impossible to get 2500! ");else color(112),puts(" Hard: Impossible to get 2500! "),color(7);
            print(7,0," ");
            if(t!=0) puts(" User-Defined ");else color(112),puts(" User-Defined "),color(7);
        }
        if(lanf==0)
        {
            print(2,0," ");
            if(t!=5) puts(" 手速 [没有子弹!] ");else color(112),puts(" 手速 [没有子弹!] "),color(7);
            print(3,0," ");
            if(t!=4) puts(" 和平 [不要把int玩爆呀!] ");else color(112),puts(" 和平 [不要把int玩爆呀!] "),color(7);
            print(4,0," ");
            if(t!=3) puts(" 简单 [新手建议!] ");else color(112),puts(" 简单 [新手建议!] "),color(7);
            print(5,0," ");
            if(t!=2) puts(" 普通 [是时候比速度了!] ");else color(112),puts(" 普通 [是时候比速度了!] "),color(7);
            print(6,0," ");
            if(t!=1) puts(" 困难 [2500? 不可能的!] ");else color(112),puts(" 困难 [2500? 不可能的!] "),color(7);
            print(7,0," ");
            if(t!=0) puts(" 用户自定义 ");else color(112),puts(" 用户自定义 "),color(7);
        }
        if(KEY_DOWN(13)||KEY_DOWN(108)) break;
        if(KEY_DOWN(38)||KEY_DOWN(87)||KEY_DOWN(104)) t=(t+1)%6;
        if(KEY_DOWN(40)||KEY_DOWN(83)||KEY_DOWN(98)) t=(t+5)%6;
        Sleep(100);
    }
    Nan=40;
    if(t==5) {N=30,Numk=75,Numl=0,Numd=1,Hp=1,Bebc=Bebh=Bebb=0,bulc=bulh=bulb=0,squ=14;return;}
    if(t==4) {N=30,Numk=15,Numl=20,Numd=1,Hp=20,Bebc=500,Bebh=100,Bebb=100,bulc=bulh=bulb=1,squ=10;return;}
    if(t==3) {N=30,Numk=25,Numl=10,Numd=1,Hp=15,Bebc=100,Bebh=20,Bebb=20,bulc=bulh=bulb=1,squ=7;return;}
    if(t==2) {N=30,Numk=40,Numl=8,Numd=1,Hp=15,Bebc=20,Bebh=4,Bebb=2,bulc=bulh=bulb=1,squ=5;return;}
    if(t==1) {N=30,Numk=40,Numl=5,Numd=2,Hp=20,Bebc=10,Bebh=Bebb=0,bulc=bulh=bulb=1,squ=3;return;}
    system("cls"),t=0,Sleep(100);
    if(lanf==1) puts("Do you want to be able to shoot the bullets?");
    if(lanf==0) puts("请选择你能否发射狙击枪子弹!");
    while(1)
    {
        if(lanf==1)
        {
            print(2,0," ");
            if(t==1) puts(" Yes ");else color(112),puts(" Yes "),color(7);
            print(3,0," ");
            if(t==0) puts(" No ");else color(112),puts(" No "),color(7);
        }
        if(lanf==0)
        {
            print(2,0," ");
            if(t==1) puts(" 是 ");else color(112),puts(" 是 "),color(7);
            print(3,0," ");
            if(t==0) puts(" 否 ");else color(112),puts(" 否 "),color(7);
        }
        if(KEY_DOWN(13)||KEY_DOWN(108)) break;
        if(KEY_DOWN(87)||KEY_DOWN(83)||KEY_DOWN(38)||KEY_DOWN(40)||KEY_DOWN(104)||KEY_DOWN(101)) t=1-t;
        Sleep(100);
    }
    bulc=1-t,t=0,system("cls"),Sleep(100);
    if(lanf==1) puts("Do you want to be able to shoot the bullets?");
    if(lanf==0) puts("请选择你能否发射高射炮子弹!");
    while(1)
    {
        if(lanf==1)
        {
            print(2,0," ");
            if(t==1) puts(" Yes ");else color(112),puts(" Yes "),color(7);
            print(3,0," ");
            if(t==0) puts(" No ");else color(112),puts(" No "),color(7);
        }
        if(lanf==0)
        {
            print(2,0," ");
            if(t==1) puts(" 是 ");else color(112),puts(" 是 "),color(7);
            print(3,0," ");
            if(t==0) puts(" 否 ");else color(112),puts(" 否 "),color(7);
        }
        if(KEY_DOWN(13)||KEY_DOWN(108)) break;
        if(KEY_DOWN(87)||KEY_DOWN(83)||KEY_DOWN(38)||KEY_DOWN(40)||KEY_DOWN(104)||KEY_DOWN(101)) t=1-t;
        Sleep(100);
    }
    bulh=1-t,t=0,system("cls"),Sleep(100);
    if(lanf==1) puts("Do you want to be able to shoot the bullets?");
    if(lanf==0) puts("请选择你能否发射大炮子弹!");
    while(1)
    {
        if(lanf==1)
        {
            print(2,0," ");
            if(t==1) puts(" Yes ");else color(112),puts(" Yes "),color(7);
            print(3,0," ");
            if(t==0) puts(" No ");else color(112),puts(" No "),color(7);
        }
        if(lanf==0)
        {
            print(2,0," ");
            if(t==1) puts(" 是 ");else color(112),puts(" 是 "),color(7);
            print(3,0," ");
            if(t==0) puts(" 否 ");else color(112),puts(" 否 "),color(7);
        }
        if(KEY_DOWN(13)||KEY_DOWN(108)) break;
        if(KEY_DOWN(87)||KEY_DOWN(83)||KEY_DOWN(38)||KEY_DOWN(40)||KEY_DOWN(104)||KEY_DOWN(101)) t=1-t;
        Sleep(100);
    }
    bulb=1-t,t=0,system("cls"),Sleep(100);
    if(lanf==1) puts("Please choose your pattern\nIf you choose Pattern 1, you can go up and down, while Pattern 2 can't!\n");
    if(lanf==0) puts("请选择你的模式:\n如果你选择了模式1,你可以上下左右移动;而模式2只能左右移动!\n");
    while(1)
    {
        if(lanf==1)
        {
            print(3,0," ");
            if(t==1) puts(" Pattern 1:←↑↓→ ");else color(112),puts(" Pattern 1:←↑↓→ "),color(7);
            print(4,0," ");
            if(t==0) puts("  Pattern 2:←→  ");else color(112),puts("  Pattern 2:←→  "),color(7);
        }
        if(lanf==0)
        {
            print(3,0," ");
            if(t==1) puts(" 模式1:←↑↓→ ");else color(112),puts(" 模式1:←↑↓→ "),color(7);
            print(4,0," ");
            if(t==0) puts("  模式2:←→  ");else color(112),puts("  模式2:←→  "),color(7);
        }
        if(KEY_DOWN(13)||KEY_DOWN(108)) break;
        if(KEY_DOWN(87)||KEY_DOWN(83)||KEY_DOWN(38)||KEY_DOWN(40)||KEY_DOWN(104)||KEY_DOWN(101)) t=1-t;
        Sleep(100);
    }
    udf=t;
    system("cls"),t=-1;
    while(t<3||t>35)
    {
        if(lanf==1) puts("Please Input an Integer: The Size of the Game(from 3 to 35):\n");
        if(lanf==0) puts("请输入一个整数:游戏界面的大小(3 ~ 35)\n");
        print(2,0," "),t=read(),N=t,system("cls");
    }
    system("cls"),t=-1;
    while(t<1||90<t)
    {
        if(lanf==1) puts("Please Input an Integer: The Number of Bullets(from 1 to 90):\n");
        if(lanf==0) puts("请输入一个整数:障碍物的数量(1 ~ 90)\n");
        print(2,0," "),t=read(),Numk=t,system("cls");
    }
    system("cls"),t=-1;
    while(t<1||90<t)
    {
        if(lanf==1) puts("Please Input an Integer: The Number of Backpack(from 1 to 90):\n");
        if(lanf==0) puts("请输入一个整数:回血包的数量(1 ~ 90)\n");
        print(2,0," "),t=read(),Numl=t,system("cls");
    }
    system("cls"),t=-1;
    while(t<1||90<t)
    {
        if(lanf==1) puts("Please Input an Integer: The Number of Upgrade Bullets(from 1 to 90):\n");
        if(lanf==0) puts("请输入一个整数:恐怖障碍物的数量(1 ~ 90)\n");
        print(2,0," "),t=read(),Numd=t,system("cls");
    }
    system("cls"),t=-1;
    while(t<1||t>100)
    {
        if(lanf==1) puts("Please Imput an Integer: The Total HP of You(from 1 to 100):\n");
        if(lanf==0) puts("请输入一个整数:初始生命值(1 ~ 100)\n");
        print(2,0," "),t=read(),Hp=t,system("cls");
    }
    system("cls"),t=-1;
    while(t<1||t>100)
    {
        if(lanf==1) puts("Please Input an Integer: The Bullet You Have at First(from 1 to 100):\n");
        if(lanf==0) puts("请输入一个整数:初始狙击枪子弹数(1 ~ 100)\n");
        print(2,0," "),t=read(),Bebc=t,system("cls");
    }
    system("cls"),t=-1;
    while(t<1||t>100)
    {
        if(lanf==1) puts("Please Input an Integer: The Bullet You Have at First(from 1 to 100):\n");
        if(lanf==0) puts("请输入一个整数:初始高射炮子弹数(1 ~ 100)\n");
        print(2,0," "),t=read(),Bebh=t,system("cls");
    }
    system("cls"),t=-1;
    while(t<1||t>100)
    {
        if(lanf==1) puts("Please Input an Integer: The Bullet You Have at First(from 1 to 100):\n");
        if(lanf==0) puts("请输入一个整数:初始大炮子弹数(1 ~ 100)\n");
        print(2,0," "),t=read(),Bebb=t,system("cls");
    }
}
inline void work()
{
    init();
    int die=1,luck=1,dowm=1,t;
    while(1)
    {
        for(int i=1;i<=Numk;i++) (k[i].vf+=1)%=k[i].bv;
        for(int i=1;i<=Numl;i++) (l[i].vf+=1)%=l[i].bv;
        for(int i=1;i<=Numd;i++) (d[i].vf+=1)%=d[i].bv;
        for(int i=1;i<=Numk;i++) if(k[i].y<=N&&k[i].x>0&&k[i].vf==0) print(k[i].x,k[i].y," ");
        for(int i=1;i<=Numl;i++) if(l[i].y<=N&&l[i].x>0&&l[i].vf==0) print(l[i].x,l[i].y," ");
        for(int i=1;i<=Numd;i++) if(d[i].y<=N&&d[i].x>0&&d[i].vf==0) print(d[i].x,d[i].y," ");
        t=0; 
        if(!udf&&(KEY_DOWN(87)||KEY_DOWN(38)||KEY_DOWN(104))) t=1;
        if(!udf&&(KEY_DOWN(83)||KEY_DOWN(40)||KEY_DOWN(101))) t=1;
        if(KEY_DOWN(65)||KEY_DOWN(37)||KEY_DOWN(100)) t=1;
        if(KEY_DOWN(68)||KEY_DOWN(39)||KEY_DOWN(102)) t=1;
        if(t) print(x,y," ");move_thi(),move_peo();
        for(int i=1;i<=Numk;i++) if(k[i].y<=N&&k[i].x>0&&k[i].vf==0) color(4),print(k[i].x,k[i].y,"&"),color(7);
        for(int i=1;i<=Numl;i++) if(l[i].y<=N&&l[i].x>0&&l[i].vf==0) color(2),print(l[i].x,l[i].y,"+"),color(7);
        for(int i=1;i<=Numd;i++) if(d[i].y<=N&&d[i].x>0&&d[i].vf==0) color(14),print(d[i].x,d[i].y,"!"),color(7);
        if(t) print(x,y,"*");
        die=check_die(),luck=check_luck(),dowm=check_dowm();
        if(!luck) print(hp/30+17,N+2+hp%30,"-"),hp++,score+=20,(numc+=rand()%10+5)*=bulc,(numh+=rand()%5+5)*=bulh,(numb+=rand()%5)*=bulb;
        if(!die) print((hp-1)/30+17,N+2+(hp-1)%30," "),hp--,score--;
        if(!dowm) score+=50;
        if((!die||!luck||!dowm)&&!t) print(x,y,"*");
        if(hp<=0) return;
        int xx=0,xw=1,yy=0,_90=0,_88=0,_67=0,_32=0;
        for(int i=1;i<=Numk;i++) if(k[i].y==y&&xx<k[i].x&&k[i].x<x) xx=k[i].x,yy=k[i].y,xw=i;
        for(int i=1;i<=Numl;i++) if(l[i].y==y&&xx<l[i].x&&l[i].x<x) xx=l[i].x,yy=l[i].y,xw=i+Numk;
        for(int i=1;i<=Numd;i++) if(d[i].y==y&&xx<d[i].x&&d[i].x<x) xx=d[i].x,yy=d[i].y,xw=i+Numk+Numl;
        if(KEY_DOWN(32)) {for(int i=x-1;i>xx;i--) print(i,y,"|");_32=1,color(112),print(15,N+8," Space "),color(7);}else print(15,N+8," Space ");
        if(KEY_DOWN(90)&&numc>0)
        {
            numc--,color(112),print(13,N+9," Z "),color(7),_90=1;
            if(xx!=0&&numc>0) for(int i=x-1;i>=xx;i--) print(i,y,"|");
        }
        else print(13,N+9," Z ");
        if(KEY_DOWN(88)&&numh>0)
        {
            numh--,color(112),print(13,N+12," X "),color(9),_88=1;
            if(xx!=0&&numc>0) for(int i=x-1;i>=1;i--) print(i,y,"|");
            color(7);
        }
        else print(13,N+12," X ");
        if(KEY_DOWN(67)&&numb>0)
        {
            numb--,color(112),print(13,N+15," C "),color(12),_67=1;
            if(xx!=0&&numc>0) for(int i=x-1;i>=xx;i--) print(i,y,"|");
            color(7);
        }
        else print(13,N+15," C ");
        for(int i=N+28;i<=N+35;i++) print(1,i," ");
        for(int i=N+28;i<=N+35;i++) print(3,i," ");
        for(int i=N+33;i<=N+38;i++) print(5,i," ");
        for(int i=N+31;i<=N+36;i++) print(7,i," ");
        for(int i=N+30;i<=N+36;i++) print(9,i," ");
        print(1,N+29,":"),printf("%d",hp);
        print(3,N+29,":"),printf("%d",score);
        print(5,N+33,":"),printf("%d",numc);
        print(7,N+31,":"),printf("%d",numh);
        print(9,N+30,":"),printf("%d",numb);
        Sleep(Nan);
        if(_32==1) {for(int i=x-1;i>xx;i--) print(i,y," ");}
        if(xx!=0&&_90)
        {
            for(int i=x;i>=xx;i--) print(i,y," ");
            if(xw<=Numk) k[xw].init(),k[xw].x=0,score++;
            else if(xw<=Numk+Numl) l[xw-Numk].init(),l[xw-Numk].x=0,score+=20;
            else d[xw-Numk-Numl].init(),d[xw-Numk-Numl].x=0,score++,(numc+=rand()%10+5)*=bulc,(numh+=rand()%5+5)*=bulh,(numb+=rand()%5)*=bulb;
        }
        if(_88)
        {
            for(int i=x;i>=1;i--) print(i,y," ");
            for(int i=1;i<=Numk;i++) if(k[i].y==y) k[i].init(),k[i].x=0,score++;
            for(int i=1;i<=Numl;i++) if(l[i].y==y) l[i].init(),l[i].x=0,score+=20;
            for(int i=1;i<=Numd;i++) if(d[i].y==y) d[i].init(),d[i].x=0,score++,(numc+=rand()%10+5)*=bulc,(numh+=rand()%5+5)*=bulh,(numb+=rand()%5)*=bulb;
        }
        if(xx!=0&&_67)
        {
            for(int i=x;i>=1;i--) print(i,y," ");
            for(int i=1;i<=Numk;i++)
                if(k[i].y>=yy-squ&&k[i].y<=yy+squ&&k[i].x>=xx-squ&&k[i].x<=xx+squ&&k[i].x>=1&&k[i].y<=N)
                    print(k[i].x,k[i].y," "),k[i].init(),k[i].x=0,score++;
            for(int i=1;i<=Numl;i++)
                if(l[i].y>=yy-squ&&l[i].y<=yy+squ&&l[i].x>=xx-squ&&l[i].x<=xx+squ&&l[i].x>=1&&k[i].y<=N)
                    print(l[i].x,l[i].y," "),l[i].init(),l[i].x=0,score++;
            for(int i=1;i<=Numd;i++)
                if(d[i].y>=yy-squ&&d[i].y<=yy+squ&&d[i].x>=xx-squ&&d[i].x<=xx+squ&&d[i].x>=1&&k[i].y<=N)
                    print(d[i].x,d[i].y," "),d[i].init(),d[i].x=0,score++,(numc+=rand()%10+5)*=bulc,(numh+=rand()%5+5)*=bulh,(numb+=rand()%5)*=bulb;
        }
        score++;
    }
}
int main()
{
    Begin();
    while(1)
    {
        choose(),work(),die();int t=0;
        while(1)
        {
            if(lanf==1)
            {
                print(5,0," ");
                if(t==1) puts(" Yes ");else color(112),puts(" Yes "),color(7);
                print(6,0," ");
                if(t==0) puts(" No ");else color(112),puts(" No "),color(7);
            }
            if(lanf==0)
            {
                print(5,0," ");
                if(t==1) puts(" 是 ");else color(112),puts(" 是 "),color(7);
                print(6,0," ");
                if(t==0) puts(" 否 ");else color(112),puts(" 否 "),color(7);
            }
            if(KEY_DOWN(13)||KEY_DOWN(108)) break;
            if(KEY_DOWN(87)||KEY_DOWN(83)||KEY_DOWN(38)||KEY_DOWN(40)||KEY_DOWN(104)||KEY_DOWN(101)) t=1-t;
            Sleep(100);
        }
        if(t==1) return 0;
        system("cls");
    }
}

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值