名字竞技场(两种版本(二))

第二种

fans的

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<windows.h>
using namespace std;
string name[2000];
int n;
struct I {
long long heal,att,stand,buff,baoji,lengdong,flag;
    string s;
}id[2000];
void welcome(){
    printf("                             学校版名字竞技场\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("                             学校版名字竞技场\n");
    printf("      --------------------------------------------------------------------------------\n");
    printf("                                          by floatiy\n");
    for(int i = 1; i <= n; i++) {
        cout <<"    "<<id[i].s<<"    HP:"<<id[i].heal<<"    攻击:"<<id[i].att<<"    防御:"<<id[i].stand;
        cout<<"    暴击:"<<id[i].baoji<<"    冷冻:"<<id[i].lengdong<<endl;
    }
       
        cout<<endl;
    
    printf("\n\n");
    printf("请稍后.......................................................");
}
void init_longwang(string x,int num) {
    if(x== "longwangboos@!") {
        id[num].baoji = 0;
        id[num].heal += 99999999;
        id[num].lengdong = 10;
        id[num].att += 500000000;
        id[num].stand = 300000000;
    }
}
void init_Teacher(string x,int num) {
    if(x== "xiaozhangboos@!") {
        id[num].baoji = 0;
        id[num].heal += 400;
        id[num].lengdong = 0;
        id[num].att += 50;
        id[num].stand = 30;
    }
}
void init_hkr(string x,int num) {
    if(x== "hkrboos@!") {
        id[num].baoji *= 9999;
        id[num].heal *= 999999;
        id[num].lengdong *= 9999;
        id[num].att *= 10000000;
        id[num].stand *= 9999;
    }
}
void init_MP5(string x,int num) {
    if(x== "MP5boos@!") {
        id[num].baoji += 4000;
        id[num].heal += 1500;
        id[num].lengdong = 1000;
        id[num].stand = 100;
    }
}
void init_WWQ(string x,int num) {
    if(x== "sbboos@!") {
        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);
        init_hkr(name[i],i);
        init_longwang(name[i],i);
    }
}
void join(I &x,string neko) {
    if(x.heal < 0) x.heal *= -1;
    Sleep(1000);
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;
   
}
void init() {
    for(int i = 1;i <= n;i++){
        join(id[i],name[i]);
    }
    BOSS();
    print(); 
    
}
void hit(I &x,I &y);
bool teacher_BOSS(I &x,I &y,int opt){
    if(x.s == "xiaozhangboos@!" && opt % 2 == 0) {
        y.heal = -100;
        cout<<"校长发现"<<y.s<<"在玩游戏,把你开除了!"<<endl;
        Sleep(500);
        cout<<y.s<<"哭晕在厕所!"<<endl;
        Sleep(1500);
        
    }
}
/*longwangboos@!
hkrboos@!
MP5boos@!
sbboos@!
xiaozhangboos@!*/
bool longwang_BOSS(I &x,I &y,int opt,int k=3){
    if(x.s == "longwangboos@!" ) {
        y.heal = +100;
        cout<<"龙王使用了龙息"<<"所有人受到了伤害!"<<endl;
         
          if(x.s == "longwangboos@!" &&y.heal < 0 )
            k--,cout<<"龙王被击倒了,但龙王还有"<<k<<"条命"; 
        }
            if(y.heal < 0&&k==0){
            Sleep(300);
            y.buff = 1;
            cout<<y.s<<"被击倒了"<<endl;
        Sleep(500);
for(int i = 1;i <= n;i++)
        id[i].heal-500;
        
        Sleep(1500);
        
    }
}

bool tongji_BOSS(I &x,I &y,int opt) {
    if(x.s == "sbboos@!" && opt % 3 == 0) {
        x.baoji += 10;
        x.heal += 300;
        x.lengdong += 5;
        
        cout<<"                                                        当前回合:"<<"sbBOOS"<<endl;
        cout<<"sb开始了通技课,各项能力提高了!"<<endl;
        Sleep(500);
        cout<<"然而大家都睡着了。。。对方跳过一回合"<<endl;
        Sleep(1500);

        hit(x,y);
    }

}
bool MP5_BOSS(I &x,I &y,int opt) {
    if(x.s == "MP5boos@!" && opt % 3 == 0) {
        int ham = x.att;
        if(ham <= 5) ham = 5;
        x.stand += 10;
        y.heal -= ham*7;
        
        cout<<"                                                        当前回合:"<<"MP5BOOS"<<endl;
        cout<<x.s<<"启动了核心"<<endl;
        cout<<x.s<<"造成了"<<ham*7<<"点伤害!"<<endl;
        Sleep(500);
        cout<<y.s<<"还有"<<y.heal<<"点生命!"<<endl;
        Sleep(500);
        cout<<"MP5开启了力场,防御++"<<endl;
        if(y.heal < 0){
            Sleep(300);
            y.buff = 1;
            cout<<y.s<<"被击倒了"<<endl;
        }
        Sleep(1500);


    }
}
bool BAOJI(I &x,I &y,int opt) {
    if(y.heal < 0){
            Sleep(300);
            y.buff = 1;
            cout<<y.s<<"被击倒了"<<endl;
        }
        Sleep(1500);if(0<opt && opt < x.baoji) {
        int ham = x.att - rand() % 10;
        if(ham <= 5) ham = 5;
        ham *= 3;
        y.heal -= ham;
        cout<<"                                                        当前回合:"<<x.s<<endl;
        cout<<x.s<<"打出了致命一击!"<<endl;
        cout<<x.s<<"造成了"<<ham<<"点伤害!"<<endl;
        Sleep(500);
        cout<<y.s<<"还有"<<y.heal<<"点生命!"<<endl;
        

        
    }

}
bool FREEZE(I &x,I &y,int opt) {
       if(y.heal < 0){
            Sleep(300);
            y.buff = 1;
            cout<<y.s<<"被击倒了"<<endl;if(20 <= opt && opt <= 20 + x.lengdong) {
        int ham = y.heal * 0.8;
        y.heal -= ham;
        cout<<"                                                        当前回合:"<<x.s<<endl;
        cout<<x.s<<"打开了对方的月考卷子!敌人凉凉了"<<endl;
        cout<<x.s<<"造成了"<<ham<<"点伤害!(剩余生命的20%)"<<endl;
        Sleep(500);
        cout<<y.s<<"还有"<<y.heal<<"点生命!暂停一回合"<<endl;
     
        }
        Sleep(1500);
        hit(x,y);

    }
}
bool AOYE(I &x,I &y,int opt) {
if(y.heal < 0){
            Sleep(300);
            y.buff = 1;
            cout<<y.s<<"被击倒了"<<endl;}
    if(opt%4 ==0) {
        int ham = y.att * 0.4;
        y.att -= ham;
        y.heal += 50;
        cout<<"                                                        当前回合:"<<x.s<<endl;
        cout<<"--------------------------------------------------------------------------------"<<endl;
        cout<<x.s<<"留了大量的作业!"<<endl;
        cout<<y.s<<"熬夜爆肝,攻击力下降了"<<ham<<"!"<<endl;
        cout<<y.s<<"学到了知识,体力恢复了50点!"<<endl;
        Sleep(1500);
    }

}
bool GEDANG(I &x,I &y,int opt) {

    if(y.stand > opt) {
        y.heal += 50;
        cout<<"                                                        当前回合:"<<x.s<<endl;
        cout<<"--------------------------------------------------------------------------------"<<endl;
        cout<<x.s<<"的攻击被格挡了!"<<endl;
        cout<<y.s<<"去校园服务部吃东西"<<endl;
        cout<<y.s<<"体力恢复了50点!"<<endl;
        Sleep(1500);

    }
}
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;
    }
    
    for(int i = 1;i <= n;i++){
        if(id[i].heal  <=0) cout<<id[i].s<<"输了 "<<endl;
        else cout<<"幸存:"<<id[i].s<<endl;
    }
    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() % 10;
    if(ham <= 5) ham = 5;
    y.heal -= ham;
    print();
    cout<<"                                                        当前回合:"<<x.s<<endl;
    cout<<x.s<<"造成了"<<ham<<"点伤害!"<<endl;
    Sleep(500);
    cout<<y.s<<"还有"<<y.heal<<"点生命!"<<endl;
    if(y.heal < 0){
            Sleep(300);
            y.buff = 1;
            cout<<y.s<<"被击倒了"<<endl;
        }
    Sleep(1500);
}
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();
            }
        }
    }
}
int main() {
    srand(time(NULL));
    welcome();    
    init();
begin();
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值