跳到正文

剪贴板

剪贴板 sl6prg5y

原文
剪贴板信息

剪贴板信息

收录
更新

自创

注:如果本游戏存档读入出现错误,请复制下原存档里的内容,再删除存档,新建一个文件名不变的新存档,粘贴下原内容,即可

C++
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
const int Stage_num=15;
string CHEST[5]={"白银","黄金","巨型","神奇","雷电"};
short Map[10][10];
int direng[9];
int direnf[9];
int wofang[9];
int game_num;
int people;
void HideCursor()
{
    HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO CursorInfo;
    GetConsoleCursorInfo(handle,&CursorInfo);
    CursorInfo.bVisible=false;
    SetConsoleCursorInfo(handle,&CursorInfo);
}
void gotoxy(int x,int y)
{
    HANDLE hOut;
    hOut=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD pos={x,y};
    SetConsoleCursorPosition(hOut,pos);
}
void print(string a)
{
	for(int i=0;i<a.size();i++)
	{
		cout<<a[i];
		Sleep(80);
	}
	cout<<"\n";
}
void Begin()
{
    system("cls");
    system("color 0c");
    cout<<"轰!一朵蘑菇云缓缓升起\n";getch();
    cout<<"英雄之城即将发生一场大变动!\n";getch();
    cout<<"你需要一路披荆斩棘,在这个世界上生存上来!\n";getch();
    cout<<"战斗即将开始,你 准备好了吗";getch();
    system("cls");
    gotoxy(45,10);
    cout<<"明日之后  英雄崛起";
    gotoxy(45,15);
    cout<<"114514公司出品";
    gotoxy(45,16);
    cout<<"编制者:TCY";getch();
    system("cls");
    system("color 07");
}
struct Lines
{
	int startnum;
	string startline[5];
}stage_lines[Stage_num]={{4,{"蘑菇云渐渐消散,你幸存了下来","整个社会陷入混乱,法律已经完全失效",
"你只有不断杀戮,升级,变得强大,才可以存活下去","拿起你的武器吧,战斗!!!"}},
{2,{"两个全副武装的人正在组团屠杀","他们突然看见了你,便向你走来"}},
{5,{"那两个人被你打的跪地求饶:","  大哥,我这有秘密情报,马上告诉你,饶我们一命!!!",
"你想了想说:","  不错,说来听听","那两个人刚刚要说,又有两个不要命的朝着走来..."}},
{5,{"见你又KO了两个人,他们吓得直发抖,战战兢兢的说:","  我们是OPIC组织的人,是我们组织策划了这场核爆",
"  我们OPIC组织的老大Eric想要毁灭这个世界,再最终统治世界!",
"  远处的大楼便是我们的总部,杀掉老大Eric!","你听了他们的话,向远处的大楼走去,走到门口时,几个护卫拦住了你"}},
{2,{"区区几个护卫,你很快轻松解决掉","你迈开步伐,向二楼走去"}},{2,{"二楼由五个精英把守,一个精英看到了你",
"五个人一齐向你冲来,你跑不掉了,战吧!!!"}},{3,{"干掉五个精英,你径直走向二楼会议室",
"  不错,正好向里面的议员打听一下Eric到底在哪里","你想着,然后破门而入!"}},
{5,{"四个议员被你打的跪地求饶:","  老大Eric在三楼走廊尽头的那间房间里,",
"  不过想要进入Eric的房间,你要先击败守卫","  我们能说的就这些,剩下的靠你自己吧!",
"听了他们的话,你走向三楼,刚走到门口,守卫拦住了你"}},{5,{"守卫被你打到在了地上,你一脚踹爆了Eric房间的大门",
"  Eric,有胆量就来和我单挑!","你朝着房间里大吼","Eric从房间里冲了出来:","  我倒要看看你有多强!"}},
{5,{"Eric倒在地上,他恶狠狠的说:","  你以为我Eric就是OPIC的首领吗,哈哈哈!我Eric不过是OPIC普通的小首领而已",
"  我们OPIC远在昆仑山之上,由伟大的Alex掌控,策划核爆对他们来说无比简单",
"  我的使命完成了,就让我们同归于尽吧!","然后Eric拉开了一个手榴弹.....轰!"}},
{5,{"你迷迷糊糊的睁开眼睛,发现自己在一个房间里","你侥幸没有被炸死,只是炸晕了过去",
"  把他抓给上头,升官加薪稳了!!!","你闻声看去,是一群OPIC的议员",
"刚刚还被你打的跪地求饶,现在还想绑架你?你怒火中烧向他们杀去"}}};
struct stage
{
    string nem;//战争名
    int enemy[8];//敌人
    int d_lv[8];//敌人等级
    int rewar;//奖励
    int Chest;//奖励宝箱
    int ensem;//敌人数量
};
stage STAGE[Stage_num]={{"第一战",{0,1},{1,1},750,0,2},{"情报",{9,10},{2,2},750,0,2},
{"不要命",{12,2},{3,3},1500,1,2},{"OPIC",{0,1,2,3},{3,4,2,2},2000,1,4},
{"护卫",{7,8,20,15},{3,5,4,4},2500,1,4},{"五个精英",{19,18,17,16,23},{4,4,3,3,3},3000,2,5},
{"会议室",{14,13,12,11},{5,5,5,5},4000,2,4},{"三楼",{6,5,21,3,4,14,17},{5,6,5,5,4,4,4},10000,3,6},
{"与Eric的决战",{12},{17},17500,4,1},{"幕后黑手",{2,16,11,10,0,7,22,19},{10,10,10,8,8,8,8,8},20000,4,8},
{"醒来",{2,6,17,8,3,0,11},{12,12,12,12,12,12,14},25000,4,7},
{"法术幽谷",{18,19,6,7,8,9,23,15},{12,12,15,15,15,15,15,15},30000,4,8},
{"丛林竞技",{23,22,21,20,2,4,6,10},{15,15,15,17,17,17,17,18},40000,4,8},
{"误入迷失森林",{2,4,6,16,22,0,11,9},{20,20,20,20,20,20,21,21},50000,4,8},
{"传奇擂台",{23,0,13,19,18,3,7,12},{25,25,25,25,25,25,25,25},60000,4,8}};//关卡
struct hero
{
    string NA;//名字
    int k,upk;//卡
    int sp,sc;//速度,射程
    int G,F;//攻击防御
    int lv;//等级
    string XI;
};
hero YX[24]={{"野蛮人",1,20,2,2,500,2500,1,"普通"},{"哥布林",1,20,5,2,500,2100,1,"普通"},
{"烟花炮手",1,20,3,5,250,2200,1,"普通"},{"皇家速递",1,20,3,2,400,2650,1,"普通"},
{"炸弹骷髅",1,20,2,6,500,1750,1,"普通"},{"骷髅飞龙",1,20,3,4,300,2400,1,"普通"},
{"烈焰法师",1,11,3,5,350,2350,1,"稀有"},{"瓦基丽武神",1,11,3,3,300,2800,1,"稀有"},
{"飞龙宝宝",1,4,3,3,500,2400,1,"史诗"},{"幻影刺客",1,3,5,2,500,2500,1,"传奇"},
{"黄金圣骑",1,2,3,2,650,2700,1,"英雄"},{"战斗天使",1,11,2,2,500,2350,1,"稀有"},
{"火焰精灵",1,20,5,3,600,1900,1,"普通"},{"电击车",1,11,2,4,350,2300,1,"稀有"},
{"黑暗王子",1,4,6,2,300,2300,1,"史诗"},{"皇家巨人",1,20,2,5,250,2350,1,"普通"},
{"火枪手",1,11,3,6,250,2250,1,"稀有"},{"圣水戈仑",1,4,2,2,500,2500,1,"史诗"},
{"超级骑士",1,3,3,2,500,2600,1,"传奇"},{"威猛矿工",1,2,5,2,650,2500,1,"英雄"},
{"骷髅气球",1,20,4,2,400,2400,1,"普通"},{"掘地矿工",1,3,3,2,500,2750,1,"传奇"},
{"吹箭哥布林",1,11,3,6,550,1750,1,"稀有"},{"皮卡超人",1,4,1,2,700,2500,1,"史诗"}};
struct pro
{
    bool one=true;
    int LV=1;//经验等级
    int P,X,S,C,Y;//外卡
    int g=100,f=500;//攻防
    int SP=3,SC=3;//速度,射程
    string name;
    string cipher;
    int yx_num=1;
    int glod=6000;//金币
    int exp;//经验值
    int stage_jd=0;//关卡进度
};
pro user[10];
struct comm
{
    string name;
    int money;
};
comm COMM[5]={{"普通外卡",100},{"稀有外卡",175},{"史诗外卡",500},{"传奇外卡",700},{"英雄外卡",1000}};
hero yx[3][9];//英雄
void filin()
{
    ifstream fin("this is your archive.txt");
    fin>>game_num;
    for(int j=0;j<game_num;j++)
    {
        pro n=user[j];
        fin>>n.one>>n.yx_num;
        fin>>n.P>>n.X>>n.S>>n.C>>n.Y;
        fin>>n.LV;
        fin>>n.g>>n.f;
        fin>>n.SP>>n.SC;
        fin>>n.name>>n.cipher;
        for(int i=0;i<9;i++)
        {
            hero a=yx[j][i];
            fin>>a.F>>a.G>>a.lv>>a.NA>>a.sc>>a.sp>>a.k>>a.XI>>a.upk;
            yx[j][i]=a;
        }
        fin>>n.stage_jd;
        fin>>n.glod>>n.exp;
        user[j]=n;
    }
}
void filout()
{
    ofstream fout("this is your archive.txt");
    fout<<game_num<<"\n";
    for(int j=0;j<game_num;j++)
    {
        pro n=user[j];
        fout<<n.one<<" "<<n.yx_num<<" ";
        fout<<n.P<<" "<<n.X<<" "<<n.S<<" "<<n.C<<" "<<n.Y<<" ";
        fout<<n.LV<<endl;
        fout<<n.g<<" "<<n.f<<endl;
        fout<<n.SP<<" "<<n.SC<<endl;
        fout<<n.name<<" "<<n.cipher<<endl;
        for(int i=0;i<9;i++)
        {
            hero a=yx[j][i];
            fout<<a.F<<" "<<a.G<<" "<<a.lv<<" "<<a.NA<<" "<<a.sc<<" "<<a.sp<<" "<<a.k<<" "<<a.XI<<" "<<a.upk<<" ";
            fout<<endl;
        }
        fout<<n.stage_jd<<" ";
        fout<<n.glod<<" "<<n.exp<<"\n";
    }
}
void cpro()
{
    system("cls");
    pro n=user[people];
    cout<<"玩家:"<<n.name<<"\n";
    cout<<"经验等级:"<<n.LV<<"  经验值:"<<n.exp<<"\n";
    cout<<"攻击:"<<n.g<<"  防御:"<<n.f<<"\n";
    cout<<"射程:"<<n.SC<<"  速度:"<<n.SP<<"\n";
    cout<<"金币:"<<n.glod;
    cout<<"\n外卡库:\n";
    cout<<"普通外卡x"<<n.P<<"\n";
    cout<<"稀有外卡x"<<n.X<<"\n";
    cout<<"史诗外卡x"<<n.S<<"\n";
    cout<<"传奇外卡x"<<n.C<<"\n";
    cout<<"英雄外卡x"<<n.Y<<"\n";
    getch();
}
void change()
{
    system("cls");
    gotoxy(40,9);
    cout<<"按R退出";
    gotoxy(40,8);
    cout<<"你要改成什么名字:";
    string v;
    cin>>v;
    if(v=="R") return;
    user[people].name=v;
}
int dis(int ka,int he)
{
    int u;
    cout<<"你有"<<ka<<"张"<<"  ";
    cout<<"你要用几张:";
    cin>>u;
    if(u>ka)
    {
        cout<<"错误!";
        Sleep(500);
        return ka;
    }
    ka-=u;
    yx[people][he].k+=u;
    if(yx[people][he].k>=yx[people][he].upk)
    {
        system("color 06");
        cout<<"\n升级啦!!!";
        Sleep(1000);
        yx[people][he].k-=yx[people][he].upk;
        yx[people][he].lv++;
        yx[people][he].upk=(int)ceil((double)yx[people][he].upk*1.1);
        yx[people][he].G=yx[people][he].G+yx[people][he].G/10;
        yx[people][he].F=yx[people][he].F+yx[people][he].F/10;
        system("color 07");
    }
    return ka;
}
void Hreo()
{
    system("cls");
    for(int i=0;i<user[people].yx_num;i++)
    {
        hero l=yx[people][i];
        cout<<i+1<<".";
        cout<<l.NA<<"LV."<<l.lv<<"  攻:"<<l.G<<"  血:"<<l.F<<"  速:"<<l.sp;
        cout<<"  射程"<<l.sc<<"  碎片:"<<l.k<<"  "<<l.XI<<endl;
    }
    getch();
    cout<<"\n你想升级哪个英雄(-1退出):";
    int t;
    cin>>t;
    t--;
    if(t==-2) return;
    if(t>=user[people].yx_num)
    {
        cout<<"\n错误";
        getch();
        return;
    }
    string x=yx[people][t].XI;
    if(x=="普通") user[people].P=dis(user[people].P,t);
    if(x=="稀有") user[people].X=dis(user[people].X,t);
    if(x=="传奇") user[people].C=dis(user[people].C,t);
    if(x=="史诗") user[people].S=dis(user[people].S,t);
    if(x=="英雄") user[people].Y=dis(user[people].Y,t);
}
int dis2(int op)
{
    cout<<"\n要买多少?";
    int u;
    cin>>u;
    int m=COMM[op].money*u;
    if(m>user[people].glod)
    {
        cout<<"\n金币不够";
        getch();
        return 0;
    }
    user[people].glod-=m;
    return u;
}
void store()
{
    system("cls");
    cout<<"商品:\n";
    for(int i=0;i<5;i++)
    cout<<i+1<<'.'<<COMM[i].name<<":"<<COMM[i].money<<"\n";
    cout<<"\n你要买什么?(-1不买)";
    int a;
    cin>>a;
    if(a==-1) return;
    switch(a)
    {
        case 1:user[people].P+=dis2(0);break;
        case 2:user[people].X+=dis2(1);break;
        case 3:user[people].S+=dis2(2);break;
        case 4:user[people].C+=dis2(3);break;
        case 5:user[people].Y+=dis2(4);break;
    }
}
void print_map(int gk)
{
    system("cls");
    cout<<"  ";
    for(int i=1;i<=9;i++)
    cout<<i<<" ";
    putchar('\n');
    for(int i=1;i<=9;i++)
    {
        cout<<i<<" ";
        for(int j=1;j<=9;j++)
        if(!Map[i][j])
        cout<<". ";
        else cout<<Map[i][j]<<" ";
        putchar('\n');
    }
    printf("\n我方英雄信息:\n");
    for(int i=0;i<user[people].yx_num;i++)
    {
        hero p=yx[people][i];
        printf("%d号:LV.%d %s 攻击%d 血量%d",i+1,p.lv,p.NA.c_str(),p.G,wofang[i+1]);
        printf(" 速度%d 射程%d\n",p.sp,p.sc);
    }
    printf("敌方英雄信息:\n");
    for(int i=user[people].yx_num,j=0;j<STAGE[gk].ensem;i++,j++)
    {
        hero tmp=YX[STAGE[gk].enemy[j]];
        printf("%d号:LV.%d %s 攻击%d 血量%d",i+1,STAGE[gk].d_lv[j],tmp.NA.c_str(),direng[j+1],direnf[j+1]);
        printf(" 速度%d 射程%d\n",tmp.sp,tmp.sc);
    }
}
void memset_map(int gk)
{
    memset(Map,0,sizeof Map);
    for(int i=1;i<=user[people].yx_num;i++)
    Map[1][i]=i;
    for(int i=user[people].yx_num+1,j=1;j<=STAGE[gk].ensem;i++,j++)
    Map[9][j]=i;
    for(int i=1;i<=user[people].yx_num;i++)
    wofang[i]=yx[people][i-1].F;
    for(int i=1;i<=STAGE[gk].ensem;i++)
    {
        int LV=STAGE[gk].d_lv[i-1];
        direng[i]=YX[STAGE[gk].enemy[i-1]].G;
        direnf[i]=YX[STAGE[gk].enemy[i-1]].F;
        for(int j=1;j<LV;j++)
        {
            direng[i]=direng[i]+direng[i]/10;
            direnf[i]=direnf[i]+direnf[i]/10;
        }
    }
}
int diattack(int wsi,int gk)
{
    int tmp[21][3],l=0;
    memset(tmp,0,sizeof(tmp));
    int MINj=0x3f3f3f3f,MINwx,MINwy,MINdx,MINdy,MINd;
    for(int i=1;i<=9;i++)
    for(int j=1;j<=9;j++)
    if(Map[i][j]<=user[people].yx_num&&Map[i][j]!=0)
    {
        tmp[l][0]=i;
        tmp[l][1]=j;
        tmp[l][2]=Map[i][j];
        l++;
    }
    for(int i=0;i<STAGE[gk].ensem;i++)//检测有没有敌人攻击得到的角色
    {
        if(direnf[i+1]<=0)
        continue;
        int bh=user[people].yx_num+i+1;
        int dx,dy;
        for(int j=1;j<=9;j++)
        for(int k=1;k<=9;k++)
        if(Map[j][k]==bh)
        {
            dx=j,dy=k;
            break;
        }
        hero HERO=YX[STAGE[gk].enemy[i]];
        int Sc=HERO.sc,Attack=direng[i+1];
        for(int j=0;j<l;j++)
        {
            int ju=abs(dx-tmp[j][0])+abs(dy-tmp[j][1]);
            if(ju<MINj)
            {
                MINj=ju;
                MINwx=tmp[j][0];
                MINwy=tmp[j][1];
                MINdx=dx;
                MINdy=dy;
                MINd=i;
            }
            if(ju<=Sc)
            {
                wofang[tmp[j][2]]-=Attack;
                if(wofang[tmp[j][2]]<=0)
                {
                    wofang[tmp[j][2]]=0;
                    Map[tmp[j][0]][tmp[j][1]]=0;
                    system("color 0c");
                    cout<<"你的英雄被击杀了!!!";
                    getch();
                    system("color 07");
                    return wsi+1;
                }
                return wsi;
            }
        }
    }
    Map[MINdx][MINdy]=0;
    int xju=MINwx-MINdx,yju=MINwy-MINdy;
    int Sp=YX[STAGE[gk].enemy[MINd]].sp;
    int newx=MINdx,newy=MINdy;
    int X=1,Y=1;
    if(xju<0) xju=-xju,X=-1;
    if(yju<0) yju=-yju,Y=-1;
    if(xju>=Sp)
    {
        newx+=Sp*X;
        Sp=0;
    }
    else
    {
        newx=MINwx;
        Sp-=xju;
    }
    if(yju>=Sp)
    newy+=Sp*Y;
    else
    {
        newy=MINwy-1;
        if(newy==0) newy++,newx--;
        if(newx==0) newx+=2;
    }
    while(Map[newx][newy]&&newx>0)
    newx--;
    while(Map[newx][newy]&&newx<10)
    newx++;
    while(Map[newx][newy]&&newy>0)
    newy--;
    while(Map[newx][newy]&&newy<10)
    newy++;
    Map[newx][newy]=MINd+user[people].yx_num+1;
    return wsi;
}
int myattack(int dsi)
{
    cout<<"\n请输入指令(格式:编号 攻击(G)/移动(Y) 攻击编号几/ 移动到哪个位置(x,y))\n";
    int bh,x,y,gbh,gbh2;
    char op;
    cin>>bh>>op;
    if(wofang[bh]<=0)
    {
        cout<<"他已经死了!";
        getch();
        return dsi;
    }
    bh--;
    int mx,my;
    for(int i=1;i<=9;i++)
    for(int j=1;j<=9;j++)
    if(Map[i][j]==bh+1)
    {
        mx=i,my=j;
        break;
    }
    if(op=='G')
    {
        int dx,dy;
        cin>>gbh;
        gbh2=gbh-user[people].yx_num;
        for(int i=1;i<=9;i++)
        for(int j=1;j<=9;j++)
        if(Map[i][j]==gbh)
        {
            dx=i,dy=j;
            break;
        }
        int ju=abs(my-dy)+abs(mx-dx);
        if(ju>yx[people][bh].sc)
        {
            cout<<"英雄还打不到呢";
            getch();
            return dsi;
        }
        direnf[gbh2]-=yx[people][bh].G;
        if(direnf[gbh2]<=0)
        {
            direnf[gbh2]=0;
            for(int i=1;i<=9;i++)
            for(int j=1;j<=9;j++)
            if(Map[i][j]==gbh)
            {
                Map[i][j]=0;
                break;
            }
            cout<<"\n敌人被击杀了!!!";
            system("color 0c");
            getch();
            system("color 07");
            return dsi+1;
        }
        return dsi;
    }
    if(op=='Y')
    {
        cin>>x>>y;
        if(Map[x][y])
        {
            cout<<"这里有人了~";
            getch();
            return dsi;
        }
        int ju=abs(mx-x)+abs(my-y);
        if(ju>yx[people][bh].sp)
        {
            cout<<"英雄跑不了这么快";
            getch();
            return dsi;
        }
        Map[x][y]=bh+1;
        Map[mx][my]=0;
        return dsi;
    }
}
void chest(int b)
{
    string m=CHEST[b];
    cout<<m<<"宝箱:\n";getch();
    int pu=0,xi=0,sh=0,ch=0,yi=0,ji;
    srand(time(0));
    switch(b)
    {
        case 0:pu=rand()%5+5;xi=rand()%3+2,ji=rand()%200+100;break;
        case 1:pu=rand()%9+5;xi=rand()%4+3,ji=rand()%300+200;break;
        case 2:pu=rand()%9+8;xi=rand()%4+4,sh=rand()%2,ji=rand()%400+300;break;
        case 3:pu=rand()%13+12;xi=rand()%7+8,sh=rand()%3+1,ch=rand()%2,ji=rand()%500+500;break;
        case 4:pu=rand()%20+20;xi=rand()%10+15,sh=rand()%5+3,ch=1,yi=rand()%2,ji=rand()%800+700;break;
    }
    cout<<"恭喜获得:\n";getch();
    cout<<"普通外卡x"<<pu<<"\n";getch();
    cout<<"稀有外卡x"<<xi<<"\n";getch();
    if(sh>0)
    {
        cout<<"史诗外卡x"<<sh<<"\n";
        getch();
    }
    if(ch>0)
    {
        cout<<"传奇外卡x"<<ch<<"\n";
        getch();
    }
    if(yi>0)
    {
        cout<<"英雄外卡x"<<yi<<"\n";
        getch();
    }
    cout<<"金币x"<<ji;getch();
    user[people].P+=pu;
    user[people].X+=xi;
    user[people].S+=sh;
    user[people].C+=ch;
    user[people].Y+=yi;
    user[people].glod+=ji;
}
void fight(int gk)
{
    system("cls");
    memset_map(gk);
    for(int i=0;i<stage_lines[gk].startnum;i++)
    print(stage_lines[gk].startline[i]);
    getch();
    int dsi=0,wsi=0;
    print_map(gk);
    while(true)
    {
        dsi=myattack(dsi);
        print_map(gk);
        if(dsi>=STAGE[gk].ensem)
        {
            system("color 06");
            if(user[people].stage_jd==gk)
            {
            	cout<<"\n游戏胜利!获得奖励"<<STAGE[gk].rewar<<"金币\n";
            	user[people].glod+=STAGE[gk].rewar;
            	user[people].stage_jd=max(user[people].stage_jd,gk+1);
            	chest(STAGE[gk].Chest);
			}
            else cout<<"\n你已经通过关卡了,无法领取奖励!";
            getch();
            system("color 07");
            return;
        }
        wsi=diattack(wsi,gk);
        if(wsi>=user[people].yx_num)
        {
            system("color 0c");
            cout<<"\nGAME OVER!!!";
            getch();
            system("color 07");
            return;
        }
        print_map(gk);
    }
}
void Stage()
{
    system("cls");
    cout<<"进度:第"<<user[people].stage_jd+1<<"关\n";
    for(int i=0;i<Stage_num;i++)
    cout<<i+1<<"."<<STAGE[i].nem<<"\n";
    cout<<"\n你想玩哪一关?(-1退出)";
    int g;
    cin>>g;
    if(g==-1) return;
    g--;
    if(g>user[people].stage_jd)
    {
        cout<<"还没解锁呢!";
        getch();
        Stage();
    }
    fight(g);
}
void conjure()
{
    system("cls");
    cout<<"召唤一个英雄需3000金币\n";
    cout<<"是否召唤(y/n)?";
    char c;
    c=getch();
    if(c=='y')
    {
        if(user[people].glod<3000)
        {
            cout<<"\n金币不够!!";
            getch();
            return;
        }
        user[people].glod-=3000;
        srand(time(0));
        int s=rand()%24;
        cout<<"\n你召唤到了"<<YX[s].XI<<"级的"<<YX[s].NA;
        getch();
        bool p=true;
        p=true;
        for(int i=0;i<user[people].yx_num;i++)
        if(YX[s].NA==yx[people][i].NA)
        {
            p=false;
            break;
        }
        if(!p)
        {
            cout<<"\n因你已有这个英雄了,自动转换为此3000金币\n";
            user[people].glod+=3000;
            getch();
            return;
        }
        if(user[people].yx_num==9)
        {
            cout<<"\n英雄最多只能有9个!\n你可以去掉一个英雄(y/n)";
            cout<<"\n注意:新英雄是从1级开始的。\n";
            char y=getch();
            if(y=='y')
            {
                for(int i=0;i<user[people].yx_num;i++)
                {
                    hero l=yx[people][i];
                    cout<<i+1<<".";
                    cout<<l.NA<<"LV."<<l.lv<<"  攻:"<<l.G<<"  血:"<<l.F<<"  速:"<<l.sp;
                    cout<<"  射程"<<l.sc<<"  碎片:"<<l.k<<"  "<<l.XI<<endl;
                }
                int bh;
                cin>>bh;
                bh--;
                if(bh<0||bh>8)
                {
                    cout<<"错误";
                    getch();
                    return;
                }
                yx[people][bh]=YX[s];
            }
            else user[people].glod+=3000;
            return;
        }
        yx[people][user[people].yx_num++]=YX[s];
    }
}
void login()
{
    system("cls");
    cout<<"1.登录\n2.注册";
    char ch=getch();
    if(ch=='1')
    {
        cout<<"\n请输入你的名字:";
        string NAME,mm;
        cin>>NAME;
        bool p=true;
        for(int i=0;i<game_num;i++)
        if(user[i].name==NAME)
        {
            p=false;
            mm=user[i].cipher;
            people=i;
        }
        if(p)
        {
            cout<<"不好意思,没有找到名字为"<<NAME<<"的用户.";
            getch();
            login();
            return;
        }
        cout<<"请输入密码:";
        string MM;
        cin>>MM;
        if(MM==mm)
        {
            cout<<"密码正确!!!";
            getch();
            return;
        }
        else
        {
            cout<<"密码错误!!!";
            getch();
            login();
            return;
        }
    }
    else
    {
        if(game_num==10)
        {
            cout<<"\n对不起,本游戏暂时最高支持10人游戏\n";
            getch();
            login();
            return;
        }
        cout<<"\n请输入你的名字:";
        string NAME;
        cin>>NAME;
        people=game_num;
        user[game_num].name=NAME;
        cout<<"设置你的密码:";
        cin>>user[game_num].cipher;
        cout<<"OK";
        game_num++;
        getch();
        system("cls");
        system("color 06");
        cout<<"开局大宝箱!!!\n";
        chest(4);
        system("color 07");
        yx[people][0]=YX[0];
        user[people].one=false;
    }
}
bool st[3];
void FIGHT(int db)
{
    system("cls");
    cout<<"该功能2.0出版";
    getch();
}
void online()
{
    memset(st,false,sizeof st);
    char ch;
    int db;
    while(true)
    {
        system("cls");
        while(true)
        {
            cout<<"1.CY自动轰炸系统:";
            if(st[0]) cout<<"开\n";
            else cout<<"关\n";
            cout<<"每回合系统会在随机一个点降下伤害为2000的炸弹,被砸中者扣血,不论敌我\n";
            cout<<"2.随机空投医疗包:";
            if(st[1]) cout<<"开\n";
            else cout<<"关\n";
            cout<<"每回合系统会在随机一个点降下回复为2000的医疗包,被砸中者加血,不论敌我\n";
            cout<<"3.登录对手\n";
            cout<<"4.开始战斗\n5.退出";
            cout<<"请输入指令:\n";
            cout<<"输入1或2开关前两个系统,3登录对手,4开始战斗,5退出:";
            cin>>ch;
            if(ch>='1'||ch<='5')
            break;
            cout<<"\n错误!!!";
            system("cls");
            getch();
        }
        switch(ch)
        {
            case '1':st[0]=!st[0];break;
            case '2':st[1]=!st[1];break;
            case '3':
            {
                cout<<"输入对手名字:";
                string NAME,mm;
                cin>>NAME;
                bool p=true;
                for(int i=0;i<game_num;i++)
                if(user[i].name==NAME)
                {
                    p=false;
                    mm=user[i].cipher;
                    db=i;
                }
                if(p)
                {
                    cout<<"不好意思,没有找到名字为"<<NAME<<"的用户.";
                    getch();
                    break;
                }
                cout<<"请输入密码:";
                string MM;
                cin>>MM;
                if(MM==mm)
                {
                    cout<<"密码正确!!!";
                    getch();
                    st[2]=true;
                    break;
                }
                cout<<"密码错误!!!";
                getch();
                break;
            }
            case '4':
                if(!st[2])
                {
                    cout<<"请先登录对手哟~";
                    getch();
                    break;
                }
                FIGHT(db);return;
            case '5':return;
        }
    }
}
void Cipher()
{
    system("cls");
    gotoxy(40,12);
    cout<<"你想要换成什么密码:(R退出)";
    string mm;
    cin>>mm;
    if(mm=="R") return;
    user[people].cipher=mm;
}
void basic()
{
    system("cls");
    cout<<"1.主角\n2.改名\n3.英雄\n4.商店\n5.关卡\n6.召唤\n7.换号\n";
    cout<<"8.联机\n9.密码\nR.退出\n";
    cout<<"\n注:在本游戏输入数据时,请正常回答。此游戏此方面存在bug,程序崩溃后果自负\n";
    char ch=getch();
    switch(ch)
    {
        case '1':cpro();break;
        case '2':change();break;
        case '3':Hreo();break;
        case '4':store();break;
        case '5':Stage();break;
        case '6':conjure();break;
        case '7':login();break;
        case '8':online();break;
        case '9':Cipher();break;
        case 'R':return;break;
        default:break;
    }
    filout();
    basic();
}
int main()
{
    filin();
    HideCursor();
    Begin();
    login();
    system("cls");
    gotoxy(43,12);
    cout<<"欢迎,"<<user[people].name;
    getch();
    basic();
}