C++游戏讨论

讨论里可以发C++游戏

6 条评论

  • @ 2021-12-25 12:02:56

    p1133zenmexie

  • @ 2021-12-19 12:23:53

    #include <cstdio>
    #include <ctime>
    #include <conio.h>
    #include <windows.h>
    #include <cstdlib>
    #include <cstring>
    using namespace std;
    //==================================================================
    #define hest 100 //跳的速度(点击到最高点有 (250/hest) 秒)
    #define mo 2000 //跳的高度(每次点击跳到最高多 (((1+hest)*hest+hest)/mo) 格)
    #define hei 20 //屏幕高度
    #define wid 13 //屏幕宽度
    #define det v*2-1
    #define gap 5 //柱子间上下的空隙长度
    #define len 3 //柱子的宽度
    #define T 25 //柱子移动时间单位 T t移动一格
    #define TT 500/T //柱子出现频率 TT T出现一个
    //==================================================================
    void color(int a)//颜色函数
    {
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
    }
    void gotoxy(int x,int y)//位置函数(列为x 行为y)
    {
    COORD pos;
    pos.X=2*x;
    pos.Y=hei-y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
    }

    int v,h,hx,hy,t,tt,gg,quit,score,plused,wall[hei+5][wid+len+10];
    /*
    t: 时间基本单位 1t=4ms
    tt: 辅助作用 柱子每 移动T格tt++
    quit 记录是否退出游戏
    plused 辅助用作计分
    wall[i][j] 第 i 行第 j 列的柱子情况(0为空 1为有但还没打印 2为打印过了)
    */

    void reset(){
    system("cls");
    color(4);
    for (int i=0; i<=wid; i++){gotoxy(i,-1); printf("※");}
    gg=0;
    hx=5;
    hy=hei/2;
    h=hy*mo;
    t=0;
    tt=-5;
    v=hest;
    score=0;
    memset(wall,0,sizeof(wall));
    color(14); gotoxy(hx,hy); printf("◎");
    }

    void move_bird(){
    h+=(v*2-1);
    if (h>hei*mo) h=hei*mo;
    if (h/mo!=hy){
    gotoxy(hx,hy); printf(" ");
    hy=h/mo;
    if (hy<0) hy=h=0;//gg=1;
    if (wall[hy][hx]) gg=1;
    gotoxy(hx,hy);
    color(14); printf("◎");
    }
    }

    void move_wall(){
    for (int i=0; i<=hei; i++){
    int k=0,pp=0;
    while (k<wid+5){
    color(2);
    for (; k<=wid+5 && !wall[i][k]; k++);
    if (k+len/2==hx){
    if (!plused) plused=1, score++;
    if (!pp) color(15),pp=1;
    }
    if (k>=0 && wall[i][k]) wall[i][k-1]=1;
    k-=2; if (k<-1) k=-1;
    while (wall[i][++k]){
    if (hx==k && hy==i) gg=1;
    if (k<=wid && wall[i][k]==1){wall[i][k]=2; gotoxy(k,i); printf("█");}
    }
    wall[i][k-1]=0; gotoxy(k-1,i); printf(" ");
    }
    }
    }

    void new_wall(){
    srand(time(NULL));
    int dd=(rand()%(hei-gap-1)+1),uu=dd+gap+1;
    for (int i=1; i<=len; i++) wall[dd][i+wid]=1;
    for (int i=dd-1; i>=0; i--) for (int j=2; j<len; j++) wall[i][j+wid]=1;
    for (int i=1; i<=len; i++) wall[uu][i+wid]=1;
    for (int i=uu+1; i<=hei; i++) for (int j=2; j<len; j++) wall[i][j+wid]=1;
    plused=0;
    }

    void game(){
    while (!gg){
    v--;
    if(kbhit()) {char ch=getch(); v=hest;}
    Sleep(4); t=(t+1)%T;
    if (tt==TT) tt=0, new_wall();
    if (t==0) tt++, move_wall();
    move_bird();
    color(8);
    gotoxy(wid/2,2*hei/3);
    printf("%d",score);
    }
    gotoxy(wid/2,-3); color(15); printf("GG~");
    gotoxy(wid/2-3,-5); printf("final score: %d",score);
    gotoxy(hx,hy); color(12); printf("◎");
    }

    int main(){
    char ch;
    while (ch!='*'){
    reset();
    ch=getch();
    game();
    Sleep(1500);
    while (kbhit()) ch=getch();
    Sleep(1000);
    ch=getch();
    }
    }

  • @ 2021-12-19 12:23:09

    #include<stdlib.h>
    #include<stdio.h>
    #include<time.h> //suiji

    #include<string.h>
    #include<windows.h> //SLEEP函数
    struct Player //玩家结构体,并初始化player
    {
    char name[21];
    int attack;
    int defense;
    int health;
    long int max_health;
    int level;
    int exp;
    int range_exp;
    long int max_exp;
    }player={"勇者",99999999999,99999999999,99999999999,99999999999,99999999999,99999999999,99999999999,99999999999};
    struct Enemy //怪的结构体,并初始化各种怪
    {
    char name[20];
    char wupin[12];
    int attack;
    int defense;
    int health;
    int money;
    long int exp;
    int wupin_sign;
    int wupinpro;
    int double_attack;
    int miss;
    }strongman={"森林巨人","黄金圣衣",40,50,350,200,100,1,2,1,0},
    witch={"森林女巫","银甲",25,15,100,50,50,2,2,1,1},
    xiyi={"森林蜥蜴","铁甲",18,10,50,30,35,3,3,2,2},
    big_strongman={"森林巨人王","巨人之臂",40*5,50*5,50*5,10*5,20*5,4,4,2,0},
    lion={"草原雄狮","绝世好剑",60,30,280,200,100,5,2,1,0},
    horse={"草原野马","碧血剑",28,12,90,50,50,6,2,1,1},
    bee={"草原黄蜂","长剑",17,11,60,30,35,7,3,2,2},
    shitu={"邪恶使徒","\0",6*8,3*8,8*8,2*8,10*8,9,1,1,0},
    guai={"\0","\0",0,0,0,0,0,0,0,0,0};
    struct Place
    {
    int bar,hotel,forest1,forest2,forest3,grass1,grass2,grass3;
    }place={1,2,3,4,5,6,7,8};

    int max_exp=0;
    int choose_number=0,s=0,strongman_arm=0,battle=0,money=500,place_sign=9;
    int cao=3,jijiubao=2,baiyao=2,superbaiyao=1,boom=3,dubiao=2,atom_boom=1;
    int fang=0,fang1=10,fang1n=0,fang2=20,fang2n=0,fang3=40,fang3n=0,fang4=100,fang4n=0;
    int gong=0,gong1=8,gong1n=0,gong2=15,gong2n=0,gong3=25,gong3n=0,gong4=60,gong4n=0;
    char gongname[20]="无",fangname[20]="无";
    char proof;

    void AddWupin(int);
    int AttackResult();
    void BattleAct();
    void ChooseWupin();
    void DisplayState();
    void OrdinaryAct();

    int SuiJi();
    int SuiJi100();
    void WhetherLevelUp();
    void SlowDisplay(char *);

    int main()
    {

    int i=0,j=0,k=0;
    char player_name[21];

    SlowDisplay("这是一个勇者的世界! 雅莉萨斯国的SB罗茜公主被陌生人绑架了!\n\n 伟大的憨憨勇者啊~~拿起你们的武器,营救SB罗茜公主!\n\n\n输入你的名字: (20个字符)\n\n\n");

    // sndPlaySound("res\F005.wav",SND_LOOP);
    scanf("%s",player_name);

    strncpy(player.name,player_name,20);
    if(strcmp(player.name,"EVA初号机")==0)
    {
    SlowDisplay("封印多年的 EVA初号机 啊!你终于可以重见天日了!\n\n\n EVA初号机 重新启动... 随即... 暴走!!!\n\n\n");
    player.attack=999;
    player.defense=999;
    player.health=9999;
    player.max_health=9999;
    }

    getchar();

    OrdinaryAct();
    return 0;
    }

    int SuiJi()
    {
    srand((unsigned)time(NULL));
    return rand()%10;
    }

    int SuiJi100()
    {
    srand((unsigned)time(NULL));
    return rand()%100;
    }

    void ChooseWupin() //选择物品 并使用
    {
    printf("物品: 1,止血草%d个 2,急救包%d个 3,云南白药%d个 4,超级云南白药%d个 5,手雷%d个 6,毒标%d个 7,手抛式原子弹%d个 0,返回\n\n\n",cao,jijiubao,baiyao,superbaiyao,boom,dubiao,atom_boom);
    switch(scanf("%d",&choose_number),choose_number)
    {
    case 1:
    if(cao>0)
    {
    SlowDisplay("使用止血草,HP增加40\n\n\n");
    cao--;
    if(player.health+60>player.max_health)player.health=player.max_health;
    else player.health+=60;
    }
    else SlowDisplay("没有止血草了\n\n\n");
    break;
    case 2:
    if(jijiubao>0)
    {
    SlowDisplay("使用急救包,HP增加60\n\n\n");
    jijiubao--;
    if(player.health+80>player.max_health)player.health=player.max_health;
    else player.health+=80;
    }
    else SlowDisplay("没有急救包了\n\n\n");
    break;
    case 3:
    if(baiyao>0)
    {
    SlowDisplay("使用云南白药,HP增加100\n\n\n");
    baiyao--;
    if(player.health+120>player.max_health)player.health=player.max_health;
    else player.health+=120;
    }
    else SlowDisplay("没有云南白药了\n\n\n");
    break;
    case 4:
    if(superbaiyao>0)
    {
    SlowDisplay("使用超级云南白药,HP增加200\n\n\n");
    superbaiyao--;
    if(player.health+200>player.max_health)player.health=player.max_health;
    else player.health+=200;
    }
    else SlowDisplay("没有超级云南白药了\n\n\n");
    break;
    case 5:
    if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
    {
    if(boom>0)
    {
    SlowDisplay("使用手雷,敌人HP减少60\n\n\n");
    boom--;
    guai.health-=100;
    AttackResult();
    }
    }
    else SlowDisplay("非战斗状态,不能使用手雷!\n\n\n");
    break;
    case 6:
    if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
    {
    if(dubiao>0)
    {
    SlowDisplay("使用毒标,敌人HP减少100\n\n\n");
    dubiao--;
    guai.health-=200;
    AttackResult();
    }
    }
    else SlowDisplay("非战斗状态,不能使用毒标!\n\n\n");
    break;
    case 7:
    if(battle) //在战斗中(battle=1),否则(battle=0)不能使用攻击性物品
    {
    if(atom_boom>0)
    {
    SlowDisplay("使用手抛式原子弹,敌人HP减少500\n\n\n");
    atom_boom--;
    guai.health-=500;
    AttackResult();
    }
    }
    else SlowDisplay("非战斗状态,不能使用手抛式原子弹!\n\n\n");
    break;
    case 0:break;
    default:printf("ChooseWupin error!\n\n\n");
    }
    }
    int AttackResult() //攻击结果:判断是否获胜 是否获得物品 和 是否升级
    {
    if(guai.health<=0)
    {
    battle=0;
    printf("战斗胜利!获得金币%d,经验%d\n\n\n",guai.money,guai.exp);
    player.exp+=guai.exp;
    player.range_exp+=guai.exp;
    money+=guai.money;
    s=SuiJi();
    if(s<guai.wupinpro)
    {
    SlowDisplay("从敌人尸骸中发现");
    printf("%s\n\n\n",guai.wupin);
    AddWupin(guai.wupin_sign);
    }
    WhetherLevelUp();
    if(strcmp(guai.name,"邪恶使徒")==0)
    {
    puts("战斗胜利,救出公主!!!");
    getchar();
    getchar();
    exit(0);
    }
    return 1; //攻击有结果了返回1,否则返回0,用于判断是否继续做战斗行为
    }
    else
    {
    int s=SuiJi();

    if((guai.attack+s-player.defense/3)<0)
    {
    player.health-=1;
    printf("%s反击,你的HP减少了 1\n\n",guai.name);
    }
    else
    {
    player.health-=guai.attack+s-player.defense/3;
    printf("%s反击,你的HP减少了%d\n\n",guai.name,guai.attack+s-player.defense/3);
    }
    if(player.health<0)
    {
    battle=0;
    printf("%s战死!金币掉落%d\n\n\n",player.name,player.level*500);
    money-=player.level*500;
    player.health=player.max_health/5;
    OrdinaryAct();//////////
    return 1;
    }
    }
    return 0;
    }
    void AddWupin(int wupin_sign)
    {

    switch(wupin_sign)
    {
    case 1:fang4n++; break;
    case 2:fang3n++; break;
    case 3:fang2n++; break;
    case 4:strongman_arm=1;break;
    case 5:gong4n++; break;
    case 6:gong3n++; break;
    case 7:gong2n++; break;
    default:printf("AddWupin error\n\n\n");
    }

    }
    void WhetherLevelUp()
    {
    int i=0,j=0;
    int l1=player.range_exp/100;
    int l2=player.range_exp/300;
    int l3=player.range_exp/600;
    if(player.level<=15&&l1>0) //15级以下,经验足够 都满足则升级
    {
    if(l1==1)
    {
    printf("%s",player.name);
    SlowDisplay(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
    player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
    player.attack+=3;
    player.defense+=2;
    player.max_health+=20;
    player.health=player.max_health;
    player.level++;
    player.range_exp=0;
    player.exp=player.max_exp;
    player.max_exp+=100;
    }
    else
    {
    printf("好厉害!连升%d级!",l1);
    printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l1,2*l1,20*l1);
    player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
    player.attack+=3*l1;
    player.defense+=2*l1;
    player.max_health+=20*l1;
    player.health=player.max_health;
    player.level+=l1;
    player.range_exp=0;
    player.exp=player.max_exp;
    player.max_exp+=100*l1;
    }
    }
    else if(player.level<=40&&l2>0)
    {
    if(l2==1)
    {
    printf("%s",player.name);
    SlowDisplay(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
    player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
    player.attack+=3;
    player.defense+=2;
    player.max_health+=20;
    player.health=player.max_health;
    player.level++;
    player.range_exp=0;
    player.exp=player.max_exp;
    player.max_exp+=300;
    }
    else
    {
    printf("好厉害!连升%d级!",l1);
    printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l2,2*l2,20*l2);
    player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
    player.attack+=3*l2;
    player.defense+=2*l2;
    player.max_health+=20*l2;
    player.health=player.max_health;
    player.level+=l2;
    player.range_exp=0;
    player.exp=player.max_exp;
    player.max_exp+=300*l2;
    }
    }
    else if(l3>0)
    {
    if(l3==1)
    {
    printf("%s",player.name);
    SlowDisplay(" 升级!\n\n\n攻击力+3, 防御力+2, HP上限+20\n\n\n");
    player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
    player.attack+=3;
    player.defense+=2;
    player.max_health+=20;
    player.health=player.max_health;
    player.level++;
    player.range_exp=0;
    player.exp=player.max_exp;
    player.max_exp+=600;
    }
    else
    {
    printf("好厉害!连升%d级!",l1);
    printf("攻击力+%d, 防御力+%d, HP上限+%d\n\n\n",3*l3,2*l3,20*l3);
    player.exp=player.exp+guai.exp-(player.exp+guai.exp)%100;
    player.attack+=3*l3;
    player.defense+=2*l3;
    player.max_health+=20*l3;
    player.health=player.max_health;
    player.level+=l3;
    player.range_exp=0;
    player.exp=player.max_exp;
    player.max_exp+=600*l3;
    }
    }
    }
    void OrdinaryAct() //正常行为菜单(移动,物品,对话,查看状态,装备,退出游戏)
    {

    while(1)
    {
    // (1000);
    // system("cls");
    puts("=============================================================================");
    printf("要做什么?\n\n\n 1,移动 2,道具 3,对话 4,查看状态 5,装备 0,退出游戏\n\n\n");
    puts("=============================================================================");
    switch(scanf("%d",&choose_number),choose_number)
    {
    case 1: //显示移动菜单
    SlowDisplay("要去哪里?\n\n\n");
    printf("1,酒吧 2,旅馆 3,森林一层 4,森林二层 5,森林三层 6,草原一层 7,草原二层 8,草原三层\n\n\n");
    switch(scanf("%d",&choose_number),choose_number)
    {
    case 1:place_sign=place.bar; //记录目前位置-酒吧
    // OrdinaryAct();
    break;
    case 2:place_sign=place.hotel; //进入旅店
    SlowDisplay("要住店吗? 200个金币 1,是 0,否\n\n\n");
    choose_number=1;
    switch(scanf("%d",&choose_number),choose_number)
    {
    case 1:if(money-200<0) //判断钱是否够
    {
    SlowDisplay("Sorry,你的钱不够~\n\n\n");
    }
    else
    {
    SlowDisplay("好好休息\n\tHP满\n\t\t第二天了\n\n");
    money-=200; //花费200住店费
    player.health=player.max_health; //体力满
    }
    break;
    case 0:SlowDisplay("下次再来!\n\n\n");break;
    default:printf("hotel talk error!\n\n\n");
    }
    place_sign=0;
    break;
    case 3:
    place_sign=place.forest1;
    s=SuiJi();
    if(s<7)
    {
    battle=1;
    guai=xiyi;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else if(s<9)
    {
    battle=1;
    guai=witch;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else
    {
    SlowDisplay("这里安全\n\n\n");
    //不用调用OAct函数,会自动执行OAct函数;
    }
    break;
    case 4:
    place_sign=place.forest2;
    s=SuiJi();
    if(s<7)
    {
    battle=1;
    guai=witch;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else if(s<9)
    {
    battle=1;
    guai=strongman;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else
    {
    SlowDisplay("这里安全\n\n\n");
    }
    break;
    case 5:
    place_sign=place.forest3;
    s=SuiJi();
    if(s<7)
    {
    battle=1;
    guai=strongman;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else if(s<9)
    {
    battle=1;
    guai=big_strongman;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else
    {
    SlowDisplay("这里安全\n\n\n");
    }
    break;
    case 6:
    place_sign=place.grass1;
    s=SuiJi();
    if(s<7)
    {
    battle=1;
    guai=bee;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else if(s<9)
    {
    battle=1;
    guai=horse;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else
    {
    SlowDisplay("这里安全\n\n\n");
    }
    break;
    case 7:
    place_sign=place.grass2;
    s=SuiJi();
    if(s<7)
    {
    battle=1;
    guai=horse;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else if(s<9)
    {
    battle=1;
    guai=lion;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else
    {
    SlowDisplay("这里安全\n\n\n");
    }
    break;
    case 8:
    place_sign=place.grass3;
    s=SuiJi();
    if(s<7)
    {
    battle=1;
    guai=lion;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else if(s<9)
    {
    battle=1;
    if(strongman_arm)
    {
    SlowDisplay("神秘脑残老人:\n\n\n 哈哈,年轻人,做的不错,不过...嘿嘿,你上当啦!巨人之臂我要了,公主你也别想带走!\n\n\n");
    guai=shitu;
    printf("%s扑了过来!\n\n\n",guai.name);
    BattleAct();
    }
    else SlowDisplay("神秘脑残老人:\n\n\n 年轻人,你好啊.如果你有巨人之臂,我可以告诉你公主的下落哦~\n\n\n");
    }
    else
    {
    SlowDisplay("这里安全\n\n\n");
    }
    break;
    default:printf("choose map error!\n\n\n");
    }
    break;
    case 2: ChooseWupin();break; //显示道具,并可以使用.
    case 3: //对话选项
    if(place_sign==place.bar)
    {
    SlowDisplay("要和谁说话?\n\n\n1,红发女郎(精神病形态) 2,SB猎人 3,智障酒吧老板\n\n\n"); //显示对话人物
    switch(scanf("%d",&choose_number),choose_number)
    {
    case 1:
    SlowDisplay("红发女郎(精神病形态):\n\n\n 吧台边那个Hunter好帅啊!(~脸红~)\n\n\n听说他经常外出打猎,外面的路他应该很熟悉的!\n\n\n");
    break;
    case 2:
    if(fang1n<1&&gong1n<1)
    {
    SlowDisplay("SB猎人:\n\n\n 你要救公主啊!好胆量!\n\n\n 不过外面的丛林和草原很险恶,而且越深越危险,这是匕首和布衣,对你会有些帮助的,拿去吧!\n\n\n");
    printf("%s心想:(哇,这位大叔人真好啊!\n\n\n)",player.name);
    gong1n++;
    fang1n++;
    }
    else SlowDisplay("SB猎人:\n\n\n 加油吧,年轻人!\n\n\n 不要被外面丛林和草原所吓倒!\n\n\n");
    break;
    case 3:
    printf("要喝点什么?\n\n\n 1,二锅头25金币 HP+20 2,XO酒80金币 HP+50 3,人头马面150金币 HP+100 0,返回\n\n\n");
    choose_number=1;
    while(choose_number)
    {
    switch(scanf("%d",&choose_number),choose_number)
    {
    case 1:if(money<25)
    {
    SlowDisplay("钱不够!");
    }
    else
    {
    if(player.health+20<=player.max_health)
    {
    SlowDisplay("HP+20.");
    money-=25;
    player.health+=20;
    }
    else
    {
    SlowDisplay("HP满了");
    player.health=player.max_health;
    }
    }
    break;
    case 2:if(money<80)
    {
    SlowDisplay("钱不够!");
    }
    else
    {
    if(player.health+50<=player.max_health)
    {
    SlowDisplay("HP+50.");
    money-=80;
    player.health+=50;
    }
    else
    {
    SlowDisplay("HP满了");
    player.health=player.max_health;
    }
    }
    break;
    case 3:if(money<150)
    {
    SlowDisplay("钱不够!");
    }
    else
    {
    if(player.health+100<=player.max_health)
    {
    SlowDisplay("HP+100.");
    money-=150;
    player.health+=100;
    }
    else
    {
    SlowDisplay("HP满了");
    player.health=player.max_health;
    }
    }
    break;
    case 0:SlowDisplay("下次在来!\n");break;
    default:SlowDisplay("输入错误\n\n\n");
    }
    }
    }
    }
    else if(place_sign==place.hotel)
    SlowDisplay("“老板娘!我...”\n\n\n“我忙着呢,没空理你~”\n\n\n");
    else SlowDisplay("这里好像没人可以聊天\n\n\n");
    break;
    case 4: DisplayState(); break; //显示状态
    case 5: //装备
    printf("攻装: 1,匕首:%d个 2,长剑:%d个 3,碧血剑:%d个 4,绝世好剑:%d个\n\n\n",gong1n,gong2n,gong3n,gong4n);
    printf("防装: 5,布衣:%d个 6,铁甲:%d个 7,银甲:%d个 8,黄金圣衣:%d个\t\t0,返回\n\n\n",fang1n,fang2n,fang3n,fang4n);
    SlowDisplay("选择要装备的武器或防具:\n\n\n");
    switch(scanf("%d",&choose_number),choose_number)
    {
    case 1:if(gong1n>=1)
    {
    SlowDisplay("拿起了匕首\n\n\n");
    gong=gong1;
    strcpy(gongname,"匕首");
    }
    else SlowDisplay("你没有匕首可以装备\n\n\n");
    break;
    case 2:if(gong2n>=1)
    {
    SlowDisplay("拿起了长剑\n\n\n");
    gong=gong2;
    strcpy(gongname,"长剑");
    }
    else SlowDisplay("你没有长剑可以装备\n\n\n");
    break;
    case 3:if(gong3n>=1)
    {
    SlowDisplay("拿起了碧血剑\n\n\n");
    gong=gong3;
    strcpy(gongname,"碧血剑");
    }
    else SlowDisplay("你没有碧血剑可以装备\n\n\n");
    break;
    case 4:if(gong4n>=1)
    {
    SlowDisplay("拿起了绝世好剑\n\n\n");
    gong=gong4;
    strcpy(gongname,"绝世好剑");
    }
    else SlowDisplay("你没有绝世好剑可以装备\n\n\n");
    break;
    case 5:if(fang1n>=1)
    {
    SlowDisplay("穿上了布衣\n\n\n");
    fang=fang1;
    strcpy(fangname,"布衣");
    }
    else SlowDisplay("你没有布衣可以装备\n\n\n");
    break;
    case 6:if(fang2>=1)
    {
    SlowDisplay("穿上了铁甲\n\n\n");
    fang=fang2;
    strcpy(fangname,"铁甲");
    }
    else SlowDisplay("你没有铁甲可以装备\n\n\n");
    break;
    case 7:if(fang3n>=1)
    {
    SlowDisplay("穿上了银甲\n\n\n");
    fang=fang3;
    strcpy(fangname,"银甲");
    }
    else SlowDisplay("你没有银甲可以装备\n\n\n");
    break;
    case 8:if(fang4n>=1)
    {
    SlowDisplay("穿上了黄金圣衣\n\n\n");
    fang=fang4;
    strcpy(fangname,"黄金圣衣");
    }
    else SlowDisplay("你没有黄金圣衣可以装备\n\n\n");
    break;
    case 0:SlowDisplay("未更换装备\n\n\n");break;
    default:printf("change error!");
    }
    break;
    case 0:
    SlowDisplay("确定推出游戏?(Y/N)\n\n\n");
    getchar();
    proof=getchar();
    if(proof=='y'||proof=='Y')
    {
    SlowDisplay("数据存储中...");
    //向文件中更新数据;
    getchar();
    SlowDisplay("按回车退出");
    getchar();
    return;
    }
    else if(proof=='n'||proof=='N')printf("继续游戏!\n\n\n");
    else SlowDisplay("继续!\n\n\n");
    break;
    default:SlowDisplay("输入错误!\n\n\n");
    }
    }
    }
    void DisplayState()
    {
    printf("%s 攻击力:%d+%d=%d 防御力:%d+%d=%d HP:%d/%d \n\n\n",player.name,player.attack,gong,player.attack+gong,player.defense,fang,player.defense+fang,player.health,player.max_health);
    printf("武器: %s 防具: %s \n\n\n",gongname,fangname);
    printf("等级:%d 经验:%d/%d 还需要%d经验升级 金币:%d \n\n\n",player.level,player.exp,player.max_exp,player.max_exp-player.exp,money);
    }
    void BattleAct()
    {
    while(1)
    {
    puts("=============================================================================");
    printf("要怎么办?\n\n\n 1,攻击 2,物品 3,查看状态 4,逃跑\n\n\n");
    switch(scanf("%d",&choose_number),choose_number)
    {
    case 1:
    s=SuiJi();
    printf("%s攻击! %sHP减少%d\n\n\n",player.name,guai.name,player.attack+s+gong-guai.defense/3);
    guai.health-=player.attack+s+gong-guai.defense/3;
    if(AttackResult())return; //如果攻击有结果(敌人或玩家战死)退出函数
    else continue;
    case 2: ChooseWupin();break; //选择物品,可以使用,战斗中允许使用攻击性物品
    case 3:DisplayState();break; //显示状态
    case 4:
    s=SuiJi();
    if(s<4) //40%的概率可以逃跑
    {
    printf("%s逃跑了~\n\n\n",player.name);
    battle=0;
    return;
    }
    else printf("%s逃跑失败!\n\n\n",player.name);
    break;
    default:SlowDisplay("输入错误,重新输入!\n\n\n");
    }
    }
    }
    void SlowDisplay(char *p)
    {
    while(1)
    {
    if(*p!=0)
    printf("%c",*p++);
    else
    break;
    Sleep(100);
    }
    }

  • @ 2021-12-19 12:22:40

    我也是

  • @ 2021-12-18 20:19:36

    游戏我那多的是

  • @ 2021-12-18 20:19:15

    #include<bits/stdc++.h>//头文件
    #include<windows.h>//头文件
    #include <conio.h>
    #include <cstdio>
    #include <fstream>

    void xiaozhen();
    void wuqidian();//武器店
    void yaopindian();//药品店
    void maoxian();//冒险
    void daguai();//大怪
    void xiaoguai();//小怪
    void shixuepangzi();//嗜血胖子
    void BOOS(); //boos
    void zhuangtai();//状态
    void ziliao();//资料
    void jiangli();//奖励
    void tanbao();//探宝
    void ronglu();//熔炉
    void gongjiangtai();//工匠台
    void fenjiecailiao();//奖励分解材料
    void jijia(); //制作机甲
    void cailiaoshangren();//材料商人
    void wuqizhizuo();//武器制作
    void juntuanzhaomu();
    void start1();//开始界面
    void start2();//开始界面
    void shangdian();//商店
    void gongzuoshi();//
    void chenjiu();
    void swcd();
    void dqcd();
    void xcd();
    void xuefu();
    void zhiyewuqi();

    char a[14][100]= {"| R资源 X大怪 F小大怪 O入口 0你的位置 H分解材料 @传送门 |",
    "| |",
    "| |X-R-F|-X--FH-X---X-F-H-F-H--| |-F|-F--H-| |",
    "| H | | |-F|FH-| | | |",
    "| X |-H--X--|FF-R| |-F-| | |-F--H-| |",
    "| |--R--| | |--H-X| |-F|-H-| |--@|",
    "| O0-| |R-FF| |-F-|-F| | |-F-H--| |",
    "| F--F|--F-H-F--| |-F-H| | | | | |",
    "| X | | | | |FH|-F|-H-|-F--H-| |",
    "| H |-X--R-|-X--F-R-|--F-F--H| | | |",
    "| F | R F HHFFFHFF-| |",
    "| RFRF|X---H---X--F-R-|-X-F-HF-RHF|-FHFH |",
    "| |"};

    char b[14][100]= {"|R资源 F小大怪 Q嗜血胖子 H分解材料 G吸血蝙蝠 K路障 |",
    "| |",
    "| |-FH-FHF-HF-R-RG-F--Q--F-G-F-RFQ-F--GF-RQ-G-H-R |",
    "| 返回 F K Q | | |",
    "| | | HGRR RGFFF QQRRG ------ R ----GQHQ ----| |",
    "| | R G G-GR GG F -QGGF ------- ----- ----| |",
    "| O0-|-R-G | QQ F --QFF ----------------------| |",
    "| R GG-G-GR Q F HH--- ------- -----------| |",
    "| | G |GGR - RH--- ------ KHHK ----------| |",
    "| Q H-GRG-R --G--Q G ------- KRRRRK ---------| |",
    "| F K | ----- KRHHHHRK --------| |",
    "| |-H-R-Q-Q-Q-G-Q--G--R ----- KRHHHHHHRK -------| |",
    "| 怪物宝藏区 |"};
    int x=6,y=5,z=6,l=4;
    int baoci=0;
    int bao=0;

    int tj=0,dj=0;
    bool xxgj=0,xgj=0,xhs=0,xtk=0,xxj=0;
    int shengming=4000,shanghai=1234124312,fangyu=11111,jinbi=999900,jingyan=100,shengmingf=999999999;//主角资料
    int Xzj=0;//机甲
    int Zzj=0;
    int Xsj=0;
    int huo=0,jijiubao=5;//药品
    int tiekuai=0;//材料
    int fenjie=0;//材料
    int jingkuai=0;//材料
    int yuansujingkuai=0;//材料
    int tdjh=0;//天地精华
    int spzx=0;//审判之心
    int bykj=0;
    int sy=0,yy=0;
    int zhiye=0;
    int boosdj=1;
    int emzx=0;
    int tsd=0;
    int xsd=0;
    int spj=0;

    int vip=0;

    int c[1000];

    int xhp,xsh,xjb,xdj,xfy;//小怪
    int dhp,dsh,djb,ddj,dfy;//大怪
    int boosHP=30000,boosSH,boosfy;//BOOS

    using namespace std;

    void dqcd()
    {
    ifstream infile; //输入流
    ofstream outfile; //输出流
    int i=1;
    infile.open("存档.txt");
    while (!infile.eof()&&i<=33) // 若未到文件结束一直循环
    {
    infile >> c[i];
    i++;

    }
    tj=c[1];
    dj=c[2];
    xxgj=c[3];
    xgj=c[4];
    xtk=c[5];
    xxj=c[6];
    shengming=c[7];
    shanghai=c[8];
    fangyu=c[9];
    jinbi=c[10];
    jingyan=c[11];
    shengmingf=c[12];
    Xzj=c[13];
    Zzj=c[14];
    Xsj=c[15];
    huo=c[16];
    jijiubao=c[17];
    tiekuai=c[18];
    fenjie=c[19];
    jingkuai=c[20];
    yuansujingkuai=c[21];
    tdjh=c[22];
    spzx=c[23];
    bykj=c[24];
    sy=c[25];
    yy=c[26];
    zhiye=c[27];
    boosdj=c[28];
    xhs=c[29];
    emzx=c[30];
    tsd=c[31];
    xsd=c[32];
    spj=c[33];
    }
    void swcd()
    {
    ofstream outfile[3];//创建一个ofstream对象
    c[1]=tj;
    c[2]=dj;
    c[3]=xxgj;
    c[4]=xgj;
    c[5]=xtk;
    c[6]=xxj;
    c[7]=shengming;
    c[8]=shanghai;
    c[9]=fangyu;
    c[10]=jinbi;
    c[11]=jingyan;
    c[12]=shengmingf;
    c[13]=Xzj;
    c[14]=Zzj;
    c[15]=Xsj;
    c[16]=huo;
    c[17]=jijiubao;
    c[18]=tiekuai;
    c[19]=fenjie;
    c[20]=jingkuai;
    c[21]=yuansujingkuai;
    c[22]=tdjh;
    c[23]=spzx;
    c[24]=bykj;
    c[25]=sy;
    c[26]=yy;
    c[27]=zhiye;
    c[28]=boosdj;
    c[29]=xhs;

    c[30]=emzx;
    c[31]=tsd;
    c[32]=xsd;
    c[33]=spj;
    outfile[0].open("存档.txt");//创建txt
    for(int i=1;i<=33;i++)
    outfile[0]<<c[i]<<endl;
    }
    int main()
    {
    start1();
    if(zhiye==0)
    start2();
    system("cls");
    cout<<"千万不能输入字母或特殊符号,探宝WASD移动"<<endl;
    Sleep(1000);
    system("cls");
    xiaozhen();
    }
    void start1()
    {
    int f=0;
    cout<<" [小镇5.3.0怪物狂欢季]\n";
    cout<<"-------------------------------------------------------------------------------\n" ;
    cout<<"请输入账号(没有请随便输入)";
    string a,b;
    cin>>a;
    cout<<endl<<"请输入密码(没有请随便输入)";
    cin>>b;
    if(a=="波斯顿大龙虾"&&b=="绿色健康小清新")
    {
    cout<<">>波斯顿大龙虾<< VIP2 玩家,欢迎你"<<endl;
    vip=2;
    }
    if(a=="200575"&&b=="75")
    {
    cout<<"尊贵的VIP8玩家"<<endl;
    vip=8;
    }
    if(a=="MC"&&b=="元气")
    {
    cout<<">>MC<< VIP 3 玩家,欢迎你"<<endl;
    vip=3;
    }
    int l;
    cout<<"输入 1 读取存档"<<endl;
    cout<<"输入 2 开始新的一局"<<endl;
    cin>>l;
    if(l==1)
    {
    //dqcd();
    if(zhiye==0&&f==0)
    cout<<"普通玩家你好,检测到你没有存档以为你重新开始一局"<<endl;
    if(vip==2&&zhiye==0)
    {
    cout<<"尊敬的>>波斯顿大龙虾<< VIP2 玩家,检测到当前您没有存档,以为你重新开始一局(VIP2礼包)"<<endl;
    vip=2;
    }
    if(vip==3&&zhiye==0)
    {
    cout<<"尊敬的>>MC<< VIP3 玩家,检测到当前您没有存档,以为你重新开始一局(VIP3礼包)"<<endl;
    vip=3;
    }
    Sleep(3000);
    }
    system("cls");
    }
    void start2()
    {
    cout<<" [小镇5.3.0怪物狂欢季]\n";
    cout<<"-------------------------------------------------------------------------------\n" ;
    cout<<" 请选择职业"<<endl;
    cout<<" 1.战士"<<endl
    <<" 生命:5000 伤害:50 防御:20 "<<endl
    <<" 技能:MAX斩,对怪造成 伤害*2的 伤害无视防御"<<endl
    <<" 注:对BOOS防御有效 但造成 伤害*3 的伤害"<<endl<<endl;
    cout<<" 2.狂热的血战士"<<endl
    <<" 生命:4000 伤害:100 防御:10 "<<endl
    <<" 技能:血神盾,无敌三回合 "<<endl<<endl;
    cout<<" 3.天使"<<endl
    <<" 生命:6000 伤害:60 防御:50"<<endl
    <<" 技能:天使救赎与惩戒,恢复500血,并造成 100*怪物等级 伤害,冷却10回合"<<endl;
    int l;
    cin>>l;
    if(l==1)
    {
    shengming=5000,shanghai=50,fangyu=20,jinbi=150,jingyan=100,shengmingf=999999999;//主角资料
    zhiye=1;
    if(vip==3)
    {
    shanghai+=50;
    fangyu+=60;
    tiekuai+=50;
    fenjie+=100;
    jinbi+=400;
    Xzj=1;
    }
    if(vip==2)
    {
    shanghai+=50;
    fangyu+=50;
    jinbi+=300;
    Xzj=1;
    }
    if(vip==8)
    {
    shengming=20000,shanghai=2000,fangyu=2000,jinbi=999900,jingyan=99999,shengmingf=999999999;//主角资料
    jijiubao=100;
    Xsj=1;
    tiekuai=99999;//材料
    fenjie=5;//材料
    jingkuai=99999;//材料
    yuansujingkuai=99999;//材料
    tdjh=0;
    spzx=0;
    tj=1;
    dj=1;
    }
    }
    else if(l==2)
    {
    shengming=4000,shanghai=100,fangyu=10,jinbi=150,jingyan=0,shengmingf=999999999;//主角资料
    zhiye=2;
    if(vip==3)
    {
    shanghai+=50;
    fangyu+=60;
    tiekuai+=50;
    fenjie+=100;
    jinbi+=400;
    Xzj=1;
    }
    if(vip==2)
    {
    shanghai+=50;
    fangyu+=50;
    jinbi+=300;
    Xzj=1;
    }
    if(vip==8)
    {
    shengming=20000,shanghai=2000,fangyu=2000,jinbi=999900,jingyan=99999,shengmingf=999999999;//主角资料

    jijiubao=100;
    Xsj=1;
    tiekuai=99999;//材料
    fenjie=5;//材料
    jingkuai=99999;//材料
    yuansujingkuai=99999;//材料
    tdjh=0;
    spzx=0;
    tj=1;
    dj=1;
    }
    }
    else
    {
    shengming=6000,shanghai=60,fangyu=50,jinbi=100,jingyan=0,shengmingf=999999999;//主角资料
    zhiye=3;
    if(vip==3)
    {
    shanghai+=50;
    fangyu+=60;
    tiekuai+=50;
    fenjie+=100;
    jinbi+=400;
    Xzj=1;

    }
    if(vip==2)
    {
    shanghai+=50;
    fangyu+=50;
    jinbi+=300;
    Xzj=1;
    }
    if(vip==8)
    {
    shengming=20000,shanghai=2000,fangyu=2000,jinbi=999900,jingyan=99999,shengmingf=999999999;//主角资料

    jijiubao=100;
    Xsj=1;
    tiekuai=99999;//材料
    fenjie=5;//材料
    jingkuai=99999;//材料
    yuansujingkuai=99999;//材料
    tdjh=0;
    spzx=0;
    tj=1;
    dj=1;
    }
    }
    }
    void xiaozhen()
    {
    swcd();
    int i=0,n=0,l=1;
    while (l)
    {

    system("cls");
    cout<<" [小镇5.3.0怪物狂欢季]\n";
    cout<<"-------------------------------------------------------------------------------\n" ;
    cout<<"输入 1 冒险"<<endl;
    cout<<"输入 2 探宝"<<endl;
    cout<<"输入 3 商店"<<endl;
    cout<<"输入 4 工作室"<<endl;
    cout<<"输入 5 查看自己状态"<<endl;
    cout<<"输入 6 查看游戏资料"<<endl;
    cout<<"输入 7 查看成就"<<endl;
    cout<<"输入 8 存档(没事按按)"<<endl;
    cout<<"输入 0 结束游戏"<<endl;
    cin>>l;
    switch(l)
    {
    case 1:
    cout<<"-------------------------------------------------------------------------------\n" ;
    maoxian();
    if(Xzj==2)
    {

    shanghai-=300;
    Xzj=1;
    }
    else if(Zzj==2)
    {
    shanghai-=500;
    Zzj=1;
    }
    else if(Xsj==2)
    {
    shanghai-=500;
    Xsj=1;
    }
    if(shengming>shengmingf)
    {
    shengming=shengmingf;
    cout<<"机甲增幅已解除"<<endl;
    Sleep(750);
    }
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 2:
    cout<<"-------------------------------------------------------------------------------\n" ;
    tanbao();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 3:
    cout<<"-------------------------------------------------------------------------------\n" ;
    shangdian();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 4:
    cout<<"-------------------------------------------------------------------------------\n" ;
    gongzuoshi();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 5:
    cout<<"-------------------------------------------------------------------------------\n" ;
    zhuangtai();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 6:
    cout<<"-------------------------------------------------------------------------------\n" ;
    ziliao();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 7:
    cout<<"-------------------------------------------------------------------------------\n" ;
    chenjiu();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 8:
    //swcd();
    break;
    case 0:
    //swcd();
    break;
    default:
    cout<<"不要乱输入"<<endl;
    }
    if(Xzj==2)
    {
    shanghai-=300;
    Xzj=1;
    }
    else if(Zzj==2)
    {
    shanghai-=500;
    Zzj=1;
    }
    else if(Xsj==2)
    {
    shanghai-=500;
    Xsj=1;
    }
    if(shengming>shengmingf)
    {
    shengming=shengmingf;
    cout<<"机甲增幅已解除"<<endl;
    Sleep(750);
    }
    if(shengming<=0)
    {
    cout<<"你死了"<<endl;
    return ;
    }
    }
    }
    void maoxian()
    {
    //
    int i=0,n=0,l=1,f1=1;
    if(Zzj==1||Xzj==1||Xsj==1)
    {
    while(n!=1&&n!=2&&n!=3&&f1)
    {
    cout<<"请选择作战机甲"<<endl;
    cout<<"输入 1 选择X原型机"<<endl;
    cout<<"输入 2 选择Z原型机"<<endl;
    cout<<"输入 3 选择X射线机"<<endl;
    cin>>n;
    if(n==1&&Xzj==1)
    {
    Xzj=2;
    cout<<"你已选择X原型机"<<endl;
    shengmingf=shengming;
    shengming+=500;
    shanghai+=200;
    f1=0;
    Sleep(750);
    }
    else if(n==2&&Zzj==1)
    {
    Zzj=2;
    cout<<"你已选择Z原型机"<<endl;
    shengmingf=shengming;
    shengming+=300;
    shanghai+=500;
    f1=0;
    Sleep(750);
    }
    else if(n==3&&Xsj==1)
    {
    Xsj=2;
    cout<<"你已选择X射线机"<<endl;
    shengmingf=shengming;
    shengming+=500;
    shanghai+=700;
    f1=0;
    Sleep(750);
    }
    else
    {
    cout<<"请选择有效机甲"<<endl;
    f1=1;
    }
    }
    }
    while(l)
    {
    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;
    if(baoci>10||jingyan/100>7)
    {
    cout<<"*远古骷髅已增强*"<<endl;
    }
    if(baoci>20||jingyan/100>10)
    {
    cout<<"*远古骑士已增强*"<<endl;
    }
    cout<<"输入 1 打远古骷髅"<<endl;
    cout<<"输入 2 打远古骑士"<<endl;
    cout<<"输入 3 打远古凶兽"<<endl;
    cout<<"输入 4 打吸血蝙蝠"<<endl;
    cout<<"输入 5 打上古异体"<<endl;
    cout<<"输入 0 返回小镇"<<endl;
    cin>>l;
    switch(l)
    {
    case 1:
    cout<<"-------------------------------------------------------------------------------\n" ;
    xiaoguai();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 2:
    cout<<"-------------------------------------------------------------------------------\n" ;
    daguai();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 3:
    cout<<"-------------------------------------------------------------------------------\n" ;
    shixuepangzi();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 4:
    cout<<"-------------------------------------------------------------------------------\n" ;
    xuefu();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 5:
    cout<<"-------------------------------------------------------------------------------\n" ;
    BOOS();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 0:
    break;
    default:
    cout<<"不要乱输入"<<endl;
    Sleep(750);
    cout<<"-------------------------------------------------------------------------------\n" ;
    }
    }
    }
    void zhuangtai()
    {
    system("cls");
    cout<<"你的生命为:"<<shengming<<endl;
    cout<<"你的金币为:"<<"$"<<jinbi<<endl;
    cout<<"你的防御为:"<<fangyu<<endl;
    cout<<"你的伤害为:"<<shanghai<<endl;
    cout<<"你的经验为(100经验=1级):"<<jingyan<<endl;
    cout<<"你的等级为:"<<jingyan/100<<endl;
    cout<<"你拥有的急救包数"<<jijiubao<<endl;
    cout<<"技能MAX斩(无敌,造成2*伤害,boos*3) "<<endl;
    cout<<"分解材料:"<<fenjie<<endl;
    cout<<"铁块:"<<tiekuai<<" 晶块:"<<jingkuai<<" 元素晶块"<<yuansujingkuai<<endl;
    cout<<"天地精华:"<<tdjh<<" 审判之心:"<<spzx<<endl;
    int f=1 ;
    cout<<"机甲仓库:"<<endl;
    if(Xzj==1)
    {
    cout<<"X原型机"<<endl;

    f=0;
    }
    if(Zzj==1)
    {
    cout<<"Z原型机"<<endl;
    f=0;
    }
    if(Xsj==1)
    {
    cout<<"x射线机"<<endl;
    f=0;
    }
    if(f)
    {
    cout<<"暂无机甲"<<endl;
    }
    cout<<endl;
    cout<<"返回小镇";
    system("pause");
    }
    void xiaoguai()
    {
    // swcd();
    int wudi=0;
    if(shengming<=0)
    {
    return xiaoguai();
    }
    int i=1,n=0,l=1,lengque=0,xsp=0,xbj=0,jn=1;
    int flag=9999;
    int r,w;
    int bj=2;
    srand(static_cast<unsigned int >(time(0))) ;
    int randomNumber=rand();
    xdj=(randomNumber% 5)+1;

    xhp=xdj*100+200;
    xsh=xdj*100;
    xfy=xdj*40;
    xsp=xdj*5;
    xbj=10;
    if(jingyan/100>=20)
    {
    cout<<"<超级>远古骷髅,小心!!!!"<<endl;
    xhp+=700;
    xsh+=400;
    xfy+=200;
    xhp+=400;
    xsh+=200;
    xfy+=100;
    xsp+=10;
    bj=3;
    jn=3;
    flag=(randomNumber% 100)+1;
    if(flag<=20&&xdj==5)
    {
    cout<<"此怪为BUG远古骷髅!!!!已超进化"<<endl;
    xhp+=1000;
    xsh+=500;
    xfy+=400;
    xbj=20;
    }
    }
    else if(jingyan/100<20&&jingyan/100>=10)
    {
    cout<<"<精英>远古骷髅,小心!!!!"<<endl;
    xhp+=400;
    xsh+=200;
    xfy+=100;
    xsp+=5;
    bj=2;
    jn=2;
    }
    if(Xzj==2||Zzj==2||Xsj==2)
    {
    cout<<"你已得到机甲增幅!!"<<endl;
    }
    cout<<"你面对的是"<<xdj<<"级远古骷髅,伤害"<<xsh<<"生命:"<<xhp<<"防御:"<<xfy<<endl
    <<"闪避几率:"<<xsp<<endl
    <<"暴击几率:"<<xbj<<endl
    <<"是否迎战,迎战 1,逃跑 0"<<endl;
    if(bao==1)
    {
    cout<<"探宝情况下不能逃跑!!!!"<<endl;
    }
    cin>>r;
    if(r==1||bao==1)
    {
    int f=0;
    while(shengming>0&&xhp>0&&l!=123&&(bao==1||i>0))
    {
    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;
    cout<<"第"<<i<<"回合"<<endl;
    if(flag<=20&&xdj==5)
    cout<<"BUG小怪100%会掉落审判之心"<<endl;
    cout<<" 你 的 生命:"<<shengming<<"伤害"<<shanghai<<"防御"<<fangyu<<endl;
    cout<<"远古骷髅生命:"<<xhp<<"伤害"<<xsh<<"防御:"<<xfy<<endl;
    cout<<"输入1攻击(造成攻击(你的伤害-怪的防御),防御减半)"<<endl;
    cout<<"输入2防御(不造成攻击,防御*2)"<<endl;
    if(zhiye==1)
    cout<<"输入3使用技能(无敌并造成 2*伤害,BOOS*3点伤害)"<<endl;
    if(zhiye==2)
    cout<<"输入3使用技能(无敌三回合,可进行攻击)"<<endl;
    if(zhiye==3)
    cout<<"输入3使用技能(恢复500血,并造成 100*怪物等级 伤害,冷却10回合)"<<endl;
    cout<<"输入4使用战斗急救包!!!"<<endl;
    cin>>l;
    if(huo>=1)
    {
    xhp-=100;
    }
    if(lengque>0&&f==1)
    {
    lengque--;
    }
    if(i%5==0&&i!=1)
    {
    int p=0;
    if(flag<=20&&xdj==5)
    p=200;
    cout<<"远古骷髅释放[亡灵击],造成"<<50*jn+p<<"伤害"<<endl;
    cout<<"生命恢复"<<50*jn+p<<endl;
    Sleep(500);
    shengming-=50*jn+p;
    xhp+=50*jn+p;
    int sh;
    sh=(randomNumber% 100)+1;
    if(46<sh&&sh<50&&flag<=20&&xhp<=1000)
    {
    cout<<"远古骷髅触发[亡灵觉醒],一击必杀并抢夺金币500"<<endl;
    shengming=0;
    jinbi-=500;
    Sleep(2000);
    swcd();
    }
    }
    int a;
    int b;
    switch(l)
    {
    case 1:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    a=(randomNumber% 100)+1;
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    b=(randomNumber% 100)+1;
    if(wudi>0)
    {
    wudi--;
    i++;
    f=1;
    if(a<=xsp)
    {
    cout<<"远古骷髅成功闪避"<<endl;
    Sleep(1000);
    }
    else
    xhp-=shanghai-xfy;
    break;
    }
    if((fangyu/2)<xsh)
    {
    if(b>xbj)
    shengming-=xsh-fangyu/2;
    else
    {
    cout<<"远古骷髅成功暴击"<<xsh*bj-fangyu/2<<"伤害"<<endl;
    shengming-=xsh*bj-fangyu/2;
    Sleep(500);
    }
    }
    if(shanghai>xfy )
    {
    if(a<=xsp)
    {
    cout<<"远古骷髅成功闪避"<<endl;
    Sleep(1000);
    }
    else
    xhp-=shanghai-xfy;
    }
    i++;
    f=1;
    break;
    case 2:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    b=(randomNumber% 100)+1;
    if(fangyu*2<xsh||(b<xbj&&xsh*bj>fangyu*2))
    {
    if(b>xbj)
    shengming-=xsh-fangyu*2;
    else
    {
    cout<<"远古骷髅成功暴击"<<xsh*bj-fangyu*2<<"伤害"<<endl;
    shengming-=xsh*bj-fangyu/2;
    Sleep(500);
    }
    }
    i++;
    f=1;
    break;
    case 3:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    a=(randomNumber% 100)+1;
    if(lengque==0)
    {
    if(zhiye==1)
    {
    if(a<=xsp)
    {
    cout<<"远古骷髅成功闪避"<<endl;
    Sleep(1000);
    }
    else
    xhp-=shanghai*2;
    lengque=5;
    }
    if(zhiye==2)
    {
    wudi=3;
    lengque=8;
    }
    if(zhiye==3)
    {
    if(a<=xsp)
    {
    cout<<"远古骷髅成功闪避"<<endl;
    Sleep(1000);
    }
    else
    xhp-=xdj*100;
    shengming+=500;
    lengque=10;
    }
    i++;
    f=0;
    break;
    }
    cout<<"冷却中剩余"<<lengque<<"回合"<<endl;
    Sleep(750);
    f=0;
    break;
    case 4:
    if(jijiubao>0)
    {
    cout<<"使用成功!!!"<<endl;
    jijiubao--;
    shengming+=50;
    Sleep(750);
    }
    break;

    default:
    cout<<"不要乱输入"<<endl;
    break;
    }

    }
    if(shengming<=0)
    {
    cout<<"你死了"<<endl;
    Sleep(1000);
    return ;
    }
    if(xhp<=0)
    {
    cout<<"你打败了"<<xdj<<"级";
    if(jingyan/100>=20)
    {
    cout<<"<超级>远古骷髅"<<endl;
    cout<<"奖励金币"<<xdj*15<<"$"<<endl;
    cout<<"奖励经验"<<xdj*10<<endl;
    jinbi+=xdj*15;
    jingyan+=xdj*10;
    }
    else if(jingyan/100<20&&jingyan/100>=10)
    {
    cout<<"<精英>远古骷髅"<<endl;
    cout<<"奖励金币"<<xdj*12<<"$"<<endl;
    cout<<"奖励经验"<<xdj*10<<endl;
    jinbi+=xdj*12;
    jingyan+=xdj*10;
    }
    else
    {
    cout<<"远古骷髅"<<endl;
    cout<<"奖励金币"<<xdj*10<<"$"<<endl;
    cout<<"奖励经验"<<xdj*10<<endl;
    jinbi+=xdj*10;
    jingyan+=xdj*10;
    }
    if(xdj==5&&flag<=20)
    {
    cout<<"恭喜获得>>审判之心*1<<"<<endl;
    spzx++;
    }
    Sleep(1000);
    }
    }
    }
    void daguai()
    {
    //swcd();
    int wudi=0;
    if(shengming<=0)
    {
    return;
    }
    int i=1,n=0,l=1,flag=0,dsp=0,dbj=0,bj,jn=1;
    int lengque=0;
    int r,w;
    srand(static_cast<unsigned int >(time(0))) ;
    int randomNumber=rand();
    ddj=(randomNumber% 6)+7;

    dsp = (ddj-5)*6;
    dhp = ddj*100+200;
    dsh = dhp-200;
    dfy = (ddj-3)*100;
    dbj = 20;
    bj = 2;
    if(jingyan/100>=30)
    {
    cout<<"<超级>远古骑士,小心!!!!"<<endl;
    dhp+=700;
    dsh+=400;
    dfy+=200;
    jn=3;
    dhp+=400;
    dsh+=200;
    dfy+=100;
    dsp+=10;
    bj = 3;
    if(ddj==12&&tj==1&&dj==1)
    {
    dhp+=1000;
    dsh+=500;
    dfy+=500;
    flag=1;
    dbj=25;
    }

    }
    else if(jingyan/100<=30&&jingyan/100>=20)
    {
    cout<<"<精英>远古骑士,小心!!!!"<<endl;
    dhp+=400;
    dsh+=200;
    dfy+=100;
    bj=2;
    dsp+=5;
    jn=2;

    }
    cout<<"你面对的是"<<ddj<<"级远古骑士,伤害"<<dsh<<"生命:"<<dhp<<"防御:"<<dfy<<"是否迎战,迎战 1,逃跑 0"<<endl
    <<"闪避几率:"<<dsp<<endl
    <<"暴击几率:"<<dbj<<endl
    <<"是否迎战,迎战 1,逃跑 0"<<endl;
    if(bao==1)
    {
    cout<<"探宝情况下不能逃跑!!!!"<<endl;
    }
    cin>>r;
    int f;
    if(r==1||bao==1)
    {
    if(Xzj==2||Zzj==2||Xsj==2)
    {
    cout<<"你已得到机甲增幅!!"<<endl;
    }
    while(shengming>0&&dhp>0&&l!=123&&(bao==1||i>0))
    {
    system("cls");
    cout<<"第"<<i<<"回合"<<endl;
    if(flag==1)
    cout<<"此远古骑士可能会爆出 合成天地剑必须品>>天地精华,以超级增强"<<endl;
    cout<<" 你 的 生命:"<<shengming<<"伤害"<<shanghai<<"防御"<<fangyu<<endl;
    cout<<"远古骑士生命:"<<dhp<<"伤害"<<dsh<<"防御:"<<dfy<<endl;
    cout<<"输入1攻击(造成攻击(你的伤害-怪的伤害),防御减半)"<<endl;
    cout<<"输入2防御(不造成攻击,防御*2)"<<endl;
    if(zhiye==1)
    cout<<"输入3使用技能(无敌并造成 2*伤害,BOOS*3点伤害)"<<endl;
    if(zhiye==2)
    cout<<"输入3使用技能(无敌三回合,可进行攻击)"<<endl;
    if(zhiye==3)
    cout<<"输入3使用技能(恢复500血,并造成 100*怪物等级 伤害,冷却10回合)"<<endl;
    cout<<"输入4使用战斗急救包!!!"<<endl;
    cin>>l;
    if(i%10==0&&i!=1)
    {
    int sh=0;
    cout<<"远古骑士使用技能>>骑士冲锋<<全属性增加"<<endl;
    Sleep(1000);
    dhp+=300*jn;
    dfy+=jn*5;
    dsh+=jn*5;
    sh=(randomNumber% 5)+1;
    if(sh==3)
    {
    cout<<"你被远古骑士冲锋击伤"<<200*jn<<endl;
    shengming-=200*jn;
    Sleep(1000);
    }
    }
    if(huo>=1)
    {
    dhp-=100;
    }
    if(lengque>0&&f==1)
    {
    lengque--;
    }
    int a;
    int b;
    switch(l)
    {
    case 1:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    a=(randomNumber% 100)+1;
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    b=(randomNumber% 100)+1;
    if(wudi>0)
    {
    wudi--;
    i++;
    f=1;
    if(a<=dsp)
    {
    cout<<"远古骑士成功闪避"<<endl;
    Sleep(1000);
    }
    else
    dhp-=shanghai-dfy;
    break;
    }
    if((fangyu/2)<dsh)
    {
    if(b>dbj)
    shengming-=dsh-fangyu/2;
    else
    {
    shengming-=dsh*bj-fangyu/2;
    cout<<"远古骑士成功暴击"<< dsh*bj-fangyu/2<<"伤害"<<endl;
    Sleep(500);
    }
    }
    if(shanghai>dfy )
    {
    if(a<=dsp)
    {
    cout<<"远古骑士成功闪避"<<endl;
    Sleep(1000);
    }
    else
    dhp-=shanghai-dfy;
    }
    i++;
    f=1;
    break;
    case 2:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    b=(randomNumber% 100)+1;
    if((fangyu*2<dsh)||(b<dbj&&fangyu*2<dsh*bj))
    {
    if(b>dbj)
    shengming-=dsh-fangyu*2;
    else
    {
    shengming-=dsh*bj-fangyu/2;
    cout<<"远古骑士成功暴击"<< dsh*bj-fangyu*2<<"伤害"<<endl;
    Sleep(500);
    }
    }
    i++;
    f=1;
    break;
    case 3:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    a=(randomNumber% 100)+1;
    if(lengque==0)
    {
    if(zhiye==1)
    {
    if(a<=dsp)
    {
    cout<<"远古骑士成功闪避"<<endl;
    Sleep(1000);
    }
    else
    dhp-=shanghai*2;
    lengque=5;
    }
    if(zhiye==2)
    {
    wudi=3;
    lengque=8;
    }
    if(zhiye==3)
    {
    if(a<=dsp)
    {
    cout<<"远古骑士成功闪避"<<endl;
    Sleep(1000);
    }
    else
    dhp-=ddj*100;
    shengming+=500;
    lengque=10;
    }
    i++;
    f=0;
    break;
    }
    cout<<"冷却中剩余"<<lengque<<"回合"<<endl;
    Sleep(750);
    f=0;
    break;
    case 4:
    if(jijiubao>0)
    {
    cout<<"使用成功!!!"<<endl;
    jijiubao--;
    shengming+=100;
    Sleep(750);
    }

    break;

    default:
    cout<<"不要乱输入"<<endl;
    }

    }
    if(shengming<=0)
    {
    cout<<"你死了"<<endl;
    Sleep(1000);
    return ;
    }
    if(dhp<=0)
    {
    cout<<"你打败了"<<ddj<<"级";
    if(jingyan/100>=30)
    {
    cout<<"<超级>远古骑士"<<endl;
    cout<<"奖励金币"<<ddj*15<<"$"<<endl;
    cout<<"奖励经验"<<(ddj-5)*10<<endl;
    jinbi+=ddj*15;
    jingyan+=(ddj-5)*10;
    }
    else if(jingyan/100<=30&&jingyan/100>=20)
    {
    cout<<"<精英>远古骑士"<<endl;
    cout<<"奖励金币"<<ddj*12<<"$"<<endl;
    cout<<"奖励经验"<<(ddj-5)*10<<endl;
    jinbi+=ddj*12;
    jingyan+=(ddj-5)*10;
    }
    else
    {
    cout<<"远古骑士"<<endl;
    cout<<"奖励金币"<<ddj*10<<"$"<<endl;
    cout<<"奖励经验"<<(ddj-5)*10<<endl;
    jinbi+=ddj*10;
    jingyan+=(ddj-5)*10;
    }
    if(flag==1&&tj==1&&dj==1)
    {
    srand(static_cast<unsigned int >(time(0))) ;
    int randomNumber=rand();

    if((randomNumber% 100)+1<=10)
    {
    cout<<"你人品爆发获得>>天地精华<<"<<endl;
    tdjh++;
    }
    else
    {
    cout<<"再接再厉,没有刷出"<<endl;
    }
    }
    Sleep(1000);
    }
    }

    }
    void BOOS()
    {
    //swcd();
    int wudi=0;
    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;
    Sleep(750);
    int i=1,n=0,l=1,bsp=0,bbj=0,bj=2;
    int lengque=0;
    int taopao;
    srand(static_cast<unsigned int >(time(0))) ;
    int randomNumber=rand();

    cout<<"你面对的是";
    if(boosdj==1)
    {
    cout<<"普通";
    boosHP=40000;
    boosSH=2000;
    boosfy=1000;
    bsp=10;
    bbj=10;
    }
    else if( boosdj==2 )
    {
    cout<<"精英";
    boosHP=50000;
    boosSH=4000;
    boosfy=2000;
    bsp=12;
    bbj=10;
    bj=3;
    }
    else if(boosdj==3)
    {
    cout<<"超级";
    boosHP=100000;
    boosSH=5000;
    boosfy=3000;
    bsp=18;
    bbj=10;
    bj=3;
    }

    else
    {
    cout<<"SSS";
    boosHP=100000;
    boosSH=7000;
    boosfy=5000;
    bsp=20;
    bbj=10;
    bj=4;
    }
    cout<<"上古异体,伤害"<<boosSH<<"生命:"<<boosHP<<"防御:"<<boosfy<<endl;
    system("pause");
    int f=0;
    while(shengming>0&&boosHP>0&&l!=123&&i<=100)
    {
    system("cls");
    cout<<"第"<<i<<"回合"<<endl;
    cout<<" 你 的 生命:"<<shengming<<"伤害"<<shanghai<<"防御"<<fangyu<<endl;
    cout<<"上古异体生命:"<<boosHP<<"伤害"<<boosSH<<"防御:"<<boosfy<<endl;
    cout<<"输入1攻击(造成攻击(你的伤害-怪的伤害),自己防御减半)"<<endl;
    cout<<"输入2防御(不造成攻击,防御*2)"<<endl;
    if(zhiye==1)
    cout<<"输入3使用技能(无敌并造成伤害*3-上古异体的防御)"<<endl;
    if(zhiye==2)
    cout<<"输入3使用技能(无敌三回合,可进行攻击)"<<endl;
    if(zhiye==3)
    cout<<"输入3使用技能(恢复500血,并造成 1000*上古异体等级 伤害,冷却10回合)"<<endl;
    cout<<"输入4逃跑"<<endl;
    cout<<"输入5使用战斗急救包!!!"<<endl;
    if((shanghai-boosfy)<=0)
    cout<<"目前你对上古异体造成不了伤害,请逃跑!!!!!!"<<endl;
    cin>>l;
    if(huo>=1)
    boosHP-=100;
    if(lengque>0&&f==1)
    lengque--;
    int a;
    int b;
    switch(l)
    {
    case 1:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    a=(randomNumber% 100)+1;
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    b=(randomNumber% 100)+1;
    if(wudi>0)
    {
    wudi--;
    i++;
    f=1;
    if(bsp>=a)
    cout<<"上古异体成功闪避"<<endl;
    else
    boosHP-=shanghai-boosfy;
    Sleep(500);
    break;
    }
    if((fangyu/2)<boosSH)
    {
    if(bbj>=b)
    {
    shengming-=boosSH*bj-fangyu/2;

    cout<<"上古异体成功暴击"<< boosSH*bj-fangyu/2<<"伤害"<<endl;
    }
    else
    shengming-=boosSH-fangyu/2;
    }
    if(shanghai>boosfy )
    {
    if(bsp>=a)
    cout<<"上古异体成功闪避"<<endl;
    else
    boosHP-=shanghai-boosfy;
    Sleep(500);
    }
    i++;
    f=1;
    break;
    case 2:
    f=1;

    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    b=(randomNumber% 100)+1;

    if((fangyu*2<boosSH)||(b<bbj&&fangyu*2<boosSH*bj))
    {
    if(bbj>=b)
    {
    shengming-=boosSH*bj-fangyu*2;

    cout<<"上古异体成功暴击"<< boosSH*bj-fangyu*2<<"伤害"<<endl;
    }
    else
    shengming-=boosSH-fangyu*2;
    }
    i++;
    break;
    case 3:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    a=(randomNumber% 100)+1;
    f=1;
    if(lengque==0)
    {
    if(zhiye==1)
    {
    if(bsp>=a)
    cout<<"上古异体成功闪避"<<endl;
    else
    boosHP-=shanghai*3-boosfy;
    lengque=5;
    }
    if(zhiye==2)
    {
    wudi=3;
    lengque=8;
    }
    if(zhiye==3)
    {
    if(bsp>=a-10)
    cout<<"上古异体成功闪避"<<endl;
    else
    boosHP-=boosdj*1000;
    shengming+=500;
    Sleep(500);
    }
    i++;
    f=0;
    break;
    }
    cout<<"冷却中剩余"<<lengque<<"回合"<<endl;
    Sleep(500);
    f=0;
    break;
    case 4:
    f=1;
    if(taopao=1)
    {
    cout<<"逃跑成功!!!"<<endl;
    Sleep(500);
    l=123;
    }
    break;
    case 5:
    if(jijiubao>0)
    {
    cout<<"使用成功!!!"<<endl;
    Sleep(500);
    jijiubao--;
    shengming+=100;

    }
    break;

    default:
    cout<<"不要乱输入"<<endl;
    }
    }
    if(shengming<=0)
    {
    cout<<"你死了"<<endl;
    Sleep(1000);
    return ;

    }
    if(boosHP<=0)
    {
    cout<<"你打败了上古异体"<<endl;
    boosdj++;
    jinbi+=5000;
    Sleep(750);
    }
    }
    void wuqidian()
    {
    int i=1,n=0,l=1;
    char w,r;
    while(l)
    {
    system("cls");
    cout<<"武器店规则:伤害不能叠加!!!\n例如:假如你目前伤害50 ,购买匕首后,伤害不会+20,而是替换成20"<<endl;
    cout<<"你目前伤害:"<<shanghai<<"目前防御:"<<fangyu<<"你的金币为:"<<"$"<<jinbi<<endl;
    cout<<"欢迎来到 武器店!"<<endl;
    cout<<"1.铁块(材料) ($20*1)"<<endl;
    cout<<"2.金剑 ($100加150攻击力)"<<endl;
    cout<<"3.光刃 ($120加180攻击力)"<<endl;
    cout<<"4.X光刃 ($150加200攻击力)"<<endl;
    cout<<"5.木质铠甲($300加100防御力)"<<endl;
    cout<<"6.青铜铠甲($400加200防御力)"<<endl;
    cout<<"7.白银铠甲($500加300防御力)"<<endl;
    cout<<"8.光刃 ($500加300攻击力)"<<endl;
    cout<<"9.战斗头盔($500加50防御,必须有白银铠甲+50)"<<endl;
    cout<<"0、离开武器店"<<endl;
    cin>>l;
    switch(l)
    {
    case 1 :
    if(jinbi<20)
    {
    cout<<"你的钱不够"<<endl;
    break;
    }
    else
    {
    cout<<"购买成功!"<<endl;//钱足够时返回True
    tiekuai+=1;
    jinbi-=20;
    cout<<"你现在有铁块:"<<tiekuai<<"块"<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }
    case 2 :
    if(jinbi<100)
    {
    cout<<"你的钱不够"<<endl;//钱不够时返回Flase
    break;
    }
    else
    {
    shanghai=150;
    jinbi-=100;
    cout<<"你的攻击现在为"<<shanghai<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }

    case 3 :
    if(jinbi<120)
    {
    cout<<"你的钱不够"<<endl;//钱不够时返回Flase
    break;
    }
    else
    {
    cout<<"购买成功!"<<endl;
    shanghai=180;
    jinbi-=120;
    cout<<"你的伤害现在为"<<shanghai<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }

    case 4 :
    if(jinbi<150)
    {
    cout<<"你的钱不够"<<endl;//钱不够时返回Flase
    break;
    }
    else
    {
    cout<<"购买成功!"<<endl;
    xgj=1;
    shanghai=200;
    jinbi-=150;
    cout<<"你的伤害现在为"<<shanghai<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }

    case 5 :

    if(jinbi<300)
    {
    cout<<"你的钱不够"<<endl;//钱不够时返回Flase
    break;
    }
    else
    {
    cout<<"购买成功!"<<endl;
    fangyu=100;
    jinbi-=300;
    cout<<"你的防御现在为"<<fangyu<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }

    case 6:
    if(jinbi<400) {
    cout<<"你的钱不够"<<endl;//钱不够时返回Flase
    break;
    } else {
    fangyu=200;
    jinbi-=400;
    cout<<"你的防御现在为"<<fangyu<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }
    case 7:
    if(jinbi<500) {
    cout<<"你的钱不够"<<endl;//钱不够时返回Flase
    break;
    } else {
    fangyu=300;
    jinbi-=500;
    bykj=1;
    cout<<"你的防御现在为"<<fangyu<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }
    case 8:
    if(jinbi<500) {
    cout<<"你的钱不够"<<endl;//钱不够时返回Flase
    break;
    } else {
    shanghai=300;
    jinbi-=500;
    cout<<"你的攻击现在为"<<shanghai<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }
    case 9://******
    if(jinbi<500) {
    cout<<"你的钱不够"<<endl;//钱不够时返回Flase
    break;
    } else {
    if(bykj==0) {
    cout<<"没有购买白银铠甲不能购买此装备!!!"<<endl;
    break;
    } else {
    fangyu+=50;
    jinbi-=500;
    cout<<"你的防御现在为"<<fangyu<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }

    }
    case 0:
    system("cls");
    xiaozhen();
    default:
    cout<<"看清楚"<<endl;
    break;
    }
    Sleep(100);
    }

    }
    void yaopindian()
    {

    int i=1,n=0,l=0;
    char w,r;
    do
    {
    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;
    cout<<"欢迎来到 药品店!"<<endl;
    cout<<"你的金币为:"<<"$"<<jinbi<<endl;
    cout<<"1.坏药水(小) ($50加50血)"<<endl;
    cout<<"2.一般的药水 ($100加100血)"<<endl;
    cout<<"3.正常的药水 ($150加200血)"<<endl;
    cout<<"4.好药水 ($200加300血)"<<endl;
    cout<<"5.优质药水 ($5000加500血,50点防御,限购10瓶)"<<endl;
    cout<<"6.神圣药水 ($7000加300血,50点防御,100点攻击(+100),限购10瓶)"<<endl;
    cout<<"7.急救包 ($50加50血 战斗时使用)"<<endl;
    cout<<"8.*火之水* ($7000,敌方每回合减少100血)"<<endl;
    cout<<"0.离开药品店"<<endl;
    cin>>l;
    switch(l) {
    case 1 :
    if(jinbi<50)
    {
    cout<<"你的钱不够"<<endl;
    Sleep(1000);
    break;
    }
    else
    {
    cout<<"购买成功!"<<endl;
    shengming+=50;
    shengmingf=shengming;
    jinbi-=50;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }
    case 2 :
    if(jinbi<100)
    {
    cout<<"你的钱不够"<<endl;
    Sleep(1000); //钱不够时返回Flase
    break;
    }
    else
    {
    cout<<"购买成功!"<<endl;
    shengming+=100;
    shengmingf=shengming;
    jinbi-=100;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }

    case 3 :
    if(jinbi<150) {
    cout<<"你的钱不够"<<endl;
    Sleep(1000); //钱不够时返回Flase
    break;
    } else

    {
    cout<<"购买成功!"<<endl;
    shengming+=200;
    shengmingf=shengming;
    jinbi-=150;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }

    case 4 :
    if(jinbi<200) {
    cout<<"你的钱不够"<<endl;
    Sleep(1000); //钱不够时返回Flase
    break;
    } else {
    cout<<"购买成功!"<<endl;
    shengming+=300;
    shengmingf=shengming;
    jinbi-=200;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }

    case 5 :
    if(yy==10)
    {
    cout<<"已购买10瓶"<<endl;
    break;
    }
    else if(jinbi<5000)
    {
    cout<<"你的钱不够"<<endl;
    Sleep(1000); //钱不够时返回Flase
    break;
    }
    else if(jinbi>=5000&&yy<10)
    {
    cout<<"购买成功!"<<endl;
    yy++;
    shengming+=500;
    shengmingf=shengming;
    fangyu+=50;
    jinbi-=500;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }

    case 6:
    if(sy==10)
    {
    cout<<"已购买10瓶"<<endl;
    break;
    }
    else if(jinbi<7000) {
    cout<<"你的钱不够"<<endl;
    break;
    }
    else
    {
    cout<<"购买成功!"<<endl;
    shengming+=300;
    fangyu+=50;
    sy++;
    shanghai+=100;
    shengmingf=shengming;
    jinbi-=700;
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }
    case 7:
    if(jinbi<50) {
    cout<<"你的钱不够"<<endl;
    Sleep(1000); //钱不够时返回Flase
    break;
    }
    jinbi-=50;
    jijiubao++;
    cout<<"购买成功!"<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;

    break;
    case 8:
    if(jinbi<7000) {
    cout<<"你的钱不够"<<endl;
    Sleep(1000);
    break;
    }
    jinbi-=700;
    huo=1;
    cout<<"购买成功!"<<endl;
    cout<<"-------------------------------------------------------------------------------\n" ;

    break;
    case 0:
    system("cls");
    xiaozhen();
    break;

    default:
    cout<<"看清楚"<<endl;
    Sleep(1000);
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    }

    } while(l);

    }
    void ziliao()
    {

    cout<<"小镇5.2.0[怪物狂欢季]欢迎你!!!"<<endl;
    cout<<"普通怪:技能等级1级"<<endl;
    cout<<"精英怪:技能等级2级"<<endl;
    cout<<"超级怪:技能等级3级"<<endl;
    cout<<"BUG远古骷髅:在打远古骷髅时有可能会出现并化身为5级超级骷髅,并且超进化和加强,击杀可能掉落审判之心"<<endl<<endl;
    cout<<"远古骷髅技能[亡灵击]:每5回合释放一次,无视防御造成 技能等级*50伤害,生命恢复 技能等级*50,BUG状态下增加200"<<endl;
    cout<<"BUG状态下 3/100 的几率会触发[亡灵觉醒]一击必杀"<<endl;
    cout<<"远古骑士技能[骑士冲锋]:每7回合释放一次,全属性提升"<<endl;
    cout<<"伤害和防御增加 技能等级*5,生命恢复 技能等级*300,有 1/6 的几率会被冲锋击伤造成 200*技能等级"<<endl;
    cout<<"小镇可以存档了"<<endl;
    system("pause");
    }
    void tanbao()
    {
    system("cls");
    int n=0,l=1;
    if(Zzj==1||Xzj==1||Xsj==1)
    {
    while(n!=1&&n!=2&&n!=3)
    {
    cout<<"请选择作战机甲"<<endl;
    cout<<"输入 1 选择X原型机"<<endl;
    cout<<"输入 2 选择Z原型机"<<endl;
    cout<<"输入 3 选择X射线机"<<endl;
    cin>>n;
    if(n==1&&Xzj==1)
    {
    Xzj=2;
    cout<<"你已选择X原型机"<<endl;
    shengmingf=shengming;
    shengming+=500;
    shanghai+=200;
    Sleep(750);
    }
    else if(n==2&&Zzj==1)
    {
    Zzj=2;
    cout<<"你已选择Z原型机"<<endl;
    shengmingf=shengming;
    shengming+=300;
    shanghai+=500;
    Sleep(750);
    }
    else if(n==3&&Xsj==1)
    {
    Xsj=2;
    cout<<"你已选择X射线机"<<endl;
    shengmingf=shengming;
    shengming+=500;
    shanghai+=700;
    Sleep(750);
    }
    else
    {
    cout<<"请选择有效机甲"<<endl;
    }
    }
    }
    system("cls");
    baoci++;
    bao=1;
    a[6][4]=='O';

    int i=0;
    for(i=0; i<=12; i++)
    cout<<a[i]<<endl;
    char ch;
    while(1)
    {
    if(shengming<=0)
    {
    xiaozhen();
    }
    ch=getch();
    if(ch=='w')
    {
    if(a[x-1][y]=='-'||a[x-1][y]=='|'||a[x-1][y]=='R'||a[x-1][y]=='F'||a[x-1][y]=='X'||a[x-1][y]=='H'||a[x-1][y]=='Q'||a[x-1][y]=='B')
    {

    if(a[x-1][y]=='H')
    {
    system("cls");
    fenjiecailiao();
    system("cls");
    }
    if(a[x-1][y]=='R')
    {
    system("cls");
    jiangli();
    system("cls");
    }
    if(a[x-1][y]=='F')
    {
    system("cls");
    xiaoguai();
    system("cls");
    daguai();
    system("cls");
    }
    if(a[x-1][y]=='X')
    {
    system("cls");
    daguai();
    system("cls");
    }
    if(a[x-1][y]=='Q')
    {
    system("cls");
    shixuepangzi();
    system("cls");
    }
    if(a[x-1][y]=='G')
    {
    system("cls");
    xuefu();
    system("cls");
    }
    if(a[x+1][y]!=' '||a[x-1][y]!=' ')
    {
    a[x][y]='|';
    }
    else
    {
    a[x][y]='-';
    }
    x--;
    a[x][y]='0';
    system("cls");
    i=0;
    for(i=0; i<=13; i++)
    cout<<a[i]<<endl;

    }
    }
    else if(ch=='s')
    {
    if(a[x+1][y]=='-'||a[x+1][y]=='|'||a[x+1][y]=='R'||a[x+1][y]=='F'||a[x+1][y]=='X'||a[x+1][y]=='H'||a[x+1][y]=='Q'||a[x+1][y]=='B')
    {
    if(a[x+1][y]=='H')
    {
    system("cls");
    fenjiecailiao();
    system("cls");
    }
    if(a[x+1][y]=='R')
    {
    system("cls");
    jiangli();
    system("cls");
    }
    if(a[x+1][y]=='F')
    {

    system("cls");
    xiaoguai();
    system("cls");
    daguai();
    system("cls");
    }
    if(a[x+1][y]=='X')
    {
    system("cls");
    daguai();
    system("cls");
    }
    if(a[x+1][y]=='Q')
    {
    system("cls");
    shixuepangzi();
    system("cls");
    }
    if(a[x+1][y]=='G')
    {
    system("cls");
    xuefu();
    system("cls");
    }
    if(a[x+1][y]!=' '||a[x-1][y]!=' ')
    {
    a[x][y]='|';
    }
    else
    {
    a[x][y]='-';
    }
    x++;
    a[x][y]='0';
    system("cls");
    i=0;
    for(i=0; i<=13; i++)
    cout<<a[i]<<endl;

    }
    }
    else if(ch=='a')
    {
    if(a[x][y-1]=='O')
    {
    bao=0;
    xiaozhen();
    }
    if(a[x][y-1]=='-'||a[x][y-1]=='|'||a[x][y-1]=='R'||a[x][y-1]=='F'||a[x][y-1]=='X'||a[x][y-1]=='o'||a[x][y-1]=='H'||a[x][y-1]=='Q'||a[x][y-1]=='B')
    {
    if(a[x][y-1]=='H')
    {
    system("cls");
    fenjiecailiao();
    system("cls");
    }
    if(a[x][y-1]=='R')
    {
    system("cls");
    jiangli();
    system("cls");
    }
    if(a[x][y-1]=='F')
    {
    system("cls");
    xiaoguai();
    system("cls");
    daguai();
    system("cls");
    }
    if(a[x][y-1]=='X')
    {
    system("cls");
    daguai();
    system("cls");
    }
    if(a[x][y-1]=='Q')
    {
    system("cls");
    shixuepangzi();
    system("cls");
    }
    if(a[x][y-1]=='G')
    {
    system("cls");
    xuefu();
    system("cls");
    }
    if(a[x+1][y]!=' '||a[x-1][y]!=' ')
    {
    a[x][y]='|';
    }
    else
    {
    a[x][y]='-';
    }
    y--;
    a[x][y]='0';
    system("cls");
    i=0;
    for(i=0; i<=13; i++)
    cout<<a[i]<<endl;

    }
    }
    else if(ch=='d')
    {

    if(a[x][y+1]=='-'||a[x][y+1]=='|'||a[x][y+1]=='R'||a[x][y+1]=='F'||a[x][y+1]=='X'||a[x][y+1]=='o'||a[x][y+1]=='H'||a[x][y+1]=='@'||a[x][y+1]=='Q'||a[x][y+1]=='B')
    {
    if(a[x][y+1]=='H')
    {
    system("cls");
    fenjiecailiao();
    system("cls");
    }
    if(a[x][y+1]=='R')
    {
    system("cls");
    jiangli();
    system("cls");
    }
    if(a[x][y+1]=='F')
    {
    system("cls");
    xiaoguai();
    system("cls");
    daguai();
    system("cls");
    }
    if(a[x][y+1]=='X')
    {
    system("cls");
    daguai();
    system("cls");
    }
    if(a[x][y+1]=='Q')
    {
    system("cls");
    shixuepangzi();
    system("cls");
    }
    if(a[x][y+1]=='G')
    {
    system("cls");
    xuefu();
    system("cls");
    }
    if(a[x][y+1]=='@')
    {
    system("cls");
    for(int i=0;i<13;i++)
    for(int j=0;j<58;j++)
    a[i][j]=b[i][j];

    x=6;y=5;
    Sleep(500);
    system("cls");
    }
    if(a[x+1][y]!=' '||a[x-1][y]!=' ')
    {
    a[x][y]='|';
    } else {
    a[x][y]='-';
    }
    y++;
    a[x][y]='0';
    system("cls");
    i=0;
    for(i=0; i<=13; i++)
    cout<<a[i]<<endl;

    }
    }
    }
    }
    void jiangli()
    {

    cout<<"奖励 $200";
    jinbi+=200;
    Sleep(750);
    }
    void ronglu()
    {
    int l=1,h;
    while(l) {

    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;

    cout<<"输入 1 分解成普通铁块"<<endl;
    cout<<"输入 2 分解成普通晶块"<<endl;
    cout<<"输入 3 分解成元素晶块"<<endl;
    cout<<"输入 0 返回小镇"<<endl;
    cin>>l;
    switch(l) {
    case 1:
    cout<<"输入你分解的分解材料数(分解材料1个=2块铁块)"<<endl;
    cout<<"目前拥有"<<fenjie<<"个分解材料"<<endl;
    cout<<"输入 0 离开"<<endl;
    cin>>l;
    if(l>fenjie) {
    cout<<"分解材料不足!!!!"<<endl;
    break;
    } else if(l==0) {
    xiaozhen();

    } else {
    fenjie-=l;
    tiekuai+=l*2;
    cout<<"分解成功,"<<"目前剩余普通铁块"<<tiekuai<<endl;
    }

    break;
    case 2:
    cout<<"输入你分解的分解材料数(分解材料1个=2块晶块)"<<endl;
    cout<<"目前拥有"<<fenjie<<"个分解材料"<<endl;
    cout<<"输入 0 离开"<<endl;
    cin>>l;
    if(l>fenjie) {
    cout<<"分解材料不足!!!!"<<endl;
    break;
    } else if(l==0) {
    xiaozhen();

    } else {
    fenjie-=l;
    jingkuai+=l*2;
    cout<<"分解成功,"<<"目前剩余普通晶块"<<jingkuai<<endl;
    }

    break;
    case 3:
    cout<<"输入你分解的分解材料数(分解材料2个=1块元素晶块)"<<endl;
    cout<<"目前拥有"<<fenjie<<"个分解材料"<<endl;
    cout<<"输入 0 离开"<<endl;
    cin>>l;
    if(l>fenjie) {
    cout<<"分解材料不足!!!!"<<endl;
    break;
    } else if(l==0) {
    xiaozhen();
    } else {
    fenjie-=l;
    yuansujingkuai+=(l/2);
    cout<<"分解成功,"<<"目前剩余元素晶块"<<yuansujingkuai<<endl;
    }

    break;
    case 0:
    xiaozhen();
    Sleep(740);
    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;

    default:
    cout<<"输入有误"<<endl;

    }
    Sleep(740);
    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;

    }

    }
    void gongjiangtai()
    {
    //工匠台
    int l=1,h,r;
    while(l)
    {
    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;

    cout<<"输入 1 制作机甲"<<endl;
    cout<<"输入 2 制作武器"<<endl;
    cout<<"输入 3 制作职业神器"<<endl;
    cout<<"输入 0 返回小镇"<<endl;
    cin>>l;
    switch(l) {
    case 1:
    cout<<"-------------------------------------------------------------------------------\n" ;
    jijia();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 2:
    cout<<"-------------------------------------------------------------------------------\n" ;
    wuqizhizuo();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 3:
    cout<<"-------------------------------------------------------------------------------\n" ;
    zhiyewuqi();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    case 0:
    xiaozhen();

    default:
    cout<<"输入有误"<<endl;

    }

    Sleep(750);
    }
    }
    void fenjiecailiao()
    {
    int cl;
    srand(static_cast<unsigned int >(time(0))) ;
    int randomNumber=rand();
    cl=(randomNumber% 5)+5;
    cout<<"分解材料*"<<cl<<endl;
    Sleep(750);
    fenjie+=cl;
    }
    void jijia()
    {
    //制作机甲
    int l=1,h=1,k=0;
    while(l) {

    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;

    cout<<"输入 1 制作 X原型机(生命+500,攻击+200)\n"<<endl;
    cout<<"输入 2 制作 Z原型机(生命+300,攻击+500)"<<endl;
    cout<<"此机甲只有一种制作方式\n铁块*100 晶块*30 元素晶块*20\n\n";
    cout<<"输入 3 制作 X射线机甲(生命+500,攻击+700)"<<endl;
    cout<<"此机甲只有一种制作方式\n铁块*300 晶块*300 元素晶块*300\n";
    cout<<"输入 0 返回小镇"<<endl;
    cin>>l;
    switch(l)
    {
    case 1://X
    if(Xzj==0) {
    cout<<"方案一:铁块100个 元素晶块 10个(输入 1)\n";
    cout<<"方案二:铁块150个 晶块30个(输入 2)\n";

    cout<<"输入 0 返回\n";
    cin>> h;
    switch(h) {
    case 1:
    if(tiekuai>=100&&yuansujingkuai>=10) {
    tiekuai-=100;
    yuansujingkuai-=10;
    Xzj=1;
    cout<<"你已成功制作 X原型机"<<endl;
    Sleep(1000);
    cout<<"-------------------------------------------------------------------------------\n" ;
    } else {
    cout<<"材料不足!!!!"<<endl;
    Sleep(1000);
    cout<<"-------------------------------------------------------------------------------\n" ;
    }
    break;
    case 2:
    if ( tiekuai>=150&&jingkuai>=5 ) {
    tiekuai-=150;
    jingkuai-=30;
    Xzj=1;
    cout<<"你已成功制作 X原型机"<<endl;
    Sleep(1000);
    cout<<"-------------------------------------------------------------------------------\n" ;
    } else {
    cout<<"材料不足!!!!"<<endl;
    Sleep(1000);
    cout<<"-------------------------------------------------------------------------------\n" ;
    }
    break;

    case 0:
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;
    default:
    cout<<"没有找到你输入的方案编号"<<endl;
    break;
    }

    } else {
    cout<<"你已经制作过此机甲"<<endl;
    }

    break;

    case 2:// z
    if(Zzj==0)
    {
    cout<<"此机甲只有一种制作方式\n铁块*100 晶块*30 元素晶块*20\n";
    if(tiekuai>=100&&jingkuai>=30&&yuansujingkuai>=20 )
    {
    Zzj=1;
    tiekuai-=100;
    jingkuai-=30;
    yuansujingkuai-=20;
    cout<<"你已成功制作 Z原型机"<<endl;
    Sleep(1000);
    }
    else
    {
    cout<<"材料不足!!!!"<<endl;
    Sleep(1000);
    }
    } else {
    cout<<"你已制作此机甲"<<endl;
    Sleep(1000);

    }

    break;

    case 3:
    if(Xsj==0)
    {
    cout<<"此机甲只有一种制作方式\n铁块*300 晶块*300 元素晶块*300\n";
    if(tiekuai>=300&&jingkuai>=100&&yuansujingkuai>=100 )
    {
    Xsj=1;
    tiekuai-=300;
    jingkuai-=300;
    yuansujingkuai-=300;
    cout<<"你已成功制作 X射线机甲"<<endl;
    Sleep(1000);
    }
    else
    {
    cout<<"材料不足!!!!"<<endl;
    Sleep(1000);
    }
    }
    else
    {
    cout<<"你已制作此机甲"<<endl;
    Sleep(1000);

    }

    break;
    case 0:
    xiaozhen();
    default://xz
    cout<<"没有找到你输入的机甲编号"<<endl;
    break;
    }
    Sleep(750);
    }
    }
    void cailiaoshangren()
    {
    int l=1,n;
    while (l) {
    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;
    cout<<"材料商店"<<endl;
    cout<<"输入 1 购买分解材料*100 ($1000)"<<endl;
    cout<<"输入 2 购买元素晶块*100 ($2000)"<<endl;
    cout<<"输入 0 返回小镇"<<endl;
    cin>>l;
    switch(l) {
    case 1:
    if(jinbi<1000)
    {
    cout<<"金币不够"<<endl;
    }
    else
    {
    cout<<"购买成功"<<endl;
    jinbi-=1000;
    fenjie+=100;
    }
    break;

    case 2:
    if(jinbi<2000)
    {
    cout<<"金币不够"<<endl;
    }
    else
    {
    cout<<"购买成功"<<endl;
    jinbi-=1000;
    yuansujingkuai+=1000;
    }
    break;
    case 0:
    system("cls");
    xiaozhen();
    break;
    default:
    cout<<"没有找到你购买的物品编号"<<endl;
    Sleep(750);
    }
    Sleep(100);
    cout<<"-------------------------------------------------------------------------------\n" ;

    }
    }
    void wuqizhizuo()
    {

    int l=1,h,n;
    while(l)
    {
    system("cls");
    cout<<"制作 苍穹剑(伤害600) 输入 1 "<<endl;
    cout<<"铁块*200,晶块*10"<<endl<<endl;
    cout<<"制作 大地剑(伤害800) 输入 2 "<<endl;
    cout<<"铁块*350"<<endl<<endl;
    cout<<"制作 X头盔(防御300) 输入 3 "<<endl;
    cout<<"铁块*300,元素晶块*10"<<endl<<endl;
    cout<<"制作 X胸甲(防御400) 输入 4 "<<endl;
    cout<<"铁块*350,元素晶块*20"<<endl<<endl;
    cout<<"制作 XX光剑(伤害400) 输入 5 "<<endl;
    cout<<"铁块*150,元素晶块*20"<<endl<<endl;
    cout<<"制作 x护手(防御400) 输入 6 "<<endl;
    cout<<"铁块*300,晶块*30,元素晶块*10"<<endl;
    cout<<"制作 天地剑(伤害1000)输入 7 "<<endl;
    cout<<"无消耗"<<endl;
    cout<<"制作 x审判者套装(防御800) 输入 8 "<<endl;
    cout<<"无消耗"<<endl<<endl;
    cout<<"返回小镇 输入 0 "<<endl;

    cin>>l;
    switch(l)
    {
    case 1:
    if(tiekuai>=200&&jingkuai>=10)
    {
    tj=1;
    cout<<"制作成功"<<endl;
    tiekuai-=200;
    jingkuai-=10;
    shanghai=600;
    cout<<"铁块剩余:"<<tiekuai<<"晶块剩余:"<<jingkuai<<endl;
    cout<<"伤害:"<<shanghai<<endl;
    Sleep(500);
    }
    else
    {
    cout<<"材料不足!!!\n";
    }
    break;
    case 2:
    if(tiekuai>=350)
    {
    dj=1;
    cout<<"制作成功"<<endl;
    tiekuai-=350;
    shanghai=800;
    cout<<"铁块剩余:"<<tiekuai<<endl;
    cout<<"伤害:"<<shanghai<<endl;
    Sleep(500);
    }
    else
    {
    cout<<"材料不足!!!\n";
    }
    break;
    case 3:
    if(tiekuai>=300&&yuansujingkuai>=10)
    {
    xtk=1;
    cout<<"制作成功"<<endl;
    tiekuai-=300;
    yuansujingkuai-=10;
    fangyu=300;
    cout<<"铁块剩余:"<<tiekuai<<"元素晶块剩余:"<<yuansujingkuai<<endl;
    cout<<"防御:"<<fangyu<<endl;
    Sleep(500);
    }
    else
    {
    cout<<"材料不足!!!\n";
    }
    break;
    case 4:
    if(tiekuai>=350&&yuansujingkuai>=20)
    {
    xxj=1;
    cout<<"制作成功"<<endl;
    tiekuai-=350;
    yuansujingkuai-=20;
    fangyu=400;
    cout<<"铁块剩余:"<<tiekuai<<"元素晶块剩余:"<<yuansujingkuai<<endl;
    cout<<"防御:"<<fangyu<<endl;
    Sleep(500);
    }
    else
    {
    cout<<"材料不足!!!\n";
    }
    break;
    case 5:
    if(tiekuai>=150&&yuansujingkuai>=20&&xgj==1)
    {
    xxgj=1;
    cout<<"制作成功"<<endl;
    tiekuai-=150;
    yuansujingkuai-=20;
    shanghai=400;
    cout<<"铁块剩余:"<<tiekuai<<"元素晶块剩余:"<<yuansujingkuai<<endl;
    cout<<"伤害:"<<shanghai<<endl;
    Sleep(500);
    }
    else
    {
    cout<<"材料不足!!!或未购买光剑\n";
    }
    break;
    case 6:
    if(tiekuai>=300&&yuansujingkuai>=10&&jingkuai>=30)
    {
    xhs=1;
    cout<<"制作成功"<<endl;
    tiekuai-=300;
    yuansujingkuai-=10;
    fangyu=400;
    cout<<"铁块剩余:"<<tiekuai<<"元素晶块剩余:"<<yuansujingkuai<<"晶块剩余:"<<jingkuai<<endl;
    cout<<"防御:"<<fangyu<<endl;
    Sleep(500);
    }
    else
    {
    cout<<"材料不足!!!\n";
    }
    break;
    case 7:
    if(tj==1&&dj==1&&tdjh>0)
    {
    cout<<"制作成功"<<endl;
    shanghai=1000;
    cout<<"伤害:"<<shanghai<<endl;
    Sleep(500);
    }
    else
    {
    cout<<"未购买苍穹剑或大地剑或未拥有天地精华(刷增加大怪12级得)\n";
    }
    break;
    case 8:
    if(xxgj==1&&xxj==1&&xhs==1&&xtk==1&&spzx>0)
    {
    cout<<"制作成功"<<endl;
    fangyu=800;
    cout<<"防御:"<<fangyu<<endl;
    Sleep(500);
    }
    else
    {
    cout<<"未购买其余x类型武器或未拥有审判之心(刷BUG小怪5级得)\n";
    }
    break;
    case 0:
    xiaozhen();
    cout<<"-------------------------------------------------------------------------------\n" ;
    break;

    default:
    cout<<"没有找到你制作的武器编号"<<endl;
    Sleep(750);
    }
    Sleep(100);
    }
    }
    void shixuepangzi()
    {
    //swcd();
    int wudi=0;
    if(shengming<=0)
    {
    return xiaoguai();
    }
    int i=1,n=0,l=1,lengque=0,xsp=0;
    int flag=9999;
    int r,w;
    int xhp,xsh,xjb,xdj,xfy;
    srand(static_cast<unsigned int >(time(0))) ;
    int randomNumber=rand();
    xdj=(randomNumber% 5)+1;

    xhp=xdj*100+200;
    xsh=xdj*20;
    xfy=400;
    xsp=xdj*5;
    if(jingyan/100>=20)
    {
    cout<<"<超级>远古凶兽,小心!!!!"<<endl;
    xhp+=700;
    xsh+=200;
    xfy+=400;
    xhp+=500;
    xsh+=100;
    xfy+=600;
    xsp+=10;
    }
    else if(jingyan/100<20&&jingyan/100>=10)
    {
    cout<<"<精英>远古凶兽,小心!!!!"<<endl;
    xhp+=500;
    xsh+=100;
    xfy+=400;
    xsp+=5;
    }
    if(Xzj==2||Zzj==2||Xsj==2)
    {
    cout<<"你已得到机甲增幅!!"<<endl;
    }
    cout<<"你面对的是"<<xdj<<"级远古凶兽,伤害"<<xsh<<"生命:"<<xhp<<"防御:"<<xfy<<endl
    <<"无视防御攻击" <<endl
    <<"闪避几率:"<<xsp<<endl//
    <<"天使技能可被防御"<<endl;
    if((xdj*100-xfy)<=0&&zhiye==3)
    cout<<"技能无法造成伤害"<<endl;
    cout<<"每7回合恢复500血"<<endl
    <<"是否迎战,迎战 1,逃跑 0"<<endl;
    if(bao==1)
    {
    cout<<"探宝情况下不能逃跑!!!!"<<endl;
    }
    cin>>r;
    if(r==1||bao==1)
    {
    int f=0;
    while(shengming>0&&xhp>0&&l!=123&&(bao==1||i>0))
    {
    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;
    cout<<"第"<<i<<"回合"<<endl;
    cout<<" 你 的 生命:"<<shengming<<"伤害"<<shanghai<<"防御"<<fangyu<<endl;
    cout<<"嗜血胖子生命:"<<xhp<<"伤害"<<xsh<<"防御:"<<xfy<<endl;
    cout<<"输入1攻击(造成攻击(你的伤害-怪的防御),防御减半,会受到怪的攻击)"<<endl;
    cout<<"输入2防御(不造成攻击,防御*2,若防御*2 小于 伤害, >无视防御<)"<<endl;
    if(zhiye==1)
    cout<<"输入3使用技能(无敌并造成 2*伤害,BOOS*3点伤害,远古凶兽需减去防御)"<<endl;
    if(zhiye==2)
    cout<<"输入3使用技能(无敌三回合,可进行攻击)"<<endl;
    if(zhiye==3)
    cout<<"输入3使用技能(恢复500血,并造成 100*怪物等级,远古凶兽可防御 伤害,冷却10回合)"<<endl;
    cout<<"输入4使用战斗急救包!!!"<<endl;
    cin>>l;
    if(huo>=1)
    xhp-=30;
    if(lengque>0&&f==1)
    lengque--;
    if(i%7==0)
    xhp+=500;
    int a;
    switch(l)
    {
    case 1:
    srand(static_cast<unsigned int>(time(0))) ;
    randomNumber=rand();
    a=(randomNumber% 100)+1;
    if(wudi>0)
    {
    wudi--;
    i++;
    f=1;

    if(a<=xsp)
    cout<<"远古凶兽成功闪避"<<endl;
    else
    xhp-=shanghai-xfy;
    break;
    }
    shengming-=xsh;
    if(shanghai>xfy )
    {
    if(a<=xsp)
    cout<<"远古凶兽成功闪避"<<endl;
    else
    xhp-=shanghai-xfy;
    }
    i++;
    f=1;
    break;
    case 2:
    shengming-=xsh;
    i++;
    f=1;
    break;
    case 3:
    if(lengque==0)
    {
    if(zhiye==1)
    {
    xhp-=shanghai*2-dfy;
    lengque=5;
    }
    if(zhiye==2)
    {
    wudi=3;
    lengque=8;
    }
    if(zhiye==3)
    {
    shengming+=500;
    if((xdj*100-xfy)>0)
    dhp-=xdj*100-xfy;
    else
    {
    cout<<"技能无伤"<<endl;
    Sleep(500);
    }
    lengque=10;
    }
    i++;
    f=0;
    break;
    }
    cout<<"冷却中剩余"<<lengque<<"回合"<<endl;
    Sleep(750);
    f=0;
    break;
    case 4:
    if(jijiubao>0)
    {
    cout<<"使用成功!!!"<<endl;
    jijiubao--;
    shengming+=50;
    i++;
    Sleep(750);
    f=1;
    }
    else
    f=0;

    break;

    default:
    cout<<"不要乱输入"<<endl;
    break;
    }

    }
    if(shengming<=0)
    {
    cout<<"你死了"<<endl;
    Sleep(1000);
    return ;
    }
    if(xhp<=0)
    {
    cout<<"你打败了"<<xdj<<"级";
    if(jingyan/100>=20)
    {
    cout<<"<超级>远古凶兽"<<endl;
    cout<<"奖励金币300$"<<endl;
    cout<<"奖励经验"<<xdj*10<<endl;
    jinbi+=300;
    jingyan+=xdj*10;
    }
    else if(jingyan/100<20&&jingyan/100>=10)
    {
    cout<<"<精英>远古凶兽"<<endl;
    cout<<"奖励金币200$"<<endl;
    cout<<"奖励经验"<<xdj*10<<endl;
    jinbi+=200;
    jingyan+=xdj*10;
    }
    else
    {
    cout<<"远古凶兽"<<endl;
    cout<<"奖励金币100$"<<endl;
    cout<<"奖励经验"<<xdj*10<<endl;
    jinbi+=100;
    jingyan+=xdj*10;
    }
    Sleep(1000);
    }
    }
    else
    {
    cout<<"输入有误"<<endl;
    Sleep(750);
    }
    }
    void shangdian()
    {
    while(1)
    {
    system("cls");
    cout<<"输入 1 武器店"<<endl;
    cout<<"输入 2 药品店"<<endl;
    cout<<"输入 3 材料商店"<<endl;
    cout<<"输入 0 返回小镇"<<endl;
    int l;
    cin>>l;
    if(l==1)
    {
    wuqidian();
    break;
    }

    else if(l==2)
    {
    yaopindian();
    break;
    }
    else if(l==3)
    {
    cailiaoshangren();
    break;
    }
    else if(l==0)
    break;
    else
    cout<<"输入有误"<<endl;
    }

    }
    void gongzuoshi()
    {

    while(1)
    {
    system("cls");
    cout<<"输入 1 使用熔炉"<<endl;
    cout<<"输入 2 使用工匠台"<<endl;
    cout<<"输入 0 返回小镇"<<endl;
    int l;
    cin>>l;
    if(l==1)
    {
    ronglu();
    break;
    }
    else if(l==2)
    {
    gongjiangtai();
    break;
    }
    else if(l==0)
    break;
    else
    cout<<"输入有误"<<endl;
    }
    }
    void chenjiu()
    {
    bool f=0;
    if(spzx>0)
    {
    cout<<">>审判天使<<"<<endl;
    f=1;
    }
    else
    cout<<"获得审判之心可获得成就>>审判天使<<"<<endl;
    if(tdjh>0)
    {
    cout<<">>苍穹与大地<<"<<endl;
    f=1;
    }
    else
    cout<<"获得天地精华可获得成就>>苍穹与大地<<"<<endl;
    if(f)
    {
    cout<<"暂无成就"<<endl;
    }
    system("pause");
    return ;
    }
    void xuefu()
    {
    //swcd();
    int wudi=0;
    if(shengming<=0)
    {
    return xiaoguai();
    }
    int i=1,n=0,l=1,lengque=0,xsp=0,xbj=0;
    int flag=9999;
    int r,w;
    int bj=2;
    srand(static_cast<unsigned int >(time(0))) ;
    int randomNumber=rand();
    xdj=(randomNumber% 10)+1;

    xhp=xdj*100+100;
    xsh=xdj*100;
    xfy=xdj*50;
    xsp=xdj*5;
    xbj=xdj*3;
    if(jingyan/100>=20)
    {
    cout<<"<超级>吸血蝙蝠,小心!!!!"<<endl;
    xhp+=700;
    xsh+=400;
    xfy+=200;
    xhp+=400;
    xsh+=200;
    xfy+=100;
    xsp+=15;
    bj=5;
    flag=(randomNumber% 100)+1;
    if(flag<=20&&xdj==10)
    {
    cout<<"此怪为BUG吸血蝙蝠!!!!已超进化"<<endl;
    xhp+=1000;
    xsh+=500;
    xfy+=400;
    xbj+=10;
    }
    }
    else if(jingyan/100<20&&jingyan/100>=10)
    {
    cout<<"<精英>吸血蝙蝠,小心!!!!"<<endl;
    xhp+=400;
    xsh+=200;
    xfy+=100;
    xsp+=10;
    bj=2;
    }
    if(Xzj==2||Zzj==2||Xsj==2)
    {
    cout<<"你已得到机甲增幅!!"<<endl;
    }
    cout<<"你面对的是"<<xdj<<"级吸血蝙蝠,伤害"<<xsh<<"生命:"<<xhp<<"防御:"<<xfy<<endl
    <<"闪避几率:"<<xsp<<endl//
    <<"暴击几率:"<<xbj<<"伤害翻"<<bj<<"倍"<<endl
    <<"每回合吸血100点"<<endl
    <<"建议血量5000以上,伤害1200以上,防御1000以上"<<endl
    <<"是否迎战,迎战 1,逃跑 0"<<endl;
    if(bao==1)
    {
    cout<<"探宝情况下不能逃跑!!!!"<<endl;
    }
    cin>>r;
    if(r==1||bao==1)
    {
    int f=0;
    while(shengming>0&&xhp>0&&l!=123&&(bao==1||i>0))
    {
    system("cls");
    cout<<"-------------------------------------------------------------------------------\n" ;
    cout<<"第"<<i<<"回合"<<endl;
    if(flag<=20&&xdj==10)
    cout<<"BUG吸血蝙蝠100%会掉落恶魔之心"<<endl;
    cout<<" 你 的 生命:"<<shengming<<"伤害"<<shanghai<<"防御"<<fangyu<<endl;
    cout<<"吸血蝙蝠生命:"<<xhp<<"伤害"<<xsh<<"防御:"<<xfy<<endl;
    cout<<"输入1攻击(造成攻击(你的伤害-怪的防御),防御减半)"<<endl;
    cout<<"输入2防御(不造成攻击,防御*2)"<<endl;
    if(zhiye==1)
    cout<<"输入3使用技能(无敌并造成 2*伤害,BOOS*3点伤害)"<<endl;
    if(zhiye==2)
    cout<<"输入3使用技能(无敌3回合,可进行攻击)"<<endl;
    if(zhiye==3)
    cout<<"输入3使用技能(恢复500血,并造成 100*怪物等级 伤害,冷却10回合)"<<endl;
    cout<<"输入4使用战斗急救包!!!"<<endl;
    cin>>l;
    if(huo>=1)
    {
    xhp-=100;
    }
    if(lengque>0&&f==1)
    {
    lengque--;
    }
    if(f==1)
    {
    xhp+=100;
    shengming-=60;
    }
    int a;
    int b;
    switch(l)
    {
    case 1:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    a=(randomNumber% 100)+1;
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    b=(randomNumber% 100)+1;
    if(wudi>0)
    {
    wudi--;
    i++;
    f=1;
    if(a<=xsp)
    {
    cout<<"吸血蝙蝠成功闪避"<<endl;
    Sleep(1000);
    }
    else
    xhp-=shanghai-xfy;
    break;
    }
    if((fangyu/2)<xsh)
    {
    if(b>xbj)
    shengming-=xsh-fangyu/2;
    else
    {
    cout<<"吸血蝙蝠成功暴击"<<xsh*bj-fangyu/2<<"伤害"<<endl;
    shengming-=xsh*bj-fangyu/2;
    Sleep(500);
    }
    }
    if(shanghai>xfy )
    {
    if(a<=xsp)
    {
    cout<<"吸血蝙蝠成功闪避"<<endl;
    Sleep(1000);
    }
    else
    xhp-=shanghai-xfy;
    }
    i++;
    f=1;
    break;
    case 2:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    b=(randomNumber% 100)+1;
    if(fangyu*2<xsh||(b<xbj&&xsh*bj>fangyu*2))
    {
    if(b>xbj)
    shengming-=xsh-fangyu*2;
    else
    {
    cout<<"吸血蝙蝠成功暴击"<<xsh*bj-fangyu*2<<"伤害"<<endl;
    shengming-=xsh*bj-fangyu/2;
    Sleep(500);
    }
    }
    i++;
    f=1;
    break;
    case 3:
    srand(static_cast<unsigned int >(time(0))) ;
    randomNumber=rand();
    a=(randomNumber% 100)+1;
    if(lengque==0)
    {
    if(zhiye==1)
    {
    if(a<=xsp)
    {
    cout<<"吸血蝙蝠成功闪避"<<endl;
    Sleep(1000);
    }
    else
    xhp-=shanghai*2;
    lengque=5;
    }
    if(zhiye==2)
    {
    wudi=3;
    lengque=8;
    }
    if(zhiye==3)
    {
    if(a<=xsp)
    {
    cout<<"吸血蝙蝠成功闪避"<<endl;
    Sleep(1000);
    }
    else
    xhp-=xdj*100;
    shengming+=500;
    lengque=10;
    }
    i++;
    f=0;
    break;
    }
    cout<<"冷却中剩余"<<lengque<<"回合"<<endl;
    Sleep(750);
    f=0;
    break;
    case 4:
    if(jijiubao>0)
    {
    cout<<"使用成功!!!"<<endl;
    jijiubao--;
    shengming+=50;
    Sleep(750);
    }
    break;

    default:
    cout<<"不要乱输入"<<endl;
    break;
    }

    }
    if(shengming<=0)
    {
    cout<<"你死了"<<endl;
    Sleep(1000);
    return ;
    }
    if(xhp<=0)
    {
    cout<<"你打败了"<<xdj<<"级";
    if(jingyan/100>=20)
    {
    cout<<"<超级>吸血蝙蝠"<<endl;
    cout<<"奖励金币"<<xdj*20+100<<"$"<<endl;
    cout<<"奖励经验"<<xdj*10<<endl;
    jinbi+=xdj*20+100;
    jingyan+=xdj*10;
    }
    else if(jingyan/100<20&&jingyan/100>=10)
    {
    cout<<"<精英>远古骷髅"<<endl;
    cout<<"奖励金币"<<xdj*15+100<<"$"<<endl;
    cout<<"奖励经验"<<xdj*10<<endl;
    jinbi+=xdj*15+100;
    jingyan+=xdj*10;
    }
    else
    {
    cout<<"远古骷髅"<<endl;
    cout<<"奖励金币"<<xdj*10+100<<"$"<<endl;
    cout<<"奖励经验"<<xdj*10<<endl;
    jinbi+=xdj*10+100;
    jingyan+=xdj*10;
    }
    if(xdj==10&&flag<=20)
    {
    cout<<"恭喜获得>>恶魔之心*1<<"<<endl;
    emzx++;
    }
    Sleep(1000);
    }
    }
    }
    void zhiyewuqi()
    {

    return ;
    }

  • 1