人生之路小游戏代码3。。。

点我查看全部代码

二十多万字,每篇两万多,大概十篇吧。。。

void home()
{
    const string where[]={"做作业(+XP)","看书(+XP)","睡觉(回满精力)","冥想(+IQ)","吃饭(+饱食度,+水分)","查看状态","查看背包","存档","设置","返回"}; 
    int i,j,k,n,m;
    things[25]++;
    while(1)
    {
      if (things[7]>=1000000)
        hdcj(17);
      system("cls");
      char l;
      if (things[188]==1)
        l=choose(1)+'0';
    else
      {
      cout<<"这里是你的家,充满着温馨和你珍贵的回忆\n";
      cout<<"按下序号,实现功能\n";
      for(i=0;i<10;i++)
        printf("%d.%s\n",i,where[i].c_str());
      l=_getch();
      }
      cls();
      switch(l)
        {
            case '0':
                cls();
                use(9);
                tepan();
                things[8]-=5;
                system("cls");
                Sout("1+1==2");
                jdt(7);
                gs();
                Sout("你的XP增加了!");
                things[1]+=5;
                sheng();break;
            case '1':cls();
                use(10);
                tepan();
                things[8]-=5;
                system("cls");
                Sout("苟利国家生死以,岂因祸福避趋之~");
                jdt(6);
                gs();
                Sout("你的XP增加了!");
                things[1]+=10;
                if (things[1]>=sj[things[9]])
                  things[9]++,cout<<"你升级了!";break;
            case '2':cls();
                hdcj(38);
                use(11);
                Sout("多么一个舒适的好觉啊!你的精力已经回满!(水分-10 饱食-10)");
                things[16]++;
                things[97]=rand()%400+100;
                    things[93]+=things[93]*float(things[97]/100000.0);
                things[3]-=10,things[4]-=10,things[8]=100;
                gs();
                    things[187]=random(1,10);
                    switch(things[187])
                      {
                        case 1:Sout("天气预报:今日雷暴天气,不宜出行");break;
                        case 2:Sout("新闻:小森林传来不明怪叫声,专家称可能是一种叫树妖的生物发出的。树妖是一种由枯死的树木变成的怪物,异常凶猛");break;
                        case 3:Sout("娱乐新闻:今日有一算命先生称我市市民"+name+"会事事不顺,该算命先生已被逮捕");break;
                        case 4:Sout("你的眼前好像出现了一个黑影,你正想仔细看,他却不见了,你发现你还是在睡觉的位置");break;
                        case 5:Sout("特大新闻,特大新闻:我市银行遭犯罪分子抢劫,损失惨重。据银行人员说他们会尽力减少广大市民们的损失");things[93]*=(random(72,100)/100.0);break;
                        default:Sout("天亮了,又是美好的一天");break;
                      }
                    Sleep(3000);
                    gs();
                break;
            case '3':cls();
                use(12);
                tepan();
                things[8]-=5;
                things[1]+=10;
                jdt(6);
                sheng();break;
            case '4':cls();
                use(13);
                tepan();
                things[8]-=5;
                Sout(name+":嗯。。。真香!");
                jdt(6);
                Sout("饱食度,水分已回满!");
                things[3]=50,things[4]=50;break;
            case '5':cls();
                {
                use(14);
                const string w[]=
                {"关卡进度:",
                "经验值:",
                "健康值:",
                "水分:",
                "饱食度:",
                "攻击力:",
                "防御力:",
                "零花钱:",
                "精力:",
                "等级:",
                "年龄:",
                };
                string nan[5]={"","简单模式","中等模式","困难模式","炼狱模式"};
                string xs[2]={"文字","图像"};
                cout<<"姓名:"<<name<<'\n';
                for(i=0;i<=10;i++)
                if (i==1)
                  printf("%s%d/%lld\n",w[i].c_str(),things[i],sj[things[9]+1]);
                else
                  printf("%s%d\n",w[i].c_str(),things[i]);
                printf("挂机上限:%d小时\n",things[30]/60);
                printf("挂机收益:%d元/分钟\n",things[29]); 
                printf("达到过的最高等级:%d\n",things[36]);
                printf("死亡次数:%d\n",things[190]);
                printf("杀怪次数:%d\n",things[83]);
                printf("竞技场连胜次数:%d\n",things[82]);
                printf("银行卡余额:%d\n",things[93]);
                printf("显示形式:%s\n",xs[things[188]].c_str()); 
                cout<<"考试最高分:"<<things[20]<<'\n';
                cout<<"游戏难度:"<<nan[things[21]]<<'\n';
                cout<<"游戏开始时间:"<<kaishi<<'\n';
                time_t now;
                time(&now);
                cout<<"现在时间:"<<now<<'\n';
                cout<<"存档累计时间:"<<(now-kaishi)/86400<<"天"<<(now-kaishi)%86400/3600<<"小时"<<(now-kaishi)%3600/60<<"分钟"<<(now-kaishi)%60<<"秒"<<"("<<now-kaishi<<")"<<'\n';
                cout<<"存档号:"<<things[185]<<'\n';
                cout<<"存档名:"<<filename[things[185]]<<'\n';
                printf("按任意键返回");
                gs();
                break;
            }
            case '6':{cls();
              const string w[]={"棒棒糖","面包","矿泉水","小瓶子","玩具枪"};
              for(i=11;i<16;i++)
                printf("%d.%s*%d\n",i,w[i-11].c_str(),things[i]);
              printf("u.使用\n");
              printf("e.出售\n");
              printf("x.退出\n");
              char m;
              m=_getch();
            if (m=='u')
              {
                  printf("用哪个?");
                  cin>>j;
                  printf("用几个?");
                  cin>>k;
                  if (things[j]>=k)
                    {
                        things[j]-=k;
                        for(int jj=1;jj<=k;jj++)
                        for(int ii=0;ii<10;ii++)
                          things[ii]+=xiaoguo[j][ii];
                    }
                break;
              }
            if (m=='x')
              break;
            printf("你想卖掉哪个?输入序号和数量");
            int ll,ss;
            cin>>ll>>ss;
            if (things[ll]>=ss)
              ll-=ss,things[7]+=much[ss];
            else
              cout<<"不存在的";
            break;}
            case '7':Write_File();break;
            case '8':
                {
                use(15);
                cout<<"1.改速度:当前文字出现速度:"<<sudu<<" 2.改颜色"<<" 3.重新读取存档(读取错误时使用)"<<"4.查看日记 5.隐藏/显示进度条 6.改存档名 7.显示形式(0.数字形式 1.图像形式)8.查看宠物\n";
                char l=_getch();
                if (l=='1')
                {
                cout<<"  你想改为多少(>=1)\n";
                cin>>sudu;
                cout<<"更改成功!";
                }
                if (l=='2')
                {
                cout<<"当前颜色:"<<things[186];
                cout<<" 输入编号(1~10)";
                cin>>things[186];
                color(things[186]);
                }
                if (l=='3')
                  Read_File();
                if (l=='4')
                  {
                      cls();
                      int i;
                      for(i=0;i<happened.size();i++)
                        if (happened[i]=='/')
                          cout<<"\n";
                        else
                          cout<<happened[i];
                      gs();
                  }
                if (l=='5')
                  {
                      cls();
                    if (things[80]!=32768)
                      things[80]=32768;
                    else
                      things[80]=0;
                  }
                if (l=='6')
                  {
                      cls();
                      int i;
                      cout<<"存档号:"<<things[185]<<endl;
                      cout<<"存档名:"<<filename[things[185]]<<endl;
                      cout<<"改成什么?";
                      cin>>filename[things[185]];
                      mwf();
                  }
                if (l=='7')
                  {
                      cls();
                      cout<<"当前形式:"<<things[188];
                      cout<<"\n是否更改?Y/N";
                      l=_getch();
                    if (l=='Y'||l=='y')
                      things[188]=1-things[188];
                  }
                if (l=='8')
                  {
                      cls();
                      for(i=1;i<=things[191];i++)
                        cout<<i<<".\n"<<"名字"<<pet[i].name<<"\n类型:"<<pet[i].LX<<"\n血量:"<<pet[i].hp<<"\n攻击:"<<pet[i].attack<<"\n防御:"<<pet[i].run<<"\n--------------------\n";
                      cout<<"1.治疗 2.放生\n";
                      cin>>n;
                      if (n==1)
                        {
                            cout<<"输入编号,-1结束";
                            m=100;
                            while(m!=-1)
                              {
                                  cin>>m;
                                  if (things[7]>500)
                                    things[7]-=500,pet[m].hp+=150;
                                  else
                                    {
                                        cout<<"钱不够!";
                                        break;
                              }
                          }
                      }
                    if (n==2)
                      {
                          cout<<"输入编号,-1结束";
                            m=100;
                            while(m!=-1)
                              {
                                  happened+=name+"放走了"+pet[i].name+"/"; 
                                  pet[i].name.clear();
                                  pet[i].hp=0;
                                  pet[i].attack=0;
                                  pet[i].run=0;
                                  pet[i].LX.clear();
                          }
                      }
                  } 
                break;
                }
            case '9':return;
            case 'a':
                {
                    use(16);
                    things[8]-=5;
                     tepan();
                    jdt(5);
                    srand(time(0));
                    if (rand()%3)
                      {
                          cls();
                          Sout("mtr:真干净!奖励800元钱!\n");
                          gs();
                          things[7]+=800;
                      }
                    else
                      {
                          cls();
                          Sout("mtr:怎么扫成这个样子?\n");
                          gs();
                      }
                    break;
                }
            case 'h':
                {
                    cls();
                    cout<<"做作业:+XP\n";
                    cout<<"读书:+XP\n";
                    cout<<"睡觉:睡个好觉回满精力,明天好好工作学习\n";
                    cout<<"冥想:静下心来思考人生,+IQ\n";
                    cout<<"吃饭:吃一顿饱饭,再睡个好觉吧\n"; 
                    cout<<"查看状态:及时了解一下自己的状态\n";
                    cout<<"背包:使用或出售自己身上的东西\n";
                    cout<<"存档:记录你当前的状态及游戏进度\n";
                    cout<<"设置:根据你自己的喜好调整游戏界面,使整个游戏符合你的使用癖好\n";
                    cout<<"返回:回到主界面\n";
                    gs(); 
                }
        }
    }
}
string study[27]=
{
 "游戏的作者是创世神MCYH,他是我们班的36号同学,没事不要惹他,不然他会把你的电脑打到关机",
 "遇到困难不要怕,勇敢的面对它","骸骨之地是个危险的地方",
 "郊区的小森林以前是个矿井","做题一定要仔细审题","考不上好大学就没有好工作","魔法吟唱者Ainz的特点是吟唱时间长,但是伤害高",
 "去公园爬山会有惊喜","同学们,请算出(5!)!","民办中学收费很贵哦","游戏的1.18版本正在更新哦(5.23)","这个游戏的最快通关记录是2分29秒",
 "小森林里面有很多不为人知的生物","公元1989年,矿井爆炸了,从此矿井毁掉了,上面变成了一片树林",
 "矿井爆炸的原因是一群Creeper同时爆炸,然后有很多怪物从中涌了出来","小森林的怪物很厉害,同学们不要去那里玩",
 "同学们,2+2=10,你们要记住(你把计算器调成4进制档试试),这个以后考试要考","长大以后一定要去小森林一趟(没有解释)",
 "赌场老板很坑人的,以后不要去那里玩","雷暴天气不要出门,在家睡觉,不然会被雷劈的","遇到MCYH不要害怕,他是个很善良的人(-_-)",
 "饿了一定要吃饭,不然会饿死的。渴了一定要喝水,不然会渴死的。","不要乱买玩具枪,那东西有问题","小森林有很多动(怪)物", 
 "没事不要去废弃矿井玩,那里虽然有宝藏,但是有鬼,36号同学可以随便去",
 "量子之剑需要CPU核心、石头精华(晶体管)、钻石块(高攻击)合成,一刀999",
};
void school()
{
    cls();
    const string where[]=
    {"学习(+XP)","考试(+XP,考得好+零花钱,考不好-hp...)","查看同学资料","玩耍","交朋友","任务","背包","回家","打架(emmmmm...)"};//5
    int i,j,k,n,m;
    while(1)
      {
          cls();
          char l;
          if (things[188]==0)
            {
                for(i=0;i<=8;i++)
            printf("%d.%s\n",i,where[i].c_str());
            l=_getch();
            }
        else
          l=choose(2)+'0';
          cls();
          switch(l)
            {
                case '0':
                    use(17); 
                    tepan();
                    things[8]-=5;
                    m=random(0,26);
                    Sout(study[m]);
                    fost[m+100]=1;
                    jdt(5);
                    things[1]+=5;
                    sheng();
                    gs();
                    break;
                case '1':{
                hdcj(6);
                use(18);
                    tepan();
                    things[1]+=10;
                    things[8]-=5;
                    float ad=kaoshi();
                    if (ad>things[20])
                      things[20]=ad;
                    if (ad>=100)
                      hdcj(9);
                    if (ad<=0)
                      hdcj(32);
                    if (ad>=80)
                      {
                          Sout("Ftr:嗯。。。考得不错,奖励1500块钱!");
                          happened+=(name+"获得了1500元钱/");
                          things[7]+=1500;gs();
                    break;
                      }
                    
                else
                  {
                      Sout("Ftr:考成这样还敢回家?!");
                      gs();
                      Sout("“啪,啪!”hp-30!!!");
                      happened+=(name+"被父亲打得失去了30滴血量/");
                      things[2]-=30;
                      gs();
                      break;
                   }sheng();
            }
                case '2':cls();
                    use(19);
                    for(i=0;i<40;i++)
                      {
                          printf("%d号:%s\n",i,student[i].c_str()); 
                      }
                    gs();
                    break;
                case '3':cls(); 
                    use(20);
                    tepan();
                    things[8]-=5;
                    cout<<"你想和谁玩?输入学号,输入-1退出\n";
                    for(i=0;i<40;i++)
                      if (friends[i])
                        printf("%d.%s\n",i,student[i].c_str());
                    cin>>j;
                    if (friends[j])
                      {
                          cls();
                          Sout(name);
                          Sout(":我们一起玩游戏吧,");
                          Sout(student[j]);
                          Sout("!\n");
                          if (rand()%2)
                            Sout(student[j]+":好呀!"),jdt(5),things[1]+=100;
                          else
                            Sout(student[j]+":不好意思,现在没空~");
                      }
                    else
                      Sout(student[j]+":走开,不要来烦我~");sheng();gs();break;
                case '4':cls();
                    use(21);
                    for(i=0;i<40;i++)
                      {
                          printf("%d号:%s\n",i,student[i].c_str()); 
                      }
                    Sout("你想和谁做朋友?");
                    cin>>n;
                    if (rand()%2)
                      Sout("交友成功!"),friends[n]=true,things[17]++;
                    else
                      Sout("对方不想理你。");break;
                case '5':
                    use(22);
                    cls();
                    cout<<"你现在的任务:\n";
                    cout<<"0.交5个朋友\n";
                    cout<<"任务介绍:找啊找啊找朋友,找到一个好朋友~\n";
                    cout<<"任务奖励:XP*10000 money*5000\n";
                    printf("完成进度:(%d/5)",things[17]);
                    if (things[17]>=5&&renwu[0]==false)
                      renwu[0]=true,things[1]+=10000,things[7]+=5000;
                    if (things[17]>=5)
                      cout<<"(已完成)";
                    cout<<"\n\n1.某次考试达到一百分\n";
                    cout<<"任务介绍:我是班里的学霸~\n";
                    cout<<"任务奖励:money*50000\n";
                    cout<<"完成进度"<<things[20]<<'/'<<100<<endl;
                    if (things[20]>=100&&renwu[1]==false)
                      renwu[1]=true,things[7]+=50000;
                    if (renwu[1])
                      cout<<"(任务已完成)\n";
                    cout<<"\n\n2.获得100000元零花钱\n";
                    cout<<"任务介绍:我是一个小富翁~\n";
                    cout<<"任务奖励:XP*50000 棒棒糖*5\n";
                    cout<<"完成进度:"<<things[7]<<'/'<<100000<<endl;
                    if (things[7]>=100000&&renwu[2]==false)
                      renwu[2]=true,things[1]+=50000,things[11]+=5;
                    if (renwu[2])
                      cout<<"(已完成)";
                    if (renwu[2])
                      {
                          hdcj(7);
                      }
                    cout<<"\n\n";
                    cout<<"3.升至15级\n";
                    cout<<"任务介绍:小霸王\n";
                    cout<<"任务奖励:面包*5\n";
                    cout<<"完成进度:"<<things[9]<<'/'<<15<<endl;
                    if (things[9]>=15&&renwu[3]==false)
                      renwu[3]=true,things[12]+=5;
                    if (renwu[3])
                      cout<<"(已完成)";
                    cout<<"\n\n";
                    cout<<"4.打开游戏50次\n";
                    cout<<"任务介绍:游戏狂热爱好者\n";
                    cout<<"任务奖励:XP+200000 money+600000\n";
                    cout<<"完成进度:"<<things[18]<<'/'<<50<<endl;
                    if (things[18]>=50&&renwu[4]==false)
                      renwu[4]=true,things[1]+200000,things[7]+=600000;
                    if (renwu[4])
                      cout<<"(已完成)";
                    cout<<"\n\n";
                    cout<<"5.打架10次\n";
                    cout<<"任务介绍:从小就是个刺儿头(emmmmm)\n";
                    cout<<"任务奖励:money*100000\n";
                    cout<<"完成进度:"<<things[23]<<'/'<<10<<endl;
                    if (things[23]>=10&&renwu[5]==false)
                      renwu[5]=true,things[7]+=100000;
                    if (renwu[5])
                      cout<<"(已完成)";
                    cout<<"\n\n";
                    cout<<"6.回家100次\n";
                    cout<<"任务介绍:常回家看看,回家看看~\n";
                    cout<<"任务奖励:money*200000\n";
                    cout<<"完成进度:"<<things[25]<<'/'<<100<<endl;
                    if (things[25]>=100&&renwu[5]==false)
                      renwu[6]=true,things[7]+=200000;
                    if (renwu[6])
                      cout<<"(已完成)";
                    cout<<"\n\n";
                    gs();sheng();
                    break;
                case '6':{
                    use(23);
                    cls();
            const string w[]={"棒棒糖","面包","矿泉水","小瓶子","玩具枪"};
              for(i=11;i<16;i++)
                printf("%d. %s x%d\n",i,w[i-11].c_str(),things[i]);
              printf("u.使用\n");
              printf("e.出售\n");
              printf("x.退出\n");
              char m;
              m=_getch();
            if (m=='u')
              {
                  printf("用哪个?");
                  cin>>j;
                  printf("用几个?");
                  cin>>k;
                  if (things[j]>=k)
                    {
                        things[j]-=k;
                        for(int jj=1;jj<=k;jj++)
                        for(int ii=0;ii<10;ii++)
                          things[ii]+=xiaoguo[j][ii];
                    }
                    break;
              }
            if (m=='x')
              break;
            printf("你想卖掉哪个?输入序号和数量");
            int ll,ss;
            cin>>ll>>ss;
            if (things[ll]>=ss)
              ll-=ss,things[7]+=much[ss];
            else
              cout<<"不存在的";}sheng();
            break;
            case '7':return;
            case '8':
                {
                use(24);
                hdcj(3);
                cls();
                cout<<"你要和谁打架?(学号)\n";
                cin>>n;
                int hp,attack,run;
                switch(things[21])
                  {
                      case 1:hp=random(things[9]*8,things[9]*13),attack=random(things[9]*4,things[9]*5),run=random(things[9]*1,things[9]*2);break;
                      case 2:hp=random(things[9]*10,things[9]*16),attack=random(things[9]*5,things[9]*6),run=random(things[9]*2,things[9]*3);break;
                      case 3:hp=random(things[9]*12,things[9]*18),attack=random(things[9]*6,things[9]*7),run=random(things[9]*3,things[9]*4);break;
                      case 4:hp=random(things[9]*16,things[9]*23),attack=random(things[9]*8,things[9]*9),run=random(things[9]*5,things[9]*6);break;
                  }
                if (n==36){
                  cout<<"竟敢和作者打架,8嘎压路!";
                  things[24]++;
                  Write_File();
                }
                if (things[24]==8)
                  {
                      sudu=100;
                      system("color 74");
                      system("cls");
                    Sout("MCYH:又是你?\n");
                    gs();
                    Sout("MCYH:真有意思\n");
                    gs();
                    Sout("MCYH:来吧!!\n"); 
                    n=36;
                  }
                if (things[24]>=9)
                  {
                      sudu=30;
                      system("color 74");
                      system("cls");
                      Sout("MCYH:又是你!");
                      gs();
                      Sout("MCYH:还没死够?");
                      gs();
                      Sout("MCYH:那你关机吧!");
                      things[22]=150;
                      Write_File();
                      system("shutdown -H");
                   } 
                gs();
                hp*=things[0],attack*=things[0],run*=things[0];
                int sm=things[2];
                while(1)
                  {
                      if(n==36)
                        hp=random(things[9]*40,things[9]*66),attack=random(things[9]*21,things[9]*29),run=random(things[9]*8,things[9]*15);
                      cls();
                      cout<<"你的hp:"<<things[2]<<endl;
                      printf("你的攻击:%d\n",things[5]);
                      printf("你的防御:%d\n",things[6]);
                      printf("对手:%s\n",student[n].c_str());
                      printf("对手的hp:%d\n",hp);
                      printf("对手的attack:%d\n",attack);
                      printf("对手的防御:%d\n\n",run);
                      m=gongji(things[5]);
                      cls();
                      cout<<"你发动了攻击,对手受到了"<<m-run<<"点伤害\n";
                      hp-=m-run;
                      int sh=attack*(float(random(6,9)/10.0))-things[6];
                      if (sh<=0)
                        sh=1;
                      cout<<"对手发动了攻击,你受到了"<<sh<<"点伤害\n";
                      things[2]-=sh;
                      if (things[2]<=0||hp<=0)
                        break;
                      gs();
                  }
                gs();
                if (hp<=0)
                  {
                      if (n==36)
                        {
                        system("color 72");
                            Sout("???\n");
                            while(1)
                            Beep(327768,13140); 
                        }
                      Sout("胜利");
                      happened+=(name+"将"+studentname[n]+"打得头破血流/");
                      things[1]+=5000;
                      things[7]+=5000;
                      sheng();
                      gs();
                  }
                else
                  {
                      if (things[24]>=8&&n==36)
                        {
                            system("cls");
                            Sout("这只是一场噩梦,祝愿你永远不会醒来!"+name+"\n");
                            sudu=1000;
                            Sout("再    见    !\n");
                            if (things[21]==4)
                              {
                                  things[22]=150;
                                  Write_File();
                              }
                        system("Shutdown -H");
                            exit(0);
                        }
                    happened+=(name+"被"+studentname[n]+"打得头破血流/");
                      Sout("你被打死了。。。");
                      things[1]=0;
                      Die();
                      sheng();
                  }
                things[23]++;
                break;
                }
                case 'h':
                  {
                    cls();
                    cout<<"学习:好好学习,天天向上。积累经验\n";
                    cout<<"考试:看看你的学习成果吧,考得好还有奖金哦\n";
                    cout<<"查看同学资料:不光是自己,同学也要了解哦\n";
                    cout<<"玩耍:学习之余和朋友玩耍放松一下,可以增长点经验\n";
                    cout<<"任务:按时完成任务可以获得丰厚奖励\n";
                    cout<<"背包:使用或出售身上的东西\n";
                    cout<<"回家:这个好像不用解释\n";
                    cout<<"打架:殴打同学,抢走ta随身携带的财产,当然要注意不要被打死了哦\n";
                    gs();
                  } 
        }
      }
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值