dos系统下的游戏~ 不断更新中

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stdlib.h>
#include<conio.h>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 100001
#define eps 1e-9
#include <windows.h>
int system(const char *string);
//system("CLS");
const int inf=0x7fffffff;   //无限大
int key;
string s;
char c;
int flag=1;
struct people
{
    string name;
    int handsome;
    int max_hp;
    int now_hp;
    int attack;
    int defence;
    int speed;
    int money;
    int good_hushi=0;
    string wife;
};

struct monster
{
    string name;
    int max_hp;
    int now_hp;
    int attack;
    int speed;
    int defence;
};
monster shilaimu;
struct time1
{
    int year;
    int month;
    int day;
};
time1 now;
people hero;

//pk
void pk(monster a)
{
    void meun();
    void hospital();
    system("CLS");
    Sleep(1000);
    printf("你在探险的时候遇上了");
    cout<<a.name<<endl;
    Sleep(1000);
    for(int i=0;;i++)
    {
        if(i%(1000-hero.speed)==0)
        {
            int miss=rand()%100;
            if(miss<30)
            {
                cout<<hero.name<<""<<a.name<<"使用了友颜破山拳!"<<endl;
                cout<<a.name<<"受到了"<<hero.attack+3-a.defence<<"的伤害"<<endl;
                a.now_hp=max(0,a.now_hp-hero.attack-3+a.defence);
                if(a.now_hp==0)
                    break;
                cout<<a.name<<"还有"<<a.now_hp<<"的生命值"<<endl;
                printf("\n\n\n\n");
                Sleep(2000);
            }
            else if(miss>90)
            {
                cout<<a.name<<"灵巧的闪避了"<<hero.name<<"的花拳绣腿"<<endl;
                printf("\n\n\n");
                Sleep(2000);
            }
            else
            {
                cout<<hero.name<<""<<a.name<<"使用了冲锋脚!"<<endl;
                cout<<a.name<<"受到了"<<hero.attack-a.defence<<"的伤害"<<endl;
                a.now_hp=max(0,a.now_hp-hero.attack+a.defence);
                if(a.now_hp==0)
                    break;
                cout<<a.name<<"还有"<<a.now_hp<<"的生命值"<<endl;
                printf("\n\n\n\n");
                Sleep(2000);
            }
        }
        if(i%(1000-a.speed)==0)
        {
            cout<<a.name<<""<<hero.name<<"摸了一下"<<endl;
            int shanghai=max(0,a.attack-hero.defence);
            cout<<hero.name<<"受到了"<<shanghai<<"的伤害"<<endl;
            hero.now_hp=max(0,hero.now_hp-shanghai);
            if(hero.now_hp==0)
                hospital();
            cout<<hero.name<<"还有"<<hero.now_hp<<"的生命值"<<endl;
            printf("\n\n\n");
            Sleep(2000);
        }
    }
    printf("哇,打败了");
    cout<<a.name<<endl;
    printf(",简直全身舒畅!\n");
    hero.attack++;
    hero.speed++;
    hero.defence++;
    Sleep(1000);
    printf("好累呀,我还是回去睡觉吧\n\n\n\n");
    Sleep(2000);
    meun();
}

//#-2
void begin0()
{
    shilaimu.name="史莱姆";
    shilaimu.max_hp=10;
    shilaimu.now_hp=10;
    shilaimu.attack=3;
    shilaimu.defence=1;
    shilaimu.speed=1;
}

//#-1
int start01()
{
    int flag1=1;
    system("CLS");
    Sleep(1000);
    printf("你确定要开始这个游戏吗?(Y/N)\n");
    now.year=2015;
    now.month=9;
    now.day=1;
    while(1)
    {
        key=getch();
        if(key=='N'||key=='n')
        {
            flag1=0;
            break;
        }
        if(key=='Y'||key=='y')
            break;
        printf("你是傻逼吗?叫你输入Y/N\n请重新输入(Y/N)\n");
    }
    return flag1;
}
//#0
void start0()
{
    Sleep(1000);
    printf("你叫什么名字?(请输入你的名字)\n");
    int flag=1;
    while(1){
        cin>>hero.name;
        printf("哦,你的名字是");
        cout<<hero.name<<""<<endl;
        Sleep(1000);
        printf("你确定吗?(Y/N)\n");
        while(1)
        {
            key=getch();
            if(key=='N'||key=='n')
            {
                break;
            }
            if(key=='Y'||key=='y')
            {
                flag=0;
                break;
            }
            printf("你是傻逼吗?\n请重新输入(Y/N)\n");
        }
        if(flag==0)
            break;
        printf("那就再输入你的名字吧\n");
    }
    hero.handsome=50;
    hero.max_hp=50;
    hero.now_hp=50;
    hero.attack=3;
    hero.defence=0;
    hero.speed=1;
    hero.money=50;
    hero.wife="0";
}


//#1
void start1()
{
    key=0;
    system("CLS");
    Sleep(2000);
    printf("呼,到了,这里就是梦寐以求的大学了。\n");
    Sleep(1000);
    printf("已经准备好度过接下来的四年大学时光了!\n\n\n\n");
    Sleep(1000);
    printf("(按C键继续)\n");
    while(1){
        key=getch();
        if(key=='C'||key=='c')
        {
            break;
        }
        else
        {
            Sleep(1000);
            printf("你是傻逼吗?叫你按C\n");
        }
    }
}
//#2_first_chose
void start2()
{
    key=0;
    system("CLS");
    Sleep(2000);
    printf("其实,当初填报志愿之所以会选择这所学校,还有一个特殊的原因的……\n\n\n\n\n");
    Sleep(2000);
    printf("1.这所学校是曾经单相思的男生的第一志愿\n");
    printf("2.这所学校的哲学气息浓厚\n");
    printf("3.这所学校拥有良好的校风和环境\n");
    printf("4.这所学校有愉快的社团文化\n\n\n");
    Sleep(1000);
    printf("请输入1234进行选择\n\n");
    while(1)
    {
        key=getch();
        if(key=='1')
        {
            hero.max_hp+=10;
            printf("没错,我");
            cout<<hero.name;
            printf("是个基佬……\n");
            Sleep(3000);
            break;
        }
        if(key=='2')
        {
            hero.attack+=1;
            printf("没错,我是个基佬……\n\n");
            Sleep(1000);
            printf("而这所学校,则是拥有深厚的哲♂学底蕴的学校!!\n");
            Sleep(1000);
            printf("毕竟男女比例7:1\n\n");
            Sleep(3000);
            break;
        }
        if(key=='3')
        {
            hero.defence+=1;
            printf("\n\n毕竟是一所理工科学校,哥是来学习的,绝逼不会搞基的!\n");
            Sleep(3000);
            break;
        }
        if(key=='4')
        {
            hero.speed+=1;
            printf("\n\n蛤蛤,动漫社我来了!!!\n");
            Sleep(1000);
            printf("\n听说这所学校有很多萌妹子!\n\n");
            Sleep(1000);
            printf("\n不过这所学校男女比例是1:7……\n");
            break;
        }
        Sleep(1000);
        printf("你是傻逼吗?叫你输入1234,你怎么这个都看不懂啊,菜鸡\n");

        Sleep(3000);
    }
}
void check()
{
    void meun();
    key=0;
    system("CLS");
    Sleep(2000);
    printf("你的名字:");
    cout<<hero.name<<endl;
    printf("你的魅力值:");
    cout<<hero.handsome<<endl;
    printf("你的生命值:");
    cout<<hero.now_hp<<"/";
    cout<<hero.max_hp<<endl;
    printf("你的攻击力:");
    cout<<hero.attack<<endl;
    printf("你的防御力:");
    cout<<hero.defence<<endl;
    printf("你的敏捷值:");
    cout<<hero.speed<<endl;
    printf("你的金钱数: ");
    cout<<hero.money<<endl;
    printf("你的配偶:");
    if(hero.wife=="0")
        printf("有个球配偶啊!\n");
    else
        cout<<hero.wife<<endl;

    Sleep(3000);
    printf("\n\n\n\n\n");
    printf("按B键,回到主菜单\n");
    while(1){
        key=getch();
        if(key=='B'||key=='b')
        {
            break;
        }
        else
        {
            Sleep(1000);
            printf("你是傻逼吗?叫你按B\n");
        }
    }
    meun();
}
void meun()
{
    void hospital();
    void tanxian();
    void gotoschool();
    void shop();
    key=0;
    system("CLS");
    Sleep(2000);
    if(now.day>30)
    {
        now.month++;
        now.day-=30;
        if(now.month>12)
        {
            now.month-=12;
            now.year+=1;
        }
    }
    cout<<"现在是"<<now.year<<""<<now.month<<""<<now.day<<""<<endl;
    printf("呼呼,你现在想干什么呢?\n\n\n\n");
    Sleep(1000);
    printf("1.查看自己属性\n");
    printf("2.探险\n");
    printf("3.上课\n");
    printf("4.去超市逛逛\n");
    printf("5.校医院\n");
    printf("\n\n\n\n请输入12345进行选择\n");
    while(1)
    {
        key=getch();
        if(key=='1')
        {
            check();
            break;
        }
        if(key=='2')
        {
            tanxian();
            break;
        }
        if(key=='3')
        {
            gotoschool();
            break;
        }
        if(key=='4')
        {
            shop();
            break;
        }
        if(key=='5')
        {
            hospital();
            break;
        }
        Sleep(3000);
        printf("叫你这个傻逼输入1234,你怎么就是不懂啊,你怎么这么菜鸡啊\n\n\n");
        Sleep(1000);
        printf("再给你个机会,输入1/2/3/4吧!\n\n");
    }
}
void bed_end()
{
    printf("胜败乃兵家常事,大侠还请重新来过\n\n\n\n");
    Sleep(3000);
    printf("(按C键重新游戏)\n");
    while(1){
        key=getch();
        if(key=='C'||key=='c')
        {
            break;
        }
        else
        {
            Sleep(1000);
            printf("你是傻逼吗?叫你按C\n");
        }
    }
}

void tanxian()
{
    key=0;
    system("CLS");
    printf("今天去哪儿呢?\n\n\n\n");
    int kiss=rand()%100;
    if(kiss<30)
    {
        Sleep(1000);
        pk(shilaimu);
    }
    else
    {
        Sleep(2000);
        printf("什么都没有发生诶!");
        Sleep(2000);
        now.day++;
        meun();
    }
    Sleep(3000);
    printf("今天就去后山吧!!\n");
    Sleep(2000);
    printf("惨了,遇到石头人了……\n");
    Sleep(2000);
    printf("我要挂了……怎么办\n");
    Sleep(2000);
    printf("呃!!!%…我挂了%……\n\n\n");
    Sleep(3000);
    bed_end();
}

void gotoschool()
{
    key=0;
    system("CLS");
    Sleep(3000);
    printf("好无聊……\n\n\n");
    Sleep(3000);
    printf("早知道,就不来上课的\n\n\n");
    Sleep(3000);
    meun();
}

void shop()
{
    key=0;
    system("CLS");
    if(hero.money<100)
    {
        printf("这么点钱也想来高贵的校园超市?给我滚。\n\n\n\n");
        Sleep(3000);
        meun();
    }
}

void meun1()
{
    key=0;
    system("CLS");
    Sleep(2000);
    printf("呼呼,终于进来了这个学校了,你现在想干什么呢?\n\n\n\n");
    Sleep(1000);
    printf("1.查看自己属性\n");
    printf("2.探险\n");
    printf("3.上课\n");
    printf("4.去超市逛逛\n");
    while(1)
    {
        key=getch();
        if(key=='1')
        {
            check();
            break;
        }
        if(key=='2')
        {
            tanxian();
            break;
        }
        if(key=='3')
        {
            gotoschool();
            break;
        }
        if(key=='4')
        {
            shop();
            break;
        }
        Sleep(3000);
        printf("叫你这个傻逼输入1234,你怎么就是不懂啊,你怎么这么菜鸡啊\n\n\n");
        Sleep(1000);
        printf("再给你个机会,输入1/2/3/4吧!\n\n");
    }
}

void hospital()
{
    void meun();
    system("CLS");
    if(hero.now_hp==0)
    {
        printf("护士姐姐:咦,这位小哥,怎么快挂了……\n");
        printf("好好休息一下吧\n\n");
        Sleep(1000);
        printf("于是,就这样,浑浑噩噩的睡过了两天\n\n");
        Sleep(2000);
        printf("不过好像,护士姐姐对你的好感度增加了诶.");
        hero.good_hushi+=2;
        now.day+=2;
        meun();
    }
    else
    {
        Sleep(2000);
        printf("护士姐姐:这位小哥,是来看病吗?(Y/N)\n\n\n");
        key=0;
        while(1){
        key=getch();
        if(key=='y'||key=='Y')
        {
            printf("护士姐姐:~\(≧▽≦)/~好呀好呀,你就睡一觉吧!\n\n");
            Sleep(2000);
            printf("于是,你就睡了一觉,让自己精力充沛了起来\n\n");
            Sleep(2000);
            printf("不过,护士姐姐貌似挺可爱的!\n");
            hero.good_hushi+=1;
            now.day+=1;
            hero.now_hp=hero.max_hp;
            Sleep(3000);
            meun();
        }
        else if(key=='n'||key=='N')
        {
            printf("护士姐姐:那你滚吧!滚回去和基友玩蛋去!");
            Sleep(3000);
            meun();
        }
        printf("叫你按y/n呀,你又调皮,护士姐姐对你的好感度降低了!");
        }
    }
}

int main()
{
    srand( (unsigned)time( NULL ) );
    if(start01()==1)
    while(1)
    {
        begin0();
        key=0;
        system("CLS");
        start0();
        start1();
        start2();
        meun1();
    }
    return 0;
}

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值