本文主要是介绍同人小游戏:斗罗大陆2,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
前言
Hello大家好,我是文宇.
正文
#include<iostream>
#include<conio.h>
#include<windows.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<string.h>
using namespace std;
string name,wh,wh3;
int xthl=0;//先天魂力
int hldj=0;//魂力等级
int wh1;//武魂
int wh2;//武魂2
long long sxhl=200;//所需魂力
int gj=50,fy=50,jy=0,hp=60,zdhp=60;//属性
long long hj[9]={0};//九个魂环的年限
long long hj2[9]={0};//第二武魂九个魂环的年限
int hh=0;//第一武魂魂环数量
int hh2=0;//第二武魂魂环数量
int jl=0;//魂环吸收几率
int jhb=0;//金魂币
int zgn=0;//诸葛弩
int zmd=0;//子母胆
int ywt=0;//阎王帖
int bylh=0;//暴雨莲花
int fntl=0;//佛怒唐莲
int mtls=1;//曼陀罗蛇 //数字为编号
int ttjy=2;//泰坦巨猿
int tqnm=3;//天青牛蟒
int rgt=4;//柔骨兔
int gb=5;//鬼豹
int rmmz=6;人面魔蛛
int fwjgs=7;//凤尾鸡冠蛇
int fhnn=8;//粉红娘娘
int ddzw=9;//大地之王
int amxsh=10;//暗魔邪神虎
long long nx;//魂兽年限
long long dfsh;//魂兽的伤害
long long dfsm;//魂兽的生命值
int n,a,p,jg,hs,ct,xs,zd,jn,sz,o,fh;//亿些变量
int main() {srand(time(NULL));cout<<"-------------------斗罗大陆-----------------------"<<endl;cout<<"你好,欢迎来到斗罗大陆,行走江湖,请留下你的大名:"; cin >> name;cout<<name<<",你即将觉醒武魂,请做好准备"<<endl; Sleep(3000);n=rand()%5+1;if(n>=0&&n<=4){wh1=rand()%9+1;if(wh1==0) {wh="昊天锤";gj+=27;fy+=12;} if(wh1==1) {wh="蓝电霸王龙";gj+=17;fy+=21;}if(wh1==2) {wh="七杀剑";gj+=31;fy+=7;}if(wh1==3) {wh="邪火凤凰";gj+=27;fy+=10;}if(wh1==4) {wh="蓝银皇";gj+=13;fy+=26;}if(wh1==5) {wh="六翼天使";gj+=20;fy+=20;}if(wh1==6) {wh="邪眸白虎";gj+=23;fy+=16;}if(wh1==7) {wh="奇茸通天菊";gj+=16;fy+=18;}if(wh1==8){wh="幽冥灵猫";gj+=30;fy+=5;}cout<<"你的武魂 :"<<wh<<endl;}else {wh1=rand()%9+1;wh2=rand()%9+1;if(wh1==0) {wh="昊天锤";gj+=27;fy+=12;} if(wh1==1) {wh="蓝电霸王龙";gj+=17;fy+=21;}if(wh1==2) {wh="七杀剑";gj+=31;fy+=7;}if(wh1==3) {wh="邪火凤凰";gj+=27;fy+=10;}if(wh1==4) {wh="蓝银皇";gj+=13;fy+=26;}if(wh1==5) {wh="六翼天使";gj+=20;fy+=20;}if(wh1==6) {wh="邪眸白虎";gj+=23;fy+=16;}if(wh1==7) {wh="奇茸通天菊";gj+=16;fy+=18;}if(wh1==8){wh="幽冥灵猫";gj+=30;fy+=5;}if(wh2==0) {wh3="昊天锤";gj+=27;fy+=12;} if(wh2==1) {wh3="蓝电霸王龙";gj+=17;fy+=21;}if(wh2==2) {wh3="七杀剑";gj+=31;fy+=7;}if(wh2==3) {wh3="邪火凤凰";gj+=27;fy+=10;}if(wh2==4) {wh3="蓝银皇";gj+=13;fy+=26;}if(wh2==5) {wh3="六翼天使";gj+=20;fy+=20;}if(wh2==6) {wh3="邪眸白虎";gj+=23;fy+=16;}if(wh2==7) {wh3="奇茸通天菊";gj+=16;fy+=18;}if(wh2==8){wh3="幽冥灵猫";gj+=30;fy+=5;}cout<<"你的武魂 :"<<wh<<' '<<"第二武魂 :"<<wh3<<endl;}cout<<name<<",你即将进行魂力测评,请做好准备"<<endl; Sleep(3000);xthl=rand()%10+5;if(xthl>10){xthl/=2;}else if(wh1>=0&&wh1<=9||wh2>=0&&wh2<=9){xthl=10;}else{xthl=rand()%10+1;}if(xthl<=1) {cout<<"你只是一个普通人,没有魂力,平凡的度过一生!!!"<<endl;return 0; }else{hldj=xthl;cout<<"你的魂力为"<<hldj<<"级,请开始你的斗罗之旅"<<endl;}if(xthl==10){cout<<"竟然是先天满魂力!!!将来必成封号斗罗!!!"<<endl;}cout<<"你来到了城镇"<<endl;goto cz;cz:system("color 0F");SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |FOREGROUND_GREEN);cout<<" -----------------------*城镇*--------------------------------------- \n";cout<<" | 1.暗器店 2.魂兽森林 3.返回主菜单 | \n";cout<<" --------------------祝您玩的开心------------------------------------ \n";cin>>a;if(a==1){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);cout<<"\n电脑正在拼命加载中...\n\n\n";Sleep(1000);goto aqd;}if(a==2){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);cout<<"\n电脑正在拼命加载中...\n\n\n";Sleep(1000);goto hssl; }if(a==3){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);cout<<"\n电脑正在拼命加载中...\n\n\n";Sleep(1000);goto zcd;}aqd:system("color 0F");SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE |FOREGROUND_BLUE);cout<<" -------------*暗器店*----------------------------------------------- \n";cout<<" |1.诸葛弩箭矢5只 2.子母胆 3.阎王帖 4.暴雨莲花 5.佛怒唐莲 6.返回 | \n";cout<<" | 500金魂币 1000金币 5000金币 10000金币 50000金币 | \n";cout<<" -----------祝您玩的开心--------------------------------------------- \n";cin>>p;if(p==1){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);cout<<"你有"<<jhb<<"元\n"<<endl;cout<<"您购买了诸葛弩*5\n"<<endl;cout<<"几个:\n";cin>>jg;if(jhb>=jg*500){jhb-=jg*100;zgn +=jg*5;SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_RED);cout<<"购买成功!\n"<<endl;cout<<"您还有"<<jhb<<"元"<<endl;}else{ // 25045SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_RED);cout<<"余额不足!\n";cout<<"您有"<<jhb<<"元"<<endl;}Sleep(800);goto aqd;}if(p==6){goto cz;}hssl:zcd:system("color 0F");cout<<" \n";cout<<" ----------*主菜单*------------ \n";cout<<" |1.城镇 2.查看属性 3.其他 | \n";cout<<" ---------祝您玩的开心--------- \n"; cout<<" \n";cout<<" \n";cin>>o;if(o==1){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);cout<<"\n电脑正在拼命加载中...\n\n\n";Sleep(1000);goto cz;}if(o==2){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);cout<<"\n电脑正在拼命加载中...\n\n\n";Sleep(1000);goto cksx;}if(o==3){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);cout<<"\n电脑正在拼命加载中...\n\n\n";Sleep(1000);goto qt;}cksx:for(int i=xthl;i<=hldj;i++){sxhl*=1.5;fy*=1.2;gj+=10;zdhp*=1.5;hp=zdhp;}cout<<"你的武魂是:"<<wh<<' '<<"第二武魂"<<wh3<<endl<<" 攻击力:"<<gj<<" 防御力:"<<fy<<endl<<" 经验值:"<<jy<<"/"<<sxhl<<' '<<"等级 :"<<hldj<<' '<<" HP:"<<zdhp<<endl;if(wh1==0){cout<<' '<<endl;cout<<"1.泰坦之锤"<<endl;cout<<"2.定力之破."<<endl;cout<<"3.狂暴之锤"<<endl;cout<<"4.混沌黑洞"<<endl;cout<<"5.绚烂之爆"<<endl;cout<<"6.昊天森罗雷狱"<<endl;cout<<"7.昊天真身"<<endl;cout<<"8.千钧壁垒"<<endl;cout<<"9.湮灭结界"<<endl;}if(wh1==1){cout<<' '<<endl;cout<<"1.雷霆龙爪"<<endl; cout<<"2.神龙摆尾"<<endl;cout<<"3.霸道雷霆"<<endl;cout<<"4.雷霆龙甲"<<endl;cout<<"5.蓝电霸王枪"<<endl;cout<<"6.雷霆审判"<<endl;cout<<"7.蓝电霸王龙真身"<<endl;cout<<"8.蓝电龙皇傲"<<endl;cout<<"9.蓝电神龙破"<<endl;}if(wh1==2){cout<<' '<<endl;cout<<"1.长剑出锋"<<endl;cout<<"2.灵剑守护"<<endl;cout<<"3.剑翼如飞"<<endl;cout<<"4.剑影重重"<<endl;cout<<"5.威震四方"<<endl;cout<<"6.万剑归宗"<<endl;cout<<"7.七杀真身"<<endl;cout<<"8.移山填海"<<endl;cout<<"9.神魔两斩"<<endl;}if(wh1==3){cout<<' '<<endl;cout<<"1.凤凰火线"<<endl;cout<<"2.浴火凤凰"<<endl;cout<<"3.凤翼天翔"<<endl;cout<<"4.凤凰啸天击"<<endl;cout<<"5.凤凰流星雨"<<endl;cout<<"6.凤凰穿天击"<<endl;cout<<"7.凤凰真身"<<endl;cout<<"8.凤凰裂地舞"<<endl;cout<<"9.凤凰霸天舞"<<endl;}if(wh1==4){cout<<' '<<endl;cout<<"1.缠绕"<<endl;cout<<"2.寄生"<<endl;cout<<"3.蛛网束缚"<<endl;cout<<"4.蓝银囚笼"<<endl;cout<<"5.蓝银霸王枪"<<endl;cout<<"6.无敌金身"<<endl;cout<<"7.蓝银真身"<<endl;cout<<"8.蓝银邪魔镜之灭"<<endl;cout<<"9.蓝银天青龙之魂"<<endl;}if(wh1==5){cout<<' '<<endl;cout<<"1.天使神光"<<endl;cout<<"2.圣光审判"<<endl;cout<<"3.天使圣斩"<<endl;cout<<"4.圣剑"<<endl;cout<<"5.天堂法律"<<endl;cout<<"6.圣域五芒星"<<endl;cout<<"7.天使真身"<<endl;cout<<"8.太阳炽天使"<<endl;cout<<"9. 神圣 裁决 七天使之舞"<<endl;}if(wh1==6){cout<<' '<<endl;cout<<"1.白虎护身障"<<endl;cout<<"2.白虎烈光波"<<endl;cout<<"3.白虎金刚变"<<endl;cout<<"4.白虎流星雨"<<endl;cout<<"5.白虎魔神变"<<endl;cout<<"6.白虎破灭杀"<<endl;cout<<"7.白虎真身"<<endl;cout<<"8.白虎凌风灭"<<endl;cout<<"9.白虎天雷灭"<<endl;}if(wh1==7){cout<<' '<<endl;cout<<"1.天使神光"<<endl;cout<<"2.圣光审判"<<endl;cout<<"3.天使圣斩"<<endl;cout<<"4.圣剑"<<endl;cout<<"5.天堂法律"<<endl;cout<<"6.圣域五芒星"<<endl;cout<<"7.天使真身"<<endl;cout<<"8.太阳炽天使"<<endl;cout<<"9. 神圣 裁决 七天使之舞"<<endl;}cout<<"输入 1返回主菜单"<<endl;cin>>fh;if(fh==1){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);cout<<"\n电脑正在拼命加载中...\n\n\n";Sleep(1000);goto zcd;}else {SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY |FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE| BACKGROUND_GREEN| BACKGROUND_RED);cout<<"\n电脑正在拼命加载中...\n\n\n";Sleep(1000);goto cksx;}qt:return 0;
}
写了很多,但不完全.
这篇关于同人小游戏:斗罗大陆2的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!