#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
void hide() {
HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord;
CONSOLE_CURSOR_INFO cursor_info = {1, 0};
SetConsoleCursorInfo(hout, &cursor_info);
}
struct tree{
bool w;
char ch;
}mat[40][25];
struct house{
char ch;
int m,x,y;
}map2[51][51],me;
struct jain{
int num,s[11],ans[11],len;
}jian[101];
struct fatbig{
int x,y,k;
bool p;
char ch;
}bigmap[500][500],l;
struct fatandbig{
int x,y,k,time;
char ch;
}field[100][100],ho;
const int hos=2,ii=16,iii=6,iiii=6,iiiii=5,iiiiii=4,plant=2;//ii物品iiii建筑iiiii道具iii设计图iiiiii地图plant作物
string fild[plant+1]={"无","小麦","人参"};
long long go,tian=1,sheng=20,gong=3,dongs[ii],shec[iii]={4,6,9,11},ti=10,shui=10,jian_num,daojv[iiiii];
string name,she[iii]={"火把设计图(2木材)","熔炉设计图(4石头)","制药台设计图(5石头2铁锭)","纺织机设计图(3木材2石头10尼龙线)","工作台设计图(3石头2铁锭)","面粉研磨机设计图(5石头2粗铁)"};
string ddong[ii]={"矿泉水","面包","空矿泉水瓶","木材","石头","粗铁","铁锭","铁镐","人参","皮革","废弃的尼龙线","针","小麦种子","麦粒/袋","面粉","面饼"},mmap[7]={"森林","小溪","石场","农田"};
string ddong2[ii]={"0矿泉水","1面包","2空矿泉水瓶","3木材","4石头","5粗铁","6铁锭","7铁镐","8人参","9皮革","10废弃的尼龙线","11针","12小麦种子","13麦粒/袋","14面粉","15面饼"};//方便自己看
string jian1[iiii]={"火把","熔炉(周围要1火把)","制药台","纺织机","工作台","面粉研磨机"},daojv1[iiiii]={"捕鱼陷阱","皮帽","皮衣"};
char work[iii+1]={':','n','o','w','m','u'};//工作方块标记
bool shes[iii],f;
void csh(){
for(int i=0;i<25;i++){
for(int j=0;j<40;j++){
int ff=rand()%3;
if(ff==1){
mat[i][j].w=1;
mat[i][j].ch='*';
}
else{
mat[i][j].w=0;
mat[i][j].ch=' ';
}
}
}
me.x=me.y=0;
jian[0].s[0]=3;jian[0].ans[0]=2;
jian[1].s[0]=4;jian[1].ans[0]=4;
jian[2].s[0]=4;jian[2].ans[0]=5;jian[2].s[1]=6;jian[2].ans[1]=2;
jian[3].s[0]=3;jian[3].ans[0]=3;jian[3].s[1]=4;jian[3].ans[1]=2;jian[3].s[2]=10;jian[3].ans[2]=10;
jian[4].s[0]=4;jian[4].ans[0]=3;jian[4].s[1]=6;jian[4].ans[1]=2;
jian[5].s[0]=4;jian[5].ans[0]=5;jian[5].s[1]=5;jian[5].ans[1]=2;
jian[0].len=jian[1].len=0;
jian[2].len=jian[4].len=jian[5].len=1;
jian[3].len=2;
for(int i=0;i<500;i++){
for(int j=0;j<500;j++){
bigmap[i][j].p=rand()%2;
bigmap[i][j].ch='*';
}
}
}//初始化数组
void guai(){
int ggong=2,a=4,p=1;
while(a){
cout<<"你发动了攻击\n";
if(a-gong<=0){
Sleep(500);
cout<<"致命一击!怪物被击败了!\n";
break;
}
a-=gong;
Sleep(500);
cout<<"怪物失去"<<gong<<"点生命值,还剩"<<a<<"点生命值\n";
Sleep(1000);
cout<<"怪物发动了攻击\n";
/*if(wq.fys!="无"&&wq.xue!=0){
if(wq.xue>=gong[x]){
wq.xue-=gong[x];
Sleep(500);cout<<"你的防御武器 "<<wq.fys<<" 替你挡下了攻击,现在它还剩"<<wq.xue<<"点生命值\n";
}
else{
me.xue=me.xue-gong[x]-wq.xue;
wq.xue=0;
Sleep(500);
cout<<"你的防御武器 "<<wq.fys<<" 替你挡下了部分攻击,现在它还剩"<<wq.xue<<"点生命值\n";wq.fys="无"; Sleep(500);cout<<"你挡下了部分攻击,现在你还剩"<<me.xue<<"点血量\n";
if(me.xue<=0){
Sleep(500);
cout<<"致命一击!你被击败了!\n"; p=0;break;
}
}
}将来有武器锻造台,备份使用*/
if(sheng-ggong<=0){
Sleep(500);
cout<<"致命一击!你被击败了!\n";
sheng=0;
return;
}
sheng-=ggong;
Sleep(500);
cout<<"你挡下了攻击,现在你还剩"<<sheng<<"点生命值\n";
}
}
void goo(){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
for(int i=0;i<500;i++){
for(int j=0;j<500;j++){
bigmap[i][j].ch='*';
}
}
cout<<"你要去哪?\n0.不去了,在家休养生息 1.外出找物资";
cin>>go;
if(go==0){
f=0;
return;
}
int go1=0;
if(go==1){
int yes,diao=rand()%11+10,vai,dx[21],dy[21],xxx[5],yyy[5];
for(int i=0;i<diao;i++){
dx[i]=rand()%100;
bool ff=1,fff=1;
for(int j=0;j<i;j++){
if(dx[i]==dx[j]){ff=0;break;}
}
if(!ff){i--;fff=0;}
dy[i]=rand()%150;
ff=1;
for(int j=0;j<i;j++){
if(dy[i]==dy[j]){ff=0;break;}
}
if(!ff){i--;ff=0;}
if(fff) bigmap[dx[i]][dy[i]].ch='.';
}
for(int i=0;i<iiiiii;i++){
xxx[i]=rand()%100;
bool ff=1,fff=1;
for(int j=0;j<i;j++){
if(xxx[i]==xxx[j]){
ff=0;
break;
}
}
if(!ff){
i--;
fff=0;
}
yyy[i]=rand()%150;
ff=1;
for(int j=0;j<i;j++){
if(yyy[i]==yyy[j]){
ff=0;
break;
}
}
if(!ff){
i--;
fff=0;
}
if(fff) bigmap[xxx[i]][yyy[i]].ch='M';
}
while(1){
int i=l.x,j=l.y,aa;
if(i<20)i=20;if(j<40)j=40;if(i>=100)i=100;if(j>=150)j=150;
cout<<"有10-20处物资散落在地图各处,标记为'.' ,需要可以寻找\n0:退出\n";
for(int il=i-20;il<=i;il++){
for(int jj=j-40;jj<=j;jj++){
if(il==l.x&&jj==l.y){
cout<<"$";
continue;
}
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
if(bigmap[il][jj].p==1) SetConsoleTextAttribute(hConsole,FOREGROUND_GREEN);
cout<<bigmap[il][jj].ch;
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
}
cout<<endl;
}
if(bigmap[l.x][l.y].ch=='.'){
system("cls");
cout<<"你发现了物资,是否寻找?(1.yes 2.no)"<<endl;
cin>>yes;
if(yes==1){
vai=rand()%2;
if(vai){
int zhong=rand()%5;
if(zhong==0){
cout<<"你中毒了,生命值减3"<<endl;
sheng-=3;Sleep(1000);system("cls");
}
if(zhong==1){
cout<<"你碰到了尖锐物品,";
if(daojv[2]<=0){
cout<<"你没有皮衣,被划伤了,生命值减5\n";
sheng-=5;
}
else cout<<"但你有皮衣,所以你没事\n";
Sleep(1000);system("cls");
}
if(zhong==2){
cout<<"你被东西撞回了家"<<endl;Sleep(1000);system("cls");
break;
}
if(zhong==4){
cout<<"你遇到了怪物,是否迎战?(1.yes 2.no)";
int x;
cin>>x;
if(x==2){
int f;
f=1;
if(f<=1){
cout<<"怪物将你的物资偷走了!"<<endl;Sleep(1000);system("cls");
bigmap[l.x][l.y].ch='*';
continue;
}
}
if(x==1){
guai();Sleep(1000);system("cls");
if(sheng<=0) break;
}
}
}
else cout<<"周围有东西!"<<endl;
int ge=rand()%3+1,shess=rand()%iii,yo=rand()%2;
for(int i=1;i<=ge;i++){
int dong=rand()%ii;
cout<<"你获得了"<<ddong[dong]<<endl;
dongs[dong]++;
}
if(yo){
cout<<"你获得了"<<she[shess]<<endl;
shes[shess]=1;
}
}
bigmap[l.x][l.y].ch='*';
Sleep(1000);
system("cls");
continue;
}
int fg=0;
for(int i=0;i<iiiiii;i++){
cout<<mmap[i]<<"入口距离你"<<sqrt((l.x-xxx[i])*(l.x-xxx[i])+(l.y-yyy[i])*(l.y-yyy[i]))<<"米"<<endl;
if(sqrt((l.x-xxx[i])*(l.x-xxx[i])+(l.y-yyy[i])*(l.y-yyy[i]))==0){
system("cls");
cout<<"你来到了"<<mmap[i]<<"的入口,是否进入?(1.yes 2.no)"<<endl;
int aaaa;
cin>>aaaa;
if(aaaa==1){
go1=i+1;
fg=1;
break;
}
else{
cout<<"你选择不进入,返回主界面..."<<endl;
Sleep(1000);
return;
}
}
}
if(fg==2) return;
if(fg==1) break;
aa=getch();
if(aa==48) return;
if(aa==72)if(l.x!=0){l.x--;system("cls");}
if(aa==80)if(l.x!=100){l.x++;system("cls");}
if(aa==75)if(l.y!=0){l.y--;system("cls");}
if(aa==77)if(l.y!=150){l.y++;system("cls");}
system("cls");
}
}
system("cls");
if(go1==1){
int ts=0;
int a,x=0,y=0;
while(1){
cout<<"体力(饱食度):";
for(int j=1;j<=ti;j++){
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
SetConsoleTextAttribute(hConsole,6);
cout<<"i";
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
}
for(int j=1;j<=10-ti;j++)cout<<"i";
cout<<endl;
bool f=0;
for(int i=0;i<25;i++){
for(int j=0;j<40;j++){
if(mat[i][j].ch=='*') f=1;
}
}
if(!f) csh();
for(int i=0;i<25;i++){
for(int j=0;j<40;j++){
if(i==me.y&&j==me.x)cout<<"$";
else{
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
SetConsoleTextAttribute(hConsole,FOREGROUND_GREEN);
cout<<mat[i][j].ch;
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
}
}
cout<<endl;
}
cout<<"0:退出"<<endl;
cout<<"c.切割树木(得3木材)"<<endl;
a=getch();
if(a==72)if(me.y!=0)me.y--;
if(a==80)if(me.y!=24)me.y++;
if(a==75)if(me.x!=0)me.x--;
if(a==77)if(me.x!=39)me.x++;
if(a==99){
if(ti<3){
cout<<"体力不够!!"<<endl;
Sleep(1000);
system("cls");
continue;
}
if(mat[me.y][me.x].ch==' '){
cout<<"当前位置无树木!!"<<endl;
Sleep(1000);
system("cls");
continue;
}
ti-=3;
mat[me.y][me.x].w=0;mat[me.y][me.x].ch=' ';
cout<<"你获得了3个木头";dongs[3]+=3;
Sleep(1000);system("cls");
}
if(a==48){
system("cls");
break;
}
system("cls");
}
}
if(go1==2){
cout<<"一个空矿泉水瓶换矿泉水?\n1.yes 2.no\n";
int huan;
cin>>huan;
if(huan==1){
cout<<"换几个?(你有"<<dongs[2]<<"个空矿泉水瓶)";
int ji;cin>>ji;
if(ji>dongs[2]){
cout<<"不够!!!";
}
else{
dongs[2]-=ji;
dongs[0]+=ji;
}
}
}
if(go1==3){
if(dongs[7]!=0){
cout<<"没镐子!!!"<<endl;
Sleep(1000);
return;
}
if(ti-3<0){
ti=0;
cout<<"体力不足!";
Sleep(1000);
return;
}
ti-=3;
while(1){
cout<<"点击鼠标左键挖掘......";
int j=0;
while(j!=102){
if(GetAsyncKeyState(VK_LBUTTON) & 0x8000) {
system("cls");cout<<"挖掘中......"<<endl;
cout<<j<<"%"<<endl;
Sleep(70);
j+=2;
}
}
int ad=rand()%2,k=rand()%4+1;
if(ad==0){
cout<<"获得"<<k<<"粗铁!";
dongs[5]+=k;
}
else{
cout<<"获得"<<k<<"石头!";
dongs[4]+=k;
}
Sleep(500);
cout<<"\n还挖不挖?\n挖y不挖n";//防止硬控
int a;
a=getch();
if(a==int('n'))break;
}
}
if(go1==4){
while(1){
cout<<"这些符号表示: .:无 v:作物(生长中) r:作物(成熟)\n0:退出 p:种植 c:收获\n";
for(int i=0;i<21;i++){
for(int j=0;j<51;j++){
if(field[j][i].time>=5) field[j][i].ch='r';
if(j==ho.x&&i==ho.y) cout<<"$";
else cout<<field[j][i].ch;
}
cout<<endl;
}
cout<<"本方块:"<<fild[field[ho.y][ho.x].k];
if(field[ho.y][ho.x].k!=0){
if(field[ho.x][ho.y].ch=='v') cout<<"(生长中)";
else cout<<"(成熟)";
}
int a;
a=getch();
if(a==72)if(ho.y!=0)ho.y--;
if(a==80)if(ho.y!=50)ho.y++;
if(a==75)if(ho.x!=0)ho.x--;
if(a==77)if(ho.x!=20)ho.x++;
if(a==48){
system("cls");
break;
}
cout<<endl;
if(a==(int)'p'){
cout<<"种什么?\n";
cout<<"1 小麦种子 "<<dongs[12]<<"个\n";
cout<<"2 人参 "<<dongs[8]<<"个\n";
int na,p;
na=getch();
if(na==49){
if(dongs[12]<1) p=0;
else{
p=1;
dongs[12]-=1;
}
}
if(na==50){
if(dongs[8]<1) p=0;
else{
p=1;
dongs[8]-=1;
}
}
if(p==0) cout<<"不够!";
else{
if(field[ho.y][ho.x].ch=='.'){
cout<<"种植成功!";
field[ho.y][ho.x].ch='v';
field[ho.y][ho.x].k=na-48;
}
else cout<<"当前位置已有作物";
}
Sleep(1000);
}
if(a==(int)'c'){
if(field[ho.y][ho.x].ch!='r') cout<<"当前位置无法获得收获";
else{
cout<<"收获成功!";
if(field[ho.y][ho.x].k==1) dongs[13]++;
if(field[ho.y][ho.x].k==2) dongs[8]+=4;
field[ho.y][ho.x].ch='.';
field[ho.y][ho.x].k=0;
}
Sleep(1000);
}
system("cls");
}
}
if(go==1145147891){
for(int i=1;i<=40;i++)system("start https://arcxingye.github.io/r18/");//tmd100太大了,一打开吓死我了,还以为死循环
}
Sleep(1000);
system("cls");
}
void jz(int x,int y){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
bool p;
while(1){
cout<<"可建造:\n0 退出\n";
for(int i=0;i<iiii;i++){
p=1;
for(int j=0;j<=jian[i].len;j++){
if(dongs[jian[i].s[j]]<jian[i].ans[j]){
p=0;
break;
}
}
if(p){
cout<<i+1<<" "<<jian1[i]<<endl;
}
}
int sb;
cin>>sb;sb--;
if(sb==-1) return;
p=1;
for(int i=0;i<=jian[sb].len;i++){
if(dongs[jian[sb].s[i]]<jian[sb].ans[i]){
p=0;
break;
}
}
if(p){
bool pp=0;
for(int i=0;i<21;i++){
for(int j=0;j<51;j++){
if(map2[j][i].ch=='.'){
pp=1;
break;
}
}
if(pp) break;
}
if(pp){
if(map2[x][y].ch!='.') cout<<"当前位置已有建筑\n";
else{
for(int i=0;i<=jian[sb].len;i++){
dongs[jian[sb].s[i]]-=jian[sb].ans[i];
}
map2[x][y].ch=work[sb];
map2[x][y].m=sb+1;
jian[sb].num++;
cout<<"建造成功!\n";
}
}
else cout<<"位置不够\n";
}
else cout<<"材料不足\n";
getch();return;
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
csh();
for(int i=0;i<21;i++){
for(int j=0;j<21;j++){
field[i][j].ch='.';
}
}
for(int i=0;i<51;i++){
for(int j=0;j<51;j++){
map2[i][j].ch='.';
map2[i][j].m=0;
}
}
srand(time(0));
hide();
cout<<"末日生存,你的名字是:";
cin>>name;
cout<<"欢迎"<<name<<"进入!!!!!!!!!!!!!!!!\n";Sleep(1000);
system("cls");
/*cout<<"确认是否为原创(打开作者主页中)"<<endl;
system("start https://oiclass.com/user/14053");
system("start https://oiclass.com/user/14199");
system("start https://oiclass.com/user/9820");
Sleep(1000);
system("cls");*/
cout<<"为了游玩舒适,请调成全屏或者缩小窗口,将全部的输出调到可视范围内!!!\n按任意键开始....."; //提示
getch();//任意键
system("cls");
cout<<"看不看游戏信息?(操作玩法)\n看回车 不看其他";
int sb=getch();
system("cls");
if(sb==13){
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
SetConsoleTextAttribute(hConsole, FOREGROUND_RED);
cout<<"本游戏由@2022tysc1697,@2025tyoi0147和@2025tyoi0293共创!!!\n";
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
Sleep(1000);
cout<<"你可以建造东西,摸箱子,收集水和木头 \n";
Sleep(1000);
cout<<"这些符号代表:\n$:自己\nn:熔炉\n:火把\n.:移动的地方(地图范围)\nw:纺织机\no:制药台\nm:工作台\nu:面粉研磨机\n";
Sleep(1000);
cout<<"生命值上限为20,水量、体力上限为10,开箱子会有特殊事件\n";
Sleep(1000);
cout<<"小贴士:要及时收集水!(水量不足会扣血哦~~)\n";
Sleep(1000);
cout<<"输入奇怪的数字会触发彩蛋哦~~~\n";
Sleep(1000);
cout<<"按任意键开始游戏...... \n";
getch();
}
while(1){
HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
srand(time(NULL));
if(shui<=0){
int shif;
cout<<"你在缺水状态下,需要3瓶矿泉水,是否喝水?(1.yes 2.no)";
cin>>shif;
if(shif==1){
if(dongs[0]<3){
cout<<"不够!!!\n";
cout<<"你缺水了!所以生命值减5";
sheng-=5;
}
else{
cout<<"你及时补充了水分";
shui+=2;
}
}
else{
cout<<"你缺水了!所以生命值减5";
sheng-=5;
}
Sleep(1000);
system("cls");
}
if(ti<=0){
int shif;
cout<<"你在饥饿状态下,需要2个面包,是否吃面包?(1.yes 2.no)";
cin>>shif;
if(shif==1){
if(dongs[1]<2){
cout<<"不够!!!\n";
cout<<"你饿出病了!所以生命值减5";
sheng-=5;
}
else{
cout<<"你及时吃了面包,没有饿出病";
ti+=2;
}
}
else{
cout<<"你饿出病了!所以生命值减5";
sheng-=5;
}
Sleep(1000);
system("cls");
}
while(sheng<=0){
int shif;
cout<<"你的伤势很严重,即将死亡,需要急救包(3人参,回复2生命值)是否制作?(1.yes 2.no)";
cin>>shif;
if(shif==1){
if(dongs[8]<3){
cout<<"不够!!!\n";
Sleep(1000);system("cls");break;
}
else{
cout<<"你及时使用了急救包,";
dongs[8]-=3;
sheng+=2;
if(sheng<=0){
cout<<"但你的伤势太严重了,还需要继续自我急救吗?(1.yes 2.no)";
cin>>shif;
if(shif==2){
system("cls");
break;
}
}
else{
cout<<"活过来了";
Sleep(1000);system("cls");
}
}
}
}
int x=0,y=0;
while(1){
if(sheng<=0){
cout<<"you die!!!";
cout<<"\n本次生存天数:"<<tian<<"天";
Sleep(1500);
return 0;
}
for(int i=0;i<21;i++){
for(int j=0;j<51;j++){
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
if(i==y&&j==x)cout<<"$";
else if(map2[j][i].ch=='.') cout<<'.';
else{
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
SetConsoleTextAttribute(hConsole,3);
cout<<work[(map2[j][i].m)-1];
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
}
}
cout<<endl;
}
cout<<"体力(饱食度):";
for(int j=1;j<=ti;j++){
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
SetConsoleTextAttribute(hConsole,6);
cout<<"i";
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
}
for(int j=1;j<=10-ti;j++)cout<<"i";
cout<<"水量:";
for(int j=1;j<=shui;j++){
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
SetConsoleTextAttribute(hConsole,3);
cout<<"Q";
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
}
for(int j=1;j<=10-shui;j++)cout<<"Q";cout<<endl;
if(map2[x][y].m==0) cout<<"你生存了"<<tian<<"天"<<"\n生命值:"<<sheng<<" 攻击力:"<<gong<<"\nz:出发\n1:建造\nd:喝水 e:吃面包 s:看背包\n空格:使用工作方块"<<endl<<"本方块:无"<<endl;
else cout<<"你生存了"<<tian<<"天"<<"\n生命值:"<<sheng<<" 攻击力:"<<gong<<"\nz:出发\n1:建造\nd:喝水 e:吃面包 s:看背包\n空格:使用工作方块"<<endl<<"本方块:"<<jian1[(map2[x][y].m)-1]<<endl;
int g,aa,q;
bool b=0;
g=getch();
if(g==(int)' '){
if(map2[x][y].m==1){
cout<<"是否将面饼做成面包?(是y否n,用火把烘烤)";
aa=getch();
if(aa==(int)'y'){
if(dongs[15]<1) cout<<"没面饼!";
else{
dongs[15]--;dongs[1]++;
for(int i=1;i<=100;i++){
cout<<"烘烤中......\n"<<i<<"%";
Sleep(50);
system("cls");
}
cout<<name<<"将1袋面粉做成了面包";
}
}
}
if(map2[x][y].m==2&&((x>0&&map2[x-1][y].m==1)||(x<20&&map2[x+1][y].m==1)||(y>0&&map2[x][y-1].m==1)||(y<50&&map2[x][y+1].m==1))){
cout<<"是否使用熔炉?(使用y不用n)";//提示
aa=getch();
if(aa==int('y')){
cout<<"用几个粗铁?(你有"<<dongs[5]<<"个粗铁)";
int ui;cin>>ui;
if(ui>dongs[5]) cout<<"不够!";
else{dongs[5]-=ui;dongs[6]+=ui;
for(int i=0;i<100;i+=2){
cout<<"烧制"<<i<<'%';
Sleep(100);
system("cls");
}//动画
cout<<name<<"用"<<ui<<"粗铁"<<"换了"<<ui<<"铁锭"<<endl;
b=1;
Sleep(1000);//延迟
system("cls");}
}
}
if(map2[x][y].m==3){
cout<<"1.回血包:1人参,1火把,2矿泉水。回复:7生命值。\n2.体力包:1人参,1面包,1火把。回复:5体力\n3.人参滋补包:2人参,3矿泉水,2火把。回复:4生命值3体力";
cout<<"\n输入0退出 ";
int aaa;
cin>>aaa;
if(aaa==1){
if(dongs[0]>=2&&jian[0].num>=1&&dongs[8]>=1){
dongs[0]-=2,dongs[8]-=1;
cout<<"恭喜获得物品:回血包!已回复生命值";
sheng+=7;
if(sheng>20) sheng=20;
}
else cout<<"材料不够!";
}
if(aaa==2){
if(dongs[1]>=1&&jian[0].num>=1&&dongs[8]>=1){
dongs[1]-=1,dongs[8]-=1;
cout<<"恭喜获得物品:体力包!已回复体力";
ti+=5;
}
else cout<<"材料不够!";
}
if(aaa==3){
if(dongs[0]>=3&&jian[0].num>=2&&dongs[8]>=2){
dongs[0]-=3,dongs[8]-=2;
cout<<"恭喜获得物品:人参滋补包!已回复生命值和体力";
sheng+=4,ti+=3;
if(sheng>20) sheng=20;
}
else cout<<"材料不够!";
}
Sleep(1000);
system("cls");
}
if(map2[x][y].m==4){
cout<<"1.皮帽(大热天不会中暑,制作:7皮革2木材2尼龙线)\n2.皮衣(防止被刺伤,制作:15皮革6尼龙线) 任何纺织物都需要1针";
cout<<"\n输入0退出";
int aaa,r;cin>>aaa; r=rand()%4;
if(aaa==1){
if(dongs[9]<7||dongs[3]<2||dongs[10]<2||dongs[11]<1) cout<<"材料不够!";
else{
if(r!=0){
dongs[9]-=7,dongs[3]-=2,dongs[10]-=2;
cout<<"恭喜获得物品:皮帽!";
daojv[1]++;}
else cout<<"欸?针呢?";
}
}
if(aaa==2){
if(dongs[9]<15||dongs[10]<6||dongs[11]<1) cout<<"材料不够!";
else{
if(r!=0){
dongs[9]-=15,dongs[10]-=6;
cout<<"恭喜获得物品:皮衣!";
daojv[2]++;}
else cout<<"欸?针呢?";
}
}
Sleep(1000);
system("cls");
}
if(map2[x][y].m==5){
cout<<"1.针(用来纺织,制作:1粗铁)\n2.铁镐(用来挖矿,制作:2木材2铁锭)\n3.面饼(制作面包,制作:1面粉1矿泉水)";
cout<<"\n输入0退出";
int aaa;
cin>>aaa;
if(aaa==1){
if(dongs[5]<1) cout<<"材料不够!";
else{
dongs[5]-=1;
cout<<"恭喜获得物品:针!";
dongs[11]++;
}
}
if(aaa==2){
if(dongs[3]<2||dongs[6]<2) cout<<"材料不够!";
else{
dongs[3]-=2,dongs[6]-=2;
cout<<"恭喜获得物品:铁镐!";
dongs[7]++;
}
}
if(aaa==3){
if(dongs[14]<1||dongs[0]<1) cout<<"材料不够!";
else{
dongs[14]-=1;dongs[0]-=1;
cout<<"恭喜获得物品:面饼!(注意:面饼只有1天的使用时间!)";
dongs[15]++;
}
}
Sleep(1000);
system("cls");
}
if(map2[x][y].m==6){
cout<<"是否使用面粉研磨机?(使用y不用n)";//提示
aa=getch();
if(aa==int('y')){
cout<<"用几袋麦粒?(你有"<<dongs[5]<<"袋麦粒)";
int ui;cin>>ui;
if(ui>dongs[5]) cout<<"不够!";
else{dongs[13]-=ui;dongs[14]+=ui;
cout<<"点击鼠标左键研磨......";
int j=0;
while(j!=101){
if(GetAsyncKeyState(VK_LBUTTON) & 0x8000) {
system("cls");cout<<"研磨中......"<<endl;
cout<<j<<"%"<<endl;
Sleep(70);
j+=1;
}
}
cout<<name<<"用"<<ui<<"袋麦粒"<<"换了"<<ui<<"面粉"<<endl;
b=1;
Sleep(1000);//延迟
system("cls");}
}
}
}
if(g==(int)'s'){
int c;
while(1){
cout<<"\n看哪个?(退出:0 物品:1 设计图:2)";
int dong,p=0;cin>>c;
if(c==0) break;
if(c==1){
cout<<"拥有的物品:";
for(int i=0;i<ii;i++){
if(dongs[i]){
cout<<endl<<i+1<<" "<<ddong[i]<<" "<<dongs[i]<<" 个";
p=1;
}
}
if(!p) cout<<"无";
p=0;
cout<<"\n\n拥有的道具:";
for(int i=0;i<iiiii;i++){
if(daojv[i]){
cout<<endl<<i+1<<" "<<daojv1[i]<<" "<<daojv[i]<<" 个";
p=1;
}
}
if(!p) cout<<"无"<<endl;
cout<<"按任意键退出";
getch();
}
if(c==2){
cout<<"拥有的设计图:"<<endl;
for(int i=0;i<4;i++){
if(shes[i]){
cout<<i+1<<" "<<she[i]<<endl;
p=1;
}
}
if(!p) cout<<"无"<<endl;
cout<<"\n按任意键退出";
getch();
}
break;
}
}
if(g==49) jz(x,y);
if(g==72)if(y-1>=0){y--;}
if(g==80)if(y+1<=20){y++;}
if(g==75)if(x-1>=0){x--;}
if(g==77)if(x+1<=50){x++;}
if(g==(int)'d'){
if(dongs[0]<=0) cout<<"没水\n";
else{
cout<<"你喝了水,水量+2\n";
shui+=2;
dongs[0]--;
if(shui>10) shui=10;
}
Sleep(1000);
}
if(g==(int)'e'){
if(dongs[1]<=0) cout<<"没面包\n";
else{
cout<<"你吃了面包,体力(饱食度)+2\n";
ti+=2;
dongs[1]--;
if(ti>10) ti=10;
}
Sleep(1000);
}
if(g==(int)'z'){
goo();
break;
}
system("cls");
}
system("cls");
if(sheng<20) sheng++;
tian++;shui--;
int til;bool ss=0;
if(tian<30) til=rand()%15;
else til=rand()%10;
if(til==1){
cout<<"今天是寒潮,需要4火把"<<endl;
if(jian[0].num>=4) ss=1;
if(!ss){
cout<<"你被冻没了5点血和3点水量"<<endl;
shui-=3;
sheng-=5;
}
else cout<<"你有4火把,所以你没事"<<endl;
Sleep(1000);
system("cls");
}
if(til==3){
cout<<"今天是回南天,东西腐朽了";
for(int i=0;i<ii;i++){
dongs[i]+=1;dongs[i]/=2;
}
Sleep(1000);
system("cls");
}
if(til==5){
cout<<"今天是大风天,东西和建筑被吹走了"<<endl;
for(int i=0;i<ii;i++) dongs[i]=dongs[i]/3*2;
for(int i=0;i<21;i++){
for(int j=0;j<51;j++){
int lk=rand()%4;
if(lk==2){
map2[i][j].m=0;map2[i][j].ch='.';
}
}
}
Sleep(1000);
system("cls");
}
if(til==7){
cout<<"今天是大热天,";
if(daojv[1]<=0){
int shif;
cout<<"你中暑了,需要5瓶矿泉水,是否喝水?(1.yes 2.no)";
cin>>shif;
if(shif==1){
if(dongs[0]<5){
cout<<"不够!!!\n";
cout<<"你中暑了!所以水量减4,生命值减5";
sheng-=5,shui-=4;
}
else cout<<"你逃过了一劫";
}
else{
cout<<"你中暑了!所以水量减4,生命值减5";
sheng-=5,shui-=4;
}
}
else cout<<"你有皮帽,所以没事";
Sleep(1000);
}
for(int i=0;i<21;i++){
for(int j=0;j<21;j++){
if(field[i][j].k>0) field[i][j].time++;
}
}
dongs[15]=0;
system("cls");
}
return 0;
}