只有粉丝可见 游戏 秘密世界 C++

粉丝点个赞,超过10个赞,写下一篇

#include<bits/stdc++.h>
#include<windows.h>
#include<cstdio>
#include <time.h>
#include<iostream>
#include<conio.h>
#define HD 29
using namespace std;
int hp=100,bsd=100,water=100,nl=100;
bool han=0;int fire=0;
//                      1      2     3      4        5       6        7        8      9     10     11     12     13         14        15    16     17    18    19       20       21     22      23      24      25    26      27     28     29 
string name[100]={"0","木条","木板","石头","碎石","平滑石","捕鱼笼","捕兽夹","苹果","浆果","皮毛","生肉","熟肉","木桶","装有水的木桶","船","火把","藤蔓","弓","石剑","地图碎片","地图","磁石","指南针","石斧","生鱼","熟鱼","金币","铁锭","金锭"};
int num[100];
///
int animal;//是否探索到野兽小径 1探索到了 0没有探索到
/
int berry;//是否探索到浆果地 1探索到了 0没有探索到
int berry_time=10;
int YNberry;//berry_time:浆果的状态berry_time>=10时浆果成熟   YNberry:浆果是否种植1种植了0没种植 

int brook;//是否探索到小溪   1探索到了 0没探索到
int fcageplace;//捕鱼笼数量(已放置)
int acageplace;//捕兽夹数量(已放置)
int YNcatchfish;//是否捕到鱼(大于等于10时,每个捕鱼笼有几率获得3~6条鱼)
int YNcatchanimal;//是否捕到野兽(大于等于20时,每个捕鱼笼有几率获得3~5块肉)
///
int hand[100];
int YNenergy=1;
int fmenu=1;
char choose;
/
void print(char a[]);
void juqin();
void login();
void home();
void bag();
void table();
void gotable();
void goberry();
void gobrook();
void goanimal();
void main_menu();
void empty();
//
int main(){
//  for(int i=1;i<=HD;i++){
//      hand[i]=100;
//  }
//  han=1;
    srand(time(NULL));
    system("color 0E");
    system("MODE CON COLS=30 LINES=10");
    srand(time(NULL));
    system("title 秘境");
    cout<<"剧情?输入1:\n";
    int t;
    cin>>t;
    if(t==1)juqin();
    system("cls");
    print("    秘境");
    print("huaxuanwu传奇出品");
    system("pause");
    system("cls");
    print("huaxuanwu出品");
    system("pause");
    login();
    system("MODE CON COLS=60 LINES=40");
    home();
    return 0;
}
void empty(){
    hp=bsd=water=nl=100;
    memset(num,0,sizeof(0));
    memset(hand,0,sizeof(0));
    han=fire=animal=berry=YNberry=brook=fcageplace=acageplace=YNcatchfish=YNcatchanimal=0;
    berry_time=10;
    for(int i=1;i<=HD;i++) num[i]=hand[i]=0;
}
void print(char a[]){
    for(int i=0;i<strlen(a);i++){
        Sleep(10);
        cout<<a[i];
    }
    cout<<endl;
}
void main_menu(){
    system("MODE CON COLS=30 LINES=15");
    while(1){
        system("cls");
        printf("            主菜单\n");
        if(fmenu==1){ 
            printf("         ------------\n");
            printf("         + 继续游戏 +\n");
            printf("         ------------");
        }else if(fmenu!=1){
            printf("\n           继续游戏\n");
        }
        if(fmenu==2){
            printf("         ------------\n");
            printf("         + 重开游戏 +\n");
            printf("         ------------\n");
        }else if(fmenu!=2){
            printf("\n           重开游戏\n");
        }
        choose=getch();
        if(choose=='w'){
            if(fmenu!=1) fmenu--; 
        }
        else if(choose=='s'){
            if(fmenu!=2) fmenu++;
        }else if(choose==' '){
            if(fmenu==1){
                return;
            }
            if(fmenu==2){
                //是 6 不是 7 
                if(MessageBox(NULL,"这将丢失你目前的存档,确定要重开游戏吗?","提示",MB_YESNO)==6){
                    empty();
                    return;
                }
            }
        }
    }
}
void home(){
    int time=0;
    while(1){
        YNenergy=0; 
        time++;
        system("cls");
        cout<<"现在是";
        if((time/12)%2==0)cout<<"白天"<<endl;
        else cout<<"黑夜"<<endl;
        cout<<"这是你被困在这里的第"<<time/24+1<<"天......"<<endl;
        cout<<"血量:"<<hp<<" "<<"饱食度:"<<bsd<<" "<<"口渴度:"<<water<<" "<<"耐力:"<<nl<<endl;
        if(berry_time>=10 && berry==1){
            cout<<"浆果已成熟!"<<endl;
        }
        if(YNcatchfish>=10 && brook==1){
            cout<<"捕鱼笼已捕到鱼!"<<endl;
        }
        if(YNcatchanimal>=20 && animal==1){
            cout<<"捕兽夹已捕到猎物!"<<endl;
        }
        if(fire==2)cout<<"火堆熊熊燃烧"<<endl;
        if(fire==1)cout<<"火堆燃烧着"<<endl;
        if(bsd<=50)cout<<"你感到很饿"<<endl;
        if(water<=50)cout<<"你感到很渴"<<endl;
        if(nl<=50)cout<<"你感到你需要休息一下"<<endl;
        if(han){
            printf("你拿出了:\n");
            for(int i=1;i<=HD;i++){
                if(hand[i]!=0) cout<<name[i]<<"X"<<hand[i]<<" ";
            }
            cout<<endl;
        }
        cout<<"0 返回主菜单"<<endl;
        if(han) cout<<"1 放回背包"<<endl; 
        cout<<"2 背包"<<endl;
        if(nl>=15) cout<<"3 收集"<<endl;
        if(nl>=10) cout<<"4 探索"<<endl;
        cout<<"5 休息"<<endl;
        if((time/12)%2!=0 && fire) cout<<"6 睡觉"<<endl;
        cout<<"7 查看合成表"<<endl; 
        if(nl>=10 && hand[1]>=8 && fire==0) cout<<"8 钻木取火"<<endl;
        if(hand[1]>=2 && fire>0) cout<<"9 加柴火"<<endl;
        if(hand[3]>=1 && nl>=10) cout<<"10 将石头摔成碎石"<<endl;
        if(nl>=5 && brook) cout<<"11 前往小溪"<<endl;
        if(berry && nl>=5) cout<<"12 前往浆果地"<<endl;
        cout<<"13 前往合成"<<endl;
        if(hand[3]>=1) cout<<"14 将石头烤成平滑石"<<endl;
        if(hand[9]>=1) cout<<"15 食用浆果(回复5口渴度,5饱食度)"<<endl;
        if(hand[25]>=1) cout<<"16 将生鱼烤成熟鱼"<<endl;
        if(hand[26]>=1) cout<<"17 吃熟鱼(回复8饱食度)"<<endl;
        if(hand[12]>=15 && hand[16]>=50 && nl>=30) cout<<"18 挖矿(花费15块熟肉,50根火把)"<<endl;
        if(animal==1 && nl>=5) cout<<"19 去野兽小径"<<endl; 
        if(hand[11]>=1) cout<<"20 将生肉烤成熟肉"<<endl;
        if(hand[12]>=1) cout<<"21 吃熟肉(回复12饱食度)"<<endl;
        if(hand[1]>=10 && fire>0) cout<<"22 点燃木条(10根)做成2根火把"<<endl;
        int t;
        cin>>t;
        if(t==0){
            main_menu();
            system("MODE CON COLS=60 LINES=40");
        }
        else if(t==1 && han){
            for(int i=1;i<=HD;i++) num[i]+=hand[i],hand[i]=0;
            han=0;
        }else if(t==2){
            bag();
        }else if(t==3 && nl>=15){
            system("cls");
            print("你到森林里收集了一点木条和石头");
            num[1]+=rand()%10;
            num[3]+=rand()%3;
            nl-=15;
            YNenergy=1;
            system("pause");
        }else if(t==4 && nl>=10){
            system("cls");
            int tsRand=rand()%100;
            if(tsRand>=11 && tsRand<=15 && brook==0){
                print("你发现了一条小溪");
                brook=1;
                system("pause");
            }else if(tsRand<=10 && berry==0){
                print("你发现了一片浆果地");
                berry=1;
                system("pause");
            }else if(tsRand>=16 && tsRand<=20 && animal==0){
                print("你发现了一条野兽小径");
                animal=1;
                system("pause"); 
            }else if(tsRand>20){
                print("你什么也没探索到");
                system("pause");
            }
            nl-=10; 
            YNenergy=1;
        }else if(t==5){
            system("cls");
            cout<<"休息中"<<endl;
            Sleep(5000); 
            cout<<"耐力+5"<<endl;
            nl+=5;
            if(nl>=100) nl=100;
            system("pause");
        }else if(t==6 && (time/12)%2!=0 && fire){
            system("cls");
            cout<<"z";
            Sleep(1000);
            cout<<"z";
            Sleep(1000);
            cout<<"z";
            Sleep(1000);
            system("cls");
            cout<<"z";
            Sleep(1000);
            cout<<"z";
            Sleep(1000);
            cout<<"z";
            Sleep(1000);
            time=24;
            nl=100;
        }else if(t==7){
            table();
        }else if(t==8 && nl>=10 && hand[1]>=8 && fire==0){
            nl-=10;
            system("cls");
            hand[1]-=8;
            fire++;
            print("火堆燃烧起来了");
            YNenergy=1;
            system("pause");
        }else if(t==9 && hand[1]>=2 && fire>0){
            system("cls");
            hand[1]-=2;
            fire++;
            print("火堆熊熊燃烧");
            system("pause");
        }else if(t==10 && hand[3]>=1 && nl>=10){
            nl-=10;
            hand[3]--;
            hand[4]+=rand()%3+1;
            YNenergy=1;
        }else if(t==11 && nl>=5 && brook){
            gobrook();
            nl-=5;
            YNenergy=1;
        }else if(t==12 && nl>=5 && berry==1){
            goberry();
            nl-=5;
            YNenergy=1;
        }else if(t==13){
            gotable();
        }else if(t==14 && hand[3]>=1){
            system("cls");
            print("烧烤中");
            Sleep(3000);
            hand[3]--;
            hand[5]++;
        }else if(t==15 && hand[9]>=1){
            hand[9]--;
            water+=5;
            bsd+=5;
            if(water>100) water=100;
            if(bsd>100) bsd=100;
        }else if(t==16 && hand[25]>=1){
            system("cls");
            print("烧烤中");
            Sleep(3000);
            hand[25]--;
            hand[26]++;
        }else if(t==17 && hand[26]>=1){
            hand[26]--;
            bsd+=8;
            if(bsd>=100) bsd=100;
        }else if(t==18 && hand[12]>=15 && hand[16]>=50 && nl>=30){
            hand[12]-=15;
            hand[16]-=50; 
            nl-=30;
            system("cls");
            print("挖掘中");
            Sleep(5000);
            hand[28]+=rand()%10+5;
            hand[29]+=rand()%5+3;
        }else if(t==19 && animal==1 && nl>=5){
            goanimal();
            nl-=5;
            YNenergy=1;
        }else if(t==20 && hand[11]>=1){
            system("cls");
            print("烧烤中");
            Sleep(3000);
            hand[11]--;
            hand[12]++;
        }else if(t==21 && hand[12]>=1){
            hand[12]--;
            bsd+=12;
            if(bsd>=100) bsd=100;
        }else if(t==22 &&  hand[1]>=10 && fire>0){
            system("cls");
            print("点燃中");
            Sleep(1500);
            hand[16]+=2;
            hand[1]-=10;
        }
        if(fcageplace>0) YNcatchfish++;
        if(acageplace>0) YNcatchanimal++;
        if(YNberry==1) berry_time++;
        if(YNenergy==1) bsd--,water--;
        han=0;for(int i=1;i<=26;i++){if(hand[i]!=0){han=1;break;}}
        if(hp<=0||bsd<=0||water<=0)break;
    }
    if(hp<=0||bsd<=0||water<=0){
        system("cls"); 
        print("你死了......");
        Sleep(3000);
        print("我就说没有人能活下来,呵呵......");
        Sleep(3000);
        system("cls"); 
        print("GAME OVER");
        Sleep(5000);
        return;
    }else{
        system("cls");
        print("你居然活了下来,呵呵......");
        Sleep(3000);
        system("cls"); 
        print("GAME OVER");
        Sleep(5000);
    }
    mama:exit(0);
}
void bag(){
    system("cls");
    while(1){
        system("cls");
        cout<<"0 返回|g a b 丢弃编号为a的物品b件|p a b拿出编号为a的物品b件"<<endl;
        for(int i=1;i<=HD;i++){
            if(num[i]==0)continue;
            cout<<i<<":"<<name[i]<<"X"<<num[i]<<" ";
            if(i%4==0)cout<<endl; 
        }
        cout<<endl;
        char a[2];
        scanf("%s",a);
        if(a[0]=='0')return;
        else if(a[0]=='g'){
            int x,y;
            scanf("%d%d",&x,&y);
            if(num[x]>=y)num[x]-=y;
        }
        else{
            han=1;
            int x,y;
            scanf("%d%d",&x,&y);
            if(num[x]>=y){
                hand[x]+=y;
                num[x]-=y;
            }
        }
    }
    login();
}
void login(){
    int t=0;
    while(t<100){
        system("cls");
        t++;
        cout<<"加载中 "<<t<<"%"<<endl;
        cout<<"■■■■□□□□□□"<<endl;
        Sleep(10);
        system("cls");
        t++;
        cout<<"加载中 "<<t<<"%"<<endl;
        cout<<"□■■■■□□□□□"<<endl;
        Sleep(10);
        system("cls");
        t++;
        cout<<"加载中 "<<t<<"%"<<endl;
        cout<<"□□■■■■□□□□"<<endl;
        Sleep(10);
        system("cls");
        t++;
        cout<<"加载中 "<<t<<"%"<<endl;
        cout<<"□□□■■■■□□□"<<endl;
        Sleep(10);
        system("cls");
        t++;
        cout<<"加载中 "<<t<<"%"<<endl;
        cout<<"□□□□■■■■□□"<<endl;
        Sleep(10);
        system("cls");
        t++;
        cout<<"加载中 "<<t<<"%"<<endl;
        cout<<"□□□□□■■■■□"<<endl;
        Sleep(10);
        system("cls");
        t++;
        cout<<"加载中 "<<t<<"%"<<endl;
        cout<<"□□□□□□■■■■"<<endl;
        Sleep(10);
        system("cls");
        t++;
        cout<<"加载中 "<<t<<"%"<<endl;
        cout<<"■□□□□□□■■■"<<endl;
        Sleep(10);
        system("cls");
        t++;
        cout<<"加载中 "<<t<<"%"<<endl;
        cout<<"■■□□□□□□■■"<<endl;
        Sleep(10);
        system("cls");
        t++;
        cout<<"加载中 "<<t<<"%"<<endl;
        cout<<"■■■□□□□□□■"<<endl;
        Sleep(20);
        //□■
    }
    system("cls");
    cout<<"加载中 "<<t<<"%"<<endl;
    cout<<"■■■■□□□□□□"<<endl;
    system("cls");
    cout<<"加载中 "<<t<<"%"<<endl;
    cout<<"■■■■■□□□□□"<<endl;
    system("cls");
    cout<<"加载中 "<<t<<"%"<<endl;
    cout<<"■■■■■■□□□□"<<endl;
    system("cls");
    cout<<"加载中 "<<t<<"%"<<endl;
    cout<<"■■■■■■■□□□"<<endl;
    system("cls");
    cout<<"加载中 "<<t<<"%"<<endl;
    cout<<"■■■■■■■■□□"<<endl;
    system("cls");
    cout<<"加载中 "<<t<<"%"<<endl;
    cout<<"■■■■■■■■■□"<<endl;
    system("cls");
    cout<<"加载中 "<<t<<"%"<<endl;
    cout<<"■■■■■■■■■■"<<endl;
    Sleep(1000);
    system("pause");
    system("cls");
}
void juqin(){
    system("cls");
    print("冒险者站在夕阳下......");
    Sleep(1000);
    print("他知道......");
    Sleep(1000);
    print("这不是他的传说......");
    Sleep(1000);
    system("cls");
    print("没人离开过这里......");
    Sleep(1000);
    print("我这是在哪儿?");
    Sleep(1000);
    print("一阵头痛袭来......");
    Sleep(1000);
    print("我好像,什么也不记得了......");
    Sleep(1000);
    system("cls");
    Sleep(1000);
    print("呵呵");
    Sleep(1000);
    system("cls");
    Sleep(1000);
}
void table(){
    system("cls");
    print("20个木条 5个平滑石 10个碎石 3个浆果 5个石头 合成 捕兽夹");
    print("15个木条 3个石头 3个平滑石 2个浆果 20个碎石 合成 捕鱼笼");
    print("3个平滑石 10个木条 合成 石斧");
    print("15个石头 5个平滑石 10根木条 合成 石剑");
    system("pause");
}
void gobrook(){
    system("cls"); 
    printf("哗哗哗");
    Sleep(1000);
    while(1){
        system("cls");
        print("0   返回");
        print("1.  喝水(回复10口渴度)");
        if(hand[6]>=1 && fcageplace<10) print("2   放置捕鱼笼");
        if(fcageplace>=1 && YNcatchfish>=10) print("3   查看捕鱼笼");
        ///
        int brookt;
        scanf("%d",&brookt);
        if(brookt==0){
            return;
        }
        if(brookt==1){
            system("cls");
            printf("咕嘟嘟");
            Sleep(5000);
            water+=10;
            if(water>100){
                system("cls");
                printf("口渴度满了\n");
                water=100;
                system("pause");
            }
        }
        //
        if(brookt==2){
            system("cls");
            if(hand[6]>=1 && fcageplace<10){
                hand[6]--;
                fcageplace++;
            }else if(hand[6]<1){
                system("cls");
                print("你还没有捕鱼笼!");
                system("pause"); 
            }else if(fcageplace==10){
                system("cls");
                print("捕鱼笼已满!");
                system("pause"); 
            }
        }
        if(brookt==3){
            system("cls");
            if(fcageplace>=1 && YNcatchfish>=10){
                hand[25]+=fcageplace*(rand()%2+1);
                YNcatchfish=0; 
            }else if(fcageplace<1){
                system("cls");
                print("你还未放置捕鱼笼!");
                system("pause");
            }else if(YNcatchfish<10){
                system("cls");
                print("捕鱼笼没有捕到东西!");
                system("pause");
            }
        }
    }
}
void gotable(){
    while(1){
        system("cls");
        print("0.  返回");
        if(hand[1]>=20 && hand[5]>=5 && hand[4]>=10 && hand[9]>=3 && hand[3]>=5){
            print("1.  合成捕兽夹"); 
        }
        if(hand[1]>=15 && hand[3]>=3 && hand[5]>=3 && hand[9]>=2 && hand[4]>=20){
            print("2.  合成捕鱼笼");
        }
        if(hand[1]>=10 && hand[5]>=3){
            print("3.  合成石斧");
        }
        if(hand[3]>=15 && hand[5]>=5 && hand[1]>=10){
            print("4.  合成石剑");
        }
        int tablet;
        scanf("%d",&tablet);
        if(tablet==0){
            return;
        }if(tablet==1){
            if(hand[1]>=20 && hand[5]>=5 && hand[4]>=10 && hand[9]>=3 && hand[3]>=5){
                hand[1]-=20;
                hand[5]-=5;
                hand[4]-=10;
                hand[9]-=3;
                hand[3]-=5;
                hand[7]++;
            }else if(hand[1]<15 || hand[3]<3 || hand[5]<3 || hand[9]<2 || hand[4]<20){
                system("cls");
                print("材料不足!");
                system("pause"); 
            }
        }
        if(tablet==2){
            if(hand[1]>=15 && hand[3]>=3 && hand[5]>=3 && hand[9]>=2 && hand[4]>=20){
                hand[1]-=15;
                hand[3]-=3;
                hand[5]-=3;
                hand[9]-=2;
                hand[4]-=20;
                hand[6]++;
            }else if(hand[1]<20 || hand[5]<5 || hand[4]<10 || hand[9]<3 || hand[3]<5){
                system("cls");
                print("材料不足!");
                system("pause"); 
            }
        }

        if(tablet==3){
            if(hand[1]>=10 && hand[5]>=3){
                hand[1]-=10;
                hand[5]-=3;
                hand[24]++; 
            }else if(hand[1]<10 || hand[5]<3){
                system("cls");
                print("材料不足!");
                system("pause"); 
            }
        }
        if(tablet==4){
            if(hand[3]>=15 && hand[5]>=5 && hand[1]>=10){
                hand[1]-=10;
                hand[5]-=5;
                hand[3]-=15;
                hand[19]++;
            }else if(hand[1]<15 || hand[5]<5 || hand[1]<10){
                system("cls");
                print("材料不足!");
                system("pause");
            }
        } 
    }
}
void goberry(){
    while(1){
        system("cls");
        print("0   返回");
        print("1.  采集浆果");
        print("2   种植浆果(花费5个浆果)");
        int berryt;
        scanf("%d",&berryt);
        if(berryt==0){
            return;
        }
        if(berryt==1){
            if(berryt==1 && berry_time>=10){
                hand[9]+=rand()%4+6;
                han=1;
                YNberry=0;
                berry_time=0;
            }else if(berry_time<10){
                system("cls");
                print("浆果地已经采集过了!");
                system("pause");
            }
        }else if(berryt==2){
            if(berryt==2 && YNberry==0 && hand[9]>=5){
                YNberry=1;
                hand[9]-=5;
            }else if(YNberry==1){
                system("cls");
                print("浆果地已经种植过了!");
                system("pause");
            }else if(hand[9]<5){
                print("浆果不够!");
            }
        }
    }
}
void goanimal(){
    while(1){
        system("cls");
        print("0  返回");
        if(hand[7]>=1 && acageplace<10) print("1  放置捕兽夹");
        if(acageplace>=1 && YNcatchanimal>=20) print("2  查看捕兽夹"); 
        
        int animalt;
        scanf("%d",&animalt);
        if(animalt==0){
            return;
        }
        /
        if(animalt==1){
            system("cls");
            if(acageplace==10){
                system("cls");
                print("捕兽夹已满!");
                system("pause"); 
            }else if(hand[7]>=1 && acageplace<10){
                hand[7]--;
                acageplace++;
            }else if(hand[7]<1){
                system("cls");
                print("你还没有捕兽夹!");
                system("pause"); 
            }
        }
        if(animalt==2){
            system("cls");
            if(acageplace>=1 && YNcatchanimal>=20){
                hand[11]+=acageplace*(rand()%2+2);
                YNcatchanimal=0;
            }else if(acageplace<1){
                system("cls");
                print("你还未放置捕兽夹!");
                system("pause");
            }else if(YNcatchanimal<20){
                system("cls");
                print("捕兽夹没有捕到东西!");
                system("pause");
            }
        }
    }
}

  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值