斗罗大陆(不喜勿喷)

这篇文章描述了一个基于C++编写的斗罗大陆主题游戏,玩家在游戏中进行武魂觉醒,选择战斗,抽取魂兽并升级。游戏包含角色成长、战斗决策和商城功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#include<bits/stdc++.h>
#include<algorithm>
#include<cstdio>
#include<windows.h>

using namespace std;

string s[9]={"蓝银草","柔骨兔","昊天锤","七宝琉璃塔","白虎","幽冥灵猫","火凤凰","大力金刚熊","罗三炮"};
string x[5]={"暗魔邪神虎","泰坦巨猿","天青牛蟒","蓝银皇","冰苍狼"};
int a[5]={1,2,3,4,5};
int c=1;
int wfx,wfgj,dfx,dfgj,gj,fy;
int q,jy;
int main()
{
    system("color 9E");
    cout<<"欢 迎 来 到 斗 罗 大 陆 ! ! ! "<<endl;
    Sleep(1000);
    system("cls");
    cout<<"开始觉醒武魂......"<<endl;
    Sleep(2000);
    srand(time(0));
    int r=rand()%8;
    cout<<"您的武魂是:";
    Sleep(500);
    cout<<s[r]<<endl;
    Sleep(2000);
    system("cls");
    while(1)
    {
        logo:
        system("cls");
        cout<<"你现在要做什么?"<<endl;
        cout<<"1.打怪 2.商城 3.查看等级 4.退出"<<endl;
        int z;
        cin>>z;
        if(z==1)
        {
            cout<<"开始抽取魂兽......"<<endl;
            Sleep(2000);
            srand(time(0));
            int y=rand()%5;
            int o=rand()%5;
            system("cls");
            cout<<"魂兽是:";
            Sleep(500);
            cout<<x[y]<<endl;
            Sleep(500);
            cout<<"等级:";
            Sleep(500);
            cout<<a[o]<<endl;
            cout<<"是否战斗? 1.是 2.否"<<endl;
            int b;
            cin>>b;
            if(b==1)
            {
                system("cls");
                if(a[o]==1)
                {
                    dfx=80;
                    dfgj=20;
                }
                if(a[o]==2)
                {
                    dfx=100;
                    dfgj=30;
                }
                if(a[o]==3)
                {
                    dfx=120;
                    dfgj=35;
                }
                if(a[o]==4)
                {
                    dfx=150;
                    dfgj=50;
                }
                if(a[o]==5)
                {
                    dfx=160;
                    dfgj=60;
                }
                wfx=fy;
                wfgj=gj;
                if(c==1)
                {
                    wfx+=100;
                    wfgj+=25;
                }
                if(c==2)
                {
                    wfx+=110;
                    wfgj+=30;
                }
                if(c==3)
                {
                    wfx+=130;
                    wfgj+=35;
                }
                if(c==4)
                {
                    wfx+=155;
                    wfgj+=40;
                }
                if(c==5)
                {
                    wfx+=165;
                    wfgj+=55;
                }
                if(c==6)
                {
                    wfx+=170;
                    wfgj+=60;
                }
                system("cls");
                cout<<"开始战斗!!!"<<endl;
                Sleep(1000);
                system("cls");
                for(int i=1;;i++)
                {
                    cout<<"第"<<i<<"回合"<<endl;
                    cout<<"我方血量:"<<wfx<<" "<<"敌方血量:"<<dfx<<endl;
                    cout<<"你对它攻击"<<endl;
                    cout<<"它对你攻击"<<endl;
                    wfx-=dfgj;
                    dfx-=wfgj;
                    Sleep(2000);
                    if(wfx<=0&&dfx<=0)
                    {
                        if(wfx>=dfx)
                        {
                            cout<<"恭喜你赢了!!!"<<endl;
                            q+=1;
                            jy+=1;
                            Sleep(500);
                            if(jy%5==0)
                            {
                                c++;
                            }
                            goto logo;
                        }
                        else
                        {
                            cout<<"你死了!!!"<<endl;
                            return 0;
                        }
                    }
                    else if(dfx<=0)
                    {
                        cout<<"恭喜你赢了!!!"<<endl;
                        q+=1;
                        jy+=1;
                        Sleep(500);
                        if(jy%5==0)
                        {
                            c++;
                        }
                        goto logo;
                    }
                    if(wfx<=0)
                    {
                        cout<<"你死了!!!"<<endl;
                        return 0;
                    }
                    system("cls");
                }
            }
            else if(b==2)
            {
                continue;
            }
            else
            {
                cout<<"你点错了!";
                continue;
            }
        }
        else if(z==2)
        {
            system("cls");
            cout<<"钱:"<<q<<endl;
            cout<<"请问要买什么?"<<endl;
            cout<<"1.神之剑 攻击力增加20 10元"<<endl;
            cout<<"2.神之护盾 血量增加30 10元"<<endl;
            int d;
            cin>>d;
            if(d==1)
            {
                if(q>=10)
                {
                    gj=20;
                    cout<<"已购买!!!"<<endl;
                    q-=10;
                    continue;
                }
                else
                {
                    cout<<"你的钱不够!!"<<endl;
                    Sleep(500);
                    continue;
                }
            }
            else if(d==2)
            {
                if(q>=10)
                {
                    fy=30;
                    cout<<"已购买!!!"<<endl;
                    q-=10;
                    continue;
                }
                else
                {
                    cout<<"你的钱不够!!"<<endl;
                    Sleep(500);
                    continue;
                }
            }
            else
            {
                cout<<"点错了!"<<endl;
                Sleep(1000);
                continue;
            }
        }
        else if(z==3)
        {
            system("cls");
            cout<<"目前等级是:"<<c;
            Sleep(3000);
            continue;
        }
        else if(z==4)
        {
            system("cls");
            for(int i=1;i<=100;i++)
            {
                cout<<i<<"%"<<endl;
                Sleep(50);
                system("cls");
            }
            return 0;
        }
        else
        {
            cout<<"点错了!"<<endl;
            Sleep(1000);
            continue;
        }
        return 0;
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

༺ཌༀ༒ཉི黎明之时༃༒ༀད༻

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

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

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

打赏作者

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

抵扣说明:

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

余额充值