《名字竞技场 V3.0》 组队功能开放!

更新内容:

1.加入新boss,更高的难度。

2.支持组队模式勒!

3.针对大家反应的人物属性算法进行了修改,现在人物属性更多的取决于名字而不是随机数

4.用户界面优化

//by floatiy

#include
#include
#include
#include
#include
using namespace std;
string name[2000];
int n;
struct I {
    int heal;
    int att;
    int stand;
    int buff;
    int baoji;
    int lengdong;
    int flag;
    string s;
}id[2000];
//显示部分
void welcome(){
    printf("                             SDFZ版名字竞技场\n");
    printf("几人对战?\n");cin>>n;
    printf("输入名字:\n");
    for(int i = 1;i <= n;i++){
        cin>>name[i];
    }
    printf("按顺序输入战队(数字):");
    for(int i = 1;i <= n;i++){
        cin>>id[i].flag;
    }
    printf("请稍后");
}
void print() {
    printf("                             SDFZ版名字竞技场\n");
//          --------------------------------------------------------------------------------
    printf("                                          by floatiy\n");
    for(int i = 1; i <= n; i++) {
        cout <<"    "<"    HP:"<"    攻击:"<"    防御:"<cout<<"    暴击:"<"    冷冻:"<for(int i = 1; i <= n; i++) {
        cout<"队 "<" HP ";
        int tmp=id[i].heal;
        while(tmp > 0) {
            tmp-=30;
            cout<<"-";
        }
        cout<printf("\n\n");
}

//初始化
void init_Teacher(string x,int num) {
    if(x== "静静") {
        id[num].baoji = 0;
        id[num].heal += 400;
        id[num].lengdong = 0;
        id[num].att += 50;
        id[num].stand = 30;
    }
}
void init_MP5(string x,int num) {
    if(x== "MP5娘") {
        id[num].baoji += 100;
        id[num].heal += 150;
        id[num].lengdong = 0;
        id[num].stand = 10;
    }
}
void init_WWQ(string x,int num) {
    if(x== "王文强") {
        id[num].baoji = 0;
        id[num].heal += 250;
        id[num].lengdong = 0;
        id[num].att = 50;
    }
}
void BOSS() {
    for(int i = 1; i <= n; i++) {
        init_MP5(name[i],i);
        init_WWQ(name[i],i);
        init_Teacher(name[i],i);
    }
}
void join(I &x,string neko) {
    x.s = neko;
    x.att = x.s[1] + (rand() % 20);
    if(x.att < 0) x.att *= -1;
    x.heal = x.s[0] - x.s[2] + rand() % 211;
    x.heal *= 7;
    x.stand = rand() % x.s[1];
    x.att += 70;
    Sleep(200);
    x.baoji = rand() + x.s[2];
    x.baoji %= 10;
    Sleep(500);
    x.lengdong = rand()-x.s[1];
    x.lengdong %= 10;
    x.lengdong += 10;
    x.baoji += 20;
    if(x.heal < 0) x.heal *= -1;
    Sleep(1000);
}
void init() {
    for(int i = 1;i <= n;i++){
        join(id[i],name[i]);
    }
    BOSS();
    system("cls");
}

//技能
void hit(I &x,I &y);
bool teacher_BOSS(I &x,I &y,int opt){
    if(x.s == "静静" && opt % 2 == 0) {
        y.heal = -100;
        print();
        cout<<"--------------------------------------------------------------------------------"<cout<<"静静发现"<"在玩游戏,来查房了!"<500);
        cout<"出局了!"<1500);
        system("cls");
        return 1;
    }
    return 0;
}
bool tongji_BOSS(I &x,I &y,int opt) {
    if(x.s == "王文强" && opt % 3 == 0) {
        x.baoji += 10;
        x.heal += 300;
        x.lengdong += 5;
        print();
        cout<<"                                                        当前回合:"<cout<<"--------------------------------------------------------------------------------"<cout<<"王文强开始了通技课,各项能力提高了!"<500);
        cout<<"然而大家都睡着了。。。对方跳过一回合"<1500);
        system("cls");
        hit(x,y);
        return 1;
    }
    return 0;
}
bool MP5_BOSS(I &x,I &y,int opt) {
    if(x.s == "MP5娘" && opt % 3 == 0) {
        int ham = x.att;
        if(ham <= 5) ham = 5;
        x.stand += 10;
        y.heal -= ham*7;
        print();
        cout<<"                                                        当前回合:"<cout<<"--------------------------------------------------------------------------------"<cout<"启动了核心"<cout<"造成了"<7<<"点伤害!"<500);
        cout<"还有"<"点生命!"<500);
        cout<<"MP5娘开启了力场,防御++"<if(y.heal < 0){
            Sleep(300);
            y.buff = 1;
            cout<"被击倒了"<1500);
        system("cls");
        return 1;
    }
    return 0;
}
bool BAOJI(I &x,I &y,int opt) {
    if(0int ham = x.att - rand() % 20;
        if(ham <= 5) ham = 5;
        ham *= 3;
        y.heal -= ham;
        print();
        cout<<"                                                        当前回合:"<cout<<"--------------------------------------------------------------------------------"<cout<"打出了致命一击!"<cout<"造成了"<"点伤害!"<500);
        cout<"还有"<"点生命!"<if(y.heal < 0){
            Sleep(300);
            y.buff = 1;
            cout<"被击倒了"<1500);
        system("cls");
        return 1;
    }
    return 0;
}
bool FREEZE(I &x,I &y,int opt) {
    if(50 <= opt && opt <= 50 + x.lengdong) {
        int ham = y.heal * 0.4;
        y.heal -= ham;
        print();
        cout<<"                                                        当前回合:"<cout<<"--------------------------------------------------------------------------------"<cout<"打开了对方的月考卷子!敌人凉凉了"<cout<"造成了"<"点伤害!(剩余生命的40%)"<500);
        cout<"还有"<"点生命!暂停一回合"<if(y.heal < 0){
            Sleep(300);
            y.buff = 1;
            cout<"被击倒了"<1500);
        system("cls");
        hit(x,y);
        return 1;
    }
    return 0;
}
bool AOYE(I &x,I &y,int opt) {
    if(opt%7 ==0) {
        int ham = y.att * 0.4;
        y.att -= ham;
        y.heal += 50;
        print();
        cout<<"                                                        当前回合:"<cout<<"--------------------------------------------------------------------------------"<cout<"留了大量的作业!"<cout<"熬夜爆肝,攻击力下降了"<"!"<cout<"学到了知识,体力恢复了50点!"<1500);
        system("cls");
        return 1;
    }
    return 0;
}
bool GEDANG(I &x,I &y,int opt) {
    if(y.stand > opt) {
        y.heal += 50;
        print();
        cout<<"                                                        当前回合:"<cout<<"--------------------------------------------------------------------------------"<cout<"的攻击被格挡了!"<cout<"去校园服务部吃东西"<cout<"体力恢复了50点!"<1500);
        system("cls");
        return 1;
    }
    return 0;
}

//主体
void judge() {
    int cnt = 0;
    int col = 0;
    for(int i = 1; i <= n; i++) {
        if(id[i].heal > 0 && col == 0) col = id[i].flag;
        if(id[i].heal > 0 && col != id[i].flag) return;
    }
    cout<"队胜利了!"<cout<<"幸存:";
    for(int i = 1;i <= n;i++){
        if(id[i].heal > 0) cout<" ";
    }
    exit(0);
}
void hit(I &x,I &y) {
    if(x.heal<0 || y.heal<0) return;
    int opt = rand() % 100 + 1;
    if(tongji_BOSS(x,y,opt)) return;
    else if(MP5_BOSS(x,y,opt)) return;
    else if(teacher_BOSS(x,y,opt)) return;
    else if(BAOJI(x,y,opt)) return;
    else if(FREEZE(x,y,opt)) return;
    else if(GEDANG(x,y,opt)) return;
    else if(AOYE(x,y,opt)) return;

    int ham = x.att - rand() % 20;
    if(ham <= 5) ham = 5;
    y.heal -= ham;
    print();
    cout<<"                                                        当前回合:"<cout<<"--------------------------------------------------------------------------------"<cout<"造成了"<"点伤害!"<500);
    cout<"还有"<"点生命!"<if(y.heal < 0){
            Sleep(300);
            y.buff = 1;
            cout<"被击倒了"<1500);
    system("cls");
}
void begin() {
    while(1) {
        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= n; j++) {
                if(i == j) continue;
                if(id[i].flag && id[j].flag && id[i].flag == id[j].flag) continue;
                if(id[j].buff != 1 && id[i].buff != 1) hit(id[i],id[j]);
                judge();
            }
        }
    }
}
//id[2].heal
//主函数
int main() {
    srand(time(NULL));
    welcome();
    init();
    begin();
    return 0;
}

//by SDFZ-Floatiy

你可能感兴趣的:(————杂————,小游戏,模拟)