#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int sum=0,xl=100;
int p=0,sd=900;
int st[123]={900,800,700,580,430,310,170,90,5};
double bs=1;
void wk(int t){
if(t<=5){
cout<<"你挖到了岩浆,烫**了!";
xl=0;
}else if(t<=10){
cout<<"恭喜你,挖到了钻石!";
sum+=500*bs;
}else if(t<=14){
cout<<"你遇到了怪物,因此而亡";
xl=0;
}else if(t<=23){
cout<<"你遇到了怪物,因此重伤";
xl-=60;
}else if(t<=40){
cout<<"你遇到了怪物,因此**";
xl-=20;
}else if(t<=60){
cout<<"你挖到了金矿石!";
sum+=200*bs;
}else if(t<=90){
cout<<"你挖到了铁矿石!";
sum+=100*bs;
}else if(t<=100){
cout<<"你挖到了:泥土";
sum+=bs;
}else if(t<150){
cout<<"你挖到了:岩石";
sum+=bs;
}else if(t<155){
cout<<"你挖到了青金石!";
sum+=80*bs;
}else if(t<158){
cout<<"你挖空了,摔了一跤!";
xl-=5;
}else if(t<160){
cout<<"你失足了,摔亡了!";
xl=0;
}else if(t<170){
cout<<"你挖到了水,需要花一些时间弄干\n";
Sleep(2600);
if(t==169){
cout<<"你不小心呛**了!";
xl=0;
}else{
cout<<"衣服干了,继续前进";
}
}else if(t<=190){
cout<<"你挖到了:铜";
sum+=50*bs;
}else if(t<195){
cout<<"你有些累,回家了";
p=-1;
}else if(t<=200){
cout<<"你挖到了:泥土";
sum+=bs;
}else{
cout<<"你挖到了:空气";
}
}
short int kw[1000][600][1000];
int main(){
int bt=0,zxq=0,mxd=0,hj=0;
double bss[10]={1,1.5,2,3,5,6,9,15,22};
int jg[18]={0,30,150,700,2500,10000,40000,100000,300000};
cout<<" 欢迎来到矿工模拟器"
<<"\n\n\n"
<<" ________________ \n"
<<" | 矿工模拟器 | \n"
<<" ---------------- \n"
<<"\n\n\n\n\n"
<<" 按任意键+回车进入\n\n\n ";
string a;
int t=234234;
getline(cin,a);
system("cls");
int jin=0;
string b;
while(1){
system("cls");
cout<<"1.商城\n2.开始挖矿\n";
cout<<endl<<" ";
cin>>b;
if(b=="1"){
while(1){
system("cls");
cout<<"金币:"<<jin;
cout<<"\n\n";
cout<<"1.一级镐子:30金币 2.二级镐子:150金币 3.三级镐子:700金币 4.四级镐子:2500金币\n";
cout<<"\n";
cout<<"5.五级镐子:10000金币 6.六级镐子:40000金币 7.七级镐子:100000金币 8.八级镐子:300000金币\n" ;
cout<<"\n";
cout<<"9.绷带:600金币 10.注血器:1200金币 11.满血丹:2800金币 12.合金钻头:2000\n";
cout<<"\n";
//……
cout<<"\n需要买什么?(按0返回)\n ";
int o;
cin>>o;
if(o==0){
system("cls");
break;
}else if(o>0&&o<=8){
if(jg[o]<=jin){
jin-=jg[o];
sd=st[o];
bs=bss[o];
}else{
cout<<"金币不够!\n";
Sleep(1600);
system("cls");
continue;
}
}else if(o==9){
if(jin>=600){
bt++;
jin-=600;
}else{
cout<<"金币不够!\n";
Sleep(1600);
system("cls");
continue;
}
}else if(o==10){
if(jin>=1200){
zxq++;
jin-=1200;
}else{
cout<<"金币不够!\n";
Sleep(1600);
system("cls");
continue;
}
}else if(o==11){
if(jin>=2800){
mxd++;
jin-=2800;
}else{
cout<<"金币不够!\n";
Sleep(1600);
system("cls");
continue;
}
}else if(o==12){
if(jin>=2000){
hj++;
jin-=2000;
}else{
cout<<"金币不够!\n";
Sleep(1600);
system("cls");
continue;
}
}
Sleep(500);
system("cls");
}
}else if(b=="2"){
xl=100;
srand(static_cast<unsigned int>(time(NULL)));
system("cls");
cout<<"\n\n\n 加载中 ";
for(int i=1;i<=599;i++){
if(i%20==0){
cout<<"█";
}
for(int k=1;k<=599;k++){
for(int j=1;j<=499;j++){
kw[i][j][k]=rand()%200;
}
}
}
sum=0;
srand(static_cast<unsigned int>(time(NULL)));
int x=rand()%70;
srand(static_cast<unsigned int>(time(NULL)));
int y=rand()%25;
srand(static_cast<unsigned int>(time(NULL)));
int z=rand()%65;
while(xl>0){
if(xl<100){
xl+=1;
}
if(xl>100) xl=100;
if(xl<=0){
xl==0;
}
system("cls");
if(p){
wk(kw[x][y][z]);
kw[x][y][z]=999;
}
if(p==-1){
p=0;
cout<<"\n本次探险共获得"<<sum<<"金币";
jin+=sum;
Sleep(2000);
break;
}else if(xl==0){
p=0;
cout<<"\n本次探险共获得"<<sum<<"金币";
jin+=sum;
Sleep(2500);
break;
}
cout<<"\n位置: "
<<"\n 前后:"<<x
<<"\n 高度:"<<y
<<"\n 左右:"<<z<<"\n";
cout<<" 血量: "<<xl;
cout<<"\n 要往哪个方向挖?\n\n";
cout<<" 打开背包按0\n\n ";
getline(cin,a);
if(a=="左"||a=="a"){
z++;
p=1;
system("cls");
cout<<"挖掘中";
Sleep(sd);
system("cls");
}
else if(a=="右"||a=="d"){
z--;
p=1;
system("cls");
cout<<"挖掘中";
Sleep(sd);
system("cls");
}
else if(a=="前"||a=="w"){
x++;
p=1;
system("cls");
cout<<"挖掘中";
Sleep(sd);
system("cls");
}
else if(a=="后"||a=="s"){
x--;
p=1;
system("cls");
cout<<"挖掘中";
Sleep(sd);
system("cls");
}
else if(a=="上"||a==" "||a==" "||a==" "){
y++;
p=1;
system("cls");
cout<<"挖掘中";
Sleep(sd);
}
else if(a=="下"||a=="x"){
y--;
p=1;
system("cls");
cout<<"挖掘中";
Sleep(sd);
system("cls");
}else if(a=="返回"||a=="fanhui"){
cout<<"确定返回?\n";
cin>>a;
if(a=="shi"||a=="queding"){
jin+=sum;
break;
}
}else if(a=="0"){
system("cls");
cout<<"\n\n当前有"<<sum<<"金币\n\n";
cout<<"当前物品:";
if(bt){
cout<<"绷带:"<<bt<<"个 ";
}
if(zxq){
cout<<"注血器:"<<zxq<<"个 ";
}
if(mxd){
cout<<"满血丹:"<<mxd<<"个 ";
}
if(hj){
cout<<"合金钻头"<<hj<<"个 ";
}
cout<<"\n\n按n可退出\n ";
cin>>a;
if(a=="n"){
p=0;
continue;
}else if(a=="bt"){
if(bt){
bt--;
xl+=15;
Sleep(200);
}else{
cout<<"\n该道具不存在!";
Sleep(1000);
p=0;
continue;
}
}else if(a=="zxq"){
if(zxq){
zxq--;
xl+=40;
Sleep(200);
}else{
cout<<"\n该道具不存在!";
Sleep(1000);
p=0;
continue;
}
}else if(a=="mxd"){
if(mxd){
mxd--;
xl=100;
Sleep(200);
}else{
cout<<"\n该道具不存在!";
Sleep(1000);
p=0;
continue;
}
}else if(a=="hjzt"){
cout<<"正在蓄力…\n";
Sleep(1000);
cout<<"轰!!!!!";
Sleep(1000);
cout<<"\n";
for(int i=1;i<=10;i++){
y--;
wk(kw[x][y][z]);
cout<<"\n";
}
cout<<"按任意键返回\n";
string ZS;
cin>>ZS;
continue;
}
}else if(a=="fanhui"){
cout<<"确定返回?\n";
cin>>a;
if(a=="shi"||a=="queding"){
jin+=sum;
break;
}
}else if(a!=""){
cout<<"\n请输入正确的字符串";
p=0;
Sleep(1000);
}
srand(static_cast<unsigned int>(time(NULL)));
t=rand()%200;
}
}else if(b=="/kgzb"){
jin=100000000;
}
}
return 0;
}
//放到dev-c++运行
