小游戏(欢迎修改!)
2024-06-16 15:03:11
发布于:北京
#include <bits/stdc++.h>
#include<windows.h>
using namespace std;
#define do 523
#define re 578
#define mi 659
#define fa 698
#define so 784
#define la 880
#define si 988
#define do1 1046
int bag1[11];
int zb[6];
int main(){
Beep(do,50);
for(int i=10;i<40;i+=10){
Beep(do,50+i);
}
int n=1,dn=1,g=3,life=10,r=0,F=0,gs=1;
while(n){
r++;
if(dn>=1&&dn<=12){
cout<<"现在是白天"<<dn<<"/24\n";
}else{
cout<<"现在是晚上"<<dn<<"/24\n";
}
cout<<"生命:"<<life<<endl;
cout<<"攻击:"<<g<<endl;
cout<<"防御:"<<F<<endl;
cout<<"背包{";
for(int i=1;i<=11;i++){
if(i==1&&bag1[i]!=0){
cout<<i<<"[面包*"<<bag1[i]<<"]";
}else if(i==2&&bag1[i]!=0){
cout<<i<<"[骨头*"<<bag1[i]<<"]";
}else if(i==3&&bag1[i]!=0){
cout<<i<<"[铁胸甲*"<<bag1[i]<<"]";
}else if(i==4&&bag1[i]!=0){
cout<<i<<"[铁剑*"<<bag1[i]<<"]";
}else if(i==5&&bag1[i]!=0){
cout<<i<<"[猎尸人的骨哨*"<<bag1[i]<<"]";
}else if(i==6&&bag1[i]!=0){
cout<<i<<"[黄金*"<<bag1[i]<<"]";
}else if(i==7&&bag1[i]!=0){
cout<<i<<"[空瓶*"<<bag1[i]<<"]";
}else if(i==8&&bag1[i]!=0){
cout<<i<<"[狂暴花*"<<bag1[i]<<"]";
}else if(i==9&&bag1[i]!=0){
cout<<i<<"[腐肉*"<<bag1[i]<<"]";
}else if(i==9&&bag1[i]!=0){
cout<<i<<"[苍白指骨*"<<bag1[i]<<"]";
}
}
cout<<"}\n装备{";
for(int i=1;i<=5;i++){
cout<<"[";
if(zb[i]==0){
cout<<"=";
}else if(zb[i]==2){
cout<<"骨头";
}else if(zb[i]==3){
cout<<"铁胸甲";
}else if(zb[i]==4){
cout<<"铁剑";
}else if(zb[i]==5){
cout<<"猎尸人的骨哨";
}
cout<<"]";
}
cout<<"}\n";
cout<<"1.向左走\n";
cout<<"2.向右走\n";
cout<<"3.向前走\n";
cout<<"4.向后走\n";
cout<<"5.换装备\n";
cout<<"6.使用..\n";
cout<<"7.图鉴\n";
int u;
cin>>u;
if(u==5){
int v,V;
cout<<"返回请输0\n";
cout<<"背包物品序号:";
cin>>v;
cout<<"装备物品序号:";
cin>>V;
if(v==0&&V==0){
continue;
}
if(v==2&&bag1[v]!=0){
cout<<"你装备了骨头\n";
bag1[v]--;
bag1[zb[V]]++;
zb[V]=2;
cout<<zb[V]<<endl;
}else if(v==3&&bag1[v]!=0){
cout<<"你装备了铁胸甲,防御+4\n";
bag1[v]--;
F+=4;
bag1[zb[V]]++;
zb[V]=3;
cout<<zb[V]<<endl;
}else if(v==4&&bag1[v]!=0){
cout<<"你装备了铁剑,攻击+4\n";
bag1[v]--;
g+=4;
bag1[zb[V]]++;
zb[V]=4;
cout<<zb[V]<<endl;
}else if(v==5&&bag1[v]!=0){
cout<<"你装备了猎尸人的骨哨\n";
bag1[v]--;
bag1[zb[V]]++;
zb[V]=5;
cout<<zb[V]<<endl;
}else if(v==10&&bag1[v]!=0){
cout<<"你装备了苍白指骨\n";
bag1[v]--;
life+=10;
F+=5;
bag1[zb[V]]++;
zb[V]=10;
cout<<zb[V]<<endl;
}
}else if(u==6){
cout<<"返回请输0\n";
int k;
cin>>k;
if(k==0){
continue;
}
if(k==1){
cout<<"生命+5";
life+=5;
bag1[k]--;
}else if(k==9){
cout<<"攻击+3,生命-3";
life-=3;
g+=3;
bag1[k]--;
}else if(k==8){
cout<<"生命+5,攻击+5";
life+=5;
g+=5;
bag1[k]--;
}
}else if(u==7){
cout<<"0.返回\n";
cout<<"1.面包,可以回复一些生命\n";
cout<<"2.骨头,不知道什么动物身上的骨头\n";
cout<<"3.铁胸甲,破旧的铠甲,增加防御\n";
cout<<"4.铁剑,破旧的铁剑,增加攻击\n";
cout<<"5.猎尸人的骨哨,?!(好好留着它吧)\n";
cout<<"6.黄金,世界通用货币\n";
cout<<"7.空瓶,空空如也\n";
cout<<"8.狂暴花,令人狂暴的花,增加攻击\n";
cout<<"9.腐肉,有毒的肉,增加攻击,减少生命\n";
cout<<"10.苍白指骨,不知道什么人的指骨\n";
int uio;
cin>>uio;
if(uio==0){
continue;
}
}
if(dn<=12){
if(u>=1&&u<=4){
srand(dn+r+time(NULL));
int s=rand()%10+1;
if(s>=0&&s<=3){
cout<<"什么都没有\n";
}else if(s==4){
cout<<"捡到了一把铁剑\n";
bag1[4]++;
}else if(s>=5&&s<=6&&gs==1){
cout<<"什么都没有\n";
}else if(s>=5&&s<=6&&gs==0){
srand(dn+r+time(NULL)+s);
int yui=rand()%10+1;
cout<<"遇到了"<<yui<<"只僵尸\n";
int deei=1;
int gh=yui*5;
int lifes=yui*8;
while(deei){
cout<<"你要:\n"<<"1.攻击\n"<<"2.逃跑\n";
int ui;
cin>>ui;
if(ui==1){
lifes-=g;
cout<<"僵尸还有"<<lifes<<"点生命\n";
if(lifes<=0){
cout<<"你杀了"<<yui+1<<"只僵尸\n";
cout<<"你获得了"<<(yui+1)/3<<"块腐肉,"<<yui-1<<"块黄金";
if(rand()%9==0){
cout<<",1根苍白指骨\n";
bag1[10]+=1;
}else{
cout<<"\n";
}
bag1[9]+=(yui+1)/3;
bag1[6]+=yui-1;
deei=0;
break;
}
}else if(ui==2){
if(rand()%3==0){
cout<<"逃跑成功!\n";
deei=0;
}else{
cout<<"逃跑失败!\n你死了!";
deei=0;
n=0;
}
}
if(deei==1){
int su=gh-F;
if(su<0){
su=0;
}
life-=su;
cout<<"僵尸对你发起了攻击,你还剩"<<life<<"点生命\n";
}
if(life<=0){
deei=0;
n=0;
}
}
}else if(s==7){
cout<<"捡到了一块黄金\n";
bag1[6]++;
}else if(s==8){
cout<<"捡到了一根骨头\n";
bag1[2]++;
}else if(s==8&&rand()%2==0){
cout<<"捡到了一个空瓶\n";
bag1[7]++;
}else if(s>=9&&s<=10){
cout<<"捡到了一块面包\n";
bag1[1]++;
}
}
}else{
if(u>=1&&u<=4){
srand(dn+r+time(NULL));
int s=rand()%10+1;
if((s>=0&&s<=2)||(s>=4&&s<=6)){
cout<<"你遇到了"<<s+1<<"只骷髅\n";
int g2=(s*2)+2;
int life2=(s*3)+3;
int die=1;
while(die){
cout<<"你要:\n1.攻击\n2.逃跑";
int j;
cin>>j;
if(j==1){
life2-=g;
cout<<"骷髅还有"<<life2<<"点生命\n";
if(life2<=0){
cout<<"你杀了"<<s+1<<"只骷髅\n";
cout<<"你获得了"<<(s+1)/2<<"块面包,"<<(s-1)/2<<"块黄金\n";
int an=rand()%30+1;
if(an==dn&&gs==1){
cout<<",猎尸人的骨哨\n";
gs=0;
bag1[5]=1;
}else{
cout<<"\n";
}
bag1[1]+=(s+1)/2;
bag1[6]+=(s-1)/2;
die=0;
}
}else if(j==2){
srand(dn+r+time(NULL));
int y=0;
for(int i=1;i<=3;i++){
if(zb[i]==2){
y=1;
}
}
if(y==1){
if(rand()%2==0||rand()%3==0||rand()%5==0){
cout<<"成功逃跑!\n";
die=0;
}else{
cout<<"逃跑失败!\n你死了!";
die=0;
n=0;
}
}else{
if(rand()%2==0){
cout<<"成功逃跑!\n";
die=0;
}else{
cout<<"逃跑失败!\n你死了!";
die=0;
n=0;
}
}
}
if(die==1){
int su=g2-F;
if(su<0){
su=0;
}
life-=su;
cout<<"骷髅对你发起了攻击,你还剩"<<life<<"点生命\n";
}
if(life<=0){
die=0;
n=0;
}
}
}else if(s==3){
cout<<"捡到了一把铁剑\n";
bag1[4]++;
}else if(s==3&&rand()%3==0){
cout<<"捡到了一束狂暴花\n";
bag1[8]++;
}else if(s>=7&&s<=8){
cout<<"捡到了一根骨头\n";
bag1[2]++;
}else if(s==9){
cout<<"捡到了一件铁胸甲\n";
bag1[3]++;
}
}
}
dn++;
if(dn>24){
dn=dn-24;
}
Sleep(1000);
system("cls");
}
return 0;
}
全部评论 1
有bug
2024-06-16 来自 北京
0啥bug
2024-06-16 来自 广东
0
有帮助,赞一个