手写《奇怪的名字大作战 V1.0》了解一下?

emmm很奇怪的风格

是想自己写一个啊,不喜勿喷

目前的两个boss:MP5娘,王文强
提示内容太长发不了 =_=

#include<iostream>
#include<cstdio>
#include<ctime>
#include<windows.h>
using namespace std;
string x,y;
struct I{
    int heal;
    int att;
    int stand;
    int buff;
    int baoji;
    int lengdong;
    int xuean;
    string s;
}a,b;
void welcome(){
    printf("                SDFZ版名字竞技场\n");
    printf("输入两个名字:\n");
    cin>>x>>y;
}
void BOSS(){
    if(a.s == "MP5娘"){
        a.baoji += 100;
        a.heal += 100;
        a.lengdong = 0;
        a.att += 50;
        b.lengdong -= 10;
    } else if(b.s == "MP5娘"){
        b.baoji += 100;
        b.heal += 100;
        b.lengdong = 0;
        b.att += 50;
        a.lengdong -= 10;
    }

    if(a.s == "王文强"){
        a.baoji = 0;
        a.heal += 1000;
        a.lengdong = 20;
        a.att += 150;
        b.lengdong -= 10;
    } else if(b.s == "王文强"){
        b.baoji = 0;
        b.heal += 1000;
        b.lengdong = 20;
        b.att += 150;
        a.lengdong -= 10;
    }
}
void init(){
    b.att = x[1] + (rand() % 20);
    b.heal = x[0] - x[2] + rand() % 211;
    b.heal *= 7;
    b.stand = rand() % x[1];
    Sleep(200);
    a.att = y[1] + (rand() % 20);
    if(a.att < 0) a.att *= -1;
    if(b.att < 0) b.att *= -1;
    a.heal = y[0] - y[2] + rand() % 211;
    a.heal *= 7;
    a.stand = rand() % y[1];
    a.s = x;
    b.s = y;
    a.att += 70;
    b.att += 70;
    a.baoji = rand() + a.s[2];
    a.baoji %= 10;
    a.lengdong = rand()-a.s[1];
    a.lengdong %= 10;
    Sleep(1000);
    b.baoji = rand()+b.s[1];
    b.baoji %= 10;
    b.lengdong = rand()-a.s[2];
    b.lengdong %= 10;
    b.lengdong += 10;
    a.lengdong += 10;
    a.baoji += 20;
    b.baoji += 20;
    system("cls");
    BOSS();
}

void print(){
    srand(time(NULL));
    printf("                SDFZ版名字竞技场\n");
    printf("                    by floatiy\n");
    cout <<"    "<<a.s<<"    HP:"<<a.heal<<"    攻击:"<<a.att<<"    防御:"<<a.stand;
    cout<<"    暴击:"<<a.baoji<<"    冷冻:"<<a.lengdong<<endl;
    cout <<"    "<<b.s<<"    HP:"<<b.heal<<"    攻击:"<<b.att<<"    防御:"<<b.stand;
    cout<<"    暴击:"<<b.baoji<<"    冷冻:"<<b.lengdong<<endl;

    cout<<"   "<<a.s<<"   ";
    int q=a.heal;
    int w=b.heal;
    while(q>=0){
        q-=20;
        cout<<"-";
    }
    cout<<endl;
    cout<<"   "<<b.s<<"   ";
    while(w>=0){
        w-=20;
        cout<<"-";
    }
    printf("\n\n\n\n");
}

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

int main(){
    srand(time(NULL));
    welcome();
    init();
    begin();
    return 0;
}

//by SDFZ-Floatiy

猜你喜欢

转载自blog.csdn.net/floatiy/article/details/80764282