#include<bits/stdc++.h>
#include<Windows.h>
#include<conio.h>
#include<limits>
using namespace std;
int sum=0,xl=100,jin=0;
int p=0,sd=900;
int st[123]={900,800,700,580,430,310,170,90,5};
double bs=1;
char fb(){
return _getch();
}
int czi(char a){
return a-'0';
}
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<<"你挖到了:空气";
}
if(xl==0){
cout<<"\n本次探险共获得"<<sum<<"金币";
Sleep(2500);
system("cls");
p=-1;
}
}
short int kw[1000][600][1000];
string a;
int main(){ //主函数位置 -------------------------------------
SetConsoleTitle(TEXT("____/|\\|/ 矿工模拟器 /|\\|/____"));
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 ";
char linshi1;
linshi1=fb();
int t=234234;
system("cls");
string b;
while(1){
system("cls");
cout<<"1.商城\n2.开始挖矿\n3.教程\n";
cout<<endl<<" ";
b=fb();
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.绷带(a):600金币 10.注血器(b):1200金币 11.满血丹(c):2800金币 12.合金钻头(d):2000\n";
cout<<"\n";
//……
cout<<"\n需要买什么?(按0返回)\n ";
char o;
o=fb();
if(o=='0'){
system("cls");
break;
}else if(czi(o)>0&&czi(o)<=8){
if(jg[czi(o)]<=jin){
jin-=jg[czi(o)];
sd=st[czi(o)];
bs=bss[czi(o)];
}else{
cout<<"金币不够!\n";
Sleep(1000);
system("cls");
continue;
}
}else if(o=='a'){
if(jin>=600){
bt++;
jin-=600;
}else{
cout<<"金币不够!\n";
Sleep(1000);
system("cls");
continue;
}
}else if(o=='b'){
if(jin>=1200){
zxq++;
jin-=1200;
}else{
cout<<"金币不够!\n";
Sleep(1000);
system("cls");
continue;
}
}else if(o=='c'){
if(jin>=2800){
mxd++;
jin-=2800;
}else{
cout<<"金币不够!\n";
Sleep(1000);
system("cls");
continue;
}
}else if(o=='d'){
if(jin>=2000){
hj++;
jin-=2000;
}else{
cout<<"金币不够!\n";
Sleep(1000);
system("cls");
continue;
}
}else{
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;
int y=rand()%25;
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<<"金币";
Sleep(2000);
break;
}else if(xl==0){
p=0;
cout<<"\n本次探险共获得"<<sum<<"金币";
Sleep(2500);
break;
}
cout<<"\n位置: "
<<"\n 前后:"<<x
<<"\n 高度:"<<y
<<"\n 左右:"<<z<<"\n";
cout<<" 血量: "<<xl;
cout<<"\n 要往哪个方向挖?\n\n";
cout<<" 打开背包按0\n\n ";
a=fb();
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==" "){
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=="f"){
cout<<"f";
cin>>a;
if(a=="anhui"){
cout<<"确定返回?\n";
cin>>a;
if(a=="shi"||a=="queding"){
jin+=sum;
break;
}
}
}else if(a=="0"){
system("cls");
int l=1;
cout<<"\n\n当前有"<<sum<<"金币\n\n";
cout<<"当前物品:";
if(bt){
cout<<l<<".绷带(a):"<<bt<<"个 ";
l++;
}
if(zxq){
cout<<l<<".注血器(b):"<<zxq<<"个 ";
l++;
}
if(mxd){
cout<<l<<".满血丹(c):"<<mxd<<"个 ";
l++;
}
if(hj){
cout<<l<<".合金钻头(d)"<<hj<<"个 ";
l++;
}
cout<<"\n\n按n可退出\n ";
a=fb();
if(a=="n"){
p=0;
continue;
}else if(a=="a"){
if(bt){
bt--;
xl+=15;
cout<<"使用成功!";
Sleep(1000);
}else{
cout<<"\n该道具不存在!";
Sleep(1000);
p=0;
continue;
}
}else if(a=="b"){
if(zxq){
zxq--;
xl+=40;
cout<<"使用成功!";
Sleep(1000);
}else{
cout<<"\n该道具不存在!";
Sleep(1000);
p=0;
continue;
}
}else if(a=="c"){
if(mxd){
mxd--;
xl=100;
cout<<"使用成功!";
Sleep(1000);
}else{
cout<<"\n该道具不存在!";
Sleep(1000);
p=0;
continue;
}
}else if(a=="d"){
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;
ZS=fb();
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;
}
jin+=sum;
}else if(b=="/"){
cout<<"_____________________\n";
cout<<"| \n| /";
cin>>b;
if(b=="kgzb") jin=100000000;
else if(b=="dxts"){
srand(static_cast<unsigned int>(time(NULL)));
for(int i=1;i<=599;i++){
cout<<"\n\n\n";
for(int k=1;k<=599;k++){
cout<<endl;
for(int j=1;j<=499;j++){
kw[i][j][k]=rand()%200;
cout<<kw[i][j][k]<<" ";
}
}
}
}
}else if(b=="3"){
system("cls");
cout<<" 上:\" \" 下:x 左:a 右:d 前:w 后:s\n\n";
cout<<" 挖矿时退出:fanhui———shi或者qeuding (拼音)\n";
cout<<"\n\n\n ——按任意键退出——\n ";
b=fb();
continue;
}
}
return 0;
}
//放到dev-c++运行
