1
2026-05-15 16:29:46
发布于:浙江
#include<bits/stdc++.h>
#include<Windows.h>
using namespace std;
int x=100;
int g=5;
int f=0;
int kan=0;
int xk=0;
int ch=0;
int q=0;
int a=0;
double w=36.7;
double sf=100;
int s;
int level=0;
int LV=0;
int gamelevel=1;
double difficult_x=100;
double difficult_g=5;
double difficult_f=0;
int difficult_kan=0;
int difficult_xk=0;
int difficult_ch=0;
int difficult_q=0;
int difficult_a=0;
double difficult_w=36.7;
double difficult_sf=100;
int difficult_s;
int difficult_level=0;
int difficult_LV=0;
bool vis=false;
void difficult_home(){
system("cls");
cout<<" -----------生存游戏Lv.1.0----------"<<endl;
cout<<" [这里有一片树林,一个矿洞和一个池塘]"<<endl;
cout<<"你可以做这些事:"<<endl;
cout<<"1.去树林砍树"<<endl;
cout<<"2.去矿洞挖矿石"<<endl;
cout<<"3.烧柴火取暖"<<endl;
cout<<"4.喝水"<<endl;
cout<<"5.去池塘取水"<<endl;
cout<<"6.制作武器"<<endl;
cout<<"7.显示自己的状态"<<endl;
cout<<"8.建造或升级房子"<<endl;
cout<<"9.建造或升级炮塔"<<endl;
cout<<"10.退出游戏"<<endl;
cout<<"11.关于游戏(游戏规则)"<<endl;
cout<<"12.打Boss"<<endl<<endl;
cout<<"请问你要干什么?(输入数字序号)" <<endl;
}
void difficult_zaofang(){
system("cls");
if(difficult_level==0){
if(difficult_ch<150&&difficult_q<90){
cout<<"你的东西还不够造一级避难房!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
cout<<"建造一座一级避难房需150柴火,90金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>difficult_s;
Sleep(1000);
system("cls");
if(difficult_s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
difficult_level=1;
difficult_ch-=150;
difficult_q-=90;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else if(difficult_s==2) difficult_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_level==1){
if(difficult_ch<200&&difficult_q<130){
cout<<"你的东西还不够造二级避难房!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
cout<<"从一级避难房升至二级避难房需200柴火,130金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>difficult_s;
Sleep(1000);
system("cls");
if(difficult_s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
difficult_level=2;
difficult_ch-=200;
difficult_q-=130;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else if(difficult_s==2) difficult_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_level==2){
if(difficult_ch<300&&difficult_q<260){
cout<<"你的东西还不够造满级避难房!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
cout<<"从二级避难房升至满级避难房需300柴火,260金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>difficult_s;
Sleep(1000);
system("cls");
if(difficult_s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
difficult_level=3;
difficult_ch-=300;
difficult_q-=260;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else if(difficult_s==2) difficult_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else{
cout<<"你的已经是满级,不能再升级了!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
void difficult_zaopaota(){
system("cls");
if(difficult_LV==0){
if(difficult_ch<150&&difficult_q<90){
cout<<"你的东西还不够造一级炮塔!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
cout<<"建造一座一级炮塔需150柴火,90金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>difficult_s;
Sleep(1000);
system("cls");
if(difficult_s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
difficult_LV=1;
difficult_ch-=75;
difficult_q-=45;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else if(difficult_s==2) difficult_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_LV==1){
if(difficult_ch<200&&difficult_q<130){
cout<<"你的东西还不够造二级炮塔!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
cout<<"从一级炮塔升至二级炮塔需200柴火,130金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>difficult_s;
Sleep(1000);
system("cls");
if(difficult_s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
difficult_LV=2;
difficult_ch-=200;
difficult_q-=130;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else if(difficult_s==2) difficult_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_LV==2){
if(difficult_ch<300&&difficult_q<260){
cout<<"你的东西还不够造满级炮塔!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
cout<<"从二级炮塔升至满级炮塔需300柴火,260金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>difficult_s;
Sleep(1000);
system("cls");
if(difficult_s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
difficult_LV=3;
difficult_ch-=300;
difficult_q-=260;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else if(difficult_s==2) difficult_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else{
cout<<"你的避难房已经是满级,不能再升级了!"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
void difficult_m(){
system("cls");
cout<<"你一共可以制作下列武器:"<<endl;
cout<<"1.木剑 消耗20柴火 伤害+15"<<endl;
cout<<"2.木甲 消耗30柴火 防御+15"<<endl;
cout<<"3.金剑 消耗20金矿 伤害+30"<<endl;
cout<<"4.金甲 消耗30金矿 防御+30"<<endl;
cout<<"5.合金剑 消耗40柴火和40金矿 伤害+50"<<endl;
cout<<"6.合金甲 消耗70柴火和70金矿 防御+50"<<endl;
cout<<"7.至尊之剑 消耗80柴火和90金矿 伤害和防御各+80"<<endl;
cout<<"8.返回"<<endl<<endl;
cout<<"你想制作:"<<endl;
int difficult_b;
cin>>difficult_b;
if(difficult_b==1){
if(difficult_ch<20){
cout<<"柴火不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"制作成功!伤害+15"<<endl;
difficult_w-=0.1;
difficult_g+=15;
difficult_ch-=20;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_b==2){
if(difficult_ch<30){
cout<<"柴火不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"制作成功!防御+15"<<endl;
difficult_w-=0.1;
difficult_f+=15;
difficult_ch-=30;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_b==3){
if(difficult_q<20){
cout<<"金矿不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"制作成功!伤害+30"<<endl;
difficult_w-=0.1;
difficult_g+=30;
difficult_q-=30;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_b==4){
if(difficult_q<30){
cout<<"金矿不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"制作成功!防御+30"<<endl;
difficult_w-=0.1;
difficult_f+=30;
difficult_q-=30;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_b==5){
if(difficult_ch<40||difficult_q<40){
cout<<"材料不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"制作成功!伤害+50"<<endl;
difficult_w-=0.1;
difficult_g+=50;
difficult_ch-=40;
difficult_q-=40;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_b==6){
if(difficult_ch<70||difficult_q<70){
cout<<"材料不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"制作成功!防御+50"<<endl;
difficult_w-=0.1;
difficult_f+=50;
difficult_ch-=70;
difficult_q-=70;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_b==7){
if(difficult_ch<80||difficult_q<90){
cout<<"材料不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"制作成功!伤害和防御+80"<<endl;
difficult_w-=0.2;
difficult_g+=80;
difficult_f+=80;
difficult_ch-=80;
difficult_q-=90;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_b==8){
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"输入错误"<<endl;
system("pause");
system("cls");
difficult_home();
}
}
void difficult_kill(){
cout<<"Game over!"<<endl;
cout<<"是否继续,若继续,将恢复至游戏初始设置?(y/n)"<<endl;
char difficult_kk;
cin>>difficult_kk;
if(difficult_kk=='Y'||difficult_kk=='y'){
difficult_w=36.7;
difficult_x=100;
difficult_g=10;
difficult_f=0;
difficult_kan=0;
difficult_xk=0;
difficult_ch=0;
difficult_q=0;
difficult_a=0;
difficult_sf=100;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else{
Sleep(1145);
system("cls");
return;
}
}
void kill_Boss(){
Sleep(1145);
system("cls");
double Boss_nowlife=10000;
double Boss_nowg=5;
double Boss_nowf=10;
while(1){
if(Boss_nowf<=0) Boss_nowf=0;
if(difficult_x<=0){
cout<<"你被Boss**了"<<endl;
Sleep(1145);
system("pause");
system("cls");
difficult_home();
}
if(Boss_nowlife<=0){
cout<<"恭喜你胜利了!"<<endl;
Sleep(1145);
system("pause");
system("cls");
vis=true;
difficult_home();
}
cout<<"Boss详情:"<<endl;
cout<<"血量:"<<Boss_nowlife<<" "<<"攻击:"<<Boss_nowg<<" "<<"防御:"<<Boss_nowf<<endl;
if(Boss_nowlife<=5000){
cout<<"Boss进入第二阶段"<<endl;
Sleep(1145);
cout<<"攻击力+5"<<endl;
Sleep(1145);
cout<<"防御+5"<<endl;
Boss_nowg+=5;
Boss_nowf+=5;
Sleep(1145);
system("pause");
system("cls");
cout<<"Boss详情:"<<endl;
cout<<"血量:"<<Boss_nowlife<<" "<<"攻击:"<<Boss_nowg<<" "<<"防御:"<<Boss_nowf<<endl;
}
else if(Boss_nowlife<=2000){
cout<<"Boss进入第三阶段"<<endl;
Sleep(1145);
cout<<"攻击力+10"<<endl;
Sleep(1145);
cout<<"防御+10"<<endl;
Boss_nowg+=10;
Boss_nowf+=10;
Sleep(1145);
system("pause");
}
double Boss_Critical_Hit=(Boss_nowlife/Boss_nowg/(rand()%101)*0.625)+Boss_nowf;
int Boss_Critical_Hit_probability=rand()%5;
double My_Critical_Hit=difficult_g+(difficult_x/difficult_g/(rand()%101)*0.625)+difficult_f;
int My_Critical_Hit_probability=rand()%5;
cout<<"请做出你的选择:"<<endl;
cout<<"1.打! 2.逃跑"<<endl;
int difficult_input;
cin>>difficult_input;
if(difficult_input==2){
int success_probability=rand()%2;
if(success_probability==1){
cout<<"很不幸,你没有成功逃出"<<endl;
Sleep(1145);
cout<<"You lose!"<<endl;
system("pause");
system("cls");
difficult_kill();
}
else{
cout<<"你侥幸逃了出来..."<<endl;
Sleep(1145);
cout<<"但血量-5"<<endl;
difficult_x-=5;
cout<<"你决定继续发育后再来打..."<<endl;
Sleep(1145);
system("pause");
system("cls");
difficult_home();
}
}
else{
cout<<"你对Boss造成";
if(My_Critical_Hit_probability==0){
cout<<My_Critical_Hit<<"点暴击伤害"<<endl;
Boss_nowf-=3;
}
else{
cout<<difficult_g<<"点伤害"<<endl;
Boss_nowf-=2;
}
Sleep(1145);
cout<<"Boss的回合"<<endl;
Sleep(1145);
cout<<"Boss对你造成";
if(Boss_Critical_Hit_probability==0){
cout<<Boss_Critical_Hit<<"点暴击伤害"<<endl;
difficult_f-=2;
}
else{
cout<<Boss_nowg<<"点伤害"<<endl;
difficult_f-=1;
}
}
}
}
void game_difficult_start(){
while(1){
if(difficult_ch>=150&&difficult_q>=150&&difficult_LV==3&&difficult_level==3&&vis==true){
cout<<"恭喜你生存成功!"<<endl;
Sleep(1145);
system("pause");
system("cls");
cout<<"You Win!"<<endl;
Sleep(1145);
system("pause");
system("cls");
}
difficult_home();
if(difficult_sf<=10&&difficult_sf>1){
MessageBoxA(NULL, "注意:水分<=10,请尽快补水防止渴死", "注意",MB_OK);
system("cls");
difficult_home();
}
else if(difficult_sf<=0){
MessageBoxA(NULL, "你被渴死了", "",MB_OK);
Sleep(1145);
system("cls");
difficult_kill();
}
if(difficult_w<=36&&difficult_w>35.1){
MessageBoxA(NULL, "注意:体温小于36℃,请去生火防止冻死", "注意",MB_OK);
system("cls");
difficult_home();
}
else if(difficult_w<=35){
MessageBoxA(NULL, "你被冻死了", "",MB_OK);
Sleep(1145);
system("cls");
difficult_kill();
}
cin>>difficult_s;
if(difficult_s==1){
system("cls");
if(difficult_kan<=10000){
cout<<"砍到了一块柴火"<<endl;
difficult_w-=0.1;
difficult_kan++;
difficult_ch++;
difficult_sf--;
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"树被砍光了";
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_s==2){
system("cls");
cout<<"正在挖矿......"<<endl;
difficult_w-=0.2;
if(difficult_xk==0){
Sleep(1000);
cout<<"得到了2块金矿"<<endl;
difficult_xk++;
difficult_sf-=3;
difficult_q+=2;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else if(difficult_xk>0&&difficult_xk<8000){
Sleep(1000);
cout<<"得到了一块金矿"<<endl;
difficult_xk++;
difficult_q++;
difficult_sf-=2;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else if(xk>=4000){
cout<<"这里的矿被你挖完了"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
else if(difficult_s==3){
system("cls");
if(difficult_ch<=5){
cout<<"柴火不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"取暖中......"<<endl;
Sleep(1145);
cout<<"你用6根柴火取暖,体温+3℃"<<endl;
difficult_sf-=5;
difficult_w+=3;
cout<<"你现在的体温:"<<w<<"℃"<<endl;
if(difficult_w>=38&&difficult_w<40){
Sleep(1145);
cout<<"你感受到了热,发烧了."<<endl;
Sleep(1145);
system("pause");
system("cls");
difficult_home();
}
else if(difficult_w>=40){
Sleep(1145);
cout<<"你被热死了"<<endl;
Sleep(1145);
system("pause");
system("cls");
Sleep(1145);
difficult_kill();
}
else{
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
}
}
else if(difficult_s==4){
system("cls");
if(difficult_a==0){
cout<<"水不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
difficult_home();
}
else{
cout<<"正在喝水......"<<endl;
if(difficult_a>0&&difficult_a<=10){
Sleep(1000);
cout<<"水分+10"<<endl;
difficult_sf+=10;
if(difficult_sf>=100) sf=100;
system("pause");
system("cls");
difficult_home();
}
else{
Sleep(1000);
cout<<"水分+20"<<endl;
difficult_sf+=20;
if(difficult_sf>=100) sf=100;
system("pause");
system("cls");
difficult_home();
}
}
}
else if(difficult_s==5){
system("cls");
cout<<"取水中......"<<endl;
cout<<"得到了水x1"<<endl;
difficult_a++;
system("pause");
system("cls");
difficult_home();
}
else if(difficult_s==6){
system("cls");
difficult_m();
}
else if(difficult_s==7){
system("cls");
cout<<"你的状态如下:"<<endl<<endl;
cout<<"你的水分为:"<<difficult_sf<<endl;
cout<<"你的血量为:"<<difficult_x<<endl;
cout<<"你的攻击力为:"<<difficult_g<<endl;
cout<<"你的防御力为:"<<difficult_f<<endl;
cout<<"你的砍树次数为:"<<difficult_kan<<endl;
cout<<"你的下矿次数为:"<<difficult_xk<<endl;
cout<<"你的柴火数量为:"<<difficult_ch<<endl;
cout<<"你的金矿数量为:"<<difficult_q<<endl;
cout<<"你的水的数量为:"<<difficult_a<<endl;
cout<<"你的体温为:"<<difficult_w<<endl;
system("pause");
system("cls");
difficult_home();
}
else if(difficult_s==8) difficult_zaofang();
else if(difficult_s==9) difficult_zaopaota();
else if(difficult_s==10){
MessageBoxA(NULL, "游戏已安全退出", "",MB_OK);
system("cls");
return ;
}
else if(difficult_s==11){
system("cls");
cout<<"游戏规则:"<<endl;
cout<<"1.去树林砍树:体温-0.1℃,木头数量+1,水分-1"<<endl;
cout<<"2.去矿洞挖矿石:若下矿次数为0(第一次下矿),则金块数量+2,水分-3;否则,金块数量+2,水分-2"<<endl;
cout<<"3.烧柴火取暖:柴火至少6个,每一次取暖水分-3、体温+3,若体温>=37℃且<40℃,则发烧;若体温>=40℃,则热死"<<endl;
cout<<"4.喝水:若水有1~10个,水分+10;若水有10个以上,水分+20"<<endl;
cout<<"5.去池塘取水:每次取1个水"<<endl<<endl;
cout<<"死亡条件:"<<endl;
cout<<"1.若体温<=35℃或高于40℃"<<endl;
cout<<"2.水分<=0"<<endl<<endl<<endl;
Sleep(1145);
system("pause");
system("cls");
difficult_home();
}
else if(difficult_s==12){
kill_Boss();
}
else{
cout<<"输入错误"<<endl;
Sleep(1145);
system("pause");
system("cls");
difficult_home();
}
}
}
void easy_home(){
system("cls");
cout<<" -----------生存游戏Lv.1.0----------"<<endl;
cout<<" [这里有一片树林,一个矿洞和一个池塘]"<<endl;
cout<<"你可以做这些事:"<<endl;
cout<<"1.去树林砍树"<<endl;
cout<<"2.去矿洞挖矿石"<<endl;
cout<<"3.烧柴火取暖"<<endl;
cout<<"4.喝水"<<endl;
cout<<"5.去池塘取水"<<endl;
cout<<"6.制作武器"<<endl;
cout<<"7.显示自己的状态"<<endl;
cout<<"8.建造或升级房子"<<endl;
cout<<"9.建造或升级炮塔"<<endl;
cout<<"10.退出游戏"<<endl;
cout<<"11.关于游戏(游戏规则)"<<endl<<endl;
cout<<"请问你要干什么?(输入数字序号)" <<endl;
}
void easy_zaofang(){
system("cls");
if(level==0){
if(ch<75&&q<45){
cout<<"你的东西还不够造一级避难房!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
cout<<"建造一座一级避难房需75柴火,45金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>s;
Sleep(1000);
system("cls");
if(s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
level=1;
ch-=75;
q-=45;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else if(s==2) easy_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(level==1){
if(ch<100&&q<65){
cout<<"你的东西还不够造二级避难房!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
cout<<"从一级避难房升至二级避难房需100柴火,65金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>s;
Sleep(1000);
system("cls");
if(s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
level=2;
ch-=100;
q-=65;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else if(s==2) easy_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(level==2){
if(ch<150&&q<130){
cout<<"你的东西还不够造满级避难房!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
cout<<"从二级避难房升至满级避难房需150柴火,130金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>s;
Sleep(1000);
system("cls");
if(s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
level=3;
ch-=150;
q-=130;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else if(s==2) easy_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else{
cout<<"你的已经是满级,不能再升级了!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
void easy_zaopaota(){
system("cls");
if(LV==0){
if(ch<75&&q<45){
cout<<"你的东西还不够造一级炮塔!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
cout<<"建造一座一级炮塔需75柴火,45金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>s;
Sleep(1000);
system("cls");
if(s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
LV=1;
ch-=75;
q-=45;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else if(s==2) easy_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(LV==1){
if(ch<100&&q<65){
cout<<"你的东西还不够造二级炮塔!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
cout<<"从一级炮塔升至二级炮塔需100柴火,65金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>s;
Sleep(1000);
system("cls");
if(s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
LV=2;
ch-=100;
q-=65;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else if(s==2) easy_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(LV==2){
if(ch<150&&q<130){
cout<<"你的东西还不够造满级炮塔!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
cout<<"从二级炮塔升至满级炮塔需150柴火,130金矿,你确定吗?"<<endl;
cout<<"1.确定,拜托造一个吧"<<" "<<"2.不了,我再考虑一下"<<endl<<endl;
cin>>s;
Sleep(1000);
system("cls");
if(s==1){
cout<<"建造中,请稍等......"<<endl;
Sleep(5000);
cout<<"建造成功!";
LV=3;
ch-=150;
q-=130;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else if(s==2) easy_home();
else{
cout<<"输入错误!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else{
cout<<"你的避难房已经是满级,不能再升级了!"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
void easy_m(){
system("cls");
cout<<"你一共可以制作下列武器:"<<endl;
cout<<"1.木剑 消耗10柴火 伤害+10"<<endl;
cout<<"2.木甲 消耗15柴火 防御+10"<<endl;
cout<<"3.金剑 消耗10金矿 伤害+25"<<endl;
cout<<"4.金甲 消耗15金矿 防御+25"<<endl;
cout<<"5.木金剑 消耗20柴火和20金矿 伤害+45"<<endl;
cout<<"6.木金甲 消耗35柴火和35金矿 防御+45"<<endl;
cout<<"7.至尊之剑 消耗40柴火和45金矿 伤害和防御各加75"<<endl;
cout<<"8.返回"<<endl<<endl;
cout<<"你想制作:"<<endl;
int b;
cin>>b;
if(b==1){
if(ch<10){
cout<<"柴火不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else{
cout<<"制作成功!伤害+10"<<endl;
w-=0.1;
g+=10;
ch-=10;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(b==2){
if(ch<14){
cout<<"柴火不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else{
cout<<"制作成功!防御+10"<<endl;
w-=0.1;
f+=10;
ch-=15;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(b==3){
if(q<10){
cout<<"金矿不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else{
cout<<"制作成功!伤害+25"<<endl;
w-=0.1;
g+=25;
q-=10;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(b==4){
if(q<14){
cout<<"金矿不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else{
cout<<"制作成功!防御+25"<<endl;
w-=0.1;
f+=25;
q-=15;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(b==5){
if(ch<19||q<19){
cout<<"材料不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else{
cout<<"制作成功!伤害+45"<<endl;
w-=0.1;
g+=45;
ch-=20;
q-=20;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(b==6){
if(ch<34||q<34){
cout<<"材料不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else{
cout<<"制作成功!防御+45"<<endl;
w-=0.1;
f+=45;
ch-=35;
q-=35;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(b==7){
if(ch<39||q<44){
cout<<"材料不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else{
cout<<"制作成功!伤害和防御+75"<<endl;
w-=0.2;
g+=75;
f+=75;
ch-=40;
q-=45;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(b==8){
system("pause");
system("cls");
easy_home();
}
else{
cout<<"输入错误"<<endl;
system("pause");
system("cls");
easy_home();
}
}
void easy_kill(){
cout<<"Game over!"<<endl;
cout<<"是否继续,若继续,将恢复至游戏初始设置?(y/n)"<<endl;
char kk;
cin>>kk;
if(kk=='Y'||kk=='y'){
w=36.7;
x=100;
g=10;
f=0;
kan=0;
xk=0;
ch=0;
q=0;
a=0;
sf=100;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else{
Sleep(1145);
system("cls");
return;
}
}
void game_easy_start(){
while(1){
easy_home();
if(sf<=10&&sf>1){
MessageBoxA(NULL, "注意:水分<=10,请尽快补水防止渴死", "注意",MB_OK);
system("cls");
easy_home();
}
else if(sf<=0){
MessageBoxA(NULL, "你被渴死了", "",MB_OK);
Sleep(1145);
system("cls");
easy_kill();
}
if(w<=36&&w>35.1){
MessageBoxA(NULL, "注意:体温小于36℃,请去生火防止冻死", "注意",MB_OK);
system("cls");
easy_home();
}
else if(w<=35){
MessageBoxA(NULL, "你被冻死了", "",MB_OK);
Sleep(1145);
system("cls");
easy_kill();
}
if(ch>=50&&q>=50&&LV==3&&level==3&&g>=50&&f>=50){
cout<<"恭喜你生存成功!"<<endl;
Sleep(1145);
system("pause");
system("cls");
system("color 6E");
cout<<"You Win!"<<endl;
Sleep(1145);
system("pause");
cout<<"即将进入下一难度!"<<endl;
Sleep(1145);
system("pause");
system("cls");
system("color 0F");
gamelevel++;
difficult_home();
}
cin>>s;
if(s==1){
system("cls");
if(kan<=5000){
cout<<"砍到了一块柴火"<<endl;
w-=0.1;
kan++;
ch++;
sf--;
system("pause");
system("cls");
easy_home();
}
else{
cout<<"树被砍光了";
system("pause");
system("cls");
easy_home();
}
}
else if(s==2){
system("cls");
cout<<"正在挖矿......"<<endl;
w-=0.2;
if(xk==0){
Sleep(1000);
cout<<"得到了2块金矿"<<endl;
xk++;
sf-=3;
q+=2;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else if(xk>0&&xk<4000){
Sleep(1000);
cout<<"得到了一块金矿"<<endl;
xk++;
q++;
sf-=2;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else if(xk>=4000){
cout<<"这里的矿被你挖完了"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
else if(s==3){
system("cls");
if(ch<=5){
cout<<"柴火不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else{
cout<<"取暖中......"<<endl;
Sleep(1145);
cout<<"你用6根柴火取暖,体温+3℃"<<endl;
sf-=5;
w+=3;
cout<<"你现在的体温:"<<w<<"℃"<<endl;
if(w>=38&&w<40){
Sleep(1145);
cout<<"你感受到了热,发烧了."<<endl;
Sleep(1145);
system("pause");
system("cls");
easy_home();
}
else if(w>=40){
Sleep(1145);
cout<<"你被热死了"<<endl;
Sleep(1145);
system("pause");
system("cls");
Sleep(1145);
easy_kill();
}
else{
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
}
}
else if(s==4){
system("cls");
if(a==0){
cout<<"水不够"<<endl;
Sleep(1000);
system("pause");
system("cls");
easy_home();
}
else{
cout<<"正在喝水......"<<endl;
if(a>0&&a<=10){
Sleep(1000);
cout<<"水分+10"<<endl;
sf+=10;
if(sf>=100) sf=100;
system("pause");
system("cls");
easy_home();
}
else{
Sleep(1000);
cout<<"水分+20"<<endl;
sf+=20;
if(sf>=100) sf=100;
system("pause");
system("cls");
easy_home();
}
}
}
else if(s==5){
system("cls");
cout<<"取水中......"<<endl;
cout<<"得到了水x1"<<endl;
a++;
system("pause");
system("cls");
easy_home();
}
else if(s==6){
system("cls");
easy_m();
}
else if(s==7){
system("cls");
cout<<"你的状态如下:"<<endl<<endl;
cout<<"你的水分为:"<<sf<<endl;
cout<<"你的血量为:"<<x<<endl;
cout<<"你的攻击力为:"<<g<<endl;
cout<<"你的防御力为:"<<f<<endl;
cout<<"你的砍树次数为:"<<kan<<endl;
cout<<"你的下矿次数为:"<<xk<<endl;
cout<<"你的柴火数量为:"<<ch<<endl;
cout<<"你的金矿数量为:"<<q<<endl;
cout<<"你的水的数量为:"<<a<<endl;
cout<<"你的体温为:"<<w<<endl;
system("pause");
system("cls");
easy_home();
}
else if(s==8){
easy_zaofang();
}
else if(s==9){
easy_zaopaota();
}
else if(s==10){
MessageBoxA(NULL, "游戏已安全退出", "",MB_OK);
system("cls");
return ;
}
else if(s==11){
system("cls");
cout<<"游戏规则:"<<endl;
cout<<"1.去树林砍树:体温-0.1℃,木头数量+1,水分-1"<<endl;
cout<<"2.去矿洞挖矿石:若下矿次数为0(第一次下矿),则金块数量+2,水分-3;否则,金块数量+2,水分-2"<<endl;
cout<<"3.烧柴火取暖:柴火至少6个,每一次取暖水分-3、体温+3,若体温>=37℃且<40℃,则发烧;若体温>=40℃,则热死"<<endl;
cout<<"4.喝水:若水有1~10个,水分+10;若水有10个以上,水分+20"<<endl;
cout<<"5.去池塘取水:每次取1个水"<<endl<<endl;
cout<<"死亡条件:"<<endl;
cout<<"1.若体温<=35℃或高于40℃"<<endl;
cout<<"2.水分<=0"<<endl<<endl<<endl;
Sleep(1145);
system("pause");
system("cls");
easy_home();
}
else{
cout<<"输入错误"<<endl;
Sleep(1145);
system("pause");
system("cls");
easy_home();
}
}
}
void C_game(){
system("pause");
system("cls");
cout<<"游戏即将开始..."<<endl;
Sleep(2500);
system("cls");
srand((long long)time (0));
game_easy_start();
}
int main(){
C_game();
return 0;
}
这里空空如也



















有帮助,赞一个