#include<iostream>
#include<cstdio>
#include<bits/stdc++.h>
#include<windows.h>
#include "windows.h"
#include<cstring>
#include<conio.h>
#include<stdio.h>
using namespace std;
//    cout << "原色testCOLOR(没有设置字体颜色)" << endl;
//    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED |FOREGROUND_GREEN | FOREGROUND_BLUE);//设置三色相加
//    cout << "白色testCOLOR(红色绿色蓝色相加)" << endl;
//    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);//设置红色
//    cout << "红色testCOLOR(设置的颜色为红色)" << endl;
//    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);//设置绿色
//    cout << "绿色testCOLOR(设置的颜色为绿色)" << endl;
//    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);//设置蓝色
//    cout << "蓝色testCOLOR(设置的颜色为蓝色)" << endl;
//    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);//设置红色和绿色相加
//    cout << "黄色testCOLOR(红色和绿色相加色)" << endl;
//    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);//设置红色和蓝色相加
//    cout << "粉色testCOLOR(红色和蓝色相加色)" << endl;
//    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN |FOREGROUND_BLUE);//设置绿色和蓝色相加
//    cout << "青色testCOLOR(绿色和蓝色相加色)" << endl;
//    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);//设置颜色,没有添加颜色,故为原色
using namespace std;
string kjl="    ---------------------------------------------The Way Of The Brave";
string slsf="---------------------------------------------    ";
int yao=0,jg=0,jf=0,guais,gongs,fangzhi,shengm=20,b,c=0,o;
int gongj,fangj,sheng=20,gong=10,fang=10,guaig,fangfan,renbao=0;
int hlf=0,skf=0,tlf=0,hl=0,sk=0,tl=0,m=0,qie=0,guaigs,mo=0;
int sui(int min,int max){
int a;
srand(time(NULL));
a=(rand()%(max-min+min))+min;
return a;
}
/*sui函数用法int main(){
int mi,ma;
scanf("%d%d",&mi,&ma);
int r=sui(mi,ma);
cout<<r;
}*/
int gongjh(){
hlf=hl;
skf=sk;
tlf=tl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
fangzhi=c;
while(guais>0&&sheng>0){
    if(qie==1)
        guaig=sui(4+10*m,2);
    else
        guaig=sui(guaigs-2+10*m,4);
    gongs=sui(gong-2,4);
    if(renbao==1){
        renbao=0;
        gongs*=3;
    }
    printf("\n");
    printf("------------------------------\n");
    printf("怪物生命: %d\n",guais);
    printf("怪物攻击: %d--%d\n",guaigs-2+10*m,guaigs+2+10*m);
    printf("------------------------------\n");
    cout<<"1.攻击"<<endl; 
    if(fangzhi!=0) cout<<"2.防御(次数"<<fangzhi<<")"<<endl;
    cout<<"3.嗑药(闪避)"<<endl;
    if(hlf>0||tlf>0||skf>0)cout<<"4.法杖"<<endl;
    cout<<endl;
    b=_getch()-'0';
    if(b==1){
        guais=guais-gongs;
        sheng=sheng-guaig;
        cout<<"怪物生命"<<"-"<<gongs<<"="<<guais<<endl;
        cout<<"自身生命"<<"-"<<guaig<<"="<<sheng<<endl;
    }
    if(b==2&&fangzhi!=0){
        if(fang>=guaig){
            if(fang-guaig>fangfan){
                guais=guais-fangfan;
                cout<<"怪物生命"<<"-"<<fangfan<<"="<<guais<<endl;
            }
            else{
                guais=guais-fang+guaig;
                cout<<"怪物生命"<<"-"<<fang-guaig<<"="<<guais<<endl;
            }
        }
        else{
            sheng=sheng-(guaig-fang);
            cout<<"自身生命"<<"-"<<guaig-fang<<"="<<sheng<<endl;
        }
        fangzhi--;
    }
    if(b==3){
        cout<<"1.恢复灵药"<<endl; 
        cout<<"2.嗜血药剂"<<endl;
        cout<<"3.钢铁合剂"<<endl;
        b=_getch()-'0';
        if(b==1&&yao>=1){
            yao--;
            sheng=sheng+20;
            if(sheng>shengm)sheng=shengm;
            cout<<"灵药数量"<<yao<<endl;
            cout<<"自身生命+20("<<sheng<<")"<<endl;
        }
        if(b==1&&yao==0) printf("无可用药剂!\n"); 
        if(b==2&&jg>=1){
            jg--;
            gong++;
            sheng-=guaig/10;
            cout<<"自身生命"<<"-"<<guaig/10<<"="<<sheng<<endl;
            cout<<"药剂数量"<<jg<<endl;
            cout<<"自身攻击+1("<<gong<<")"<<endl;
        }
        if(b==2&&jg==0) printf("无可用药剂!\n"); 
        if(b==3&&jf>=1){
            jf--;
            fang++;
            sheng-=guaig/10;
            cout<<"自身生命"<<"-"<<guaig/10<<"="<<sheng<<endl;
            cout<<"合剂数量"<<jf<<endl;
            cout<<"自身防御+1("<<fang<<")"<<endl;
        }
        if(b==3&&jf==0) printf("无可用药剂!\n"); 
    }
    if(b==4){
        if(hlf>0)cout<<"1.回轮5000(反伤) 价值:50"<<endl;
        if(skf>0)cout<<"2.时空折叠器(防御值回满) 价值50"<<endl;
        if(tlf>0)cout<<"3.魔王的头颅(下次伤害拥有暴击) 价值200"<<endl;
        b=_getch()-'0';
        if(b==1&&hlf>=1){
            hlf--;
            printf("反弹伤害!");
            cout<<"自身生命"<<"-"<<guaig/10<<"="<<sheng<<endl;
            cout<<"回轮次数"<<hlf<<endl;
            guais=guais-guaig;
            cout<<"怪物生命-"<<guaig<<"="<<guais<<endl;
        }
        if(b==1&&hlf==0) printf("无可用法杖!\n"); 
        if(b==2&&skf>=1){
            skf--;
            printf("时空倒流!");
            fangzhi=c;
            cout<<"自身防御次数恢复"<<"="<<fangzhi<<endl;
            cout<<"时空数量"<<"="<<skf<<endl;
        }
        if(b==2&&skf==0) printf("无可用法杖!\n"); 
        if(b==3&&tlf>=1){
            tlf--;
            renbao=1;
            cout<<"下次攻击将会暴击"<<endl;
            cout<<"头颅使用数量"<<tlf<<endl;
        }
        if(b==3&&jf==0) printf("无可用法杖!\n"); 
    }
    if(fangzhi==0){
        printf("防御次数已用尽\n");
    }
    if(sheng<=0){
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
        cout<<"你死了"<<endl;
        Sleep(50);
        cout<<"请去商店补血后再战斗"<<endl;
        Sleep(50);
        cout<<"复活中";
        for(int i=1;i<=5;i++){
            printf(".");
            Sleep(50);
        }
        printf("\n");
        break;
    }
}
}
/*战斗函数 
进入函数
gonhjh(怪生,怪攻,生命,攻击,防御,恢复灵药,嗜血药剂,钢铁合剂,生命上限)
int guais,int guaig,int sheng,int gong,int fang,int yao,int jg,int jf,int shengm)
*/ 
int main(){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
cout<<"你是一位勇者,"<<endl;
Sleep(50);
cout<<"有一天你听见了魔王的怒吼,"<<endl;
Sleep(50);
cout<<"于是你踏上了打败魔王的征程。"<<endl;
Sleep(2500); 
system("CLS");
system("color F0"); 
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
for(int i=0;i<=68;i++){
    printf("%c",kjl[i]);
    Sleep(90);
}
for(int i=0;i<=48;i++){
    printf("%c",slsf[i]);
    Sleep(90);
}
system("color 07"); 
cout<<""<<endl;
Sleep(250); 
system("CLS");
printf("请稍后");
    for(int i=1;i<=5;i++){
        printf(".");
        Sleep(5);
    }
printf("\n");
int a=0,b,qian01,laotou=0;
int qian=0,bao,muwu;
while(a==0){
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED |FOREGROUND_GREEN | FOREGROUND_BLUE);
    cout<<"1.勇者商店"<<endl; 
    cout<<"2.讨伐魔物"<<endl;
    cout<<"3.角色资料"<<endl;
    cout<<"请选择..."<<endl;
    cout<<endl;
    b=_getch()-'0';
    qian+=2000;
    if(b==1){
        system("CLS");
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
        printf("请稍后");
        for(int i=1;i<=5;i++){
            printf(".");
            Sleep(50);
            }
        printf("\n");
        cout<<"1.装备"<<endl; 
        cout<<"2.药品"<<endl;
        cout<<"输入0退出"<<endl;
        cout<<endl;
        b=_getch()-'0';
        if(b==1){
            system("CLS");
            while(b!=0){
                printf("请稍后");
                for(int i=1;i<=5;i++){
                    printf(".");
                    Sleep(50);
                }
                printf("\n");
                cout<<"1.武器"<<endl;
                cout<<"2.盾牌"<<endl;
                cout<<"3.盔甲"<<endl;
                cout<<"4.法杖"<<endl;
                if(m>0)cout<<"5.炼化"<<endl;
                cout<<"(装备不可重复购买)"<<endl;
                cout<<"输入0退出"<<endl;
                cout<<endl;
                b=_getch()-'0';
                if(b==1){
                    system("CLS");
                    printf("请稍后");
                    for(int i=1;i<=5;i++){
                        printf(".");
                        Sleep(50);
                    }
                    printf("\n");
                    cout<<"1.骑士长剑(+10) 价值:20"<<endl;
                    cout<<"2.石中剑(+20) 价值40"<<endl;
                    if(m>0)cout<<"3.魔王的右手(+90) 价值150"<<endl;
                    cout<<"输入6退出"<<endl;
                    cout<<endl;
                    b=_getch()-'0';
                    if(b==1){
                        system("CLS");
                        if(qian<20)
                            printf("金币不足\n");
                        else{
                        gong=20;
                        qian-=20;
                        cout<<"自身攻击"<<gong<<endl;
                        }
                    }
                    if(b==2){
                        system("CLS");
                        if(qian<40)
                            printf("金币不足\n");
                        else{
                        gong=30;
                        qian-=40;
                        cout<<"自身攻击"<<gong<<endl;
                        }
                    }
                    if(b==3&&m>0){
                        system("CLS");
                        if(qian<150)
                            printf("金币不足\n");
                        else{
                        gong=50;
                        qian-=150;
                        cout<<"自身攻击"<<gong<<endl;
                        mo=1;
                        }
                    }
                    b=0;
                }
                if(b==2){
                    system("CLS");
                    printf("请稍后");
                    for(int i=1;i<=5;i++){
                        printf(".");
                        Sleep(50);
                    }
                    printf("\n");
                    cout<<"1.皇家盾牌(+10) 价值:20"<<endl;
                    cout<<"2.永恒堡垒(+20) 价值40"<<endl;
                    if(m>0)cout<<"3.魔王的左手(+90) 价值150"<<endl;
                    cout<<"输入6退出"<<endl;
                    cout<<endl;
                    b=_getch()-'0';
                    if(b==1){
                        system("CLS");
                        if(qian<20)
                            printf("金币不足\n");
                        else{
                        fang=20;
                        qian-=20;
                        cout<<"自身防御"<<fang<<endl;
                        } 

                    }
                    if(b==2){
                        system("CLS");
                        if(qian<40)
                            printf("金币不足\n");
                        else{
                        fang=30;
                        qian-=40;
                        cout<<"自身防御"<<fang<<endl;
                        } 
                    }
                    if(b==3&&m>0){
                        system("CLS");
                        if(qian<150)
                            printf("金币不足\n");
                        else{
                        fang=50;
                        qian-=150;
                        cout<<"自身防御"<<fang<<endl;
                        mo=1;
                        } 
                    }
                }
                if(b==3){
                    system("CLS");
                    printf("请稍后");
                    for(int i=1;i<=5;i++){
                        printf(".");
                        Sleep(50);
                    }
                    printf("\n");
                    cout<<"1.战争盔甲(+10) 价值:20"<<endl;
                    cout<<"2.不灭龙甲(+20) 价值40"<<endl;
                    if(m>0)cout<<"3.魔王的精华(+90) 价值150"<<endl;
                    cout<<"输入6退出"<<endl;
                    cout<<endl;
                    b=_getch()-'0';
                    if(b==1){
                        system("CLS");
                        if(qian<20)
                            printf("金币不足\n");
                        else{
                        shengm=30;
                        qian-=20;
                        cout<<"自身生命上限"<<shengm<<endl;
                        }
                    }
                    if(b==2){
                        system("CLS");
                        if(qian<40)
                            printf("金币不足\n");
                        else{
                            shengm=40;
                            qian-=40;
                            cout<<"自身生命上限"<<shengm<<endl;
                        }
                    }
                    if(b==3&&qian>=150&&m>0){
                        system("CLS");
                        if(qian<150)
                            printf("金币不足\n");
                        else{
                            shengm=110;
                            qian-=150;
                            cout<<"自身生命上限"<<shengm<<endl;
                            mo=1;
                        }
                    }
                }
                if(b==4){
                    system("CLS");
                    printf("请稍后");
                    for(int i=1;i<=5;i++){
                        printf(".");
                        Sleep(50);
                    }
                    printf("\n");
                    cout<<"1.回轮5000(反伤) 价值:50"<<endl;
                    cout<<"2.时空折叠器(防御值回满) 价值50"<<endl;
                    if(m>0)cout<<"3.魔王的头颅(下次伤害拥有暴击) 价值200"<<endl;
                    cout<<"输入6退出"<<endl;
                    cout<<endl;
                    b=_getch()-'0';
                    if(b==1){
                        system("CLS");
                        if(qian<20)
                            printf("金币不足\n");
                        else{
                            hl=1;
                            printf("购买成功\n");
                        }
                    }
                    if(b==2){
                        system("CLS");
                        if(qian<40)
                            printf("金币不足\n");
                        else{
                            sk=1;
                            printf("购买成功\n");
                        }
                    }
                    if(b==3&&qian>=150&&m>0){
                        system("CLS");
                        mo=1;
                        if(qian<150)
                            printf("金币不足\n");
                        else{
                            tl=1;
                            printf("购买成功\n");
                        }
                    }
                }
                if(b==5&&m>0){
                    system("CLS");
                    printf("请稍后");
                    for(int i=1;i<=5;i++){
                        printf(".");
                        Sleep(50);
                    }
                    printf("\n");
                    cout<<"1.炼化武器(+10) 价值50"<<endl;
                    cout<<"2.炼化盾牌(+10) 价值50"<<endl;
                    cout<<"3.炼化盔甲(+10) 价值50"<<endl;
                    cout<<"输入6退出"<<endl;
                    b=_getch()-'0';
                    if(b==1){
                        system("CLS");
                        if(qian<50)
                            printf("金币不足\n");
                        else{
                            gong+=10;
                            qian-=50;
                            cout<<"自身攻击"<<gong<<endl;
                        }
                    }
                    if(b==2){
                        system("CLS");
                        if(qian<50)
                            printf("金币不足\n");
                        else{
                            fang+=10;
                            qian-=50;
                            cout<<"自身防御"<<fang<<endl;
                        }
                    }
                    if(b==3){
                        system("CLS");
                        if(qian<50)
                            printf("金币不足\n");
                        else{
                            shengm+=10;
                            qian-=50;
                            cout<<"自身生命上限"<<shengm<<endl;
                        }
                    }
                } 
            }
        }
        if(b==2){
            system("CLS");
            printf("请稍后");
            for(int i=1;i<=5;i++){
                printf(".");
                    Sleep(50);
            }
            printf("\n");
            cout<<"1.快速回复(花费1)"<<endl;
            cout<<"2.恢复灵药(花费5)*5"<<endl;
            cout<<"3.嗜血药剂(花费5)*5"<<endl;
            cout<<"2.钢铁合剂(花费5)*5"<<endl;
            cout<<"输入0退出"<<endl;
            cout<<endl;
            b=_getch()-'0';
            if(b==1&&qian>=1){
                system("CLS");
                sheng=shengm;
                qian--;
                cout<<"自身生命"<<sheng<<endl;
            }
            if(b==2&&qian>=5){
                system("CLS");
                yao=yao+5;
                cout<<"恢复灵药数量"<<yao<<endl;
                qian-=5;
            }
            if(b==3&&qian>=5){
                system("CLS");
                jg=jg+5;
                cout<<"嗜血药剂数量"<<jg<<endl;
                qian-=5;
            }
            if(b==4&&qian>=5){
                system("CLS");
                jf=jf+5;
                cout<<"钢铁合剂数量"<<jf<<endl;
                qian-=5;
            }
        }
    }
    else if(b==2&&sheng>0){
        system("CLS");
        printf("探索中");
        for(int i=1;i<=5;i++){
            printf(".");
            Sleep(50); 
        }
        cout<<endl;
        o=sui(1,99);
        if(o>=1&&o<=7&&laotou==0){
            system("CLS");
            laotou=1;
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
            printf("你遇到一个看起来饥肠辘辘的老头\n");
            Sleep(50);
            printf("他问你是否可以给他一些钱\n");
            for(int i=1;i<=5;i++){
                printf(".");
                Sleep(50);
            }
            printf("请选择\n");
            Sleep(50);
            if(qian>=5){ 
                printf("1.给予     2.算了吧\n");
                b=_getch()-'0';
            }
            else{ 
                printf("1.金币不够算了吧\n");
                b=2;
            }
            if(b==1){
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                qian-=5;
                printf("金币-5=%d\n",qian);
                yao+=5;
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
                printf("“谢谢你,小伙子。”\n");
                Sleep(50);
                printf("“这里有我珍藏的恢复药剂,”\n");
                Sleep(50);
                printf("“我已经活了很久了,”\n");
                Sleep(50);
                printf("“估计也用不上这个东西了。”\n");
                Sleep(50);
                printf("“拿去吧”\n");
                Sleep(50);
                printf("恢复灵药+5\n");
                Sleep(50);
                printf("“这些都是以前的勇者给我的”\n");
                Sleep(50);
                printf("“但是他们没有一个人回来”\n");
                Sleep(50);
                printf("“年级轻轻的,你回去吧”\n");
                Sleep(50);
            }
            if(b==2){
                printf("他死在了你的面前\n");
                Sleep(50);
                printf("脸上还残留着对这个世界的绝望\n");
                Sleep(50);
                printf("他死于饥饿与冷漠的双重打击\n");
                Sleep(50);
                printf("你心情很复杂\n");
                Sleep(50);
                printf("嗓子好像被一块巨石卡住\n");
                Sleep(50);
                printf("精神上的压力让你不能呼吸\n");
                Sleep(50);
                printf("你花了些钱为他置办了一场简单的葬礼\n");
                Sleep(50);
                qian-=10;
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                printf("金币-10=%d",qian);
                Sleep(50);
            }
        }
        if(o>=8&&o<=15){
            printf("你遇到了一个小男孩\n");
            Sleep(50);
            printf("“可以给我3瓶钢铁合剂吗?”\n");
            Sleep(50);
            printf("“为什么???”\n");
            Sleep(50);
            printf("我要去消灭这条路上的一个怪物\n");
            Sleep(50);
            printf("要相信他吗?\n");
            Sleep(50);
            for(int i=1;i<=5;i++){
                printf(".");
                Sleep(50);
            }
            printf("请选择\n");
            if(jf>=3){ 
                printf("1.加油!     2.算了吧\n");
                b=_getch()-'0';
            }
            else{ 
                printf("1.合剂不够算了吧\n");
                b=2;
            }
            if(b==1){
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                jf-=3;
                printf("钢铁合剂-3%d\n",jf);
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
                printf("“谢谢!”\n");
                Sleep(50);
                printf("过了一会儿");
                for(int i=1;i<=5;i++){
                printf(".");
                Sleep(50);
                }
                printf("\n “给,5个金币”\n");
                Sleep(50);
                printf("“5个金币?”\n");
                Sleep(50);
                printf("你原本没有在意这个小男孩.......\n");
                Sleep(50);
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                printf("金币+5\n");
                qian+=5;
                Sleep(50);
            }
            if(b==2){
                printf("过了一会.......\n");
                Sleep(50);
                printf("一个小怪迎面走来\n");
                Sleep(50);
                printf("原来这条路上真的有怪物\n");
                Sleep(50);
                printf("地面上好像还有小男孩掉下的东西\n");
                Sleep(50);
                printf("他应该是顺利逃跑了吧?\n");
                Sleep(50);
                system("CLS");
                guaigs=5;
                gongj=gong;
                fangj=fang;
                guais=sui(25+m*10,10);
                c=5;
                fangfan=10;
                gongjh();
                if(sheng>0){
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                    qian01=qian;
                    qian=qian+sui(1,2);
                    printf("金币+%d\n",qian-qian01);
                }       
                gong=gongj;
                fang=fangj;
                cout<<endl; 
                b=0;
            }   
        }
        if(o>=29&&o<=36){
            printf("你遇到了一个年轻人,\n");
            Sleep(50);
            printf("他的脸上一直带着微笑,看起来十分和善。\n");
            Sleep(50);
            printf("他拿出一个不规则球状物,\n");
            Sleep(50);
            printf("说这叫闪耀的偏方三八面体,能召唤神明,实现你三个愿望。\n");
            Sleep(50);
            printf("他的愿望已经用完了,现在想用它换一些钱,要相信他吗?\n");
            Sleep(50);
            for(int i=1;i<=5;i++){
                printf(".");
                Sleep(50);
            }
            printf("请选择\n");
            Sleep(50);
            if(qian>=50){ 
                printf("1.给予     2.算了吧\n");
                scanf("%d",&b);
            }
            else{ 
                printf("1.金币不够算了吧\n");
                b=2;
            }
            b=_getch()-'0';
            if(b==1){
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                printf("金币-50=%d\n",qian);
                qian-=50;
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
                printf("他告诉你只要把这个东西放在黑夜里就行了。\n");
                Sleep(50);
                printf("你相信了他说的话。\n");
                Sleep(50);
                printf("\n 在夜里,你把它放在了一个没有光线的地方\n");
                Sleep(50);
                printf("一只类似蝙蝠的肿胀怪物,火红的独眼裂成三瓣的生物突然出现。\n");
                Sleep(50);
                printf("你被他恐怖的形象吓到精神错乱,眼睁睁的看着祂吞掉了你。\n");
                Sleep(50);
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
                cout<<"你死了"<<endl;
                Sleep(50);
                cout<<"请去商店补血后再战斗"<<endl;
                Sleep(50);
                cout<<"复活中";
                sheng=-1;
                for(int i=1;i<=5;i++){
                    printf(".");
                    Sleep(50);
                }
            }
            if(b==2){
                printf("他耸了耸肩,\n");
                Sleep(50);
                printf("什么也没说,\n");
                Sleep(50);
                printf("迈着沉重的步伐走了。\n");
                Sleep(50);
            }
        }
        if(o>=20&&o<=28){
            system("CLS");
            printf("一个小木屋???\n");
            for(int i=1;i<=5;i++){
                printf(".");
                Sleep(50);
            }
            printf("\n进去看看\n");
            Sleep(50);
            muwu=sui(5,2);
            if(muwu==5){
                system("CLS");
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
                printf("你掉入了大魔王的陷阱\n");
                Sleep(50);
                sheng=-1;
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
                cout<<"你死了"<<endl;
                Sleep(50);
                cout<<"请去商店补血后再战斗"<<endl;
                Sleep(50);
                cout<<"复活中";
                for(int i=1;i<=5;i++){
                    printf(".");
                    Sleep(50);
                }
            }
            if(muwu==6){
                system("CLS");
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                qian01=qian; 
                printf("小怪的藏宝点!?\n");
                Sleep(50);
                qian=qian+sui(100,70);
                printf("金币+%d\n",qian-qian01);
                Sleep(50);
            }
            if(muwu==7){
                system("CLS");
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
                printf("发现了不可名状的雕像\n");
                Sleep(50);
                printf("你因为精神崩溃而受伤了\n");
                cout<<"自身生命"<<"-"<<5<<"="<<sheng<<endl;
                if(sheng>=0){
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
                    cout<<"你死了"<<endl;
                    Sleep(50);
                    cout<<"请去商店补血后再战斗"<<endl;
                    Sleep(50);
                    cout<<"复活中";
                    for(int i=1;i<=5;i++){
                        printf(".");
                        Sleep(50); 
                    }
                }
            }
        }
        if(o>=70&&o<=75){
            system("CLS");
            cout<<"你遇到了窃币者!"<<endl;
            printf("请稍后");
            for(int i=1;i<=5;i++){
                printf(".");
                Sleep(50);
            }
            qie=1;
            cout<<endl;
            guaigs=5;
            gongj=gong;
            fangj=fang;
            if(m==1){
                guais=sui(105,10);
            }
            else
                guais=sui(65,10);
            c=0;
            fangfan=10;
            gongjh();
            if(sheng>0){
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                qian01=qian;
                qian=qian+120;
                printf("金币+%d\n",qian-qian01);
                Sleep(50);
            }
            else{
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                qian01=qian;
                qian=qian/2;
                printf("金币-%d\n",qian01-qian);
                Sleep(50);
            }
            gong=gongj;
            fang=fangj;
            qie=0;
            cout<<endl;
        }
        if(o>=80&&o<=90){
            system("CLS");
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
            cout<<"------你找到了宝箱!------"<<endl;
            printf("请稍后");
            for(int i=1;i<=5;i++){
                printf(".");
                Sleep(50);
            }
            qian01=qian;
            qian=qian+sui(20,32);
            printf("金币+%d\n",qian-qian01);
            Sleep(50);
        }
        printf("\n");
        system("CLS");
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
        cout<<"1.小怪"<<endl;
        if(gong>=15){
            cout<<"2.魔头"<<endl;
            cout<<"3.幻影"<<endl;
            if(gong>=25){
                cout<<"4.大魔王"<<endl;
                cout<<"输入0退出"<<endl;
                cout<<endl;
                b=_getch()-'0'; 
            }
            else{
                cout<<"输入0退出"<<endl;
                cout<<endl;
                b=_getch()-'0'; 
            } 
        }
        else{
            cout<<"输入0退出"<<endl;
            cout<<endl;
            b=_getch()-'0'; 
        } 
        if(b==1){
            system("CLS");
            guaigs=5;
            gongj=gong;
            fangj=fang;
            guais=sui(25+m*10,10);
            c=5;
            fangfan=10;
            gongjh();
            if(sheng>0){
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                qian01=qian;
                qian=qian+sui(1,2);
                printf("金币+%d\n",qian-qian01);
            }
            gong=gongj;
            fang=fangj;
            cout<<endl; 
            b=0;
        }
        if(b==2){
            system("CLS");
            guaigs=10;
            gongj=gong;
            fangj=fang;
            guais=sui(45+10*m,10);
            fangfan=6;
            c=7;
            gongjh();
//              (int guais,int guaig,int sheng,int gong,int fang,int yao,int jg,int jf,int shengm,int fangfan)
            if(sheng>0){
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                qian01=qian;
                qian=qian+sui(8,4);
                printf("金币+%d\n",qian-qian01);
            }
            gong=gongj;
            fang=fangj;
            cout<<endl;
            b=0;
        }
        if(b==3){
            system("CLS");
            guaigs=15;
            gongj=gong;
            fangj=fang;
            guais=sui(30+10*m,70+5*m);
            fangfan=8;
            c=7;
            gongjh();
//              (int guais,int guaig,int sheng,int gong,int fang,int yao,int jg,int jf,int shengm,int fangfan)
            if(sheng>0){
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                qian01=qian;
                qian=qian+sui(2,28);
                printf("金币+%d\n",qian-qian01);
            }
            gong=gongj;
            fang=fangj;
            cout<<endl;
            b=0;
        }
        if(b==4){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
            gongj=gong;
            fangj=fang;
            guais=sui(95+200*m,10);
            c=10;
            fangzhi=c;
            hlf=hl;
            skf=sk;
            tlf=tl;
            while(guais>0&&sheng>0){
                gongs=sui(gong-2,4);
                if(renbao==1){
                    gongs*=3;
                    renbao=0;
                }
                guaig=sui(18+15*m,4);
                if(bao==3){
                    guaig=guaig*3;
                    bao=0;
                }
                printf("\n");
                printf("------------------------------\n");
                printf("魔王生命: %d\n",guais);
                printf("魔王攻击: %d--%d\n",18+15*m,18+15*m+4);
                printf("注:魔王暴击规律不变!\n");
                printf("\n------------------------------\n");
                cout<<"1.攻击"<<endl; 
                if(fangzhi==0) cout<<"2.防御(次数"<<fangzhi<<")"<<endl;
                cout<<"3.嗑药(闪避)"<<endl;
                if(hlf>0||tlf>0||skf>0)cout<<"4.法杖"<<endl;
                cout<<endl;
                b=_getch()-'0'; 
                if(b==1){
                    guais=guais-gongs;
                    sheng=sheng-guaig;
                    cout<<"怪物生命"<<"-"<<gongs<<"="<<guais<<endl;
                    cout<<"自身生命"<<"-"<<guaig<<"="<<sheng<<endl;
                    bao++;
                }
                if(b==2&&fangzhi!=0){
                    if(fang>guaig){
                        if(fang-guaig>10){
                            guais=guais-10;
                            cout<<"怪物生命"<<"-"<<10<<"="<<guais<<endl;
                            bao++;
                        }
                        else{
                            guais=guais-fang+guaig;
                            cout<<"怪物生命"<<"-"<<fang-guaig<<"="<<guais<<endl;
                            bao++;
                        }
                    }
                    else{
                        sheng=sheng-(guaig-fang);
                        cout<<"自身生命"<<"-"<<guaig-fang<<"="<<sheng<<endl;
                        bao++;
                    }
                    fangzhi--;
                }
                if(b==3){
                    cout<<"1.恢复灵药"<<endl; 
                    cout<<"2.嗜血药剂"<<endl;
                    cout<<"3.钢铁合剂"<<endl;
                    cin>>b;
                    if(b==1&&yao>=1){
                        yao--;
                        sheng=sheng+20;
                        if(sheng>shengm)sheng=shengm;
                        cout<<"灵药数量"<<yao<<endl;
                        cout<<"自身生命+20("<<sheng<<")"<<endl;
                        bao++;
                    }
                    if(b==1&&yao==0) printf("无可用药剂!\n"); 
                    if(b==2&&jg>=1){
                        jg--;
                        gong++;
                        sheng-=guaig/10;
                        cout<<"自身生命"<<"-"<<guaig/10<<"="<<sheng<<endl;
                        cout<<"药剂数量"<<jg<<endl;
                        cout<<"自身攻击+1("<<gong<<")"<<endl;
                        bao++;
                    }
                    if(b==2&&jg==0) printf("无可用药剂!\n"); 
                    if(b==3&&jf>=1){
                        jf--;
                        fang++;
                        sheng-=guaig/10;
                        cout<<"自身生命"<<"-"<<guaig/10<<"="<<sheng<<endl;
                        cout<<"合剂数量"<<jf<<endl;
                        cout<<"自身防御+1("<<fang<<")"<<endl;
                        bao++;
                    }
                    if(b==3&&jf==0) printf("无可用药剂!\n"); 
                }
                if(b==4){
                    if(hlf>0)cout<<"1.回轮5000(反伤) 价值:50"<<endl;
                    if(skf>0)cout<<"2.时空折叠器(防御值回满) 价值50"<<endl;
                    if(tlf>0)cout<<"3.魔王的头颅(下次伤害拥有暴击) 价值200"<<endl;
                    cin>>b;
                    if(b==1&&hlf>=1){
                        hlf--;
                        printf("反弹伤害!");
                        cout<<"自身生命"<<"-"<<guaig/10<<"="<<sheng<<endl;
                        cout<<"回轮次数"<<hlf<<endl;
                        guais=guais-guaig;
                        cout<<"怪物生命-"<<guaig<<"="<<guais<<endl;
                    }
                    if(b==1&&hlf==0) printf("无可用法杖!\n"); 
                    if(b==2&&skf>=1){
                        skf--;
                        printf("时空倒流!");
                        fangzhi=c;
                        cout<<"自身防御次数恢复"<<"="<<fangzhi<<endl;
                        cout<<"时空数量"<<"="<<skf<<endl;
                    }
                    if(b==2&&skf==0) printf("无可用法杖!\n"); 
                    if(b==3&&tlf>=1){
                        tlf--;
                        renbao=1;
                        cout<<"下次攻击将会暴击"<<endl;
                        cout<<"头颅使用数量"<<tlf<<endl;
                    }
                    if(b==3&&jf==0) printf("无可用法杖!\n"); 
                }
                if(sheng<=0){
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
                    cout<<"你死了"<<endl;
                    Sleep(50);
                    cout<<"请去商店补血后再战斗"<<endl;
                    Sleep(50);
                    cout<<"复活中";
                    for(int i=1;i<=5;i++){
                        printf(".");
                        Sleep(50);
                    }
                    printf("\n");
                    break;
                }
                if(fangzhi==0){
                    printf("防御次数已用尽\n"); 
                }
            }
            if(sheng>0){
                printf("你竟然击败了魔王!!!\n"); 
                printf("可是,你真的赢了吗?");
                for(int i=1;i<=5;i++){
                    printf(".");
                    Sleep(50);
                }
                printf("\n魔石的力量将赐予它们新生!");
                printf("\n"); 
                Sleep(50);
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                qian=qian+50;
                m++; 
                cout<<"金币"<<"+50"<<endl;
                cout<<"------你获得了魔石------"<<endl<<endl;
            }
            bao=0;
            gong=gongj;
            fang=fangj;
            cout<<endl; 
        }
    }
    else if(b==2&&sheng<=0){
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
        cout<<"你死了"<<endl;
        cout<<"请去商店补血后再战斗"<<endl<<endl;
    }
    else if(b==3){
        system("CLS");
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN |FOREGROUND_BLUE);
        printf("请稍后");
        for(int i=1;i<=5;i++){
            printf(".");
            Sleep(50);
        }
        printf("\n");
        printf("\n自身资料\n");
        printf("----------------------------------------------\n");
        printf("生命: %d                   ",sheng);
        printf("攻击: %d\n\n",gong);
        printf("防御: %d                   ",fang);
        printf("生命上限: %d\n\n",shengm);
        printf("金币: %d                   ",qian);
        printf("恢复灵药: %d\n\n",yao);
        printf("嗜血药剂: %d                   ",jg);
        printf("钢铁合剂: %d\n\n",jf);
        if(m>0) printf("魔石: %d                   ",m);
        printf("\n----------------------------------------------\n");
        cout<<endl<<endl;
    }
    if(m==5){
        if(mo==1){
            system("CLS");
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
            Sleep(50);
            cout<<"你第五次击败了魔王,"<<endl;
            Sleep(50);
            cout<<"看着眼前没再复活的魔王的尸体,"<<endl;
            Sleep(50);
            cout<<"“结束了?”"<<endl;
            Sleep(50);
            cout<<"你看着仍在散发着紫色光芒的魔石,"<<endl;
            Sleep(50);
            cout<<"暗自否定了这个问题。"<<endl;
            Sleep(50);
            cout<<"你的视线不经意间扫过你从魔王身上获得的战利品,"<<endl;
            Sleep(50);
            cout<<"却发现它们似乎和你的身体融合在了一起。"<<endl;
            Sleep(50);
            cout<<"“怎么回事?!”"<<endl;
            Sleep(50);
            cout<<"你眼前的景物逐渐变得模糊."<<endl;
            Sleep(50);
            cout<<"你的眼睛散发着紫色的诡异的光芒。"<<endl;
            Sleep(50);
            cout<<"意识模糊间,你看到一个幻影出现在你面前。"<<endl;
            Sleep(50);
            cout<<"它收走了四块魔石,把最后一块放在了你的胸前。"<<endl;
            Sleep(50);
            cout<<"“原来...如此...”"<<endl;
            Sleep(50);
            cout<<"一声怒吼回荡在山谷之间。"<<endl;
            Sleep(50);
            cout<<"......"<<endl;
            Sleep(50);
            cout<<"一个新的身影出现,"<<endl;
            Sleep(50);
            cout<<"“魔王,我来讨伐你了!”"<<endl;
            Sleep(50);
            break; 
        }
        else{
            system("CLS");
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN); 
            cout<<"彩蛋结局!!!!!"<<endl;
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
            Sleep(50);
            cout<<"你第五次击败了魔王,"<<endl;
            Sleep(50);
            cout<<"看着眼前没再复活的魔王的尸体,"<<endl;
            Sleep(50);
            cout<<"“结束了?”"<<endl;
            Sleep(50);
            cout<<"你看着仍在散发着紫色光芒的魔石,"<<endl;
            Sleep(50);
            cout<<"暗自否定了这个问题。"<<endl;
            Sleep(50);
            cout<<"你的视线不经意间扫过你你的身体,"<<endl;
            Sleep(50);
            cout<<"却发现你的身体在逐渐变得透明。"<<endl;
            Sleep(50);
            cout<<"“怎么回事?!”"<<endl;
            Sleep(50);
            cout<<"你的耳边回荡起不可名状的事物的低语。"<<endl;
            Sleep(50);
            cout<<"你的大脑陷入了疯狂。"<<endl;
            Sleep(50);
            cout<<"你看到一个幻影出现在天边,并且在慢慢地消失。"<<endl;
            Sleep(50);
            cout<<"你的神情突然变得坚定而又疯狂。"<<endl;
            Sleep(50);
            cout<<"“遵命...我的主人...”"<<endl;
            Sleep(50);
            cout<<"......"<<endl;
            Sleep(50);
            cout<<"一个新的身影出现,"<<endl;
            Sleep(50);
            cout<<"“魔王,我来讨伐你了!”"<<endl;
            Sleep(50);
            break;
        }
    }
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
cout<<endl; 
cout<<"---------------------------------------------------------";
cout<<"完结";
cout<<"---------------------------------------------------------"<<endl;
Sleep(50);
cout<<"感谢游玩";
return 0;
}