今天我给大家一点实用的小游戏,希望支持。
直接上代码:文章来源:https://www.toymoban.com/news/detail-632390.html
#include<bits/stdc++.h>
#include<windows.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include <cstring>
#include <cstdio>
#include <iostream>
#define N 22
using namespace std;
const int MAXN=15;
const int MAX=25;
int main(void){
long long xiaoguai=500,daguai=2000,xiaoguaixue=500,daguaixue=2000,dasi=0,xiaosi=0,touzi=0,xiaofei=0;
int r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,r7=0;
long long shai=0,shaici=0;
int o[MAXN]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},q[MAXN]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int r[MAXN]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},s[MAXN]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
long long a=1,aa,b,c,d,e,ee=0,f,ff,g,gg=10,h,i,j,k=0,l,m,n,nn=1,p,t,u,v,vv,w,x,y,z,zz=0;
int bb[MAX]={0,0,0,0,0,3,0,0,0,3,0,4,0,3,0,5,4,0,0,4,0,3,0,5,0};
int cc[MAX]={1,1,1,1,2,1,1,2,2,1,1,1,2,1,1,1,1,1,1,1,2,1,2,1,1};
char input,put,in;
long long hong=0,lu=0,mu=0,shi=0,xuyuan=0,chanzi=0,diban=10,qiangbi=10,chuang=10,zhuo=10,num;
long long jingxiaolibao=0,jingdalibao=0,wuxiaolibao=0,wudalibao=0,tixiaolibao=0,tidalibao=0,xuexiaolibao=0,xuedalibao=0;
int mao=0,gou=0,niu=0,ma=0,yang=0,maoji=1,gouji=1,niuji=1,maji=1,yangji=1,maomi=0,goumi=0,niumi=0,mami=0,yangmi=0;
long long gongjili=10,xueliang=100,jingbi=100,tili=100,jingyan=0,shengjixian=50,xiaogong=10,dagong=50,dengji=1;
long long suliao=0,muzhi=0,tiezhi=0,shuiguo=0,cai=0,fangshui=0;
long long suci=0,muci=0,tieci=0,shuici=0,caici=0;
string hh;
cout<<"加载中..."<<endl;
cout<<"提示:离小怪或大怪太近会被乎死";
Sleep(1000);
system("cls");
cout<<"加载中..."<<endl;
cout<<"提示:大怪会施法";
Sleep(1000);
system("cls");
cout<<"加载中..."<<endl;
cout<<"提示:不买氧气罐会在冒险的时候淹死";
Sleep(1000);
system("cls");
cout<<"加载中..."<<endl;
cout<<"提示:挖泥土前要买铲子";
Sleep(1000);
system("cls");
cout<<"加载中..."<<endl;
cout<<"提示:投资可能会亏钱";
Sleep(1000);
system("cls");
cout<<"加载中..."<<endl;
cout<<"提示:冒险里的草丛里会有小偷和狼";
Sleep(1000);
system("cls");
cout<<"加载中..."<<endl;
cout<<"提示:宠物在打怪时很有帮助";
Sleep(1000);
system("cls");
cout<<"加载中..."<<endl;
cout<<"提示:升级宠物可以提升耐久度";
Sleep(1000);
system("cls");
cout<<"输入用户名:";
cin>>hh;
if(hh=="爷是攻"){
jingbi=1000000;
xueliang=1000000;
tili=1000000;
}
system("cls");
while(1){
while(1){
Sleep(100);
system("cls");
cout<<"[按a向左][按d向右][我=+][按e进入此屋]"<<endl;
cout<<"/ ̄ ̄\\/ ̄ ̄\\/ ̄ ̄\\/ ̄ ̄\\/ ̄ ̄\\/ ̄ ̄\\/ ̄ ̄\\/ ̄ ̄\\/ ̄ ̄\\/ ̄ ̄\\/ \\"<<endl;
cout<<"|小怪||大怪||购物||投资||冒险||交易||许愿||任务|| 摇 ||我的||专业|"<<endl;
cout<<"|森林||森林|| 街 || || || 铺 || 池 || 栏 ||骰子||家园||打铁|"<<endl;
cout<<"|^ __||^ __||^ __||^ __||^ __||^ __||^ __||^ __||^ __||^ __||^ __|"<<endl;
cout<<"| | | | | | | | | | | | | | | | | | | | | | "<<endl;
for(p=1;p<=a;p++)
cout<<" ";
cout<<"+";
if(kbhit()) {
put=getch();
if(put=='a')
a=a-6;
if(put=='d')
a=a+6;
if(put=='e'){
if(a==1||a==7||a==13||a==19||a==25||a==31||a==37||a==43||a==49||a==55||a==61||a==67)
break;
else{
cout<<"这里不是入口";
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
}
}
if(a==61){
cout<<"更多功能,敬请期待"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(a==55){
system("cls");
cout<<"1,我的小屋"<<endl;
cout<<"2,我的礼包"<<endl;
cout<<"3,我的状态"<<endl;
cout<<"4,我的宠物"<<endl;
cout<<"5,我的背包"<<endl;
cout<<"6,我的武器"<<endl;
cout<<"7,返回"<<endl;
cin>>t;
if(t==6){
while(1){
system("cls");
if(suliao==0&&muzhi==0&&tiezhi==0&&shuiguo==0&&cai==0){
cout<<"你暂无任何武器"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
else{
if(suliao>=1){
cout<<"塑料餐具刀"<<suliao<<"把"<<endl;
cout<<"增加5点攻击力"<<endl;
cout<<"选择武器按1"<<endl;
}
if(muzhi>=1){
cout<<"木质餐具刀"<<muzhi<<"把"<<endl;
cout<<"增加20点攻击力"<<endl;
cout<<"选择武器按2"<<endl;
}
if(tiezhi>=1){
cout<<"铁制餐具刀"<<tiezhi<<"把"<<endl;
cout<<"增加50点攻击力"<<endl;
cout<<"选择武器按3"<<endl;
}
if(shuiguo>=1){
cout<<"水果刀"<<shuiguo<<"把"<<endl;
cout<<"增加100点攻击力"<<endl;
cout<<"选择武器按4"<<endl;
}
if(cai>=1){
cout<<"菜刀"<<cai<<"把"<<endl;
cout<<"增加500点攻击力"<<endl;
cout<<"选择武器按5"<<endl;
}
cout<<"返回按6"<<endl;
cin>>aa;
if(aa==1){
gongjili=gongjili+5;
suci=suci+1;
suliao=suliao-1;
cout<<"选择成功"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(aa==2){
gongjili=gongjili+20;
muci=muci+1;
muzhi=muzhi-1;
cout<<"选择成功"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(aa==3){
gongjili=gongjili+50;
tieci=tieci+1;
tiezhi=tiezhi-1;
cout<<"选择成功"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(aa==4){
gongjili=gongjili+100;
shuici=shuici+1;
shuiguo=shuiguo-1;
cout<<"选择成功"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(aa==5){
gongjili=gongjili+500;
caici=caici+1;
cai=cai-1;
cout<<"选择成功"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(aa==6)
break;
}
}
}
if(t==5){
system("cls");
cout<<"你有"<<hong<<"块超稀有红宝石"<<endl;
cout<<"你有"<<lu<<"块稀有绿宝石"<<endl;
cout<<"你有"<<mu<<"块木头"<<endl;
cout<<"你有"<<shi<<"块石头"<<endl;
cout<<"你有"<<jingbi<<"枚金币"<<endl;
cout<<"你有"<<shai<<"枚骰子"<<endl;
cout<<"按任意键回到主界面"<<endl;
getch();
system("cls");
}
if(t==4){
system("cls");
if(mao==0&&gou==0&&niu==0&&ma==0&&yang==0){
cout<<"你暂无任何宠物"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
if(mao==1){
cout<<"猫猫"<<maoji<<"级"<<endl;
cout<<"技能:每次被攻击后恢复"<<maoji*5<<"点血量"<<endl;
cout<<"升级需耗费"<<maoji*100<<"金币"<<endl;
cout<<"剩余使用次数:"<<50-maomi<<"次"<<endl;
cout<<"升级按1 选择宠物按5 卸下宠物按10"<<endl;
}
if(gou==1){
cout<<"狗狗"<<gouji<<"级"<<endl;
cout<<"技能:每次被攻击后恢复"<<gouji*10<<"点血量"<<endl;
cout<<"升级需耗费"<<gouji*150<<"金币"<<endl;
cout<<"剩余使用次数:"<<50-goumi<<"次"<<endl;
cout<<"升级按2 选择宠物按6 卸下宠物按11"<<endl;
}
if(niu==1){
cout<<"牛牛"<<niuji<<"级"<<endl;
cout<<"技能:每次额外攻击大怪或小怪"<<niuji*10<<"点血量"<<endl;
cout<<"升级需耗费"<<niuji*250<<"金币"<<endl;
cout<<"剩余使用次数:"<<50-niumi<<"次"<<endl;
cout<<"升级按3 选择宠物按7 卸下宠物按12"<<endl;
}
if(yang==1){
cout<<"羊羊"<<endl;
cout<<"技能:使大怪或小怪对你的攻击减半"<<endl;
cout<<"剩余使用次数:"<<50-yangmi<<"次"<<endl;
cout<<"选择宠物按8 卸下宠物按13"<<endl;
}
if(ma==1){
cout<<"马马 "<<endl;
cout<<"技能:使大怪或小怪的血量瞬间减半"<<endl;
cout<<"剩余使用次数:"<<50-mami<<"次"<<endl;
cout<<"选择宠物按9 卸下宠物按14"<<endl;
}
cin>>j;
if(j==1){
if(jingbi>=maoji*100){
cout<<"升级成功"<<endl;
jingbi=jingbi-maoji*100;
maoji=maoji+1;
maomi=maomi-10;
}
else{
cout<<"金币不足"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(j==2){
if(jingbi>=gouji*150){
cout<<"升级成功"<<endl;
jingbi=jingbi-gouji*150;
gouji=gouji+1;
}
else{
cout<<"金币不足"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(j==3){
if(jingbi>=niuji*100){
cout<<"升级成功"<<endl;
jingbi=jingbi-niuji*250;
niuji=niuji+1;
niumi=niumi-10;
}
else{
cout<<"金币不足"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(j==5){
k=j;
cout<<"选择成功"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(j==6){
k=j;
cout<<"选择成功"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(j==7){
k=j;
cout<<"选择成功"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(j==8){
k=j;
cout<<"选择成功"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(j==9){
k=j;
cout<<"选择成功"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(j==10){
if(k==5){
cout<<"按任意键继续"<<endl;
k=0;
getch();
system("cls");
}
else{
cout<<"你暂未选择该宠物"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(j==11){
if(k==6){
cout<<"按任意键继续"<<endl;
k=0;
getch();
system("cls");
}
else{
cout<<"你暂未选择该宠物"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(j==12){
if(k==7){
cout<<"按任意键继续"<<endl;
k=0;
getch();
system("cls");
}
else{
cout<<"你暂未选择该宠物"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(j==13){
if(k==8){
cout<<"按任意键继续"<<endl;
k=0;
getch();
system("cls");
}
else{
cout<<"你暂未选择该宠物"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(j==14){
if(k==9){
cout<<"按任意键继续"<<endl;
k=0;
getch();
system("cls");
}
else{
cout<<"你暂未选择该宠物"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
}
}
if(t==3){
system("cls");
cout<<"我的状态:"<<endl;
cout<<"等级:"<<dengji<<endl;
cout<<"经验:"<<jingyan<<"/"<<shengjixian<<endl;
cout<<"血量:"<<xueliang<<endl;
cout<<"体力:"<<tili<<endl;
cout<<"攻击力:"<<gongjili<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(t==2){
system("cls");
while(1){
system("cls");
cout<<"1,血量小礼包*"<<xuexiaolibao<<" 2,血量大礼包*"<<xuedalibao<<endl;
cout<<"3,武器小礼包*"<<wuxiaolibao<<" 4,武器大礼包*"<<wudalibao<<endl;
cout<<"5,体力小礼包*"<<tixiaolibao<<" 6,体力大礼包*"<<tidalibao<<endl;
cout<<"7,金币小礼包*"<<jingxiaolibao<<" 8,金币大礼包*"<<jingdalibao<<endl;
cout<<"9,返回主界面"<<endl;
cin>>g;
if(g==1){
if(xuexiaolibao>0){
cout<<"恭喜获得10点血量";
xueliang=xueliang+10;
xuexiaolibao=xuexiaolibao-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无该礼包"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(g==2){
if(xuedalibao>0){
cout<<"恭喜获得50点血量";
xueliang=xueliang+50;
xuedalibao=xuedalibao-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无该礼包"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(g==3){
if(wuxiaolibao>0){
cout<<"恭喜获得10点攻击力";
gongjili=gongjili+10;
wuxiaolibao=wuxiaolibao-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无该礼包"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(g==4){
if(wudalibao>0){
cout<<"恭喜获得50点攻击力";
gongjili=gongjili+50;
wudalibao=wudalibao-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无该礼包"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(g==5){
if(tixiaolibao>0){
cout<<"恭喜获得10点体力";
tili=tili+10;
tixiaolibao=tixiaolibao-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无该礼包"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(g==6){
if(tidalibao>0){
cout<<"恭喜获得50点体力";
tili=tili+50;
tidalibao=tidalibao-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无该礼包"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(g==7){
if(jingxiaolibao>0){
cout<<"恭喜获得10枚金币";
jingbi=jingbi+10;
jingxiaolibao=jingxiaolibao-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无该礼包"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(g==8){
if(jingdalibao>0){
cout<<"恭喜获得50枚金币";
jingbi=jingbi+50;
jingdalibao=jingdalibao-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无该礼包"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(g==9){
system("cls");
break;
}
}
}
if(t==1){
cout<<" ";
for(p=0;p<15;p++){
if(o[p]==0)
cout<<" ";
if(o[p]==1)
cout<<"-";
if(o[p]==2)
cout<<"_";
if(o[p]==3)
cout<<"|";
if(o[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"2 ";
for(p=0;p<15;p++){
if(q[p]==0)
cout<<" ";
if(q[p]==1)
cout<<"-";
if(q[p]==2)
cout<<"_";
if(q[p]==3)
cout<<"|";
if(q[p]==4)
cout<<"=";
}
cout<<endl;
cout<<" ";
for(p=0;p<15;p++){
if(r[p]==0)
cout<<" ";
if(r[p]==1)
cout<<"-";
if(r[p]==2)
cout<<"_";
if(r[p]==3)
cout<<"|";
if(r[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"1 ";
for(p=0;p<15;p++){
if(s[p]==0)
cout<<" ";
if(s[p]==1)
cout<<"-";
if(s[p]==2)
cout<<"_";
if(s[p]==3)
cout<<"|";
if(s[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"请选择楼层"<<endl;
cin>>u;
if(u==1){
while(1){
system("cls");
cout<<" ";
for(p=0;p<15;p++){
if(r[p]==0)
cout<<" ";
if(r[p]==1)
cout<<"-";
if(r[p]==2)
cout<<"_";
if(r[p]==3)
cout<<"|";
if(r[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"1 ";
for(p=0;p<15;p++){
if(s[p]==0)
cout<<" ";
if(s[p]==1)
cout<<"-";
if(s[p]==2)
cout<<"_";
if(s[p]==3)
cout<<"|";
if(s[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"请选择家具"<<endl;
cout<<"1,你有"<<zhuo<<"张桌子"<<endl;
cout<<"2,你有"<<diban<<"块地板"<<endl;
cout<<"3,你有"<<qiangbi<<"块墙壁"<<endl;
cout<<"4,你有"<<chuang<<"张单人床"<<endl;
cout<<"5,返回"<<endl;
cin>>v;
if(v==5){
system("cls");
break;
}
if(v==1){
if(zhuo>0){
while(1){
system("cls");
cout<<"[按1向左][按2向右][桌子=-][按3确定]"<<endl;
for(p=0;p<15;p++){
if(r[p]==0)
cout<<" ";
if(r[p]==1)
cout<<"-";
if(r[p]==2)
cout<<"_";
if(r[p]==3)
cout<<"|";
if(r[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"1 ";
for(p=0;p<15;p++){
if(s[p]==0)
cout<<" ";
if(s[p]==1)
cout<<"-";
if(s[p]==2)
cout<<"_";
if(s[p]==3)
cout<<"|";
if(s[p]==4)
cout<<"=";
}
cout<<endl;
for(p=0;p<=zz;p++)
cout<<" ";
cout<<"-";
cin>>vv;
if(vv==1)
zz=zz-1;
if(vv==2)
zz=zz+1;
if(vv==3){
if(zz<13&&zz>1){
s[zz-2]=1;
zhuo=zhuo-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
else{
cout<<"你无法将桌子安放在此"<<endl;
}
}
}
}
else{
cout<<"你暂无桌子"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(v==2){
if(diban>0){
while(1){
system("cls");
cout<<"[按1向左][按2向右][地板=_][按3确定]"<<endl;
for(p=0;p<15;p++){
if(r[p]==0)
cout<<" ";
if(r[p]==1)
cout<<"-";
if(r[p]==2)
cout<<"_";
if(r[p]==3)
cout<<"|";
if(r[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"1 ";
for(p=0;p<15;p++){
if(s[p]==0)
cout<<" ";
if(s[p]==1)
cout<<"-";
if(s[p]==2)
cout<<"_";
if(s[p]==3)
cout<<"|";
if(s[p]==4)
cout<<"=";
}
cout<<endl;
for(p=0;p<=zz;p++)
cout<<" ";
cout<<"_";
cin>>vv;
if(vv==1)
zz=zz-1;
if(vv==2)
zz=zz+1;
if(vv==3){
if(zz<13&&zz>1){
s[zz-2]=2;
diban=diban-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
else{
cout<<"你无法将地板安放在此"<<endl;
}
}
}
}
else{
cout<<"你暂无地板"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(v==3){
if(qiangbi>0){
while(1){
system("cls");
cout<<"[按1向左][按2向右][墙壁=|][按3确定]"<<endl;
for(p=0;p<15;p++){
if(r[p]==0)
cout<<" ";
if(r[p]==1)
cout<<"-";
if(r[p]==2)
cout<<"_";
if(r[p]==3)
cout<<"|";
if(r[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"1 ";
for(p=0;p<15;p++){
if(s[p]==0)
cout<<" ";
if(s[p]==1)
cout<<"-";
if(s[p]==2)
cout<<"_";
if(s[p]==3)
cout<<"|";
if(s[p]==4)
cout<<"=";
}
cout<<endl;
for(p=0;p<=zz;p++)
cout<<" ";
cout<<"|";
cin>>vv;
if(vv==1)
zz=zz-1;
if(vv==2)
zz=zz+1;
if(vv==3){
if(zz<13&&zz>1){
s[zz-2]=3;
r[zz-2]=3;
qiangbi=qiangbi-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
else{
cout<<"你无法将墙壁安放在此"<<endl;
}
}
}
}
else{
cout<<"你暂无墙壁"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(v==4){
if(chuang>0){
while(1){
system("cls");
cout<<"[按1向左][按2向右][单人床==][按3确定]"<<endl;
for(p=0;p<15;p++){
if(r[p]==0)
cout<<" ";
if(r[p]==1)
cout<<"-";
if(r[p]==2)
cout<<"_";
if(r[p]==3)
cout<<"|";
if(r[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"1 ";
for(p=0;p<15;p++){
if(s[p]==0)
cout<<" ";
if(s[p]==1)
cout<<"-";
if(s[p]==2)
cout<<"_";
if(s[p]==3)
cout<<"|";
if(s[p]==4)
cout<<"=";
}
cout<<endl;
for(p=0;p<=zz;p++)
cout<<" ";
cout<<"=";
cin>>vv;
if(vv==1)
zz=zz-1;
if(vv==2)
zz=zz+1;
if(vv==3){
if(zz<13&&zz>1){
s[zz-2]=4;
chuang=chuang-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
else{
cout<<"你无法将单人床安放在此"<<endl;
}
}
}
}
else{
cout<<"你暂无单人床"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
}
}
if(u==2){
while(1){
system("cls");
cout<<" ";
for(p=0;p<15;p++){
if(o[p]==0)
cout<<" ";
if(o[p]==1)
cout<<"-";
if(o[p]==2)
cout<<"_";
if(o[p]==3)
cout<<"|";
if(o[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"1 ";
for(p=0;p<15;p++){
if(q[p]==0)
cout<<" ";
if(q[p]==1)
cout<<"-";
if(q[p]==2)
cout<<"_";
if(q[p]==3)
cout<<"|";
if(q[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"请选择家具"<<endl;
cout<<"1,你有"<<zhuo<<"张桌子"<<endl;
cout<<"2,你有"<<diban<<"块地板"<<endl;
cout<<"3,你有"<<qiangbi<<"块墙壁"<<endl;
cout<<"4,你有"<<chuang<<"张单人床"<<endl;
cout<<"5,返回"<<endl;
cin>>v;
if(v==5){
system("cls");
break;
}
if(v==1){
if(zhuo>0){
while(1){
system("cls");
cout<<"[按1向左][按2向右][桌子=-][按3确定]"<<endl;
cout<<" ";
for(p=0;p<15;p++){
if(o[p]==0)
cout<<" ";
if(o[p]==1)
cout<<"-";
if(o[p]==2)
cout<<"_";
if(o[p]==3)
cout<<"|";
if(o[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"2 ";
for(p=0;p<15;p++){
if(q[p]==0)
cout<<" ";
if(q[p]==1)
cout<<"-";
if(q[p]==2)
cout<<"_";
if(q[p]==3)
cout<<"|";
if(q[p]==4)
cout<<"=";
}
cout<<endl;
for(p=0;p<=zz;p++)
cout<<" ";
cout<<"-";
cin>>vv;
if(vv==1)
zz=zz-1;
if(vv==2)
zz=zz+1;
if(vv==3){
if(zz<13&&zz>1){
q[zz-2]=1;
zhuo=zhuo-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
else{
cout<<"你无法将桌子安放在此"<<endl;
}
}
}
}
else{
cout<<"你暂无桌子"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(v==2){
if(diban>0){
while(1){
system("cls");
cout<<"[按1向左][按2向右][地板=_][按3确定]"<<endl;
cout<<" ";
for(p=0;p<15;p++){
if(o[p]==0)
cout<<" ";
if(o[p]==1)
cout<<"-";
if(o[p]==2)
cout<<"_";
if(o[p]==3)
cout<<"|";
if(o[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"2 ";
for(p=0;p<15;p++){
if(q[p]==0)
cout<<" ";
if(q[p]==1)
cout<<"-";
if(q[p]==2)
cout<<"_";
if(q[p]==3)
cout<<"|";
if(q[p]==4)
cout<<"=";
}
cout<<endl;
for(p=0;p<=zz;p++)
cout<<" ";
cout<<"_";
cin>>vv;
if(vv==1)
zz=zz-1;
if(vv==2)
zz=zz+1;
if(vv==3){
if(zz<13&&zz>1){
q[zz-2]=2;
diban=diban-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
else{
cout<<"你无法将地板安放在此"<<endl;
}
}
}
}
else{
cout<<"你暂无地板"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(v==3){
if(qiangbi>0){
while(1){
system("cls");
cout<<"[按1向左][按2向右][墙壁=|][按3确定]"<<endl;
cout<<" ";
for(p=0;p<15;p++){
if(o[p]==0)
cout<<" ";
if(o[p]==1)
cout<<"-";
if(o[p]==2)
cout<<"_";
if(o[p]==3)
cout<<"|";
if(o[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"2 ";
for(p=0;p<15;p++){
if(q[p]==0)
cout<<" ";
if(q[p]==1)
cout<<"-";
if(q[p]==2)
cout<<"_";
if(q[p]==3)
cout<<"|";
if(q[p]==4)
cout<<"=";
}
cout<<endl;
for(p=0;p<=zz;p++)
cout<<" ";
cout<<"|";
cin>>vv;
if(vv==1)
zz=zz-1;
if(vv==2)
zz=zz+1;
if(vv==3){
if(zz<13&&zz>1){
o[zz-2]=3;
q[zz-2]=3;
qiangbi=qiangbi-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
else{
cout<<"你无法将墙壁安放在此"<<endl;
}
}
}
}
else{
cout<<"你暂无墙壁"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(v==4){
if(chuang>0){
while(1){
system("cls");
cout<<"[按1向左][按2向右][单人床==][按3确定]"<<endl;
cout<<" ";
for(p=0;p<15;p++){
if(o[p]==0)
cout<<" ";
if(o[p]==1)
cout<<"-";
if(o[p]==2)
cout<<"_";
if(o[p]==3)
cout<<"|";
if(o[p]==4)
cout<<"=";
}
cout<<endl;
cout<<"2 ";
for(p=0;p<15;p++){
if(q[p]==0)
cout<<" ";
if(q[p]==1)
cout<<"-";
if(q[p]==2)
cout<<"_";
if(q[p]==3)
cout<<"|";
if(q[p]==4)
cout<<"=";
}
cout<<endl;
for(p=0;p<=zz;p++)
cout<<" ";
cout<<"=";
cin>>vv;
if(vv==1)
zz=zz-1;
if(vv==2)
zz=zz+1;
if(vv==3){
if(zz<13&&zz>1){
q[zz-2]=4;
chuang=chuang-1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
else{
cout<<"你无法将单人床安放在此"<<endl;
}
}
}
}
else{
cout<<"你暂无单人床"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
}
}
}
}
if(a==1){
system("cls");
cout<<"一只小怪向你跑来"<<endl;
if(k==9){
cout<<"你的宠物马马使小怪的血量减半"<<endl;
xiaoguai=xiaoguai/2;
mami=mami+1;
if(mami==50){
cout<<"你的宠物马马到期了,欢迎续期"<<endl;
k=0;
ma=0;
}
}
for(int z=1;;z++){
cout<<"Round "<<z<<endl;
cout<<"你要:"<<endl;
cout<<"1,攻击"<<endl;
cout<<"2,逃跑"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
for(ff=0;ff<gg;ff++)
cout<<" ";
cout<<"|\\___/|" <<endl;
for(ff=0;ff<gg;ff++)
cout<<" ";
cout<<"|■_■|"<<endl;
for(ff=0;ff<gg;ff++)
cout<<" ";
cout<<"|_____|"<<endl;
cout<<"+";
for(ff=0;ff<gg-1;ff++)
cout<<" ";
cout<<" | | "<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
cin>>b;
if(b==2){
cout<<"逃跑成功!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
if(b==0)
xiaoguai=0;
if(b==1){
gg=gg-1;
if(gg==1){
cout<<"小怪一手把你乎死了";
return 0;
}
cout<<"你向小怪发起进攻"<<endl;
cout<<"你打掉了小怪的"<<gongjili<<"滴血"<<endl;
xiaoguai=xiaoguai-gongjili;
tili=tili-10;
if(tili==0){
cout<<"体力不足!"<<endl;
xiaoguai=100;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
if(k==7){
cout<<"你的宠物牛牛帮你额外打掉了小怪的"<<niuji*10<<"点血量"<<endl;
xiaoguai=xiaoguai-niuji*10;
niumi=niumi+1;
if(niumi==50){
cout<<"你的宠物牛牛到期了,欢迎续期"<<endl;
k=0;
niu=0;
}
}
if(xiaoguai>0){
cout<<"小怪还剩"<<xiaoguai<<"滴血"<<endl;
cout<<"小怪向你发起了进攻"<<endl;
cout<<"小怪打掉了你的"<<xiaogong<<"滴血"<<endl;
xueliang=xueliang-xiaogong;
if(k==8){
cout<<"你的宠物羊羊使小怪对你的伤害减半"<<endl;
xueliang=xueliang+xiaogong/2;
yangmi=yangmi+1;
if(yangmi==50){
cout<<"你的宠物羊羊到期了,欢迎续期"<<endl;
k=0;
yang=0;
}
}
if(xueliang>0){
cout<<"你还剩"<<xueliang<<"滴血"<<endl;
if(k==5){
cout<<"你的宠物猫猫帮你恢复了"<<maoji*5<<"点血量"<<endl;
xueliang=xueliang+maoji*5;
maomi=maomi+1;
if(maomi==50){
cout<<"你的宠物猫猫到期了,欢迎续期"<<endl;
k=0;
mao=0;
}
}
if(k==6){
cout<<"你的宠物狗狗帮你恢复了"<<gouji*10<<"点血量"<<endl;
xueliang=xueliang+gouji*10;
goumi=goumi+1;
if(goumi==50){
cout<<"你的宠物狗狗到期了,欢迎续期"<<endl;
k=0;
gou=0;
}
}
}
else{
cout<<"你被小怪打死了!Game over!";
return 0;
}
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(xiaoguai<1){
cout<<"小怪被你打死了!"<<endl;
cout<<"恭喜获得20点经验"<<endl;
xiaoguai=500+xiaoguaixue;
jingbi=jingbi+xiaoguai/4;
cout<<"恭喜获得"<<xiaoguai/5<<"枚金币"<<endl;
xiaogong=xiaogong+50;
gg=10;
xiaoguaixue=xiaoguaixue+500;
xiaosi=xiaosi+1;
jingyan=jingyan+20;
cout<<"掉落物品:"<<endl;
srand((unsigned int)time(NULL));
num=rand()%80+1;
if(num>0&&num<=20){
xuexiaolibao=xuexiaolibao+1;
cout<<"恭喜获得血量小礼包一个"<<endl;
}
if(num>20&&num<=40){
wuxiaolibao=wuxiaolibao+1;
cout<<"恭喜获得武器小礼包一个"<<endl;
}
if(num>40&&num<=60){
tixiaolibao=tixiaolibao+1;
cout<<"恭喜获得体力小礼包一个"<<endl;
}
if(num>60&&num<=80){
jingxiaolibao=jingxiaolibao+1;
cout<<"恭喜获得金币小礼包一个"<<endl;
}
if(jingyan==shengjixian){
cout<<"恭喜升级!"<<endl;
jingyan=0;
dengji=dengji+1;
shengjixian=shengjixian+20;
srand((unsigned int)time(NULL));
num=rand()%80+1;
if(num>0&&num<10){
xuexiaolibao=xuexiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得血量小礼包一个"<<endl;
}
if(num>9&&num<20){
xuedalibao=xuedalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得血量大礼包一个"<<endl;
}
if(num>19&&num<30){
wuxiaolibao=wuxiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得武器小礼包一个"<<endl;
}
if(num>29&&num<40){
wudalibao=wudalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得武器大礼包一个"<<endl;
}
if(num>39&&num<50){
tixiaolibao=tixiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得体力小礼包一个"<<endl;
}if(num>49&&num<60){
tidalibao=tidalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得体力大礼包一个"<<endl;
}
if(num>59&&num<70){
jingxiaolibao=jingxiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得金币小礼包一个"<<endl;
}
if(num>69&&num<=80){
jingdalibao=jingdalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得金币大礼包一个"<<endl;
}
}
if(jingyan>shengjixian){
cout<<"恭喜升级!"<<endl;
jingyan=jingyan-shengjixian;
dengji=dengji+1;
shengjixian=shengjixian+20;
srand((unsigned int)time(NULL));
num=rand()%80+1;
if(num>0&&num<10){
xuexiaolibao=xuexiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得血量小礼包一个"<<endl;
}
if(num>9&&num<20){
xuedalibao=xuedalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得血量大礼包一个"<<endl;
}
if(num>19&&num<30){
wuxiaolibao=wuxiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得武器小礼包一个"<<endl;
}
if(num>29&&num<40){
wudalibao=wudalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得武器大礼包一个"<<endl;
}
if(num>39&&num<50){
tixiaolibao=tixiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得体力小礼包一个"<<endl;
}if(num>49&&num<60){
tidalibao=tidalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得体力大礼包一个"<<endl;
}
if(num>59&&num<70){
jingxiaolibao=jingxiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得金币小礼包一个"<<endl;
}
if(num>69&&num<=80){
jingdalibao=jingdalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得金币大礼包一个"<<endl;
if(num==21||num==34||num==47||num<21){
cout<<"恭喜获得骰子3枚"<<endl;
shai=shai+3;
}
}
}
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
}
}
if(a==7){
system("cls");
cout<<"一只大怪向你跑来"<<endl;
if(k==9){
cout<<"你的宠物马马使大怪的血量减半"<<endl;
daguai=daguai/2;
mami=mami+1;
if(mami==50){
cout<<"你的宠物马马到期了,欢迎续期"<<endl;
k=0;
ma=0;
}
}
for(int z=1;;z++){
cout<<"Round "<<z<<endl;
cout<<"你要:"<<endl;
cout<<"1,攻击"<<endl;
cout<<"2,逃跑"<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
for(ff=0;ff<gg;ff++)
cout<<" ";
cout<<"|\\___/|" <<endl;
for(ff=0;ff<gg;ff++)
cout<<" ";
cout<<"|■o■|"<<endl;
for(ff=0;ff<gg;ff++)
cout<<" ";
cout<<"|_____|"<<endl;
cout<<"+";
for(ff=0;ff<gg-1;ff++)
cout<<" ";
cout<<" | | "<<endl;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
cin>>b;
if(b==2){
cout<<"逃跑成功!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
if(b==0)
daguai=0;
if(b==1){
gg=gg-1;
if(gg==1)
{
cout<<"大怪一手把你乎死了";
return 0;
}
cout<<"你向大怪发起进攻"<<endl;
cout<<"你打掉了大怪的"<<gongjili<<"滴血"<<endl;
tili=tili-10;
if(tili==0){
cout<<"体力不足!"<<endl;
daguai=50000;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
daguai=daguai-gongjili;
if(k==7){
cout<<"你的宠物牛牛帮你额外打掉了大怪的"<<niuji*10<<"点血量"<<endl;
daguai=daguai-niuji*10;
niumi=niumi+1;
if(niumi==50){
cout<<"你的宠物牛牛到期了,欢迎续期"<<endl;
k=0;
niu=0;
}
}
if(daguai>0){
cout<<"大怪还剩"<<daguai<<"滴血"<<endl;
srand((unsigned int)time(NULL));
num=rand()%10+1;
if(num==2){
cout<<"大怪向你发起了进攻"<<endl;
cout<<"大怪的攻击力增强了100点"<<endl;
dagong=dagong+100;
cout<<"大怪打掉了你的"<<dagong<<"滴血"<<endl;
xueliang=xueliang-dagong;
}
if(num==3){
cout<<"大怪恢复了1000点血量"<<endl;
daguai=daguai+1000;
}
if(num==4){
cout<<"大怪施法偷走了你的好多东西(红宝石也偷嘿嘿嘿嘿)"<<endl;
hong=0;lu=0;mu=0;shi=0;jingbi=0;
}
if(num==5){
cout<<"大怪召唤了一群小怪把你揍了一顿"<<endl;
cout<<"你的血量只剩下一点了哦"<<endl;
xueliang=1;
}
if(num!=2&&num!=5){
cout<<"大怪向你发起了进攻"<<endl;
cout<<"大怪打掉了你的"<<dagong<<"滴血"<<endl;
xueliang=xueliang-dagong;
}
if(k==8){
cout<<"你的宠物羊羊使大怪对你的伤害减半"<<endl;
xueliang=xueliang+dagong/2;
yangmi=yangmi+1;
if(yangmi==50){
cout<<"你的宠物羊羊到期了,欢迎续期"<<endl;
k=0;
yang=0;
}
}
if(xueliang>0){
cout<<"你还剩"<<xueliang<<"滴血"<<endl;
if(k==5){
cout<<"你的宠物猫猫帮你恢复了"<<maoji*5<<"点血量"<<endl;
xueliang=xueliang+maoji*5;
maomi=maomi+1;
if(maomi==50){
cout<<"你的宠物猫猫到期了,欢迎续期"<<endl;
k=0;
mao=0;
}
}
if(k==6){
cout<<"你的宠物狗狗帮你恢复了"<<gouji*10<<"点血量"<<endl;
xueliang=xueliang+gouji*10;
goumi=goumi+1;
if(goumi==50){
cout<<"你的宠物狗狗到期了,欢迎续期"<<endl;
k=0;
gou=0;
}
}
}
else{
cout<<"你被大怪打死了!Game over!";
return 0;
}
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"大怪被你打死了!"<<endl;
cout<<"恭喜获得100点经验"<<endl;
daguai=2000+daguaixue;
jingbi=jingbi+daguai/8;
cout<<"恭喜获得"<<daguai/8<<"枚金币"<<endl;
dagong=dagong+50;
daguaixue=daguaixue+2000;
dasi=dasi+1;
jingyan=jingyan+100;
gg=10;
cout<<"掉落物品:"<<endl;
srand((unsigned int)time(NULL));
num=rand()%80+1;
if(num>0&&num<=20){
xuedalibao=xuedalibao+1;
cout<<"恭喜获得血量大礼包一个"<<endl;
}
if(num>20&&num<=40){
wudalibao=wudalibao+1;
cout<<"恭喜获得武器大礼包一个"<<endl;
}
if(num==21||num==34||num==47||num<21){
cout<<"恭喜获得骰子5枚"<<endl;
shai=shai+5;
}
if(num>40&&num<=60){
tidalibao=tidalibao+1;
cout<<"恭喜获得体力大礼包一个"<<endl;
}
if(num>60&&num<=80){
jingdalibao=jingdalibao+1;
cout<<"恭喜获得金币大礼包一个"<<endl;
}
if(jingyan==shengjixian){
cout<<"恭喜升级!"<<endl;
jingyan=0;
dengji=dengji+1;
shengjixian=shengjixian+20;
srand((unsigned int)time(NULL));
num=rand()%80+1;
if(num>0&&num<10){
xuexiaolibao=xuexiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得血量小礼包一个"<<endl;
}
if(num>9&&num<20){
xuedalibao=xuedalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得血量大礼包一个"<<endl;
}
if(num>19&&num<30){
wuxiaolibao=wuxiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得武器小礼包一个"<<endl;
}
if(num==21||num==34||num==47||num<21){
cout<<"恭喜获得骰子3枚"<<endl;
shai=shai+3;
}
if(num>29&&num<40){
wudalibao=wudalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得武器大礼包一个"<<endl;
}
if(num>39&&num<50){
tixiaolibao=tixiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得体力小礼包一个"<<endl;
}if(num>49&&num<60){
tidalibao=tidalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得体力大礼包一个"<<endl;
}
if(num>59&&num<70){
jingxiaolibao=jingxiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得金币小礼包一个"<<endl;
}
if(num>69&&num<=80){
jingdalibao=jingdalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得金币大礼包一个"<<endl;
}
}
if(jingyan>shengjixian){
cout<<"恭喜升级!"<<endl;
dengji=dengji+1;
jingyan=jingyan-shengjixian;
shengjixian=shengjixian+20;
srand((unsigned int)time(NULL));
num=rand()%80+1;
if(num>0&&num<10){
xuexiaolibao=xuexiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得血量小礼包一个"<<endl;
}
if(num>9&&num<20){
xuedalibao=xuedalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得血量大礼包一个"<<endl;
}
if(num>19&&num<30){
wuxiaolibao=wuxiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得武器小礼包一个"<<endl;
}
if(num>29&&num<40){
wudalibao=wudalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得武器大礼包一个"<<endl;
}
if(num>39&&num<50){
tixiaolibao=tixiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得体力小礼包一个"<<endl;
}if(num>49&&num<60){
tidalibao=tidalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得体力大礼包一个"<<endl;
}
if(num>59&&num<70){
jingxiaolibao=jingxiaolibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得金币小礼包一个"<<endl;
}
if(num>69&&num<=80){
jingdalibao=jingdalibao+1;
cout<<"升级奖励随机生成中..."<<endl;
Sleep(1000);
cout<<"恭喜获得金币大礼包一个"<<endl;
}
}
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
}
}
if(a==13){
while(1){
system("cls");
cout<<"[按a向左][按d向右][我=+][按e进入此屋]"<<endl;
cout<<"/ ̄ ̄\\/ ̄ ̄\\/ ̄ ̄\\/ ̄ ̄\\"<<endl;
cout<<"|药店||超市||工具||宠物|"<<endl;
cout<<"| || || 铺 ||商城|"<<endl;
cout<<"|^ __||^ __||^ __||^ __|"<<endl;
cout<<"| | | | | | | | "<<endl;
for(p=1;p<=nn;p++)
cout<<" ";
cout<<"+";
if(kbhit()) {
in=getch();
if(in=='a')
nn=nn-6;
if(in=='d')
nn=nn+6;
if(in=='e'){
if(nn==1||nn==7||nn==13||nn==19)
break;
else{
cout<<"这里不是入口";
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
}
}
if(nn==1){
system("cls");
cout<<"欢迎来到药店!"<<endl;
cout<<"1,补充血量包1 补充10滴血 200元"<<endl;
cout<<"2,补充血量包2 补充50滴血 600元"<<endl;
cout<<"3,补充血量包3 补充100滴血 900元"<<endl;
cout<<"4,离开药店"<<endl;
while(1){
cin>>c;
if(c==4){
system("cls");
break;
}
if(c==1){
if(jingbi>=200){
jingbi=jingbi-200;
xueliang=xueliang+10;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(c==2){
if(jingbi>=600){
jingbi=jingbi-600;
xueliang=xueliang+50;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(c==3){
if(jingbi>=900){
jingbi=jingbi-900;
xueliang=xueliang+100;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
}
}
if(nn==7){
system("cls");
cout<<"欢迎来到超市!"<<endl;
cout<<"1,饼干 补充20点体力 200元"<<endl;
cout<<"2,果汁 补充50点体力 500元"<<endl;
cout<<"3,米饭 补充100点体力 900元"<<endl;
cout<<"4,离开超市"<<endl;
while(1){
cin>>d;
if(d==4){
system("cls");
break;
}
if(d==1){
if(jingbi>=80){
jingbi=jingbi-80;
tili=tili+20;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(d==2){
if(jingbi>=110){
jingbi=jingbi-110;
tili=tili+50;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(d==3){
if(jingbi>=160){
jingbi=jingbi-160;
tili=tili+100;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
}
}
if(nn==13){
system("cls");
cout<<"欢迎来到武器铺!"<<endl;
cout<<"1,塑料餐具 增加5点攻击力 20元"<<endl;
cout<<"2,木质餐具 增加20点攻击力 80元"<<endl;
cout<<"3,铁制餐具 增加50点攻击力 300元"<<endl;
cout<<"4,水果刀 增加100点攻击力 500元"<<endl;
cout<<"5,菜刀 增加500点攻击力 2000元"<<endl;
cout<<"6,氧气罐 防水 2500元"<<endl;
cout<<"7,铲子 挖泥土 3000元"<<endl;
cout<<"8,离开工具铺"<<endl;
while(1){
cin>>e;
if(e==8){
system("cls");
break;
}
if(e==1){
if(jingbi>=20){
jingbi=jingbi-20;
suliao=suliao+1;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(e==2){
if(jingbi>=80){
jingbi=jingbi-800;
muzhi=muzhi+1;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(e==3){
if(jingbi>=300){
jingbi=jingbi-300;
tiezhi=tiezhi+1;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(e==4){
if(jingbi>=500){
jingbi=jingbi-500;
shuiguo=shuiguo+1;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(e==5){
if(jingbi>=2000){
jingbi=jingbi-2000;
cai=cai+1;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(e==6){
if(jingbi>=2500){
jingbi=jingbi-2500;
fangshui=1;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
if(e==7){
if(jingbi>=3000){
jingbi=jingbi-3000;
chanzi=1;
cout<<"购买成功"<<endl;
xiaofei=xiaofei+1;
}
else{
cout<<"金币不足!"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
}
}
if(nn==19){
system("cls");
cout<<"欢迎来到宠物商城,每只宠物仅能租购买一只"<<endl;
cout<<"1,猫猫 1000金币 使用次数50次"<<endl;
cout<<"技能:每次被攻击后恢复5点血量"<<endl;
cout<<"2,狗狗 1500金币 使用次数50次"<<endl;
cout<<"技能:每次被攻击后恢复10点血量"<<endl;
cout<<"3,牛牛 3500金币 使用次数50次"<<endl;
cout<<"技能:每次额外攻击大怪或小怪10点血量"<<endl;
cout<<"4,羊羊 4000金币 使用次数50次"<<endl;
cout<<"技能:使大怪或小怪对你的攻击减半"<<endl;
cout<<"5,马马 5000金币 使用次数50次"<<endl;
cout<<"技能:使大怪或小怪的血量瞬间减半"<<endl;
cout<<"6,离开宠物商城"<<endl;
cin>>i;
if(i==6)
system("cls");
if(i==1){
if(jingbi>=800&&mao==0){
cout<<"购买成功"<<endl;
jingbi=jingbi-800;
xiaofei=xiaofei+1;
mao=1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
if(jingbi<800)
cout<<"金币不足"<<endl;
if(mao==1)
cout<<"你已经有一只猫猫啦"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(i==2){
if(jingbi>=1500&&gou==0){
cout<<"购买成功"<<endl;
jingbi=jingbi-1500;
xiaofei=xiaofei+1;
gou=1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
if(jingbi<1500)
cout<<"金币不足"<<endl;
if(gou==1)
cout<<"你已经有一只狗狗啦"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(i==3){
if(jingbi>=3500&&niu==0){
cout<<"购买成功"<<endl;
jingbi=jingbi-3500;
xiaofei=xiaofei+1;
niu=1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
if(jingbi<3500)
cout<<"金币不足"<<endl;
if(niu==1)
cout<<"你已经有一头牛牛啦"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(i==4){
if(jingbi>=4000&&yang==0){
cout<<"购买成功"<<endl;
jingbi=jingbi-4000;
xiaofei=xiaofei+1;
yang=1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
if(jingbi<4000)
cout<<"金币不足"<<endl;
if(yang==1)
cout<<"你已经有一只羊羊啦"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(i==5){
if(jingbi>=5000&&ma==0){
cout<<"购买成功"<<endl;
jingbi=jingbi-5000;
xiaofei=xiaofei+1;
ma=1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
if(ma==1)
cout<<"你已经有一匹马马啦"<<endl;
if(jingbi<5000)
cout<<"金币不足"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
}
}
if(a==19){
system("cls");
cout<<"温馨提示:投资有风险,入市需谨慎!"<<endl;
cout<<"1,垃圾艺术馆50金币 (投资成功可获得150金币)"<<endl;
cout<<"2,旺仔牛13糖100金币 (投资成功可获得300金币)"<<endl;
cout<<"3,过期菜市场200金币 (投资成功可获得500金币)"<<endl;
cout<<"4,伪造珠宝店500金币 (投资成功可获得1000金币)"<<endl;
cout<<"5,抛锚飞机场1000金币 (投资成功可获得2000金币)"<<endl;
cout<<"6,回到主界面"<<endl;
cin>>h;
if(h==1){
if(jingbi<50){
cout<<"金币不足"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
touzi=touzi+1;
jingbi=jingbi-50;
srand((unsigned int)time(NULL));
num=rand()%5+1;
if(num<=2){
srand((unsigned int)time(NULL));
num=rand()%50+1;
cout<<"投资失败!"<<endl;
cout<<"你损失了"<<num<<"金币"<<endl;
jingbi=jingbi-num;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"投资成功!"<<endl;
cout<<"恭喜获得150金币"<<endl;
jingbi=jingbi+150;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
}
if(h==6)
system("cls");
if(h==2){
if(jingbi<100){
cout<<"金币不足"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
touzi=touzi+1;
jingbi=jingbi-100;
srand((unsigned int)time(NULL));
num=rand()%5+1;
if(num<=2){
srand((unsigned int)time(NULL));
num=rand()%100+1;
cout<<"投资失败!"<<endl;
cout<<"你损失了"<<num<<"金币"<<endl;
jingbi=jingbi-num;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"投资成功!"<<endl;
cout<<"恭喜获得300金币"<<endl;
jingbi=jingbi+300;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
}
if(h==3){
if(jingbi<200){
cout<<"金币不足"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
touzi=touzi+1;
jingbi=jingbi-200;
srand((unsigned int)time(NULL));
num=rand()%5+1;
if(num<=2){
srand((unsigned int)time(NULL));
num=rand()%200+1;
cout<<"投资失败!"<<endl;
cout<<"你损失了"<<num<<"金币"<<endl;
jingbi=jingbi-num;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"投资成功!"<<endl;
cout<<"恭喜获得500金币"<<endl;
jingbi=jingbi+500;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
}
if(h==4){
if(jingbi<500){
cout<<"金币不足"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
touzi=touzi+1;
jingbi=jingbi-500;
srand((unsigned int)time(NULL));
num=rand()%5+1;
if(num<=2){
srand((unsigned int)time(NULL));
num=rand()%500+1;
cout<<"投资失败!"<<endl;
cout<<"你损失了"<<num<<"金币"<<endl;
jingbi=jingbi-num;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"投资成功!"<<endl;
cout<<"恭喜获得500金币"<<endl;
jingbi=jingbi+500;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
}
if(h==5){
if(jingbi<1000){
cout<<"金币不足"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
touzi=touzi+1;
jingbi=jingbi-1000;
srand((unsigned int)time(NULL));
num=rand()%5+1;
if(num<=3){
srand((unsigned int)time(NULL));
num=rand()%1000+1;
cout<<"投资失败!"<<endl;
cout<<"你损失了"<<num<<"金币"<<endl;
jingbi=jingbi-num;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"投资成功!"<<endl;
cout<<"恭喜获得2000金币"<<endl;
jingbi=jingbi+2000;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
}
}
if(a==25){
while(1){
Sleep(100);
system("cls");
for(p=0;p<ee;p++)
cout<<" ";
cout<<"+"<<endl;
for(p=1;p<26;p++){
if(cc[p]==1){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),6);
cout<<"■";
}
if(cc[p]==2){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),9);
cout<<"■";
}
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7);
if(kbhit()) {
input=getch();
if(input=='a')
ee=ee-1;
if(input=='d')
ee=ee+1;
if(input=='f'){
system("cls");
break;
}
if(input=='s'){
if(chanzi==0){
cout<<"没铲子还想挖?快去买铲子!";
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
srand((unsigned int)time(NULL));
num=rand()%20+1;
if(num==18||num==16||num==9||num==4){
cout<<"恭喜获得石头1块"<<endl;
shai=shai+1;
cout<<"按任意键继续"<<endl;
getch();
}
if(num==2||num==3||num==5||num==6||num==7){
cout<<"恭喜获得骰子1枚"<<endl;
shai=shai+1;
cout<<"按任意键继续"<<endl;
getch();
}
if(num==11||num==8){
cout<<"恭喜挖到一颗红宝石"<<endl;
hong=hong+1;
cout<<"按任意键继续"<<endl;
getch();
}
if(num==12||num==14){
cout<<"你挖到地心了"<<endl;
cout<<"然后你被烫死了"<<endl;
return 0;
}
if(num==13||num==19){
cout<<"你挖到一台坏掉的吸尘器"<<endl;
cout<<"然后它吸光了你所有金币"<<endl;
jingbi=0;
cout<<"按任意键继续"<<endl;
getch();
}
if(num==17||num==15||num==10){
cout<<"恭喜挖到一颗绿宝石"<<endl;
lu=lu+1;
cout<<"按任意键继续"<<endl;
getch();
}
}
if(num!=2&&num!=3&&num!=4&&num!=5&&num!=6&&num!=7&&num!=8&&num!=9&&num!=10&&num!=11&&num!=12&&num!=14&&num!=15&&num!=16&&num!=17&&num!=18){
cout<<"这下面没有任何东西"<<endl;
cout<<"按任意键继续"<<endl;
getch();
}
}
if(cc[ee]==2){
if(fangshui==0){
cout<<"你被淹死了";
return 0;
}
}
if(bb[ee]==4){
srand((unsigned int)time(NULL));
num=rand()%2+1;
if(num==1){
cout<<"草丛里有一匹狼,咬掉了你的20滴血"<<endl;
xueliang=xueliang-20;
if(xueliang<=0){
cout<<"你被狼咬死了";
return 0;
}
cout<<"按任意键继续"<<endl;
getch();
}
else {
if(jingbi>5) {
cout<<"草丛里有一个小偷,偷走了你";
srand((unsigned int)time(NULL));
num=rand()%jingbi+1;
cout<<num;
cout<<"枚金币"<<endl;
jingbi=jingbi-num;
cout<<"按任意键继续"<<endl;
getch();
}
else{
cout<<"草丛里有一个小偷,它见你太穷,便走开了"<<endl;
cout<<"按任意键继续"<<endl;
getch();
}
}
}
if(bb[ee]==5){
srand((unsigned int)time(NULL));
num=rand()%100+1;
cout<<"恭喜获得"<<num<<"枚金币"<<endl;
jingbi=jingbi+num;
cout<<"按任意键继续"<<endl;
getch();
}
if(bb[ee]==3){
cout<<"恭喜拾获一块木头 "<<endl;
mu=mu+1;
cout<<"按任意键继续"<<endl;
getch();
}
}
}
}
if(a==31){
system("cls");
while(1){
cout<<"欢迎来到交易铺"<<endl;
cout<<"1,红宝石=5000金币"<<endl;
cout<<"2,绿宝石=1000金币"<<endl;
cout<<"3,木头=10金币"<<endl;
cout<<"4,石头=50金币"<<endl;
cout<<"5,离开交易铺"<<endl;
cin>>w;
if(w==1){
if(hong>0){
cout<<"交易成功"<<endl;
cout<<"恭喜获得金币5000枚"<<endl;
hong=hong-1;
jingbi=jingbi+5000;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无红宝石"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(w==2){
if(lu>0){
cout<<"交易成功"<<endl;
cout<<"恭喜获得金币1000枚"<<endl;
lu=lu-1;
jingbi=jingbi+1000;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无绿宝石"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(w==3){
if(mu>0){
cout<<"交易成功"<<endl;
cout<<"恭喜获得金币10枚"<<endl;
mu=mu-1;
jingbi=jingbi+10;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无木头"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(w==4){
if(shi>0){
cout<<"交易成功"<<endl;
cout<<"恭喜获得金币50枚"<<endl;
shi=shi-1;
jingbi=jingbi+50;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"你暂无红宝石"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
if(w==5){
system("cls");
break;
}
}
}
if(a==37){
system("cls");
if(xuyuan>=3){
cout<<"今日许愿次数已达上限"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
else{
cout<<"欢迎来到许愿池,一天只可许愿三次"<<endl;
cout<<"1,金币"<<endl;
cout<<"2,体力"<<endl;
cout<<"3,血量"<<endl;
cin>>f;
if(f==1&&xuyuan<4){
cout<<"恭喜获得金币50枚"<<endl;
jingbi=jingbi+50;
xuyuan++;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(f==2&&xuyuan<4){
cout<<"恭喜获得体力50点"<<endl;
tili=tili+50;
xuyuan++;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(f==3&&xuyuan<4){
cout<<"恭喜获得血量50点"<<endl;
xueliang=xueliang+50;
xuyuan++;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
}
if(a==43){
system("cls");
cout<<"1,消灭50个小怪 奖金800金币"<<endl;
cout<<"已消灭"<<xiaosi<<"个小怪"<<endl;
if(xiaosi>=50){
if(r1==0){
cout<<"已完成 恭喜获得金币800枚"<<endl;
jingbi=jingbi+800;
r1=1;
}
else
cout<<"已完成"<<endl;
}
else
cout<<"未完成"<<endl;
cout<<"2,消灭50个大怪 奖金1500金币"<<endl;
cout<<"已消灭"<<dasi<<"个小怪"<<endl;
if(dasi>=50){
if(r2==0){
cout<<"已完成 恭喜获得金币1500枚"<<endl;
jingbi=jingbi+1500;
r2=0;
}
else
cout<<"已完成"<<endl;
}
else
cout<<"未完成"<<endl;
cout<<"3,购物20次 奖金1000金币"<<endl;
cout<<"已购物"<<xiaofei<<"次"<<endl;
if(xiaofei>=20){
if(r3==0){
cout<<"已完成 恭喜获得金币1000枚"<<endl;
jingbi=jingbi+1000;
r3=1;
}
else
cout<<"已完成"<<endl;
}
else
cout<<"未完成"<<endl;
cout<<"4,投资5次 奖金500金币"<<endl;
cout<<"已投资"<<touzi<<"次"<<endl;
if(touzi>=5){
if(r4==0){
cout<<"已完成 恭喜获得金币500枚"<<endl;
jingbi=jingbi+800;
r4=1;
}
else
cout<<"已完成"<<endl;
}
else
cout<<"未完成"<<endl;
cout<<"5,消灭100个小怪 奖金1600金币"<<endl;
cout<<"已消灭"<<xiaosi<<"个小怪"<<endl;
if(xiaosi>=100){
if(r5==0){
cout<<"已完成 恭喜获得金币1600枚"<<endl;
jingbi=jingbi+1600;
r5=1;
}
else
cout<<"已完成"<<endl;
}
else
cout<<"未完成"<<endl;
cout<<"6,消灭100个大怪 奖金3000金币"<<endl;
cout<<"已消灭"<<dasi<<"个大怪"<<endl;
if(dasi>=100){
if(r6==0){
cout<<"已完成 恭喜获得金币3000枚"<<endl;
jingbi=jingbi+3000;
r6=1;
}
else
cout<<"已完成"<<endl;
}
else{
cout<<"未完成"<<endl;
cout<<"按任意键返回主界面"<<endl;
getch();
system("cls");
}
cout<<"7,掷骰子5次 奖金1000金币"<<endl;
cout<<"已掷骰子"<<shaici<<"次"<<endl;
if(shaici>=5){
if(r7==0){
cout<<"已完成 恭喜获得金币1000枚"<<endl;
jingbi=jingbi+1000;
r7=1;
}
else
cout<<"已完成"<<endl;
}
else
cout<<"未完成"<<endl;
cout<<"按任意键返回主界面"<<endl;
getch();
system("cls");
}
if(a==49){
while(1){
cout<<"你有"<<shai<<"枚骰子"<<endl;
cout<<"1,摇骰子"<<endl;
cout<<"2,返回"<<endl;
cin>>l;
if(l==1){
if(shai>0){
shai=shai-1;
shaici=shaici+1;
srand((unsigned int)time(NULL));
num=rand()%6+1;
cout<<"你的结果是:";
Sleep(50);
cout<<num<<endl;
cout<<"___________________________________________"<<endl;
cout<<"| 体力 |绿宝石| 金币 | | 血量 | 骰子 |"<<endl;
cout<<"|100点 | 1块 | 100枚| 无 | 50点 | 2枚 |"<<endl;
cout<<"|______|______|______|______|______|______|"<<endl;
for(int ii=1;ii<=num;ii++){
cout<<" "<<ii<<" ";
}
if(num==1){
cout<<"恭喜获得体力100点"<<endl;
tili=tili+100;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(num==2){
cout<<"恭喜获得绿宝石1块"<<endl;
lu=lu+1;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(num==3){
cout<<"恭喜获得金币100枚"<<endl;
jingbi=jingbi+100;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(num==4){
cout<<"很可惜没有获得任何物品"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(num==5){
cout<<"恭喜获得血量50点"<<endl;
xueliang=xueliang+100;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
if(num==6){
cout<<"恭喜获得骰子2枚"<<endl;
shai=shai+2;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
}
}
else {
cout<<"你目前还没有骰子"<<endl;
cout<<"按任意键继续"<<endl;
getch();
system("cls");
break;
}
}
else{
system("cls");
break;
}
}
}
}
return 0;
}
以上就是代码,可能有点BUG。文章来源地址https://www.toymoban.com/news/detail-632390.html
到了这里,关于Dev-c++的小游戏代码(可直接复制)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!