0
已解决
高乐彤
修练者
修练者
#include<windows.h>
#include<bits/stdc++.h>
#include <sys/stat.h>
#include <fstream>
#include <unistd.h>
#include <string>
#include <cstdlib>
#include <ctime>
#include <fstream>
int HP=25,FOOL=30,N=15,cg=0,m,fs,e;
using namespace std;
put(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(100);
}
}
void qk(int x){
if(x==2||x==3){
int k=rand()%100+1;
if(k<=55){
int r=rand()%50+1;
if(r<=10){
int l=rand()%3+1;
cout<<"你遇到了"<<l<<"只僵尸!";
cout<<"生命-"<<l;
cout<<"。同时你花费了"<<l<<"点"<<"饱食度来打僵尸"<<endl;
}if(r>=11&&r<=15){
cout<<"你挖到了地雷!";
cout<<"你你扣掉了85%的血!\n";
HP=(double)(HP*1.00/100.0*15);
}if(r>=16&&r<=30){
cout<<"你什么也没挖到\n";
}if(r>=31&&r<=39){
cout<<"你被头顶的砂砾埋了,生命-30%\n";
HP=(double)(HP*1.00/100.0*70);
}if(r>=40){
int l=rand()%5;
cout<<"你挖空了!摔掉了"<<l<<"点血\n";
HP-=l;
cg-=l;
}
}else{
int r=rand()%10+1;
if(r==1){
int k=rand()%250+100;
cout<<"你挖到了钻石!卖得"<<k<<"元\n";
m+=k;
}if(r>=2&&r<=7){
int k=rand()%100+30;
cout<<"你挖到了铁,卖得"<<k<<"元\n";
m+=k;
}if(r>=8){
int k=rand()%150+80;
cout<<"你挖到了金!卖得"<<k<<"元\n";
m+=k;
}
}
}if(x==1){
cg--;
int k=rand()%100+1;
if(k<=40){
int r=rand()%15+1;
if(r==1||r==3){
int k=rand()%250+100;
cout<<"你挖到了钻石!卖得"<<k<<"元\n";
m+=k;
}if(r>=4&&r<=11||r==2){
int k=rand()%100+30;
cout<<"你挖到了铁,卖得"<<k<<"元\n";
m+=k;
}if(r>=12&&r<=15){
int k=rand()%150+80;
cout<<"你挖到了金!卖得"<<k<<"元\n";
m+=k;
}
}else{
int r=rand()%50+1;
if(r<=10){
int l=rand()%3+1;
cout<<"你遇到了"<<l<<"只僵尸!";
cout<<"生命-"<<l;
cout<<"。同时你花费了"<<l<<"点"<<"饱食度来打僵尸"<<endl;
FOOL-=l;
HP-=l;
}if(r>=11&&r<=30){
cout<<"你什么也没挖到\n";
}if(r>=31&&r<=40){
int l=rand()%5;
cout<<"你挖空了!摔掉了"<<l<<"点血\n";
HP-=l;
cg-=l;
}if(r>=41&&r<=47){
int l=rand()%8+2;
cout<<"你掉入了地下河!氧气含量-"<<l<<endl;
N-=l;
}if(r>=49){
cout<<"你掉入了岩浆!";
HP=0;
}
}
}
return ;
}
int main(){
srand(time(0));
cout<<"生命:25 饱食度:30 氧气含量:15 海拔:0 钱数:0\n";
while(HP>0&&FOOL>0&&N>0){
cout<<"你要:1向下挖 2向左挖 3向右挖 0退出\n";
int a;
cin>>a;
if(a<=3)qk(a);
if(a==0)return 0;
Sleep(1000);
system("cls");
cout<<"生命:"<<HP<<" 饱食度:"<<FOOL<<" 氧气含量:"<<N<<" 海拔:"<<cg<<" 钱数:"<<m<<endl;
}
system("cls");
cout<<"你over了!";
Sleep(1000);
cout<<"正在计算分数";
for(int i=1;i<=3;i++){
Sleep(250);
cout<<". ";
}
system("cls");
m=m/2*2;
while(m){
printf("钱数:%d 分数:%d\n",m,fs);
m-=2;
int k=rand()%5;
fs+=98+k;
system("cls");
}
system("cls");
put("你最终的成绩为:");
cout<<fs;
return 0;
}
更新内容:变化概率使游戏更真实 结算分数时效率翻倍,且计算误差不超过51分 修复已知问题等更新
0
0
0
0
0
0
0
0