【游戏】钓鱼

· · 休闲·娱乐

本蒟蒻亲自肝了一周
希望大家多多支持
(有bug私信我)
不喜勿喷哦(QAQ)

#include <bits/stdc++.h>
#include<windows.h>
#include<ctime>
#include <cstdlib>
#include <thread>
#include <atomic>
#include <conio.h>
using namespace std;
#define inr long long
#define fi first
#define sr second
#define pb push_back
#define si size
int money=100000000;
string name;
map<string,int> bag,price,probability;
vector<string> v(13);
void zhunbei(){
    v[0]="泥鳅";
    v[1]="金鱼";
    v[2]="鮰鱼";
    v[3]="鳕鱼";
    v[4]="黄鳝";
    v[5]="金枪鱼";
    v[6]="甲鱼";
    v[7]="三文鱼";
    v[8]="电鳗";
    v[9]="鲨鱼";
    v[10]="鲸鱼";
    v[11]="变异远古鱼";
    v[12]="哥斯拉";

    bag["泥鳅"]=0;
    bag["金鱼"]=0;
    bag["鮰鱼"]=0;
    bag["鳕鱼"]=0;
    bag["黄鳝"]=0;
    bag["金枪鱼"]=0;
    bag["甲鱼"]=0;
    bag["三文鱼"]=0;
    bag["电鳗"]=0;
    bag["鲨鱼"]=0;
    bag["鲸鱼"]=0;
    bag["变异远古鱼"]=0;
    bag["哥斯拉"]=0;

    bag["面包"]=0;
    bag["饼干"]=0;
    bag["蚯蚓"]=0;
    bag["鱼饵"]=0;
    bag["专业鱼饵"]=0;
    bag["超级远古鱼饵"]=0;
    bag["核辐射鱼饵"]=0;


    price["泥鳅"]=5;
    price["金鱼"]=8;
    price["鮰鱼"]=13;
    price["鳕鱼"]=20;
    price["黄鳝"]=25;
    price["金枪鱼"]=30;
    price["甲鱼"]=35;
    price["三文鱼"]=50;
    price["电鳗"]=75;
    price["鲨鱼"]=300;
    price["鲸鱼"]=1000;
    price["变异远古鱼"]=5000;
    price["哥斯拉"]=500000;

    price["面包屑"]=0;
    price["面包"]=1;
    price["饼干"]=3;
    price["蚯蚓"]=5;
    price["鱼饵"]=10;
    price["专业鱼饵"]=20;
    price["超级远古鱼饵"]=50;
    price["核辐射鱼饵"]=200;

    probability["泥鳅"]=33330000;
    probability["金鱼"]=10000000;
    probability["鮰鱼"]=7500000;
    probability["鳕鱼"]=5000000;
    probability["黄鳝"]=2500000;
    probability["金枪鱼"]=1000000;
    probability["甲鱼"]=750000;
    probability["三文鱼"]=250000;
    probability["电鳗"]=100000;
    probability["鲨鱼"]=75000;
    probability["鲸鱼"]=10000;
    probability["变异远古鱼"]=2500;
    probability["哥斯拉"]=100;
    probability["作者"]=1;
}
void egg1(){
    system("cls");
    cout<<"啊?你钓到了作者?"<<endl;
    Sleep(1700);
    cout<<"这可是一亿分之一的概率!!!"<<endl;
    Sleep(2000);
    cout<<"作者的qq号:3789653908"<<endl;
    Sleep(2000);
    cout<<"愣着干啥,快点记啊!!"<<endl;
    cout<<"记好了输入一个数字"<<endl;
    int x;
    cin>>x;
    return;
}
void _(){
    cout<<"(输数字!!!)"<<endl;
}
void diaoyu2(map<string,int> a){
    while(1){
        system("cls");
        cout<<"你要用什么鱼饵???"<<endl;
        cout<<"1,面包屑(免费,有无限)"<<endl;
        cout<<"2,面包(你拥有"<<bag["面包"]<<"个)"<<endl;
        cout<<"3,饼干(你拥有"<<bag["饼干"]<<"个)"<<endl;
        cout<<"4,蚯蚓(你拥有"<<bag["蚯蚓"]<<"个)"<<endl;
        cout<<"5,鱼饵(你拥有"<<bag["鱼饵"]<<"个)"<<endl;
        cout<<"6,专业鱼饵(你拥有"<<bag["专业鱼饵"]<<"个)"<<endl;
        cout<<"7,超级远古鱼饵(你拥有"<<bag["超级远古鱼饵"]<<"个)"<<endl;
        cout<<"8,核辐射鱼饵(你拥有"<<bag["核辐射鱼饵"]<<"个)"<<endl;
        cout<<"9,退出"<<endl;
        _();
        int x;
        cin>>x;
        if(x==9)return;
        if(x==1){
            cout<<"好的"<<endl;
        }
        else if(x==2){
            if(bag["面包"]<=0){
                cout<<"你没有这个"<<endl;
                return;
            }
            else{
                cout<<"好的"<<endl;
                for(int i=0;i<13;i++){
                    a[v[i]]+=5;
                }
                bag["面包"]-=1;
            }
        }
        else if(x==3){
            if(bag["饼干"]<=0){
                cout<<"你没有这个"<<endl;
                return;
            }
            else{
                cout<<"好的"<<endl;
                for(int i=0;i<13;i++){
                    a[v[i]]+=50;
                }
                bag["饼干"]-=1;
            }
        }
        else if(x==4){
            if(bag["蚯蚓"]<=0){
                cout<<"你没有这个"<<endl;
                return;
            }
            else{
                cout<<"好的"<<endl;
                for(int i=0;i<13;i++){
                    a[v[i]]+=150;
                }
                bag["蚯蚓"]-=1;
            }
        }
        else if(x==5){
            if(bag["鱼饵"]<=0){
                cout<<"你没有这个"<<endl;
                return;
            }
            else{
                cout<<"好的"<<endl;
                for(int i=0;i<13;i++){
                    a[v[i]]+=5000;
                }
                bag["鱼饵"]-=1;
            }
        }
        else if(x==6){
            if(bag["专业鱼饵"]<=0){
                cout<<"你没有这个"<<endl;
                return;
            }
            else{
                cout<<"好的"<<endl;
                for(int i=0;i<13;i++){
                    a[v[i]]+=15000;
                }
                bag["专业鱼饵"]-=1;
            }
        }
        else if(x==7){
            if(bag["超级远古鱼饵"]<=0){
                cout<<"你没有这个"<<endl;
                return;
            }
            else{
                cout<<"好的"<<endl;
                for(int i=0;i<13;i++){
                    a[v[i]]+=300000;
                }
                a["变异远古鱼"]+=300000;
                bag["超级远古鱼饵"]-=1;
            }
        }
        else if(x==8){
            if(bag["核辐射鱼饵"]<=0){
                cout<<"你没有这个"<<endl;
                return;
            }
            else{
                cout<<"好的"<<endl;
                for(int i=0;i<13;i++){
                    a[v[i]]+=350000;
                }
                a["哥斯拉"]+=300000;
                bag["核辐射鱼饵"]-=1;
            }
        }
        int cnt=0;
        long long num = (long long)rand() * (RAND_MAX + 1LL) + rand();
        num=num% 100000001;
        cout<<"钓鱼中......"<<endl;
        Sleep(5000);
        if(num==99999999){
            egg1();
            continue;
        }
        bool f=0;
        int z=-1;
        for(int i=0;i<13;i++){
            if(num>=cnt&&num<(cnt+a[v[i]])){
                z=i;
                num=i;
                bag[v[i]]++;
                f=1;
            }
            cnt+=a[v[i]];
        }
        if(f==0){
            cout<<"是一个垃圾"<<endl;
            Sleep(2000);
        }
        else{
            cout<<"你钓到了"<<v[z]<<endl;
            Sleep(2000);
        }
    }
}
void diaoyu1(){
    system("cls");
    cout<<"你要去哪个钓鱼场呢"<<endl;
    cout<<"1,小池塘(门票:0)"<<endl;
    cout<<"2,景区人工湖(门票:50)"<<endl;
    cout<<"3,专业钓鱼场(门票:200)"<<endl;
    cout<<"4,远古遗迹渔场(门票:500)"<<endl;
    cout<<"5,核电站(门票:1000)"<<endl;
    _();
    int q[5]={0,50,200,500,1000};
    map<string,int> a;
    a=probability;
    int x;
    cin>>x;
    if(x==1){
        system("cls");
        cout<<"你来到了小池塘"<<endl;
        Sleep(2000);
        diaoyu2(a);
    }
    else if(x==2){
        if(money>=50){
            cout<<"你花费50元,来到了景区人工湖"<<endl;
            money-=q[1];
            a["泥鳅"]=10000000;
            a["金鱼"]+=10000000;
            a["鮰鱼"]+=2500000;
            a["鳕鱼"]+=5000000;
            a["黄鳝"]+=2500000;
            Sleep(2000);
            diaoyu2(a);
        }
        else{
            cout<<"你现有"<<money<<"元,不够!!!"<<endl;
            Sleep(2000);
        }
    }
    else if(x==3){
        if(money>=200){
            cout<<"你花费200元,来到了专业钓鱼场"<<endl;
            money-=200;
            a["泥鳅"]=5000000;
            a["金鱼"]=5000000;
            a["黄鳝"]+=5000000;
            a["金枪鱼"]+=1000000;
            a["甲鱼"]+=1200000;
            a["三文鱼"]+=50000;
            Sleep(2000);
            diaoyu2(a);
        }
        else{
            cout<<"你现有"<<money<<"元,不够!!!"<<endl;
            Sleep(2000);
        }
    }
    else if(x==4){
        if(money>=500){
            cout<<"你花费500元,来到了远古遗迹渔场"<<endl;
            money-=500;
            a["泥鳅"]=5000000;
            a["金鱼"]=5000000;
            a["黄鳝"]=5000000;
            a["金枪鱼"]=5000000;
            a["甲鱼"]+=5000000;
            a["三文鱼"]+=1000000;
            a["电鳗"]+=50000;
            a["鲨鱼"]+=1000000;
            a["鲸鱼"]+=500000;
            a["变异远古鱼"]+=10000;
            Sleep(2000);
            diaoyu2(a);
        }
        else {
            cout<<"你现有"<<money<<"元,不够!!!"<<endl;
            Sleep(2000);
        }
    }
    else if(x==5){
        if(money>=1000){
            cout<<"你花费1000元,来到了核电站"<<endl;
            money-=1000;
            a["泥鳅"]=0;
            a["金鱼"]=0;
            a["黄鳝"]=5000000;
            a["金枪鱼"]=5000000;
            a["甲鱼"]+=5000000;
            a["三文鱼"]+=1000000;
            a["电鳗"]+=50000;
            a["鲨鱼"]+=1000000;
            a["鲸鱼"]+=500000;
            a["变异远古鱼"]+=10000;
            a["哥斯拉"]+=10000;
            Sleep(2000);
            diaoyu2(a);
        }
        else {
            cout<<"你现有"<<money<<"元,不够!!!"<<endl;
            Sleep(2000);
        }
    }
    else{
        cout<<"输入无效"<<endl;
        Sleep(2000);
        _();
    }
}
void beibao(){
    system("cls");
    cout<<"金钱:"<<money<<endl;
    cout<<"___________________"<<endl;
    cout<<"鱼类:"<<endl;
    for(int i=0;i<13;i++){
        cout<<v[i]<<":"<<bag[v[i]]<<endl;
    }
    cout<<"___________________"<<endl;
    cout<<"鱼饵:"<<endl;
    cout<<"面包:"<<bag["面包"]<<"个"<<endl;
    cout<<"饼干:"<<bag["饼干"]<<"个"<<endl;
    cout<<"蚯蚓:"<<bag["蚯蚓"]<<"个"<<endl;
    cout<<"鱼饵:"<<bag["鱼饵"]<<"个"<<endl;
    cout<<"专业鱼饵:"<<bag["专业鱼饵"]<<"个"<<endl;
    cout<<"超级远古鱼饵:"<<bag["超级远古鱼饵"]<<"个"<<endl;
    cout<<"核辐射鱼饵:"<<bag["核辐射鱼饵"]<<"个"<<endl;
    cout<<"___________________"<<endl;
    cout<<"输入任意数退出"<<endl;
    int x;
    cin>>x;
}
void yuju(){
    system("cls");
    cout<<"你要买什么?"<<endl;
    cout<<"1,面包(1元一个)"<<endl;
    cout<<"2,饼干(3元一个)"<<endl;
    cout<<"3,蚯蚓(5元一个)"<<endl;
    cout<<"4,鱼饵(10元一个)"<<endl;
    cout<<"5,专业鱼饵(20元一个)"<<endl;
    cout<<"6,超级远古鱼饵(50元一个)"<<endl;
    cout<<"7,核辐射鱼饵(200元一个)"<<endl;
    cout<<"8,退出"<<endl;
    _();
    int x;
    cin>>x;
    if(x==8)return;
    cout<<"你要买几个?"<<endl;
    int y;
    cin>>y;
    if(x==1){
        if(money<y){
            cout<<"钱不够"<<endl;
            Sleep(2000);
            return ;
        }
        else{
            money-=y;
            bag["面包"]+=y;
            cout<<"Ok"<<endl;
            Sleep(2000);
            return;
        }
    }
    if(x==2){
        if(money<y*3){
            cout<<"钱不够"<<endl;
            Sleep(2000);
            return ;
        }
        else{
            money-=y*3;
            bag["饼干"]+=y;
            cout<<"Ok"<<endl;
            Sleep(2000);
            return;
        }
    }
    if(x==3){
        if(money<y*5){
            cout<<"钱不够"<<endl;
            Sleep(2000);
            return ;
        }
        else{
            money-=y*5;
            bag["蚯蚓"]+=y;
            cout<<"Ok"<<endl;
            Sleep(2000);
            return;
        }
    }
    if(x==4){
        if(money<y*10){
            cout<<"钱不够"<<endl;
            Sleep(2000);
            return ;
        }
        else{
            money-=y*10;
            bag["鱼饵"]+=y;
            cout<<"Ok"<<endl;
            Sleep(2000);
            return;
        }
    }
    if(x==5){
        if(money<y*20){
            cout<<"钱不够"<<endl;
            Sleep(2000);
            return ;
        }
        else{
            money-=y*20;
            bag["专业鱼饵"]+=y;
            cout<<"Ok"<<endl;
            Sleep(2000);
            return;
        }
    }
    if(x==6){
        if(money<y*50){
            cout<<"钱不够"<<endl;
            Sleep(2000);
            return ;
        }
        else{
            money-=y*50;
            bag["超级远古鱼饵"]+=y;
            cout<<"Ok"<<endl;
            Sleep(2000);
            return;
        }
    }
    if(x==7){
        if(money<y*200){
            cout<<"钱不够"<<endl;
            Sleep(2000);
            return ;
        }
        else{
            money-=y*200;
            bag["核辐射鱼饵"]+=y;
            cout<<"Ok"<<endl;
            Sleep(2000);
            return;
        }
    }
}
void maiyu(){
    system("cls");
    for(int i=0;i<13;i++){
        cout<<i+1<<","<<v[i]<<":"<<bag[v[i]]<<endl;
    }
    cout<<endl;
    cout<<"价目表:"<<endl;
    for(int i=0;i<13;i++){
        cout<<v[i]<<":"<<price[v[i]]<<"元"<<endl;
    }
    cout<<"你要卖哪个?"<<endl;
    int x;
    cin>>x;
    x-=1;
    cout<<"卖几个?"<<endl;
    int y;
    cin>>y;
    if(bag[v[x]]<y){
        cout<<"你的鱼不够!!"<<endl;
        Sleep(2000);
        return;
    }
    else {
        cout<<"好的"<<endl;
        cout<<y*price[v[x]]<<"元已到账"<<endl;
        money+=y*price[v[x]];
        bag[v[x]]-=y;
        Sleep(2000);
        return ;
    }
}
void dating(){
    while(1){
        system("cls");
        cout<<"钓鱼佬"<<name<<",欢迎"<<endl;
        cout<<"你要去哪呢?"<<endl;
        cout<<"1,出发钓鱼"<<endl;
        cout<<"2,查看背包"<<endl;
        cout<<"3,渔具商店"<<endl;
        cout<<"4,鲜鱼市场"<<endl;
        cout<<"5,回家(退出)"<<endl;
        _();
        int x;
        cin>>x;
        if(x==1)diaoyu1();
        else if(x==2)beibao();
        else if(x==3)yuju();
        else if(x==4)maiyu();
        else if(x==5)exit(0);
        else{
            cout<<"输入无效,请重新输入"<<endl;
            Sleep(3000);
        }

    }

}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    srand(time(0));
    zhunbei();
    cout<<"欢迎来到《钓鱼》"<<endl;
    cout<<"作者:tomyyf"<<endl;
    cout<<"luogu:1367443"<<endl;
    Sleep(4000);
    cout<<"你叫什么名字?"<<endl;
    cin>>name;
    cout<<"嗯,不错的名字"<<endl;
    Sleep(1500);
    cout<<"你跟我来吧"<<endl;
    Sleep(1500);
    dating();
    return 0;
}