Dev-C++小游戏大全(完结篇)(中)

作者十分推荐

1.哈利波特世界

#include <iostream>
#include <string>
#include <windows.h>
#include <conio.h>
#include <fstream>
#include <ctime>
#include <time.h>
#include <stdio.h>
using namespace std;
 
int D_Of_C, OK, ane, xy, D_Of_C1, OK1, ane1, xy1, nowM, MoralValue;
int ict = 0, nowlevel = 0;
int bag[44] = { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0};
//0抽奖券 1经验石R 2经验石SR 3经验石SSR 4经验石SSS 5经验石X
//6技能书快快复苏 7技能书铁甲咒 8技能书昏昏倒地 9技能书神锋无影 10技能书咒立停 11技能书石化咒 12技能书恢复咒 13技能书召唤咒 14技能书遗忘咒 15技能书万弹齐发 16技能书钻心咒 17技能书夺魂咒 18技能书死亡咒
//19生命药水 20防御药水 21攻击药水 22经验药水 23全幅药水 
//24猫狸子胡须 25媚娃头发 26马形水怪的鬃毛 27龙心腱 28雷鸟尾羽 29凤凰羽毛 30独角兽尾毛 31龙神经 32夜骐的尾羽
//33桦木 34紫衫木 35冬青木 36山楂木柳条 37橡木 38械木 39山毛榉木 40栗木 41樱桃木 42桃花心木
//43速度药水
string Material1name[9] = { "猫狸子胡须","媚娃头发","马形水怪的鬃毛","龙心腱","雷鸟尾羽","凤凰羽毛","独角兽尾毛","龙神经","夜骐的尾羽" };
string Material2name[10] = { "桦木","紫衫木","冬青木","山楂木柳条","橡木","械木","山毛榉木","栗木","樱桃木","桃花心木" };
int health = 1000, maxhealth = 1000, money=0, attack = 250, defense = 10, experience = 0, camp, level = 1, amm = 0, f = 0, speed = 0;
string Nwand = "空手";
int LE1 = 1, LE2 = 1, Sl[13];
bool dead = false;
string wandname[100] = { "柳条魔杖","胡桃魔杖","鹅耳枥木魔杖","柳条魔杖","花心木魔杖","冬青木魔杖","紫杉木魔杖","老魔杖" };
int wandpower[100] = { 200,500,1100,1300,2400,5000,9000,20000 }, wand[100], wandi = 8, wandnamei = 8, wandpoweri = 8;
string name, password;
int choose()
{
    system("cls");
    cout << "请选择您的阵营。" << endl;
    cout << "0, 哈利.HarryPotter" << endl;
    cout << "1, 伏地魔 LordVoldemort" << endl;
    cin >> camp;
    if (camp != 0 && camp != 1) {
        cout << "输入错误。";
        Sleep(250);
        choose();
    }
    else {
        if (MessageBox(0, TEXT("你确定?"), TEXT("请选择"), MB_OKCANCEL | MB_ICONINFORMATION) == IDOK) return 0; 
        choose();
    }
    return 0;
}
int login()
{
    string DN, DPW;
    bool isn = false;
    cout << "请输入账号和密码" << endl;
    cout << "账号:";
    cin >> name;
    cout << "密码:";
    cin >> password;
    ifstream fin("data2.txt");
    while(fin >> DN) {
        if (DN == name) {
            fin >> DPW;
            if (DPW != password) {
                cout << "密码错误!" << endl; isn = true;
                system("cls"); login();
            }
            else {
                fin >> money >> attack >> defense >> health >> level >> experience >> LE1 >> LE2  >> camp >> maxhealth;
                fin >> D_Of_C >> OK >> ane >> xy >> D_Of_C1 >> OK1 >> ane1 >> xy1 >> nowM;
                fin >> bag[0] >> bag[1] >> bag[2] >> bag[3] >> bag[4] >> bag[5] >> bag[6] >> bag[7];
                fin >> bag[8] >> bag[9] >> bag[10] >> bag[11] >> bag[12] >> bag[13] >> bag[14] >> bag[15];
                fin >> bag[16] >> bag[17] >> bag[18] >> bag[19] >> bag[20] >> bag[21] >> bag[22] >> bag[23];
                fin >> bag[24] >> bag[25] >> bag[26] >> bag[27] >> bag[28] >> bag[29] >> bag[30] >> bag[31];
                fin >> bag[32] >> bag[33] >> bag[34] >> bag[35] >> bag[36] >> bag[37] >> bag[38] >> bag[39];
                fin >> bag[40] >> bag[41] >> bag[42] >> bag[43];
                fin >> Sl[0] >> Sl[1] >> Sl[2] >> Sl[3] >> Sl[4] >> Sl[5] >> Sl[6] >> Sl[7] >> Sl[8] >> Sl[9] >> Sl[10] >> Sl[11] >> Sl[12];
                for (int i = 0; i < 100; i++) {
                    fin >> wandname[i];
                    fin >> wandpower[i];
                    fin >> wand[i];
                }           
                fin >> Nwand >> amm >> f >> wandi >> wandnamei >> wandpoweri >> ict >> speed >> nowlevel;
                isn = true;
            }
        }
    }
    if (!isn) {
        cout << "无此用户!" << endl;
        login();
    }
    cout << "登入成功!" << endl;
    Sleep(1000);
    return 0;
}
int save()
{
    ofstream outfile("data2.txt", ios::binary | ios::app | ios::in | ios::out);
    outfile << name << " " << password << " " << money << " " << attack << " " << defense << " " << health << " " << level << " " << experience << " " << LE1 << " " << LE2 << " " << camp << " " << maxhealth << " ";
    outfile << D_Of_C << " " << OK << " " << ane << " " << xy << " " << D_Of_C1 << " " << OK1 << " " << ane1 << " " << xy1 << " " << nowM << " ";
    outfile << bag[0] << " " << bag[1] << " " << bag[2] << " " << bag[3] << " " << bag[4] << " " << bag[5] << " " << bag[6] << " " << bag[7] << " ";
    outfile << bag[8] << " " << bag[9] << " " << bag[10] << " " << bag[11] << " " << bag[12] << " " << bag[13] << " " << bag[14] << " " << bag[15] << " ";
    outfile << bag[16] << " " << bag[17] << " " << bag[18] << " " << bag[19] << " " << bag[20] << " " << bag[21] << " " << bag[22] << " " << bag[23] << " ";
    outfile << bag[24] << " " << bag[25] << " " << bag[26] << " " << bag[27] << " " << bag[28] << " " << bag[29] << " " << bag[30] << " " << bag[31] << " ";
    outfile << bag[32] << " " << bag[33] << " " << bag[34] << " " << bag[35] << " " << bag[36] << " " << bag[37] << " " << bag[38] << " " << bag[39] << " ";
    outfile << bag[40] << " " << bag[41] << " " << bag[42] << " " << bag[43] << " ";
    outfile << Sl[0] << " " << Sl[1] << " " << Sl[2] << " " << Sl[3] << " " << Sl[4] << " " << Sl[5] << " " << Sl[6] << " " << Sl[7] << " " << Sl[8] << " " << Sl[9] << " " << Sl[10] << " " << Sl[11] << " " << Sl[12] << " ";
    for (int i = 0; i < 100; i++) {
        outfile << wandname[i] << " ";
        outfile << wandpower[i] << " ";
        outfile << wand[i] << " ";
    }
    outfile << Nwand << " " << amm << " " << f << " " << wandi << " " << wandnamei << " " << wandpoweri << " " << ict << " " << speed << " " << nowlevel << endl;
    outfile.close();
    return 0;
}
int Reg()
{
    string DN, DPW;
    cout << "请输入账号和密码  " << endl;
    cout << "账号:";
    cin >> name;
    cout << endl << "密码:";
    cin >> password;
    ifstream fin("data2.txt");
    while(fin >> DN) {
        if (DN == name) {
            cout << "用户名已被使用=====请重新起名";
            Reg();
        }
    }
    choose();
    return 0;
}
int monsterfight(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
    int mhealth = 10000, mdefense = 1000, mattack = 10000, mspeed = 500;
    int hfaint = 0;
    int mfaint = 0;
    dead = false;
    int ha = hisA;
    while (1) {
        if (hfaint > 0) hfaint -= 1; 
        if (mfaint > 0) {
            if (rand() % 3 == 0)
            {
                mfaint = 0;
                cout << "石怪使用技能咒立停,停止了魔咒!" << endl;
            }
            else mfaint -= 1;
        }
        if (mfaint <= 0) {
            if (rand() % 3) {
                cout << "石怪使用技能快快复苏 生命增加200" << endl;
                mhealth += 200;
            }
            if (rand() % 3) {
                cout << "石怪使用技能铁甲护身 生命增加100 防御增加50" << endl;
                mhealth += 100;
                mdefense += 50;
            }
            if (rand() % 3) {
                cout << "石怪使用技能神锋无影 攻击增加200 对方扣血200滴" << endl;
                hisH -= 200;
                mattack += 200;
            }
            Sleep(1000);
            int ran = rand() % 40 - 20;
            if (rand() % 10000 > hisSP) {
                if (attack + ran > hisD) {
                    cout << "石怪发起进攻 " << Hname << "扣血" << mattack - hisD + ran << "滴 剩余" << hisH - (mattack - hisD + ran) << "滴" << endl;
                    hisH -= mattack - hisD + ran;
                }
                else cout << "石怪发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl; 
            }
            else {
                if (rand() % 2) cout << "石怪一脚踹了过去,但没有踢中" << endl; 
                else {
                    cout << "石怪一脚踹了过去,但只擦着了腰" << endl;
                    if ((mattack / 3) + ran > hisD) {
                        cout << Hname << "扣血" << (mattack / 3) + ran - hisD << "滴 剩余" << hisH - ((mattack / 3) + ran - hisD) << "滴" << endl;
                        hisH -= (mattack / 3) + ran - hisD;
                    }
                    else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl; 
                }
            }
        }
        Sleep(1000);
        if (hisH <= 0) {
            if (hisS == 20 && rand() % 3 == 0) {
                cout << "对方发动技能:恢复如初 满血复活" << endl;
                hisH = ha; Sleep(1000);
            }
            else {
                cout << "对方死亡" << endl;
                return 0;
            }
        }
        if (hfaint <= 0) {
            if (hisS != 0) {
                if (rand() % 3 == 0) {
                    if (hisS == 14) {
                        cout << "对方发动技能:快快复苏  生命加200" << endl;
                        hisH += 200;
                    }
                    if (hisS == 15) {
                        cout << "对方发动技能:盔甲护身  生命加50 防御增加50" << endl;
                        hisH += 50;
                        hisD += 50;
                    }
                    if (hisS == 17) {
                        cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
                        health -= 200;
                        hisA += 200;
                    }
                }
                Sleep(1000);
            }
            int ran = rand() % 40 - 20;
            if (rand() % 10000 > mspeed) {
                if (hisA + ran > defense) {
                    cout << Hname << "发起进攻 " << "石怪扣血" << hisA - defense + ran << "滴 剩余" << mhealth - (hisA - defense + ran) << "滴" << endl;
                    mhealth -= hisA - defense + ran;
                }
                else cout << Hname << "发起进攻 " << "石怪扣血0滴 剩余" << mhealth << "滴" << endl; 
            }
            else {
                if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl; 
                else {
                    cout << "对方一脚踹了过来,但只擦着了石怪的腰" << endl;
                    if ((hisA / 3) + ran > hisD) {
                        cout << "石怪扣血" << (hisA / 3) + ran - defense << "滴 剩余" << mhealth - ((hisA / 3) + ran - defense) << "滴" << endl;
                        mhealth -= ((hisA / 3) + ran - defense);
                    }
                    else cout << "石怪扣血0滴 剩余" << mhealth << "滴" << endl;
                }
            }
            Sleep(1000);
            if (mhealth <= 0) {
                cout << "石怪死亡" << endl;
                return hisH;
            }
        }
    }
    return 0;
}
int fight1(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
    int hfaint = 0, hhurt = 0, hbeat = 0;
    int mfaint = 0, mhurt = 0;
    dead = false;
    int ha = hisA;
    int his = hisA + hisD + hisH;
    while (1) {
        if (hfaint > 0) {
            if (rand() % 3 == 0) {
                cout << "对方使用技能:咒立停!停止了魔咒" << endl;
                hfaint = 1;
            }
            hfaint -= 1;
        }
        if (hbeat == 1) {
            if (rand() % 10 == 0) {
                cout << "对方一躲,躲过了你的石头" << endl;
                hbeat = 0;
            }
            else {
                cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
                hisH -= 50;
            }
        }
        if (mfaint > 0) {
            if (Sl[6]) mfaint = 0; 
            else mfaint -= 1;
        }
        if (mhurt > 0) {
            if (Sl[6]) mhurt = 0; 
            else mhurt -= 1; 
            cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
            health -= 200;
        }
        if (mfaint <= 0) {
            if (rand() % 3 && Sl[0]) {
                cout << "你使用技能快快复苏 生命增加200" << endl;
                health += 200;
            }
            if (rand() % 3 && Sl[1]) {
                cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
                health += 100; defense += 50;
            }
            if (rand() % 3 && Sl[2]) {
                cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
                hfaint += 1;
            }
            if (rand() % 3 && Sl[3]) {
                cout << "你使用技能神锋无影 攻击增加200 扣血200滴" << endl;
                hisH -= 200; attack += 200;
            }
            if (rand() % 3 && Sl[5]) {
                if (rand() % 10) {
                    cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
                    hfaint += 2;
                }
                else {
                    cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
                    hfaint += 10;
                }
            }
            if (rand() % 4 == 0 && Sl[7])
            {
                cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
                hisH = monsterfight(Hname, hisH, hisA, hisD, hisS, hisSP);
                if (hisH < 1) return 0;
                if (Sl[0]) {
                    cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
                    if (maxhealth < health + 2000) health = maxhealth; 
                    else health += 2000; 
                }
            }
            if (rand() % 4 == 0 && Sl[8]) {
                cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
            }
            if (rand() % 3 && Sl[9]) {
                cout << "你使用技能万弹齐发!变出几十块石头" << endl;
                hbeat = 1;
            }
            if (rand() % 3 && Sl[10]) {
                cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
                hhurt += 5;
            }
            if (rand() % 3 && Sl[11]) {
                cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
                Sleep((rand() % 1000) + 1000);
                cout << Hname << "被你控制了,开始攻击自己" << endl;
                Sleep(700);
                int ran = rand() % 40 - 20;
                if (hisA + ran > hisD) {
                    cout << "对方发起进攻 自己扣血" << hisH - hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
                    hisH -= hisA - hisD + ran;
                }
                else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl; 
            }
            if (rand() % 2 && Sl[12]) {
                cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
                hisH /= 4;
            }
            Sleep(1000);
            int ran = rand() % 40 - 20;
            if (rand() % 10000 > hisSP) {
                if (attack + ran > hisD) {
                    cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
                    hisH -= attack - hisD + ran;
                }
                else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl; 
            }
            else {
                if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl; 
                else {
                    cout << "你一脚踹了过去,但只擦着了腰" << endl;
                    if ((attack / 3) + ran > hisD) {
                        cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
                        hisH -= (attack / 3) + ran - hisD;
                    }
                    else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl; 
                }
            }
        }
        Sleep(700);
        if (hhurt > 0) {
            hhurt -= 1;
            cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
            hisH -= 200;
        }
        if (hisH <= 0) {
            if (hisS == 20 && rand() % 3 == 0) {
                cout << "对方发动技能:恢复如初 满血复活" << endl;
                hisH = ha;
                Sleep(1000);
            }
            else {
                cout << "对方死亡\n获得" << (his / 30) << "经验" << endl;
                experience += (his / 30);
                if (ane == 3) D_Of_C++;
                if (ane1 == 3) D_Of_C1++;
                return 0;
            }
        }
        if (hfaint <= 0) {
            if (rand() % 3 == 0) {
                if (hisS == 14) {
                    cout << "对方发动技能:快快复苏  生命加200" << endl;
                    hisH += 200;
                }
                if (hisS == 15) {
                    cout << "对方发动技能:盔甲护身  生命加50 防御增加50" << endl;
                    hisH += 50; hisD += 50;
                }
                if (hisS == 17) {
                    cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
                    health -= 200; hisA += 200;
                }
                Sleep(1000);
            }
            int ran = rand() % 40 - 20;
            if (rand() % 10000 > speed) {
                if (hisA + ran > defense) {
                    cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
                    health -= hisA - defense + ran;
                }
                else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl; 
            }
            else {
                if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl; 
                else {
                    cout << "对方一脚踹了过来,但只擦着了你的腰" << endl;
                    if ((hisA / 3) + ran > hisD) {
                        cout << "你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
                        health -= ((hisA / 3) + ran - defense);
                    }
                    else cout << "你扣血0滴 剩余" << health << "滴" << endl; 
                }
            }
            Sleep(700);
            if (health <= 0) {
                if (Sl[6] && rand() % 2) {
                    cout << "你发动技能:恢复如初 满血复活" << endl;
                    health = maxhealth;
                    Sleep(1000);
                }
                else {
                    cout << "你死亡";
                    health = 20;
                    dead = true;
                    return 0;
                }
            }
        }
    }
    return 0;
}
int fight2(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
    int hfaint = 0, hhurt = 0, hbeat = 0;
    int mfaint = 0, mhurt = 0;
    dead = false;
    int ha = hisA;
    int his = hisA + hisD + hisH;
    while (1) {
        if (hfaint > 0) {
            if (rand() % 3 == 0) {
                cout << "对方使用技能:咒立停!停止了魔咒";
                hfaint = 1;
            }
            hfaint -= 1;
        }
        if (hbeat == 1) {
            if (rand() % 10 == 0) {
                cout << "对方一躲,躲过了你的石头" << endl;
                hbeat = 0;
            }
            else {
                cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
                hisH -= 50;
            }
        }
        if (mfaint > 0) {
            if (Sl[6]) mfaint = 0; 
            else mfaint -= 1; 
        }
        if (mhurt > 0) {
            if (Sl[6]) mhurt = 0;
            else mhurt -= 1;
            cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
            health -= 200;
        }
        if (mfaint <= 0) {
            if (rand() % 3 && Sl[0]) {
                cout << "你使用技能快快复苏 生命增加200" << endl;
                health += 200;
            }
            if (rand() % 3 && Sl[1]) {
                cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
                health += 100;
                defense += 50;
            }
            if (rand() % 3 && Sl[2]) {
                cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
                hfaint += 1;
            }
            if (rand() % 3 && Sl[3]) {
                cout << "你使用技能神锋无影 攻击增加200 扣血200滴" << endl;
                hisH -= 200;
                attack += 200;
            }
            if (rand() % 3 && Sl[5]) {
                if (rand() % 10) {
                    cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
                    hfaint += 2;
                }
                else {
                    cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
                    hfaint += 10;
                }
            }
            if (rand() % 4 == 0 && Sl[7]) {
                cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
                hisH = monsterfight(Hname, hisH, hisA, hisD, hisS, hisSP);
                if (hisH < 1) return 0;
                if (Sl[0]) {
                    cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
                    if (maxhealth < health + 2000) health = maxhealth; 
                    else health += 2000; 
                }
                Sleep(1000);
            }
            if (rand() % 4 == 0 && Sl[8]) {
                cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
            }
            if (rand() % 3 && Sl[9]) {
                cout << "你使用技能万弹齐发!变出几十块石头" << endl;
                hbeat = 1;
            }
            if (rand() % 3 && Sl[10]) {
                cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
                hhurt += 5;
            }
            if (rand() % 3 && Sl[11]) {
                cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
                Sleep((rand() % 1000) + 1000);
                cout << Hname << "被你控制了,开始攻击自己" << endl;
                Sleep(700);
                int ran = rand() % 40 - 20;
                if (hisA + ran > hisD) {
                    cout << "对方发起进攻 自己扣血" << hisH - hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
                    hisH -= hisA - hisD + ran;
                }
                else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl; 
            }
            if (rand() % 2 && Sl[12]) {
                cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
                hisH /= 4;
            }
            Sleep(1000);
            int ran = rand() % 40 - 20;
            if (rand() % 10000 > hisSP) {
                if (attack + ran > hisD) {
                    cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
                    hisH -= attack - hisD + ran;
                }
                else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl; 
            }
            else {
                if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl; 
                else {
                    cout << "你一脚踹了过去,但只擦着了腰" << endl;
                    if ((attack / 3) + ran > hisD) {
                        cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
                        hisH -= (attack / 3) + ran - hisD;
                    }
                    else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl;
                }
            }
        }
        Sleep(700);
        if (hhurt > 0) {
            hhurt -= 1;
            cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
            hisH -= 200;
        }
        if (hisH <= 0) {
            if (hisS == 20 && rand() % 3 == 0) {
                cout << "对方发动技能:恢复如初 满血复活" << endl;
                hisH = ha;
                Sleep(1000);
            }
            else {
                cout << "对方死亡\n获得" << (his / 200) << "金币" << endl;
                money += (his / 200);
                if (ane == 3) D_Of_C++;
                if (ane1 == 3) D_Of_C1++;
                return 0;
            }
        }
        if (hfaint <= 0) {
            if (rand() % 3 == 0) {
                if (hisS == 14) {
                    cout << "对方发动技能:快快复苏  生命加200" << endl;
                    hisH += 200;
                }
                if (hisS == 15) {
                    cout << "对方发动技能:盔甲护身  生命加50 防御增加50" << endl;
                    hisH += 50; hisD += 50;
                }
                if (hisS == 17) {
                    cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
                    health -= 200; hisA += 200;
                }
                Sleep(1000);
            }
            int ran = rand() % 40 - 20;
            if (rand() % 10000 > speed) {
                if (hisA + ran > defense) {
                    cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
                    health -= hisA - defense + ran;
                }
                else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl; 
            }
            else {
                if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl; 
                else {
                    cout << "对方一脚踹了过来,但只擦着了你的腰" << endl;
                    if ((hisA / 3) + ran > hisD) {
                        cout << "你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
                        health -= ((hisA / 3) + ran - defense);
                    }
                    else cout << "你扣血0滴 剩余" << health << "滴" << endl;
                }
            }
            Sleep(700);
            if (health <= 0) {
                if (Sl[6] && rand() % 2) {
                    cout << "你发动技能:恢复如初 满血复活" << endl;
                    health = maxhealth;
                    Sleep(1000);
                }
                else {
                    cout << "你死亡";
                    health = 20;
                    dead = true;
                    return 0;
                }
            }
        }
    }
    return 0;
}
int fight(string Hname, int hisH, int hisA, int hisD, int hisS, int hisSP)
{
    int hfaint = 0, hhurt = 0, hbeat = 0;
    int mfaint = 0, mhurt = 0;
    dead = false;
    int ha = hisA;
    int his = hisA + hisD + hisH;
    while (1)
    {
        if (hfaint > 0) {
            if (rand() % 3 == 0) {
                cout << "对方使用技能:咒立停!停止了魔咒" << endl;
                hfaint = 0;
            }
            else hfaint -= 1;
        }
        if (hbeat == 1) {
            if (rand() % 10 == 0) {
                cout << "对方一躲,躲过了你的石头" << endl;
                hbeat = 0;
            }
            else {
                cout << "对方躲闪不急,石头正好撞在他的鼻子上 扣血50滴" << endl;
                hisH -= 50;
            }
        }
        if (mfaint > 0) {
            if (Sl[6]) mfaint = 0; 
            else mfaint -= 1; 
        }
        if (mhurt > 0) {
            if (Sl[6]) mhurt = 0; 
            else mhurt -= 1;
            cout << "你的心像被一把刀刺穿了一样 扣血200滴" << endl;
            health -= 200;
        }
        if (mfaint <= 0) {
            if (rand() % 3 && Sl[0]) {
                cout << "你使用技能快快复苏 生命增加200" << endl;
                health += 200;
            }
            if (rand() % 3 && Sl[1]) {
                cout << "你使用技能铁甲护身 生命增加100 防御增加50" << endl;
                health += 100;
                defense += 50;
            }
            if (rand() % 3 && Sl[2]) {
                cout << "你使用技能昏昏倒地 " << Hname << "一回合之内不能攻击" << endl;
                hfaint += 1;
            }
            if (rand() % 3 && Sl[3]) {
                cout << "你使用技能神锋无影 攻击增加200 扣血200滴" << endl;
                hisH -= 200; attack += 200;
            }
            if (rand() % 3 && Sl[5]) {
                if (rand() % 10) {
                    cout << "你使用技能统统石化 " << Hname << "二回合之内不能攻击" << endl;
                    hfaint += 2;
                }
                else {
                    cout << "你使用技能统统石化 " << Hname << "十回合之内不能攻击" << endl;
                    hfaint += 10;
                }
            }
            if (rand() % 4 == 0 && Sl[7]) {
                cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
                hisH = monsterfight(Hname, hisH, hisA, hisD, hisS, hisSP);
                if (hisH < 1) return 0; 
                if (Sl[0]) {
                    cout << "在对方和石怪的战斗中,你已经恢复了2000生命" << endl;
                    if (maxhealth < health + 2000) health = maxhealth; 
                    else health += 2000; 
                }
            }
            if (rand() % 4 == 0 && Sl[8]) {
                cout << "你使用技能召唤咒!召唤出石怪跟" << Hname << "战斗" << endl;
            }
            if (rand() % 3 && Sl[9]) {
                cout << "你使用技能万弹齐发!变出几十块石头" << endl;
                hbeat = 1;
            }
            if (rand() % 3 && Sl[10]) {
                cout << "你使用技能钻心咒!对方将疼痛5回合" << endl;
                hhurt += 5;
            }
            if (rand() % 3 && Sl[11]) {
                cout << "魂魄出窍!你使用夺魂咒,企图让" << Hname << "自己攻击自己!" << endl;
                Sleep((rand() % 1000) + 1000);
                cout << Hname << "被你控制了,开始攻击自己" << endl;
                Sleep(700);
                int ran = rand() % 40 - 20;
                if (hisA + ran > hisD) {
                    cout << "对方发起进攻 自己扣血" << hisH- hisD + ran << "滴 剩余" << hisH - (hisA - hisD + ran) << "滴" << endl;
                    hisH -= hisA - hisD + ran;
                }
                else cout << "对方发起进攻 自己扣血0滴 剩余" << hisH << "滴" << endl; 
            }
            if (rand() % 2 && Sl[12]) {
                cout << "你使用技能阿瓦达索命 " << Hname << "扣血" << hisH - hisH / 4 << "滴" << endl;
                hisH /= 4;
            }
            Sleep(1000);
            int ran = rand() % 40 - 20;
            if (rand() % 10000 > hisSP) {
                if (attack + ran > hisD) {
                    cout << "你发起进攻 " << Hname << "扣血" << attack - hisD + ran << "滴 剩余" << hisH - (attack - hisD + ran) << "滴" << endl;
                    hisH -= attack - hisD + ran;
                }
                else cout << "你发起进攻 " << Hname << "扣血0滴 剩余" << hisH << "滴" << endl; 
            }
            else {
                if (rand() % 2) cout << "你一脚踹了过去,但没有踢中" << endl; 
                else {
                    cout << "你一脚踹了过去,但只擦着了腰" << endl;
                    if ((attack / 3) + ran > hisD) {
                        cout << Hname << "扣血" << (attack / 3) + ran - hisD << "滴 剩余" << hisH - ((attack / 3) + ran - hisD) << "滴" << endl;
                        hisH -= (attack / 3) + ran - hisD;
                    }
                    else cout << Hname << "扣血0滴 剩余" << hisH << "滴" << endl; 
                }
            }
        }
        Sleep(700);
        if (hhurt > 0) {
            hhurt -= 1;
            cout << "对方因中了你的钻心咒,正捂着心大叫呢 扣血200滴" << endl;
            hisH -= 200;
        }
        if (hisH <= 0) {
            if (hisS == 20 && rand() % 3 == 0) {
                cout << "对方发动技能:恢复如初 满血复活" << endl;
                hisH = ha;
                Sleep(1000);
            }
            else {
                cout << "对方死亡\n获得" << his / 30 << "元" << endl;
                money += his / 30;
                experience += (his / 30) * 10;
                if (ane == 3) D_Of_C++; 
                if (ane1 == 3) D_Of_C1++; 
                return 0;
            }
        }
        if (hfaint <= 0) {
            if (rand() % 3 == 0) {
                if (hisS == 14) {
                    cout << "对方发动技能:快快复苏  生命加200" << endl;
                    hisH += 200;
                }
                if (hisS == 15) {
                    cout << "对方发动技能:盔甲护身  生命加50 防御增加50" << endl;
                    hisH += 50;
                    hisD += 50;
                }
                if (hisS == 17)
                {
                    cout << "对方发动技能神锋无影 攻击增加200 扣血200滴" << endl;
                    health -= 200;
                    hisA += 200;
                }
                Sleep(1000);
            }
            int ran = rand() % 40 - 20;
            if (rand() % 10000 > speed) {
                if (hisA + ran > defense) {
                    cout << Hname << "发起进攻 " << "你扣血" << hisA - defense + ran << "滴 剩余" << health - (hisA - defense + ran) << "滴" << endl;
                    health -= hisA - defense + ran;
                }
                else cout << Hname << "发起进攻 " << "你扣血0滴 剩余" << health << "滴" << endl; 
            }
            else {
                if (rand() % 2) cout << Hname << "一脚踹了过来,但没有踢中" << endl; 
                else {
                    cout << "对方一脚踹了过来,但只擦着了你的腰" << endl;
                    if ((hisA / 3) + ran > hisD) {
                        cout <<"你扣血" << (hisA / 3) + ran - defense << "滴 剩余" << health - ((hisA / 3) + ran - defense) << "滴" << endl;
                        health -= ((hisA / 3) + ran - defense);
                    }
                    else cout << "你扣血0滴 剩余" << health << "滴" << endl; 
                }
            }
            Sleep(700);
            if (health <= 0) {
                if (Sl[6] && rand() % 2) {
                    cout << "你发动技能:恢复如初 满血复活" << endl;
                    health = maxhealth;
                    Sleep(1000);
                }
                else {
                    cout << "你死亡" << endl;
                    health = 20;
                    dead = true;
                    return 0;
                }
            }
        }
    }
    return 0;
}
int street()
{
    switch (rand() % 6)
    {
    case 0:
        if (camp) {
            int f;
            cout << "你遇到了一个路人" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("路人", 500, 110, 0, 14, 1000);
                if (!dead && rand() % 2) {
                    if (rand() % 4 == 0) {
                        cout << "获得一瓶经验药水" << endl;
                        bag[22] += 1;
                    }
                    else if (rand() % 4 == 1) {
                        cout << "获得一瓶攻击药水" << endl;
                        bag[21] += 1;
                    }
                    else if (rand() % 4 == 2) {
                        cout << "获得一瓶生命药水" << endl;
                        bag[19] += 1;
                    }
                    else {
                        cout << "获得一瓶防御药水" << endl;
                        bag[20] += 1;
                    }
                }
            }
        }
        else {
            int f;
            cout << "你遇到了一个小混混" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("小混混", 500, 110, 0, 15, 1000);
                if (!dead && rand() % 2) {
                    if (rand() % 4 == 0) {
                        cout << "获得一瓶经验药水" << endl;
                        bag[22] += 1;
                    }
                    else if (rand() % 4 == 1) {
                        cout << "获得一瓶攻击药水" << endl;
                        bag[21] += 1;
                    }
                    else if (rand() % 4 == 2) {
                        cout << "获得一瓶生命药水" << endl;
                        bag[19] += 1;
                    }
                    else {
                        cout << "获得一瓶防御药水" << endl;
                        bag[20] += 1;
                    }
                }
            }
        }
        break;
    case 1:
        if (camp) {
            int f;
            cout << "你遇到了一个警察" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("警察", 2000, 500, 15, 15, 1000);
                if (!dead && rand() % 3 != 0) {
                    if (rand() % 5 == 0) {
                        cout << "获得两瓶经验药水" << endl;
                        bag[22] += 2;
                    }
                    else if (rand() % 5 == 1) {
                        cout << "获得两瓶攻击药水" << endl;
                        bag[21] += 2;
                    }
                    else if (rand() % 5 == 2) {
                        cout << "获得两瓶生命药水" << endl;
                        bag[19] += 2;
                    }
                    else if (rand() % 5 == 3) {
                        cout << "获得一瓶全幅药水" << endl;
                        bag[23] += 1;
                    }
                    else {
                        cout << "获得两瓶防御药水" << endl;
                        bag[20] += 2;
                    }
                }
            }
        }
        else {
            int f;
            cout << "你遇到了一个小食死徒" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("食死徒", 2000, 500, 15, 15, 1000);
                if (!dead && rand() % 3 != 0) {
                    if (rand() % 5 == 0) {
                        cout << "获得两瓶经验药水" << endl;
                        bag[22] += 2;
                    }
                    else if (rand() % 5 == 1) {
                        cout << "获得两瓶攻击药水" << endl;
                        bag[21] += 2;
                    }
                    else if (rand() % 5 == 2) {
                        cout << "获得两瓶生命药水" << endl;
                        bag[19] += 2;
                    }
                    else if (rand() % 5 == 3) {
                        cout << "获得一瓶全幅药水" << endl;
                        bag[23] += 1;
                    }
                    else {
                        cout << "获得两瓶防御药水" << endl;
                        bag[20] += 2;
                    }
                }
            }
        }
        break;
    case 2:
        if (camp) {
            int f;
            cout << "你遇到了一个凤凰社成员" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("凤凰社成员", 5000, 700, 50, 16, 1500);
                if (!dead && rand() % 4 != 0) {
                    if (rand() % 5 == 0) {
                        cout << "获得三瓶经验药水" << endl;
                        bag[22] += 3;
                    }
                    else if (rand() % 5 == 1) {
                        cout << "获得三瓶攻击药水" << endl;
                        bag[21] += 3;
                    }
                    else if (rand() % 5 == 2) {
                        cout << "获得三瓶生命药水" << endl;
                        bag[19] += 3;
                    }
                    else if (rand() % 5 == 3) {
                        cout << "获得两瓶全幅药水" << endl;
                        bag[23] += 2;
                    }
                    else {
                        cout << "获得三瓶防御药水" << endl;
                        bag[20] += 3;
                    }
                }
            }
        }
        else {
            int f;
            cout << "你遇到了一个真食死徒" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("食死徒", 5000, 700, 50, 15, 1500);
                if (!dead && rand() % 4 != 0) {
                    if (rand() % 5 == 0) {
                        cout << "获得三瓶经验药水" << endl;
                        bag[22] += 3;
                    }
                    else if (rand() % 5 == 1) {
                        cout << "获得三瓶攻击药水" << endl;
                        bag[21] += 3;
                    }
                    else if (rand() % 5 == 2) {
                        cout << "获得三瓶生命药水" << endl;
                        bag[19] += 3;
                    }
                    else if (rand() % 5 == 3) {
                        cout << "获得两瓶全幅药水" << endl;
                        bag[23] += 2;
                    }
                    else {
                        cout << "获得三瓶防御药水" << endl;
                        bag[20] += 3;
                    }
                }
            }
        }
        break;
    case 3:
        if (camp) {
            int f;
            cout << "你遇到了一个傲罗·穆迪" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("穆迪", 10000, 1200, 250, 17, 2000);
                if (!dead) {
                    if (rand() % 3) {
                        if (rand() % 2) {
                            cout << "获得技能书神锋无影" << endl;
                            bag[9]++;
                        }
                        else {
                            cout << "获得技能书快快复苏" << endl;
                            bag[6]++;
                        }
                    }
                    if (rand() % 4) {
                        if (rand() % 5 == 0) {
                            cout << "获得四瓶经验药水" << endl;
                            bag[22] += 4;
                        }
                        else if (rand() % 5 == 1) {
                            cout << "获得四瓶攻击药水" << endl;
                            bag[21] += 4;
                        }
                        else if (rand() % 5 == 2) {
                            cout << "获得四瓶生命药水" << endl;
                            bag[19] += 4;
                        }
                        else if (rand() % 5 == 3) {
                            cout << "获得三瓶全幅药水" << endl;
                            bag[23] += 3;
                        }
                        else {
                            cout << "获得四瓶防御药水" << endl;
                            bag[20] += 4;
                        }
                    }
                }
            }
        }
        else {
            int f;
            cout << "你遇到了卢修斯·马尔福" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("马尔福", 10000, 1200, 250, 17, 2000);
                if (!dead) {
                    if (rand() % 3) {
                        if (rand() % 2) {
                            cout << "获得技能书神锋无影" << endl;
                            bag[9]++;
                        }
                        else {
                            cout << "获得技能书快快复苏" << endl;
                            bag[6]++;
                        }
                    }
                    if (rand() % 4) {
                        if (rand() % 5 == 0) {
                            cout << "获得四瓶经验药水" << endl;
                            bag[22] += 4;
                        }
                        else if (rand() % 5 == 1) {
                            cout << "获得四瓶攻击药水" << endl;
                            bag[21] += 4;
                        }
                        else if (rand() % 5 == 2) {
                            cout << "获得四瓶生命药水" << endl;
                            bag[19] += 4;
                        }
                        else if (rand() % 5 == 3) {
                            cout << "获得三瓶全幅药水" << endl;
                            bag[23] += 3;
                        }
                        else {
                            cout << "获得四瓶防御药水" << endl;
                            bag[20] += 4;
                        }
                    }
                }
            }
        }
        if (!dead)
            if (ane1 == 2) D_Of_C1++;
        break;
    case 4:
        if (camp) {
            int f;
            cout << "你遇到了卢平" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("卢平", 100000, 12000, 2500, 17, 4000);
                if (!dead) {
                    if (rand() % 3) {
                        if (rand() % 2) {
                            cout << "获得技能书恢复如初" << endl;
                            bag[12]++;
                        }
                        else {
                            cout << "获得技能书阿瓦达索命" << endl;
                            bag[18]++;
                        }
                    }
                    if (rand() % 5) {
                        if (rand() % 5 == 0) {
                            cout << "获得四瓶经验药水" << endl;
                            bag[22] += 4;
                        }
                        else if (rand() % 5 == 1) {
                            cout << "获得四瓶攻击药水" << endl;
                            bag[21] += 4;
                        }
                        else if (rand() % 5 == 2) {
                            cout << "获得四瓶生命药水" << endl;
                            bag[19] += 4;
                        }
                        else if (rand() % 5 == 3) {
                            cout << "获得三瓶全幅药水" << endl;
                            bag[23] += 3;
                        }
                        else {
                            cout << "获得四瓶防御药水" << endl;
                            bag[20] += 4;
                        }
                    }
                }
            }
        }
        else {
            int f;
            cout << "你遇到了食死徒·卡卡洛夫" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("卡卡洛夫", 100000, 12000, 2500, 170, 4000);
                if (!dead) {
                    if (rand() % 3) {
                        if (rand() % 2) {
                            cout << "获得技能书恢复如初" << endl;
                            bag[12]++;
                        }
                        else {
                            cout << "获得技能书阿瓦达索命" << endl;
                            bag[18]++;
                        }
                    }
                    if (rand() % 5) {
                        if (rand() % 5 == 0) {
                            cout << "获得四瓶经验药水" << endl;
                            bag[22] += 4;
                        }
                        else if (rand() % 5 == 1) {
                            cout << "获得四瓶攻击药水" << endl;
                            bag[21] += 4;
                        }
                        else if (rand() % 5 == 2) {
                            cout << "获得四瓶生命药水" << endl;
                            bag[19] += 4;
                        }
                        else if (rand() % 5 == 3) {
                            cout << "获得三瓶全幅药水" << endl;
                            bag[23] += 3;
                        }
                        else {
                            cout << "获得四瓶防御药水" << endl;
                            bag[20] += 4;
                        }
                    }
                }
            }
        }
        break;
    case 5:
        if (camp) {
            int f;
            cout << "你遇到了邓布利多" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("邓布利多", 300000, 36000, 7500, 20, 5000);
                if (!dead) {
                    if (rand() % 3) {
                        if (rand() % 2) {
                            cout << "获得技能书恢复如初" << endl;
                            bag[12]++;
                        }
                        else {
                            cout << "获得技能书阿瓦达索命" << endl;
                            bag[18]++;
                        }
                    }
                    if (rand() % 5) {
                        if (rand() % 5 == 0) {
                            cout << "获得四瓶经验药水" << endl;
                            bag[22] += 4;
                        }
                        else if (rand() % 5 == 1) {
                            cout << "获得四瓶攻击药水" << endl;
                            bag[21] += 4;
                        }
                        else if (rand() % 5 == 2) {
                            cout << "获得四瓶生命药水" << endl;
                            bag[19] += 4;
                        }
                        else if (rand() % 5 == 3) {
                            cout << "获得三瓶全幅药水" << endl;
                            bag[23] += 3;
                        }
                        else {
                            cout << "获得四瓶防御药水" << endl;
                            bag[20] += 4;
                        }
                    }
                }
            }
        }
        else {
            int f;
            cout << "你遇到了纳尼吉" << endl;
            cout << "1进攻/2逃跑" << endl;
            cin >> f;
            if (f == 1) {
                fight("纳尼吉", 300000, 36000, 7500, 20, 5000);
                if (!dead) {
                    if (rand() % 3) {
                        if (rand() % 2) {
                            cout << "获得技能书恢复如初" << endl;
                            bag[12]++;
                        }
                        else {
                            cout << "获得技能书阿瓦达索命" << endl;
                            bag[18]++;
                        }
                    }
                    if (rand() % 5) {
                        if (rand() % 5 == 0) {
                            cout << "获得四瓶经验药水" << endl;
                            bag[22] += 4;
                        }
                        else if (rand() % 5 == 1) {
                            cout << "获得四瓶攻击药水" << endl;
                            bag[21] += 4;
                        }
                        else if (rand() % 5 == 2) {
                            cout << "获得四瓶生命药水" << endl;
                            bag[19] += 4;
                        }
                        else if (rand() % 5 == 3) {
                            cout << "获得三瓶全幅药水" << endl;
                            bag[23] += 3;
                        }
                        else {
                            cout << "获得四瓶防御药水" << endl;
                            bag[20] += 4;
                        }
                    }
                }
            }
        }
        if (!dead)
            if (ane1 == 0) D_Of_C1++;
        break;
    }
    Sleep(1000);
    return 0;
}
int buy(int p, int m)
{
    if (money < m) {
        cout << "没钱,打出去!" << endl;
        if (camp) {
            cout << "1抢劫 2逃离" << endl;
            int a;
            cin >> a;
            if (a == 1) {
                fight("员工", 1000, 100, 10, 0, 1000);
                if (dead) return 0;
                cout << "另外一个员工冲了过来" << endl;
                fight("员工", 1000, 100, 10, 14, 1000);
                if (dead) return 0;
                cout << "另外一个员工冲了过来" << endl;
                fight("员工", 1000, 100, 10, 14, 2000);
                if (dead) return 0; 
                cout << "员工头冲了过来" << endl;
                fight("员工头", 5000, 5000, 10, 14, 2000);
                if (dead) return 0; 
                cout << "店主冲了过来" << endl;
                fight("店主", 10000, 1000, 100, 15, 4000);
                if (dead) return 0; 
                cout << "获得100元" << endl;
                money += 100;
                if (rand() % 10 < 3) {
                    Sleep(3000);
                    cout << "你翻了半天,终于找到了你要卖的东西" << endl;
                    bag[p]++;
                }
                else {
                    Sleep(3000);
                    cout << "你翻了半天,还是没找到你要卖的东西" << endl;
                    cout << "你要不要到大街上消消气(杀人)" << endl;
                    cout << "1要! 2不必了" << endl;
                    int q;
                    cin >> q;
                    if (q == 1) street(); 
                }
            }
        }
    }
    else {
        cout << "购买成功" << endl;
        bag[p]++;
        money -= m;
        if (ane == 1) D_Of_C++; 
        if (ane1 == 1) D_Of_C1 += m; 
    }
    Sleep(1000);
    return 0;
}
int buywand(int p, int m)
{
    if (money < m) cout << "没钱,打出去!" << endl;
    else {
        cout << "购买成功" << endl;
        wand[p - 6]++;
        money -= m;
        if (ane == 1) D_Of_C++;
        if (ane1 == 1) D_Of_C1 += m;
    }
    Sleep(1000);
    return 0;
}
int make(int w1, int w2, int c1, int c2)
{
    if (w1 < 24 || w2 < 33) {
        cout << "根本就没有这种材料,你眼瞎啊!" << endl;
        Sleep(1000);
        return 0;
    }
    if (c1 == 0||c2 == 0) {
        cout << "你想拿0个材料来造魔杖!没门!" << endl;
        Sleep(1000);
        return 0;
    }
    if (bag[w1] < c1) {
        if (bag[w2] < c2) cout << "你木材和杖芯都不够"; 
        else cout << "杖芯不够"; 
    }
    else if (bag[w2] < c2) cout << "木材不够"; 
    else {
        cout << "制作成功" << endl;
        string wn;
        wn = Material1name[w1 - 24] + Material2name[w2 - 33] + "魔杖";
        bag[w1] -= c1;
        bag[w2] -= c2;
        wand[wandi++]++;
        wandpower[wandpoweri++] = c1 * 20 * (w1 - 4) + c1 * 10 * (w2 - 13);
        wandname[wandnamei++] = wn; 
    }
    Sleep(1000);
    return 0;
}
int levelup()
{
    if (experience >= level * 100) {
        experience -= level * 100;
        level++;
        maxhealth += 100; health += 100; attack += 10; defense += 5; speed += 10;
        if (rand() % 2 && level > 4) bag[0] += 1; 
        cout << "你升了1级" << endl;
        levelup();
        if (ane1 == 4) D_Of_C1++; 
    }
    return 0;
}
int Hos()
{
    int a;
    if (health < maxhealth) {
        cout << "剩余生命:(" << health << "/" << maxhealth << ")" << endl;
        cout << "需要" << ((maxhealth) - health) / 16 << "元 是否恢复. 等级小于等于10免费恢复" << endl;
        cout << "1,是 2,否" << endl;
        cin >> a;
        if (a == 1) {
            if (level > 10) {
                if (money >= ((maxhealth) - health) / 16) {
                    money -= ((maxhealth) - health) / 16;
                    cout << "恢复成功\n剩余:" << money << "元";
                    if (ane == 2) D_Of_C++; 
                    if (ane1 == 1) D_Of_C1 += ((maxhealth) - health) / 16;
                    health = maxhealth;
                }
                else cout << "钱不足" << endl; 
            }
            else {
                health = maxhealth;
                cout << "恢复成功" << endl;
                if (ane == 2) D_Of_C++; 
            }
        }
        else if (a == 2) return 0; 
        else {
            cout << "请别乱输";
            Hos();
        }
    }
    else {
        cout << "生命已满";
        Sleep(1000);
    }
    return 0;
}
int w()
{
    int aaaa = 1;
    while (aaaa) {
        for (int i = 0; i < wandi; i++) {
            if (wandname[i] == Nwand) cout << "o"; 
            else cout << " "; 
            cout << i + 1 << "," << wandname[i] << " " << wand[i] << "个" << "  力量:" << wandpower[i] << endl;
        }
        cout << "1,装备魔杖 2,卸下现有魔杖 0,退出" << endl;
        cin >> aaaa;
        if (aaaa == 1) {
            cout << "请输入魔杖编号" << endl;
            int bbbb;
            cin >&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

谢铭轩

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值