cmy课堂-手搓火柴人游戏

· · 科技·工程

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<stdio.h>
#include<fstream>
using namespace std;
typedef long long ll;
const int N=105;
const int NN=3005;
const int NNN=1000005;
const int im=INT_MAX;
const int MOD=1e9;
long long money = 500;
int power(int a, int b);
int gcd(int x,int y);
int lcm(int x,int y);
map<string, bool> mp;
void coutslow(string s,int n){
    for(int i = 0; i < s.size(); i++){
        cout << s[i];
        Sleep(n);
    }
}
int renjixueliang = 10000, myxueliang = 10000, my = 10000, cnt, mypthd = 1, mygjhd = 0, cntt, mygeshu = 2, mybusituten = 0, bstt, nlyl1, nlyl2, bstt1, bstt2, bstt3;
struct node{
    string name;
    string jieshao;
    int sh, dj, jg;
    string sx;
    int p1, p2;
}jinenliebiao[105];
node you[NNN], now[NNN];
void chuchang(){
    cout << "\n";
    cout << "\n";
    cout << "                              ___\n";
    cout << "                             /   \\ \n";
    cout << "                            |     |\n";
    cout << "                             \\___/\n";
    cout << "                              /|\\ \n";
    cout << "                             / | \\\n";
    cout << "                            /  |  \\\n";
    cout << "                              / \\\n";
    cout << "                             /   \\\n";
    cout << "                             |   |\n";
    cout << "                             |   |\n";
    cout << "                             |   |\n";
    cout << "                            _|  _|\n";
    cout << "                      \n";
    cout << "\n";
    cout << "\n";
    cout << "\n";
    cout << "\n";
    Sleep(50);
    system("cls");
    cout << "\n";
    cout << "\n";
    cout << "                              ___\n";
    cout << "◣                            /   \\ \n";
    cout << "■                           |     |\n";
    cout << "◤                            \\___/\n";
    cout << "                              /|\\ \n";
    cout << "\\                           / | \\\n";
    cout << " \\                             /  |  \\\n";
    cout << "                              / \\\n";
    cout << "                             /   \\\n";
    cout << "                             |   |\n";
    cout << "                                 |   |\n";
    cout << "                             |   |\n";
    cout << "                            _|  _|\n";
    cout << "                   \n";
    cout << "\n";
    cout << "\n";
    cout << "\n";
    cout << "\n";
    Sleep(50);
    system("cls");
    cout << "\n";
    cout << "\n";
    cout << "                          ___\n";
    cout << "■◣                       /   \\ \n";
    cout << "■■                      |     |\n";
    cout << "■◤                       \\___/\n";
    cout << "|\\                       /|\\ \n";
    cout << "| \\                     / | \\\n";
    cout << "|  \\                   /  |  \\\n";
    cout << " \\                       / \\\n";
    cout << "  \\                     /   \\\n";
    cout << "   \\                    |   |\n";
    cout << "   /                     |   |\n";
    cout << "  /                      |   |\n";
    cout << " /_                     _|  _|\n";
    cout << "                    \n";
    cout << "\n";
    cout << "\n";
    cout << "\n";
    cout << "\n";
    Sleep(50);
    system("cls");
    cout << "\n";
    cout << "\n";
    cout << "                          ___\n";
    cout << "◢■◣                  /   \\ \n";
    cout << "■■■                 |     |\n";
    cout << "◥■◤                  \\___/\n";
    cout << " /|\\                     /|\\ \n";
    cout << "/ | \\                   / | \\\n";
    cout << "  |  \\                 /  |  \\\n";
    cout << " / \\                     / \\\n";
    cout << "/   \\                   /   \\\n";
    cout << "     \\                  |   |\n";
    cout << "     |                   |   |\n";
    cout << "     |                   |   |\n";
    cout << "_    |_                 _|  _|\n";
    cout << "                   \n";
    cout << "\n";
    cout << "\n";
    cout << "\n";
    cout << "\n";
    Sleep(50);
    system("cls");
    cout << "\n";
    cout << "\n";
    cout << "                               ___\n";
    cout << " ◢■◣                  /   \\ \n";
    cout << " ■■■                 |     |\n";
    cout << " ◥■◤                  \\___/\n";
    cout << "  /|\\                     /|\\ \n";
    cout << " / | \\                   / | \\\n";
    cout << "/  |  \\                 /  |  \\\n";
    cout << "  | \\                         / \\\n";
    cout << "  /  \\                   /   \\\n";
    cout << " /    \\                  |   |\n";
    cout << "/     /                   |   |\n";
    cout << "_    /                    |   |\n";
    cout << "    /_                   _|  _|\n";
    cout << "                   \n";
    cout << "\n";
    cout << "\n";
    cout << "\n";
    cout << "\n";
    Sleep(50);
    system("cls");
    cout << "\n";
    cout << "\n";
    cout << "                             ___                           \n";
    cout << " ◢■◣                    /   \\                         \n";
    cout << " ■■■                       |     |                         \n";
    cout << " ◥■◤                    \\___/                         \n";
    cout << "  /|\\                               /|\\                          \n";
    cout << " / | \\                     / | \\                         \n";
    cout << "/  |  \\                   /  |  \\                        \n";
    cout << "  / \\                       / \\                          \n";
    cout << " /   \\                     /   \\                         \n";
    cout << "|     |                     |   |                          \n";
    cout << "|     |                     |   |                          \n";
    cout << "|     |                     |   |                          \n";
    cout << "|_    |_                   _|  _|                          \n";
    Sleep(50);
}
map<string, int> mpp;
int stoi(string s){
    int ans = 0;
    for(int i = 0; i < s.size(); i++){
        ans = ans * 10 + (s[i] - '0');
    }
    return ans;
}
void zhuanbeijinen(){
    cntt = 0;
    while(1){
        system("cls");
        if(mp["普通攻击"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "1.普通攻击" << " 等级:" << you[1].dj << " 伤害:" <<  you[1].dj * jinenliebiao[1].sh << "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "1.普通攻击" << " 等级:" << you[1].dj << " 伤害:" <<  you[1].dj * jinenliebiao[1].sh << "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["大宝剑"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "2.大宝剑" << " 等级:" << you[2].dj << " 伤害:" <<  you[2].dj * jinenliebiao[2].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "2.大宝剑" << " 等级:" << you[2].dj << " 伤害:" <<  you[2].dj * jinenliebiao[2].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["跳劈"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "3.跳劈" << " 等级:" << you[3].dj << " 伤害:" <<  you[3].dj * jinenliebiao[3].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "3.跳劈" << " 等级:" << you[3].dj << " 伤害:" <<  you[3].dj * jinenliebiao[3].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["加农炮"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "4.加农炮" << " 等级:" << you[4].dj << " 伤害:" <<  you[4].dj * jinenliebiao[4].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "4.加农炮" << " 等级:" << you[4].dj << " 伤害:" <<  you[4].dj * jinenliebiao[4].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["加特林"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "10.加特林" << " 等级:" << you[10].dj << " 伤害:" <<  you[10].dj * 25 << " * ((20 ~ 50))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "10.加特林" << " 等级:" << you[10].dj << " 伤害:" <<  you[10].dj * 25 << " * ((20 ~ 50))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["雷神"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "11.雷神" << " 等级:" << you[11].dj << " 伤害:" <<  you[11].dj * 130 << " * ((10 ~ 30))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "11.雷神" << " 等级:" << you[11].dj << " 伤害:" <<  you[11].dj * 130 << " * ((10 ~ 30))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["散弹枪"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "12.散弹枪" << " 等级:" << you[12].dj << " 伤害:" <<  you[11].dj * 20 << " * ((10 ~ 20))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "12.散弹枪" << " 等级:" << you[12].dj << " 伤害:" <<  you[11].dj * 20 << " * ((10 ~ 20))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        cout << "你有" << mygeshu << "个技能格子\n";
        cout << "你已装备了技能:\n";
        mpp.clear();
        for(int i = 1; i < cntt; i++){
            cout << now[i].name << ",";
        }
        cout << now[cntt].name << "\n";
        if(cntt == mygeshu){
            cout << "技能已满,2秒后退出\n";
            Sleep(2000);
            return ;
        }else{
            cout << "你要装备哪一些技能?\n";
            cout << "输入e装备完成\n";
            string s;
            cin >> s;
            if(s == "e"){
                return;
            }
            bool f = 1;
            for(int i = 0; i < s.size(); i++){
                if(!(s[i] >= '0' && s[i] <= '9')){
                    f = 0;
                }
            }
            if(!f){
                cout << "????????????????????????\n";
                Sleep(2000);
            }else{
                int n = stoi(s);
                if(n == 0 || n >= 13){
                    cout << "????????????????????????\n";
                    Sleep(2000);
                }else{
                    cout << "确定?(y/n)\n";
                    char c = getch();
                    if(c == 'y'){
                        if(mp[jinenliebiao[n].name] == 0){
                            cout << "暂未获得这个技能\n";
                            Sleep(2000);
                            continue;
                        }
                        if(mpp[jinenliebiao[n].name] == 1){
                            cout << "????????????????????????\n";
                            Sleep(2000);
                            continue;
                        }
                        mpp[jinenliebiao[n].name] = 1;
                        now[++cntt] = jinenliebiao[n];
                        cout << "装备成功\n";
                        Sleep(2000);
                    }else{
                        cout << "OK\n";
                        Sleep(2000);
                    }
                }
            }

        }
    }
}
void xueliang(){
    cout << "对手的血量 :" << renjixueliang << "         你的血量 :" << myxueliang << "\n不死图腾 :" << bstt << "         反伤图腾1 :" << bstt1 << "         反伤图腾2 :" << bstt2 << "         反伤图腾3 :" << bstt3 << "\n能量饮料1 :" << nlyl1 << "         能量饮料2 :" << nlyl2 << "\n";
}
void youwin(){
    cout << "你赢了\n";
    money += 1000;
    cout << "money + 1000\n";
    Sleep(5000);
}
void renjiwin(){
    cout << "你输了\n";
    Sleep(5000);
}
void do_gj(int n){
    srand(time(nullptr));
    int t = rand() % 10 + 1;
//  if(t > 2){
        if(mpp[jinenliebiao[n].name] == 0){
            cout << "??????????????????????\n";
            return ;
        }
        renjixueliang -= jinenliebiao[n].dj * jinenliebiao[n].sh;
//  }else{
//      cout << "人机躲掉了\n";
//      Sleep(2000);
//  }
}
void duizhanrenji(){
    srand(time(nullptr));
    myxueliang = my;
    chuchang();
    system("cls");
    int r = rand() % 100;
    renjixueliang = myxueliang + r;
    if(mp["加农炮"]){
        renjixueliang += 1000;
    }
    while(1){
        if(renjixueliang <= 0){
            int t = rand() % 3;
            if(t == 1){
                renjixueliang = 500;
            }else{
                youwin();
            }
            return ;
        }
        if(myxueliang <= 0){
            bool f = 1;
            if(bstt >= 1){
                system("cls");
                cout << "使用不死图腾?(y/n)";
                char c = getch();
                if(c == 'y'){
                    f = 0;
                    myxueliang = 500;
                    bstt --;
                }else{
                    if(bstt1 >= 1){
                        system("cls");
                        cout << "使用反伤图腾1?(y/n)";
                        char c = getch();
                        if(c == 'y'){
                            f = 0;
                            myxueliang = 500;
                            renjixueliang -= 150;
                            bstt1 --;
                        }else{
                            if(bstt2 >= 1){
                                system("cls");
                                cout << "使用反伤图腾2?(y/n)";
                                char c = getch();
                                if(c == 'y'){
                                    f = 0;
                                    myxueliang = 600;
                                    renjixueliang -= 500;
                                    bstt2 --;
                                }else{
                                    if(bstt3 >= 1){
                                        system("cls");
                                        cout << "使用反伤图腾3?(y/n)";
                                        char c = getch();
                                        if(c == 'y'){
                                            f = 0;
                                            myxueliang = 1000;
                                            renjixueliang -= 3000;
                                            bstt3 --;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if(f){
                renjiwin();
                return ;
            }
            return ;
        }
        xueliang();
        coutslow("到你了\n", 0);
        coutslow("你要使用什么技能?\n", 0);
        for(int i = 1; i < cntt; i++){
            cout << i << ":" << now[i].name << "\n";
        }
        if(cntt <= 0){
            cout << "无\n";
        }else{
            cout << cntt << ":" << now[cntt].name << "\n";
        }
        coutslow("按q进入装备技能界面\n", 0);
        coutslow("按e退出", 0);
        cout << "\n";
        cout << "\n";
        cout << "                             ___                           \n";
        cout << " ◢■◣                    /   \\                         \n";
        cout << " ■■■                       |     |                         \n";
        cout << " ◥■◤                    \\___/                         \n";
        cout << "  /|\\                               /|\\                          \n";
        cout << " / | \\                     / | \\                         \n";
        cout << "/  |  \\                   /  |  \\                        \n";
        cout << "  / \\                       / \\                          \n";
        cout << " /   \\                     /   \\                         \n";
        cout << "|     |                     |   |                          \n";
        cout << "|     |                     |   |                          \n";
        cout << "|     |                     |   |                          \n";
        cout << "|_    |_                   _|  _|                          \n";
        string s;
        cin >> s;
        if(s == "q"){
            zhuanbeijinen();
        }else if(s == "e"){
            return ;
        }else{
            do_gj(stoi(s));
        }
        system("cls");
    }
}
void wuqi(){
    system("cls");
    while(1){
        system("cls");
        for(int i = 1; i <= cntt; i++){
            cout << jinenliebiao[i].name << ":" << jinenliebiao[i].jieshao << "\n";
        }
        coutslow("按t退出\n",20);
        char c = getch();
        if(c == 't'){
            return ;
        }
    }
}
void do_shop(int n){
    if(n > 12){
        cout << "?????????????????????\n";
        Sleep(2000);
        return ;
    }
    if(jinenliebiao[n].jg > money){
        cout << "money不够\n";
        Sleep(2000);
        return ;
    }else{
        cout << "确定购买?(y确定,n不买)\n";
        char c = getch();
        if(c == 'y'){
            if(n == 7 && mp["永久护盾"]){
                cout << "永久护盾不可升级\n";
                Sleep(1000);
                return ;
            }
            if(n == 2 && mp[jinenliebiao[n].name] == 0){
                money += 10000;
            }
            money -= jinenliebiao[n].jg;
            you[n].dj ++;
            mp[jinenliebiao[n].name] = 1;
            cout << "购买成功!!\n";
            Sleep(2000);
            return ;
        }else{
            cout << "no\n";
            Sleep(2000);
            return ;
        }
    }
}
void sj(){

}
void cj(){

}
int make_rh(int p1, int p2){
    if(p1 > 13 || p2 > 13){
        cout << "?????????????????????????\n";
        Sleep(2000);
        return -1;
    }
    if(p1 == 3 && p2 == 4){return 13;}
    if(p1 == 2 && p2 == 5){return 14;}
    if(p1 == 2 && p2 == 6){return 15;}
    if(p1 == 2 && p2 == 7){return 16;}
    if(p1 == 4 && p2 == 5){return 17;}
    if(p1 == 4 && p2 == 6){return 18;}
    if(p1 == 4 && p2 == 7){return 19;}
    if(p1 == 12 && p2 == 5){return 20;}
    if(p1 == 12 && p2 == 6){return 21;}
    if(p1 == 12 && p2 == 7){return 22;}
    if(p1 == 4 && p2 == 12){return 23;}
    if(p1 == 4 && p2 == 13){return 24;}
    if(p1 == 4 && p2 == 11){return 25;}
    return -1;
}
void rh(){
    while(1){
        system("cls");
        if(mp["普通攻击"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "1.普通攻击" << " 等级:" << you[1].dj << " 伤害:" <<  you[1].dj * jinenliebiao[1].sh << "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "1.普通攻击" << " 等级:" << you[1].dj << " 伤害:" <<  you[1].dj * jinenliebiao[1].sh << "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["大宝剑"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "2.大宝剑" << " 等级:" << you[2].dj << " 伤害:" <<  you[2].dj * jinenliebiao[2].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "2.大宝剑" << " 等级:" << you[2].dj << " 伤害:" <<  you[2].dj * jinenliebiao[2].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["跳劈"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "3.跳劈" << " 等级:" << you[3].dj << " 伤害:" <<  you[3].dj * jinenliebiao[3].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "3.跳劈" << " 等级:" << you[3].dj << " 伤害:" <<  you[3].dj * jinenliebiao[3].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["加农炮"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "4.加农炮" << " 等级:" << you[4].dj << " 伤害:" <<  you[4].dj * jinenliebiao[4].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "4.加农炮" << " 等级:" << you[4].dj << " 伤害:" <<  you[4].dj * jinenliebiao[4].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["护盾"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "5.护盾" << " 等级:" << you[5].dj << " 伤害:" <<  you[5].dj * jinenliebiao[5].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "5.护盾" << " 等级:" << you[5].dj << " 伤害:" <<  you[5].dj * jinenliebiao[5].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["高级护盾"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "6.高级护盾" << " 等级:" << you[6].dj << " 伤害:" <<  you[6].dj * jinenliebiao[6].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "6.高级护盾" << " 等级:" << you[6].dj << " 伤害:" <<  you[6].dj * jinenliebiao[6].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["永久护盾"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "7.永久护盾" << " 伤害:" <<  you[7].dj * jinenliebiao[7].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "7.永久护盾" << " 伤害:" <<  you[7].dj * jinenliebiao[7].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["不死图腾"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "8.不死图腾" << " 等级:" << you[8].dj << " 伤害:" <<  you[8].dj * jinenliebiao[8].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "8.不死图腾" << " 等级:" << you[8].dj << " 伤害:" <<  you[8].dj * jinenliebiao[8].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["物品增加"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "9.物品增加" << " 等级:" << you[9].dj << " 伤害:" <<  you[9].dj * jinenliebiao[9].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "9.物品增加" << " 等级:" << you[9].dj << " 伤害:" <<  you[9].dj * jinenliebiao[9].sh <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["加特林"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "10.加特林" << " 等级:" << you[10].dj << " 伤害:" <<  you[10].dj * 25 << " * ((20 ~ 50))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "10.加特林" << " 等级:" << you[10].dj << " 伤害:" <<  you[10].dj * 25 << " * ((20 ~ 50))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["雷神"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "11.雷神" << " 等级:" << you[11].dj << " 伤害:" <<  you[11].dj * 130 << " * ((10 ~ 30))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "11.雷神" << " 等级:" << you[11].dj << " 伤害:" <<  you[11].dj * 130 << " * ((10 ~ 30))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["散弹枪"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "12.散弹枪" << " 等级:" << you[12].dj << " 伤害:" <<  you[11].dj * 20 << " * ((10 ~ 20))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "12.散弹枪" << " 等级:" << you[12].dj << " 伤害:" <<  you[11].dj * 20 << " * ((10 ~ 20))" <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        cout << "输入你要融合的武器(序号 and 序号)(空格必须输入)\n";
        cout << "输入114514退出\n";
        int p1, p2;
        string s;
        cin >> p1;
        if(p1 == 114514){
            return ;
        }
        cin >> s >> p2;
        if(p1 > p2){
            swap(p1, p2);
        }
        if(p1 == p2){
            cout << "????????????????????????????\n";
            continue;
        }
        if(mp[jinenliebiao[p1].name] && mp[jinenliebiao[p2].name]){
            cout << "确定?(y/n)\n";
            char c = getch();
            if(c == 'y'){
                if(make_rh(p1, p2) == -1){
                    cout << "没有办法融合\n";
                    Sleep(2000);
                    continue;
                }
                if(money < jinenliebiao[make_rh(p1, p2)].jg){
                    cout << "money不够\n";
                    Sleep(2000);
                    continue;
                }else{
                    cout << "融合成功\n";
                    cout << "你获得了新武器:" << jinenliebiao[make_rh(p1, p2)].name << "\n";
//                  make(make_rh(p1, p2));
                    mp[jinenliebiao[make_rh(p1, p2)].name] = 1;
                    you[make_rh(p1, p2)].dj = (you[p1].dj + you[p2].dj) / 2;
                    you[make_rh(p1, p2)].p1 = you[p1].dj;
                    you[make_rh(p1, p2)].p2 = you[p2].dj;
                    you[p1].dj = 0;
                    you[p2].dj = 0;
                    mp[jinenliebiao[p1].name] = 0;
                    mp[jinenliebiao[p2].name] = 0;
                    Sleep(5000);
                }
            }else{
                continue;
            }
        }
    }
}
void go_shop(){
    system("cls");
    while(1){
        system("cls");
        cout << "money:" << money << "\n";
        cout << "蓝色是已拥有, 红色是未升级\n";
        if(mp["普通攻击"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "1.普通攻击" << " 等级:" << you[1].dj << " 伤害:" <<  you[1].dj * jinenliebiao[1].sh << " 价格:" << jinenliebiao[1].jg << "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "1.普通攻击" << " 等级:" << you[1].dj << " 伤害:" <<  you[1].dj * jinenliebiao[1].sh << " 价格:" << jinenliebiao[1].jg << "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["大宝剑"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "2.大宝剑" << " 等级:" << you[2].dj << " 伤害:" <<  you[2].dj * jinenliebiao[2].sh << " 价格:" << jinenliebiao[2].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "2.大宝剑" << " 等级:" << you[2].dj << " 伤害:" <<  you[2].dj * jinenliebiao[2].sh << " 价格:" << jinenliebiao[2].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["跳劈"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "3.跳劈" << " 等级:" << you[3].dj << " 伤害:" <<  you[3].dj * jinenliebiao[3].sh << " 价格:" << jinenliebiao[3].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "3.跳劈" << " 等级:" << you[3].dj << " 伤害:" <<  you[3].dj * jinenliebiao[3].sh << " 价格:" << jinenliebiao[3].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["加农炮"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "4.加农炮" << " 等级:" << you[4].dj << " 伤害:" <<  you[4].dj * jinenliebiao[4].sh << " 价格:" << jinenliebiao[4].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "4.加农炮" << " 等级:" << you[4].dj << " 伤害:" <<  you[4].dj * jinenliebiao[4].sh << " 价格:" << jinenliebiao[4].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["护盾"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "5.护盾" << " 等级:" << you[5].dj << " 伤害:" <<  you[5].dj * jinenliebiao[5].sh << " 价格:" << jinenliebiao[5].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "5.护盾" << " 等级:" << you[5].dj << " 伤害:" <<  you[5].dj * jinenliebiao[5].sh << " 价格:" << jinenliebiao[5].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["高级护盾"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "6.高级护盾" << " 等级:" << you[6].dj << " 伤害:" <<  you[6].dj * jinenliebiao[6].sh << " 价格:" << jinenliebiao[6].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "6.高级护盾" << " 等级:" << you[6].dj << " 伤害:" <<  you[6].dj * jinenliebiao[6].sh << " 价格:" << jinenliebiao[6].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["永久护盾"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "7.永久护盾" << " 伤害:" <<  you[7].dj * jinenliebiao[7].sh << " 价格:" << jinenliebiao[7].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "7.永久护盾" << " 伤害:" <<  you[7].dj * jinenliebiao[7].sh << " 价格:" << jinenliebiao[7].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["不死图腾"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "8.不死图腾" << " 等级:" << you[8].dj << " 伤害:" <<  you[8].dj * jinenliebiao[8].sh << " 价格:" << jinenliebiao[8].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "8.不死图腾" << " 等级:" << you[8].dj << " 伤害:" <<  you[8].dj * jinenliebiao[8].sh << " 价格:" << jinenliebiao[8].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["物品增加"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "9.物品增加" << " 等级:" << you[9].dj << " 伤害:" <<  you[9].dj * jinenliebiao[9].sh << " 价格:" << jinenliebiao[9].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "9.物品增加" << " 等级:" << you[9].dj << " 伤害:" <<  you[9].dj * jinenliebiao[9].sh << " 价格:" << jinenliebiao[9].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["加特林"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "10.加特林" << " 等级:" << you[10].dj << " 伤害:" <<  you[10].dj * 25 << " * ((20 ~ 50))" << " 价格:" << jinenliebiao[10].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "10.加特林" << " 等级:" << you[10].dj << " 伤害:" <<  you[10].dj * 25 << " * ((20 ~ 50))" << " 价格:" << jinenliebiao[10].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["雷神"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "11.雷神" << " 等级:" << you[11].dj << " 伤害:" <<  you[11].dj * 130 << " * ((10 ~ 30))" << " 价格:" << jinenliebiao[11].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "11.雷神" << " 等级:" << you[11].dj << " 伤害:" <<  you[11].dj * 130 << " * ((10 ~ 30))" << " 价格:" << jinenliebiao[11].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        if(mp["散弹枪"]){
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
            cout << "12.散弹枪" << " 等级:" << you[12].dj << " 伤害:" <<  you[11].dj * 20 << " * ((10 ~ 20))" << " 价格:" << jinenliebiao[12].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }else{
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
            cout << "12.散弹枪" << " 等级:" << you[12].dj << " 伤害:" <<  you[11].dj * 20 << " * ((10 ~ 20))" << " 价格:" << jinenliebiao[12].jg <<  "\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
        }
        coutslow("输入序号升级/购买技能\n",0);
        coutslow("按s进入武器简介\n",0);
        coutslow("按e去抽奖\n",0);
        coutslow("按r去融合武器\n",0);
        coutslow("按c去升级融合武器\n",0);
        coutslow("按q去拆解融合武器\n",0);
        coutslow("按t退出\n",0);
        string s;
        cin >> s;
        bool f = 1;
        for(int i = 0; i < s.size(); i++){
            if(!(s[i] >= '0' && s[i] <= '9')){
                f = 0;
            }
        }
        if(f){
            do_shop(stoi(s));
            bstt = you[8].dj;
            bstt1 = you[27].dj;
            bstt2 = you[28].dj;
            bstt3 = you[29].dj;
        }else{
            if(s == "s"){
                wuqi();
            }else if(s == "e"){
                cj();
            }else if(s == "t"){
                return ;
            }else if(s == "r"){
                rh();
            }else if(s == "c"){
                sj();
            }else if(s == "q"){
                cj();
            }else{
                coutslow("无效输入\n",20);
            }
        }
    }
}
string lingshiyongdeshuzu[N];
int now_idid = 0;
//void cd(){
//  FILE* fp = fopen("T.txt","w");
//  fprintf(fp,"%d",money);
//  fprintf(fp,"%d",my);
//  fprintf(fp,"%d",cnt);
//  fprintf(fp,"%d",myxueliang);
//  fprintf(fp,"%d",renjixueliang);
//  fprintf(fp,"%d",mypthd);
//  fprintf(fp,"%d",mygjhd);
//  fprintf(fp,"%d",cntt);
//  fprintf(fp,"%d",mygeshu);
//  fprintf(fp,"%d",mybusituten);
//  fprintf(fp,"%d",bstt);
//  fprintf(fp,"%d",nlyl1);
//  fprintf(fp,"%d",nlyl2);
//  fprintf(fp,"%d",bstt1);
//  fprintf(fp,"%d",bstt2);
//  fprintf(fp,"%d",bstt3);
//  for(auto it : mp){
//      if(mp[it]){
//          lingshiyongdeshuzu[++now_idid] = id;
//      }
//  }
//  for(int i = 1; i <= now_idid; i++){
//      fprintf(fp,"%d",lingshiyongdeshuzu[i]);
//  }
//  return ;
//}
//void dd(){
//  FILE* fp = fopen("T.txt","r");
//  fscanf(fp,"%d",&money);
//  return ;
//}
int main(){
//  freopen(".in","r",stdin);
//  freopen(".out","w",stdout);
//  ios::sync_with_stdio(false);
//  cin.tie(0);
//  cout.tie(0);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
    mp["普通攻击"] = 1;
    you[1] = {"普通攻击", "作者给新手的礼物",50,1,100,"普通",0,0};
    jinenliebiao[++cnt] = {"普通攻击", "作者给新手的礼物",50,1,100,"普通",0,0};
    jinenliebiao[++cnt] = {"大宝剑", "作者那个善良的人决定奖励你10000money",100,1,500,"普通",0,0};
    jinenliebiao[++cnt] = {"跳劈", "可以破普通盾,等你获得这个的时候,作者感觉你已经快要疯狂了",150,1,1000,"普通",0,0};
    jinenliebiao[++cnt] = {"加农炮", "更强大的武器,毁灭吧,注意购买后人机血量+x,无视普通盾牌",1000,1,500000,"史诗",0,0};
    jinenliebiao[++cnt] = {"普通盾牌", "等级 = 个数?",0,1,1000,"普通",0,0};
    jinenliebiao[++cnt] = {"高级护盾", "会被加农炮摧毁",0,1,20000,"高级",0,0};
    jinenliebiao[++cnt] = {"永久护盾", "不可摧毁",0,1,100000,"史诗",0,0};
    jinenliebiao[++cnt] = {"不死图腾", "mc好评?",0,1,100000,"史诗",0,0};
    jinenliebiao[++cnt] = {"物品增加", "???????",0,1,1000,"普通",0,0};
    jinenliebiao[++cnt] = {"加特林", "横扫子弹,做回自己",/*(10 ~ 30) * 25*/-1,1,100000,"传说",0,0};
    jinenliebiao[++cnt] = {"雷神", "让暴风雨来的更强烈一些吧",/*(20 ~ 40) * 130*/-1,1,1000000,"传说",0,0};
    jinenliebiao[++cnt] = {"散弹枪", "什么叫做狂野",/*(10 ~ 20) * 30*/-1,1,10000,"史诗"};
    //融合
//  jinenliebiao[++cnt] = {"", "",,,""};
    jinenliebiao[++cnt] = {"大农炮", "无视高级盾牌",1000,1,20000,"史诗",0,0};
    jinenliebiao[++cnt] = {"一级普通护盾", "荆棘",150,1,1000,"普通",0,0};
    jinenliebiao[++cnt] = {"一级高级护盾", "荆棘",150,1,1000,"高级",0,0};
    jinenliebiao[++cnt] = {"一级永久护盾", "荆棘",150,1,1000,"史诗",0,0};
    jinenliebiao[++cnt] = {"二级普通护盾", "荆棘",500,1,10000,"普通",0,0};
    jinenliebiao[++cnt] = {"二级高级护盾", "荆棘",500,1,10000,"高级",0,0};
    jinenliebiao[++cnt] = {"二级永久护盾", "荆棘",500,1,10000,"史诗",0,0};
    jinenliebiao[++cnt] = {"三级普通护盾", "荆棘",3000,1,100000,"传说",0,0};
    jinenliebiao[++cnt] = {"三级高级护盾", "荆棘",3000,1,100000,"传说",0,0};
    jinenliebiao[++cnt] = {"三级永久护盾", "陆地最强护盾",3000,1,100000,"传说",0,0};
    jinenliebiao[++cnt] = {"雷炮", "陆地最强进攻",/*(20 ~ 40) * 10000 */-1,1,1000000,"无敌",0,0};
    jinenliebiao[++cnt] = {"散炮", "?",/*(10 ~ 20) * 10000 */-1,1,10000,"无敌",0,0};
    jinenliebiao[++cnt] = {"加炮", "?",/*(10 ~ 30) * 10000 */-1,1,100000,"无敌",0,0};
    jinenliebiao[++cnt] = {"反伤图腾1", "mc好评?",150,1,10000,"史诗",0,0};
    jinenliebiao[++cnt] = {"反伤图腾2", "mc好评?",500,1,100000,"史诗",0,0};
    jinenliebiao[++cnt] = {"反伤图腾3", "陆地最强复活工具",3000,1,10000000,"传说",0,0};
    system("cls");
    coutslow("本游戏无不良引导,认准cmy(luogu:chengmuyao)原创,按空格继续", 20);
    while(1){
        char c = getch();
        if(c == ' '){
            break;
        }
    }
    system("cls");
    while(1){
        coutslow("你想干什么?\n", 0);
        coutslow("按1与人机比赛\n", 0);
        coutslow("按2购买技能\n", 0);
        coutslow("按3保存\n", 0);
        coutslow("按4读档\n", 0);
        coutslow("按5装备技能\n", 0);
        char c = getch();
        if(c == '1'){
            duizhanrenji();
        }else if(c == '2'){
            go_shop();
        }else if(c == '3'){
//          cd();
            coutslow("已存档\n",0);
            Sleep(2000);
        }else if(c == '4'){
//          dd();
            coutslow("已读档\n",0);
            Sleep(2000);
        }else if(c == '5'){
            zhuanbeijinen();
        }
        system("cls");
    }
    return 0;
}
int power(int a, int b){int ans = 1, aa = a;while(b){if(b & 1){ans *= aa;ans %= MOD;}aa *= aa;aa %= MOD;b >>= 1;}return ans;}
int gcd(int x,int y){if(y == 0){return x;} return gcd(y, x % y);}
int lcm(int x,int y){return x * y / gcd(x,y);}

// ■◢◣◤◥
// SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 这里);
/*
0 = 黑色                        8 = 灰色
1 = 蓝色                        9 = 淡蓝色
2 = 绿色                        10 = 淡绿色
3 = 湖蓝色                      11 = 淡浅绿色
4 = 红色                        12 = 淡红色
5 = 紫色                        13 = 淡紫色
6 = 黄色                        14 = 淡黄色
7 = 白色                        15 = 亮白色
*/