正文
增加 2219 行删除 703 行
12345678910111213141516171819207 行未改动282930313233343536373839406 行未改动474849505152535455565757 行未改动1151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511522 行未改动15515615715815916016116216316416517 行未改动18318418518618718818919019119219 行未改动21221321421521621721821922022132 行未改动2542552562572582592602612622632642 行未改动26726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932022 行未改动3433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048054 行未改动8108118128138148158168178184 行未改动82382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154```cpp#include<bits/stdc++.h>#include<windows.h>#include<stdio.h>#include<conio.h>#include<time.h>using namespace std;int level = 0, san = 120, food = 120, hp = 120, buff = 0, sbuff[5], tili = 120;int wuping = 0, xrs = 0, jjyz = 0, hy = 0, hjkl = 0, gzlr = 0, zsq = 0;int st = 0, sjcs, sxz, xd, yglgy = 0, man = 0, bbrl = 20, ynmht, rhmht, hf = 0, jj = 0;int shiti[100], wuzi[101], sdt, dl, dc, sqdy, bsxh;vector <int > swuping;//新层级 物品发现地点 分界线 层级名称 实体多少//新物品 物品简介 背包物品名称 使用 丢弃//buff 显示buff buff效用void anjian(){while(5) for(int i=0;i<=200;i++)if(GetAsyncKeyState(i)&0x8000) cout<<i<<' ';}7 行未改动DWORD cellCount = csbi.dwSize.X * csbi.dwSize.Y;COORD homeCoords = {0, 0};DWORD count;// 用空格填充整个缓冲区FillConsoleOutputCharacter(hStdOut, ' ', cellCount, homeCoords, &count);// 将光标重置到左上角SetConsoleCursorPosition(hStdOut, homeCoords);}void Color(int a){if(a == 0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);if(a == 1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);6 行未改动if(a == 8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);if(a == 9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE);if(a == 10) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN);if(a == 11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);}// 0 1 2 3 4 5 6 7 8 9 10 11// 白 较青蓝 绿 紫 大红 青 淡黄 深灰 较深红 较深蓝 较棕黄 浅灰void ksfm(){Color(0);cout << "" << endl;cout << "" << endl;57 行未改动cout << " 我应该干什么" << endl;cout << " 探索,求生,寻找,并时刻保持警惕?......" << endl;cout << " 操作" << endl;cout << " E打开背包 A/D选择物品 空格使用 P丢弃 Q退出" << endl;cout << " M 查看层级信息" << endl;sjcs ++;while (1){if(kbhit()){cls();return;}}}void cenjijianjie(){cls();Color(0);cout << endl;if (level == 0){cout << " Level 0 前厅 "<< endl;cout << " 生存难度 class 1" << endl;cout << " >> 安全" << endl;cout << " >> 不稳定" << endl;cout << " >> 无实体" << endl;cout << " Level 0是一个广袤无垠的非欧几里得空间,其外表与零售店的仓库相近,并由无数多个房间排列组合而成。单调的黄色墙纸、老旧潮湿的地毯、分散的电线插座、零散排布的荧光灯共同构成了这一楼层的重复景致。此外,Level 0内不存在任何两个完全相同的房间。楼层内的荧光灯会以恒定的频率嗡嗡作响,只是相比于日常所见的荧光灯,Level 0内的荧光灯会发出更响亮、更突兀、更刺耳的声响。由于报告不一且难以核实,Level 0至今仍被认为实体绝迹。迄今,楼层内不存在任何流浪者会面或遭遇实体的正式记录。" << endl;}else if (level == 1){cout << " Level 1 宜居区 "<< endl;cout << " 生存难度 class 1" << endl;cout << " >> 安全" << endl;cout << " >> 稳定" << endl;cout << " >> 实体数量极少" << endl;cout << " Level 1是一座仓库,仓库顶部悬挂着荧光灯,其中有着通向楼层各个区域的廊道与楼梯,以及不时出现的叉车等机械设备。地板上都偶然会出现一些杏仁水洼,蒸发后会遇冷形成浓雾,使该层部分区域的能见度降低许多,并且该层级物资较多。该层内存在多种危险因素,其中包含持续数分钟乃至数天的停电。当Level 1停电时,楼层的主区域将完全失去光亮。此时,一切都会陷入黑暗,实体也将肆意孳生并猎杀流浪者。Level 1内实体种类较多,栖息于这一楼层的常见实体有无面人、肢丛、猎犬、黯人与死亡飞蛾,以及两种Level 1的特有实体。" << endl;}}void Say(char *p,int x){while(1)2 行未改动else break;Sleep(x);}}void kscd(){int kk = 1, k = 1, xz = 1, stou[10]={0, 3, 2, 1, 0};while (k){if (GetAsyncKeyState(38)&0x8000) xz = 1;if (GetAsyncKeyState(40)&0x8000) xz = 2;if(kbhit()){char c=_getch();17 行未改动Color(11);cout << "■■";Color(7);cout << "■■" << endl;int tou = stou[k], jiange = 0;cout << " ";Color(7);cout << "==";19 行未改动Color(11);cout << "==";Color(7);cout << "==";int bian = rand() % 100;if (bian % 24 == 0){cout << endl;Color(8);32 行未改动Color(11);cout << " |" << endl;}}cout << " ";Color(7);cout << "■■";Color(11);cout << "■■";2 行未改动Color(11);cout << "■■";Color(7);cout << "■■" << endl;if (xz == 1) Color(11);else Color(7);cout << " 关于" << endl;if (xz == 2) Color(11);else Color(7);cout << " 探索" << endl;if(kbhit()){char c=_getch();if(c==' ') {if (xz == 1) guanyu();else return ;}}if(GetAsyncKeyState(38)&0x8000) xz = 1;if(GetAsyncKeyState(40)&0x8000) xz = 2;k ++;kk ++;if (k == 5) k = 1;Sleep(500);cls();}}void cengji(){Color(0);if (level == 0) cout << "Level 0 -- 前厅";else if (level == 1) cout << "Level 1 -- 宜居区";}void fenjie2(){if (level == 0){for (int i = 0; i < 30; i ++){Color(10);cout <<"■";}}else if (level == 1){for (int i = 0; i < 30; i ++){Color(7);cout <<"■";}}}void fenjie1(){if (level == 0){fenjie2();22 行未改动cout << "_";}}}}void zhuangtai(){if (level == 0){Color(10);cout << "[] ";}}void Buff(){if (bsxh > 0) {Color(7);cout << "悲尸循环" ;}else if (hf > 0){Color(2);cout << "恢复" ;}else if (jj > 0){Color(9);cout << "安静 ";}}void wpjj(int x){Color(0);if (x == 1){cout << "杏仁水" << endl;cout << "food+10 san+15 hp+5 体力+5";}else if (x == 2){cout << "罐装龙肉" << endl;cout << "food+25 hp+5 体力+5";}else if (x == 3){cout << "皇家口粮" << endl;cout << "珍贵的食物 food+35 san-5 hp+10";}else if (x == 4){cout << "火盐" << endl;cout << "投掷 击退!";}else if (x == 5){cout << "寂静液汁" << endl;cout << "使用后处于安静状态中,不易被发现";}else if (x == 6){cout << "滋水枪" << endl;cout << "加入杏仁水,发射!";}else if (x == 7){cout << "亚格鲁格亚果实" << endl;cout << "恢复效果 food+5 san+5 hp+5";}else if (x == 8){cout << "油腻棉花糖" << endl;cout << "难以下咽,加点杏仁水或许好些";}else if (x == 9){cout << "融化棉花糖" << endl;cout << "美味 food+20 san+5 体力+15";}else if (x == 10){cout << "一节电池" << endl;cout << "为手电筒提供电量";}}void sywp(int x){wuping --;if (x == 1){xrs --;food += 10;san += 15;hp += 5;tili += 5;}else if (x == 2){gzlr --;food += 25;hp += 5;tili += 5;}else if (x == 3){hjkl --;food += 35;san -= 5;hp += 10;}else if (x == 5){jj += rand() % 6 + 8;sbuff[++buff] = 3;jjyz --;}else if (x == 6){if (!xrs){wuping ++;cout << endl;cout << " 你没有填装物!";Sleep(500);}else if (sqdy > 0){wuping ++;cout << endl;cout << " 有填装物了!";Sleep(500);}else {sqdy += 5;xrs --;}}else if (x == 7){yglgy --;sbuff[++buff] = 2;hf += 6 + rand() % 6;}else if (x == 8) {if ( !xrs){wuping ++;cout << endl;cout << " 你没有东西融化它!";Sleep(500);}else {xrs --;rhmht ++;ynmht --;}}else if (x == 9){food += 20;san += 5;tili += 15;rhmht --;}else if (x == 10){if (dl == 0){dl = 100;dc --;}else {wuping ++;cout << endl;cout << " 手电筒还有电!";Sleep(500);}}}void dqwp(int x){man = 0;Color(0);cout << endl << "丢弃 ";wuping --;if (x == 1){cout << "一瓶杏仁水" << endl;xrs --;}else if (x == 2){cout << "一罐罐装龙肉" << endl;gzlr --;}else if (x == 3){cout << "一盒皇家口粮" << endl;hjkl --;}else if (x == 4){cout << "一块火盐" << endl;hy --;}else if (x == 5){cout << "一瓶寂静液汁" << endl;jjyz --;}else if (x == 6){cout << "一把滋水枪" << endl;zsq --;}else if (x == 7){cout << "一颗亚格鲁格亚果实" << endl;yglgy --;}else if (x == 8){cout << "一包油腻棉花糖" << endl;ynmht --;}else if (x == 9){cout << "一包融化棉花糖" << endl;rhmht --;}else if (x == 10){cout << "电池" << endl;dc --;}}void beibao(){cls();sjcs = rand() % sjcs;int xz = 0, xzwp, tc = 0;if (wuping > 0) xz = 1;while (1){if (wuping <= bbrl) man = 0;int wp = 0, zs = 0, xzwp = 0;cout << endl;Color(0);cout << "背包";if (man) cout << "已满,请丢弃或使用物品";cout << endl;Color(11);cout << "------------------------------" << endl;if (xrs > 0){for (int i = 1; i <= xrs; i ++){wp ++;if (wp == xz) xzwp = 1, Color(11);else Color(7);if (zs + 6 > 30){zs = 8;cout << endl;}else {zs += 8;}cout << "杏仁水 ";}}if (gzlr > 0){for (int i = 1; i <= gzlr; i ++){wp ++;if (wp == xz) xzwp = 2, Color(11);else Color(7);if (zs + 8 > 30){zs = 10;cout << endl;}else {zs += 10;}cout << "罐装龙肉 ";}}if (hjkl > 0){for (int i = 1; i <= hjkl; i ++){wp ++;if (wp == xz) xzwp = 3, Color(11);else Color(7);if (zs + 8 > 30){zs = 10;cout << endl;}else {zs += 10;}cout << "皇家口粮 ";}}if (hy > 0){for (int i = 1; i <= hy; i ++){wp ++;if (wp == xz) xzwp = 4, Color(11);else Color(7);if (zs + 4 > 30){zs = 6;cout << endl;}else {zs += 6;}cout << "火盐 ";}}if (jjyz > 0)for (int i = 1; i <= jjyz; i ++){wp ++;if (wp == xz) xzwp = 5, Color(11);else Color(7);if (zs + 8 > 30){zs = 10;cout << endl;}else {zs += 10;}cout << "寂静液汁 ";}if (zsq > 0)for (int i = 1; i <= zsq; i ++){wp ++;if (wp == xz) xzwp = 6, Color(11);else Color(7);if (zs + 6 > 30){zs = 8;cout << endl;}else {zs += 8;}cout << "滋水枪 ";}if (yglgy > 0)for (int i = 1; i <= yglgy; i ++){wp ++;if (wp == xz) xzwp = 7, Color(11);else Color(7);if (zs + 14 > 30){zs = 16;cout << endl;}else {zs += 16;}cout << "亚格鲁格亚果实 ";}if (ynmht > 0)for (int i = 1; i <= ynmht; i ++){wp ++;if (wp == xz) xzwp = 8, Color(11);else Color(7);if (zs + 10 > 30){zs = 12;cout << endl;}else {zs += 12;}cout << "油腻棉花糖 ";}if (rhmht > 0)for (int i = 1; i <= rhmht; i ++){wp ++;if (wp == xz) xzwp = 9, Color(11);else Color(7);if (zs + 10 > 30){zs = 12;cout << endl;}else {zs += 12;}cout << "融化棉花糖 ";}if (dc > 0)for (int i = 1; i <= dc; i ++){wp ++;if (wp == xz) xzwp = 10, Color(11);else Color(7);if (zs + 4 > 30){zs = 6;cout << endl;}else {zs += 6;}cout << "电池 ";}cout << endl;Color(11), cout << "------------------------------" << endl;wpjj(xzwp);cout << endl;Color(11), cout << "------------------------------" << endl;Color(0), cout << "装备 " << endl;if (sdt == 1){cout << "手电筒 " ;cout << "电量 ";if (dl <= 20) Color(4);cout << dl << "%" << endl;}while (1){if(kbhit()){char c=_getch();if (c == 'a'){xz --;if (xz < 1) xz = 1;break;}if (c == 'd'){xz ++;if (xz > wuping) xz = wuping;break;}if (c == 'q' && !man){tc = 1;break;}if (c == ' '){sywp(xzwp);break;}if (c == 'p'){dqwp(xzwp);break;}}}cls();if (tc == 1) break;}return ;}void qhcj(){cls();cout << endl << endl;int yl = level;while (yl == level) level = rand() % 2;cout << endl;Color(0);cout << " 你来到了";cengji();Sleep(1500);}void tsyy(){int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);for (int i = 1; i <= k; i ++) sj = rand() % 78;if (sj <= 14 || sj >= 72) cout << "继续探索这里" << endl;else if (sj > 14 && sj <= 31) cout << "向四处走走" << endl;else if (sj > 31 && sj <= 56) cout << "碰碰运气,搜寻一番" << endl;else cout << "环顾四周,继续探索" << endl;}void xxyy(){int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);for (int i = 1; i <= k; i ++) sj = rand() % 78;if (sj <= 14 || sj >= 63) cout << "探索很久了,歇歇吧" << endl;else if (sj > 14 && sj <= 31) cout << "休息一会" << endl;else cout << "找处安静地休息" << endl;}void xzyy(){int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);for (int i = 1; i <= k; i ++) sj = rand() % 78;if (sj <= 14 || sj >= 63) cout << "想办法离开这儿" << endl;else if (sj > 14 && sj <= 31) cout << "寻找层级出口" << endl;else cout << "尝试离开这里" << endl;}void mysh(){int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);for (int i = 1; i <= k; i ++) sj = rand() % 78;if (sj <= 14 || sj >= 63) cout << " 嗯..没有任何收获" << endl;else if (sj > 14 && sj <= 31) cout << " 没有任何结果.." << endl;else cout << " 空手而回.." << endl;}void ckdf(){if (level == 0){int sj = rand() % 3;if (sj == 0) cout << "一个通风管道口";else if (sj == 1) cout << "一面墙";else cout << "一扇玻璃门";}if (level == 1){int sj = rand() % 3;if (sj == 0) cout << "一扇门";else if (sj == 1) cout << "一段阶梯";else cout << "一面带有排水口的墙体";}}int xzcksh(){cout << endl;Color(0);4 行未改动return 1;}else {int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);for (int i = 1; i <= k; i ++) sj = rand() % 78;if (sj <= 34 || sj >= 63) cout << " 好吧,这很难." << endl;else cout << " 什么都没发现" << endl;4 行未改动if (level == 0){int k = rand() % 2;if (k == 0) cout << "地板上";else cout << "墙角边";}if (level == 1){int k = rand() % 4;if (k == 0) cout << "板条箱里";else if (k == 1) cout << "地板上";else if (k == 2) cout << "墙角";else cout << "柱子边" ;}}void ysh(){int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);Color(0);wuping ++;cout << "你在";fxdf();cout << "发现了 ";for (int i = 1; i <= k; i ++) sj = rand() % 790;if (sj >= 130 && sj <= 133 || sj >= 501 && sj <= 510 ||sj >= 671 && sj <=678) {cout << "一把滋水枪" << endl;zsq ++;}else if (sj >= 664 && sj <= 677 || sj >= 232 && sj <= 243 ||sj == 279 || sj == 378){cout << "一颗亚格鲁格亚果" << endl;yglgy ++;}else if (sj >= 74 && sj <= 88 || sj >= 491 && sj <= 512 ||sj >= 98 && sj <= 112 || sj == 11){cout << "一小块火盐" << endl;hy ++;}else if (sj >= 700 && sj <= 703 || sj >= 410 && sj <= 423 ||sj >= 33 && sj <= 35 || sj >= 632 && sj <= 635){cout << "一包油腻棉花糖" << endl;ynmht ++;}else if (sj >= 3 && sj <= 11 || sj >= 704 && sj <= 719 ||sj >= 383 && sj <= 395 || sj >= 24 && sj <= 35 ||sj >= 552 && sj <= 559 || sj >= 217 && sj <= 222){cout << "一罐罐装龙肉" << endl;gzlr ++;}else if (sj >= 179 && sj <= 187 || sj >= 512 && sj <= 522 ||sj >= 441 && sj <= 445){cout << "一瓶寂静液汁" << endl;jjyz ++;}else if (sj >= 189 && sj <= 197 || sj >= 371 && sj <= 377 ||sj >= 67 && sj <= 73){cout << "一盒皇家口粮" << endl;hjkl ++;}else if (( sj >= 720 && sj <= 734 || sj >= 378 && sj <= 391 ||sj >= 201 && sj <= 217)){if (sdt == 0) cout << "一个手电筒" << endl, sdt = 1, dl = max(rand() % 101, 20);else cout << "一节电池" << endl, dc ++;}else {cout << "一瓶杏仁水" << endl;xrs ++;}}int tssh(){int sj, hj = 0;sj = rand() % 910;if ((sj >= 656 && sj <=664) || (sj >= 321 && sj <=332) ||(sj >= 744 && sj <= 751) || (sj >= 801 && sj <= 810) ||(sj >= 431 && sj <=448) || (sj >= 711 && sj <= 720) ||(sj >= 98 && sj <=107) || (sj >= 843 && sj <=847) ||(sj >= 11 && sj <=25) || (sj >= 42 && sj <= 78) ||(sj >= 187 && sj <= 193) || (sj >= 340 && sj <= 373) ||(sj >= 555 && sj <= 569) || (sj >= 799 && sj <= 817) ||(sj >= 899 && sj <= 909) || (sj >= 600 && sj <= 616) ||(sj >= 212 && sj <= 218) ) hj = 1;if (sdt && dl > 0 && (sj >= 665 && sj <= 708)) hj = 1;if (wuzi[level] >= 1 && (sj >= 220 && sj <= 227 ||sj >= 505 && sj <= 513 || sj == 465 )) hj = 1;if (wuzi[level] >= 2 && (sj >= 232 && sj <=243 ||sj >= 518 && sj <= 521 || sj >= 332 && sj <= 334)) hj = 1;return hj;}void sw(int x){cls();cout << endl << endl;Color(4);cout << " YOU DEAD" << endl;cout << endl;cout << " reason ";if (x == 1){Color(7);cout << "悲尸循环";}Sleep(1800);exit(0);}int main(){srand((unsigned)time(NULL));CONSOLE_CURSOR_INFO cursor_info={1,0};SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);//anjian();ksfm();kscd();cls();xd = 1;shiti[1] = 1;wuzi[1] = 2;while (1){cls();if (sdt) dl = max(0, dl - 1);sjcs ++;if (food == 0) hp -= rand() % 3;if (!xd) food -= rand() % 2, san -= rand() % 3, san += rand() % 2, tili -= rand() % 2, tili += rand() % 2;if (hf){hf --;hp += rand() % 3;if (hf == 0) buff --;}if (jj){jj --;if (jj == 0) buff --;}if (bsxh) san -= rand() % 2, bsxh --;if (1000 - bsxh >= 16 && bsxh > 0){sw(1);}if (san <= 30 && !bsxh){int sj = rand() % 100;if(sj % 12 == 0 || (san <= 20 && sj % 9 == 0)){bsxh = 1000;buff ++;}}else if (san > 40 && bsxh > 0){int sj = rand() % 100;if(sj % 12 == 0 || (san <= 20 && sj % 9 == 0)){buff --;bsxh = 0;}}tili = min(tili, 120);tili = max(tili, 0);hp = min(hp, 120);hp = max(hp, 0);food = min(food, 120);food = max(food, 0);san = min(san, 120);san = max(san, 0);if (food == 0) hp -= rand() % 3;xd = 0;cout << endl;cout << " ";cengji();cout << endl;fenjie1();cout << endl;//层级及分界zhuangtai();Color(0);cout << "HP ";if (hp > 20) Color(0);else Color(4);cout << hp << " ";if (hp < 100) cout << " ";if (hp < 10) cout << " ";Color(0);cout << "FOOD ";if (food > 20) Color(0);else Color(4);cout << food << " ";if (food < 100) cout << " ";if (food < 10) cout << " ";Color(0);cout << "SAN ";if (san > 20) Color(0);else Color(4);cout << san << " ";if (san < 100) cout << " ";if (san < 10) cout << " ";//基础数值cout << endl;fenjie2();cout << endl;//分界Color(0);cout << "BUFF ";if (buff == 0) cout << "--";else {Buff();}//BUFFcout << endl;Color(0), cout << "体力 " << tili;cout << endl;fenjie2();cout << endl;//分界if (!st){Color(0);cout << "我可以.." << endl;cout << " ○ 1 ";tsyy();cout << " ○ 2 ";xxyy();cout << " ○ 3 ";xzyy();}long long xhcs = 0;while(++ xhcs < 50000){if(kbhit()){char c=_getch();if(c=='e'){beibao();break;}if(c=='1' && food && tili) {cout << endl;Color(11);cout << " 搜寻中";Say("...", rand() % 600 + 400);cout << endl;tili -= rand() % 6;food -= rand() % 7;san -= rand() % 6;hp -= rand() % 2;xd = 1;int sh = tssh();if (sh == 0){mysh();Sleep(500);}else{ysh();Sleep(600);if (wuping > bbrl) {man = 1;beibao();}}break;}if(c=='2') {hp += rand() % 2;san -= rand() % 5;san += rand() % 7;tili += rand() % 17;food -= rand() % 5;xd = 1;Color(11);cout << " 休息中";Say("...", rand() % 600 + 500);break;}if(c=='3' && tili && food){tili -= rand() % 6;food -= rand() % 6;san -= rand() % 6;hp -= rand() % 2;xd = 1;Color(11);cout << " 寻找中";Say("...", rand() % 600 + 400);cout << endl;if (xzcksh()){cout << " 是否切换层级." << endl;Color(0);cout << " 1 是 ";Color(0);cout << "2 否";while (1){if(kbhit()){char c=_getch();if (c == '2') break;if (c == '1'){qhcj();break;}}}}else {Sleep(800);}break;}if(c=='m'){cenjijianjie();cout << endl;Color(7);cout << " 空格以退出";while (1){if (kbhit()){char c=_getch();if (c == ' ') break;}}cls();break;}}}//操作}return 0;}/*if(kbhit()){char c=_getch();if(c==' ') cout<<"空格!发射子弹!";}加袋子 实体追逐 层级 层级简介*/```123456789101112131415161718192021222324252627282930313233343536377 行未改动45464748495051525354555657586 行未改动656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127257 行未改动3303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833842 行未改动38738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947017 行未改动48848949049149249349449549649719 行未改动51751851952052152252352452552632 行未改动5595605615625635645655665675685692 行未改动57257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972022 行未改动7437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015814 行未改动1586158715881589159015911592159315944 行未改动1599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670# **The** **Backrooms** *后室·无限**你终于累垮了,在平地上摔了一跤,切出了地板。你回过神来,站起身,却发现脚下并不是潮湿的地毯,而是一片草地……“我真的逃出来了吗?”“我回家了吗?”*初次游玩请看菜单内<关于>了解游戏及操作菜单内请用W/S选择~~不知为何层级简介的文字介绍部分不能过QAQ~~```cpp#include<bits/stdc++.h>#include<windows.h>#include<stdio.h>#include<conio.h>#include<time.h>using namespace std;int level = 0, san = 120, food = 120, hp = 120, buff = 0, sbuff[5], tili = 120;int wuping = 0, xrs = 0, jjyz = 0, hy = 0, hjkl = 0, gzlr = 0, zsq = 0, swfecj = 0;int st = 0, sjcs, sxz, xd, yglgy = 0, man = 0, bbrl = 20, ynmht, rhmht, hf = 0, jj = 0;int shiti[100], wuzi[101], sdt, dl, dc, sqdy, bsxh, kj = 0, duandao = 0, equip_duandao = 0;int xrscj = 0, scj = 0, ts = 0, yqlyy = 0, sc = 0, llz = 0, ffht = 0, dz = 0, bd = 0, cjyscs = 0, xrssy = 0, LL, ttcg = 0, ha = 0;map<int, int >L;vector <int > swuping;//新层级 物品发现地点 分界线 层级名称 实体多少//新物品 物品简介 背包物品名称 使用 丢弃int cjys = 0, xydn = 0, xsqqj = 0;int xydn_buff = 0, mosun_budai;void setsize(int col, int row) {char cmd[64];sprintf(cmd, "mode con cols=%d lines=%d", col, row);system(cmd);}void anjian(){while(5) for(int i=0;i<=200;i++)if(GetAsyncKeyState(i)&0x8000) cout<<i<<' ';}7 行未改动DWORD cellCount = csbi.dwSize.X * csbi.dwSize.Y;COORD homeCoords = {0, 0};DWORD count;FillConsoleOutputCharacter(hStdOut, ' ', cellCount, homeCoords, &count);SetConsoleCursorPosition(hStdOut, homeCoords);}void Color(int a){if(a == 0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);if(a == 1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);6 行未改动if(a == 8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);if(a == 9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE);if(a == 10) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN);if(a == 11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);}void cj(int x){cls();Color(0);cout << endl << endl << " 成就 ";if (x == 1) cout << "流浪者" << endl;if (x == 2) cout << "反复横跳" << endl;if (x == 3) cout << "生存" << endl;if (x == 4) cout << "杏仁水" << endl;if (x == 5) cout << "收藏家" << endl;if (x == 6) cout << "训蛾者" << endl;else cout << "一千零一夜" << endl;Sleep(1200);cls();}// 0 1 2 3 4 5 6 7 8 9 10 11// 白 较青蓝 绿 紫 大红 青 淡黄 深灰 较深红 较深蓝 较棕黄 浅灰// 清除所有数据(精简版)void saveGame() {ofstream f("save.dat",ios::binary);// 原有变量保存f.write((char*)&level,sizeof(level)) .write((char*)&san,sizeof(san)) .write((char*)&food,sizeof(food));f.write((char*)&hp,sizeof(hp)) .write((char*)&buff,sizeof(buff)) .write((char*)sbuff,sizeof(sbuff));f.write((char*)&tili,sizeof(tili)) .write((char*)&wuping,sizeof(wuping)) .write((char*)&xrs,sizeof(xrs));f.write((char*)&jjyz,sizeof(jjyz)) .write((char*)&hy,sizeof(hy)) .write((char*)&hjkl,sizeof(hjkl));f.write((char*)&gzlr,sizeof(gzlr)) .write((char*)&zsq,sizeof(zsq)) .write((char*)&st,sizeof(st));f.write((char*)&sjcs,sizeof(sjcs)) .write((char*)&sxz,sizeof(sxz)) .write((char*)&xd,sizeof(xd));f.write((char*)&yglgy,sizeof(yglgy)) .write((char*)&man,sizeof(man)) .write((char*)&bbrl,sizeof(bbrl));f.write((char*)&ynmht,sizeof(ynmht)) .write((char*)&rhmht,sizeof(rhmht)) .write((char*)&hf,sizeof(hf));f.write((char*)&jj,sizeof(jj)) .write((char*)shiti,sizeof(shiti)) .write((char*)wuzi,sizeof(wuzi));f.write((char*)&sdt,sizeof(sdt)) .write((char*)&dl,sizeof(dl)) .write((char*)&dc,sizeof(dc));f.write((char*)&sqdy,sizeof(sqdy)) .write((char*)&bsxh,sizeof(bsxh)) .write((char*)&dz,sizeof(dz));f.write((char*)&kj,sizeof(kj)) .write((char*)&duandao,sizeof(duandao)) .write((char*)&equip_duandao,sizeof(equip_duandao));f.write((char*)&cjys,sizeof(cjys)) .write((char*)&xydn,sizeof(xydn)) .write((char*)&xsqqj,sizeof(xsqqj));f.write((char*)&xydn_buff,sizeof(xydn_buff)) .write((char*)&mosun_budai,sizeof(mosun_budai));f.write((char*)&xrscj, sizeof(xrscj)).write((char*)&scj, sizeof(scj)) // 收藏家成就标记.write((char*)&sc, sizeof(sc)) // 生存成就标记.write((char*)&llz, sizeof(llz)) // 流浪者成就标记.write((char*)&ffht, sizeof(ffht)) // 反复横跳成就标记.write((char*)&bd, sizeof(bd)) // 布袋数量.write((char*)&cjyscs, sizeof(cjyscs)) // 层级钥匙使用次数.write((char*)&xrssy, sizeof(xrssy)) // 杏仁水使用次数.write((char*)&LL, sizeof(LL)) // 探索层级数量.write((char*)&ttcg, sizeof(ttcg)) // 逃离实体次数.write((char*)&ha, sizeof(ha)); // 黑暗buff标记f.close();cout << endl << " 存档成功" << endl;Sleep(1200);cls();}void cenjijianjie(){cls();Color(0);cout << endl;if (level == 0){cout << " Level 0 前厅 "<< endl;cout << " 生存难度 class 1" << endl;cout << " >> 安全" << endl;cout << " >> 不稳定" << endl;cout << " >> 无实体" << endl;cout << " >> 物资正常" << endl;}else if (level == 1){cout << " Level 1 宜居区 "<< endl;cout << " 生存难度 class 1" << endl;cout << " >> 安全" << endl;cout << " >> 稳定" << endl;cout << " >> 实体数量极少" << endl;cout << " >> 物资较丰富" << endl;}else if (level == 2){cout << " Level 2 管道噩梦 "<< endl;cout << " 生存难度 class 2" << endl;cout << " >> 不安全" << endl;cout << " >> 稳定" << endl;cout << " >> 实体相对较少" << endl;cout << " >> 物资较匮乏" << endl;}else if (level == 3){cout << " Level 3 电气室 "<< endl;cout << " 生存难度 class 2" << endl;cout << " >> 不安全" << endl;cout << " >> 不稳定" << endl;cout << " >> 少量实体" << endl;cout << " >> 少量物资" << endl;}else if (level == 4){cout << " Level 4 废弃办公室 "<< endl;cout << " 生存难度 class 宜居" << endl;cout << " >> 安全" << endl;cout << " >> 稳定" << endl;cout << " >> 无实体存在" << endl;cout << " >> 物资较丰富" << endl;}else if (level == 5){cout << " Level 5 恐怖旅馆 "<< endl;cout << " 生存难度 class 5" << endl;cout << " >> 不安全" << endl;cout << " >> 未勘探完全" << endl;cout << " >> 未经证实的实体目击" << endl;cout << " >> 物资正常" << endl;}if (level == 6){cout << " Level 6 熄灯 "<< endl;cout << " 生存难度 待分" << endl;cout << " >> 安全性未知" << endl;cout << " >> 不稳定" << endl;cout << " >> 未探明实体存在" << endl;cout << " >> 物资极少" << endl;}else if (level == 7){cout << " Level 7 深海恐惧症 "<< endl;cout << " 生存难度 class 4" << endl;cout << " >> 不安全" << endl;cout << " >> 不稳定" << endl;cout << " >> 中量实体" << endl;cout << " >> 物资较稀缺" << endl;}else if (level == 8){cout << " Level 8 岩洞系统 "<< endl;cout << " 生存难度 class 4" << endl;cout << " >> 不安全" << endl;cout << " >> 极端环境风险" << endl;cout << " >> 极多敌意存在" << endl;cout << " >> 物资匮乏" << endl;}else if (level == 9){cout << " Level 9 郊区 "<< endl;cout << " 生存难度 class 5" << endl;cout << " >> 不安全" << endl;cout << " >> 不稳定" << endl;cout << " >> 实体横行" << endl;cout << " >> 少量物资" << endl;}else if (level == 10){cout << " Level 10 丰裕 "<< endl;cout << " 生存难度 class 宜居" << endl;cout << " >> 安全" << endl;cout << " >> 低环境风险" << endl;cout << " >> 无敌对实体" << endl;cout << " >> 物资极丰富" << endl;}else if (level == 11){cout << " Level 11 不夜城 "<< endl;cout << " 生存难度 class 2" << endl;cout << " >> 安全" << endl;cout << " >> 不稳定" << endl;cout << " >> 少量实体" << endl;cout << " >> 物资极丰富" << endl;}}void loadGame() {ifstream f("save.dat",ios::binary);f.read((char*)&level,sizeof(level)) .read((char*)&san,sizeof(san)) .read((char*)&food,sizeof(food));f.read((char*)&hp,sizeof(hp)) .read((char*)&buff,sizeof(buff)) .read((char*)sbuff,sizeof(sbuff));f.read((char*)&tili,sizeof(tili)) .read((char*)&wuping,sizeof(wuping)) .read((char*)&xrs,sizeof(xrs));f.read((char*)&jjyz,sizeof(jjyz)) .read((char*)&hy,sizeof(hy)) .read((char*)&hjkl,sizeof(hjkl));f.read((char*)&gzlr,sizeof(gzlr)) .read((char*)&zsq,sizeof(zsq)) .read((char*)&st,sizeof(st));f.read((char*)&sjcs,sizeof(sjcs)) .read((char*)&sxz,sizeof(sxz)) .read((char*)&xd,sizeof(xd));f.read((char*)&yglgy,sizeof(yglgy)) .read((char*)&man,sizeof(man)) .read((char*)&bbrl,sizeof(bbrl));f.read((char*)&ynmht,sizeof(ynmht)) .read((char*)&rhmht,sizeof(rhmht)) .read((char*)&hf,sizeof(hf));f.read((char*)&jj,sizeof(jj)) .read((char*)shiti,sizeof(shiti)) .read((char*)wuzi,sizeof(wuzi));f.read((char*)&sdt,sizeof(sdt)) .read((char*)&dl,sizeof(dl)) .read((char*)&dc,sizeof(dc));f.read((char*)&sqdy,sizeof(sqdy)) .read((char*)&bsxh,sizeof(bsxh)) .read((char*)&dz,sizeof(dz));f.read((char*)&kj,sizeof(kj)) .read((char*)&duandao,sizeof(duandao)) .read((char*)&equip_duandao,sizeof(equip_duandao));f.read((char*)&cjys,sizeof(cjys)) .read((char*)&xydn,sizeof(xydn)) .read((char*)&xsqqj,sizeof(xsqqj));f.read((char*)&xydn_buff,sizeof(xydn_buff)) .read((char*)&mosun_budai,sizeof(mosun_budai));f.read((char*)&xrscj, sizeof(xrscj)).read((char*)&scj, sizeof(scj)).read((char*)&sc, sizeof(sc)).read((char*)&llz, sizeof(llz)).read((char*)&ffht, sizeof(ffht)).read((char*)&bd, sizeof(bd)).read((char*)&cjyscs, sizeof(cjyscs)).read((char*)&xrssy, sizeof(xrssy)).read((char*)&LL, sizeof(LL)).read((char*)&ttcg, sizeof(ttcg)).read((char*)&ha, sizeof(ha));f.close();cout << " 读档成功" << endl;Sleep(1200);cls();}void ksfm(){Color(0);cout << "" << endl;cout << "" << endl;57 行未改动cout << " 我应该干什么" << endl;cout << " 探索,求生,寻找,并时刻保持警惕?......" << endl;cout << " 操作" << endl;cout << " E打开背包 A/D选择物品 空格使用 P丢弃 Q退出" << endl;cout << " M 查看层级信息 L 存档 O 读档 B 返回菜单 K 清除所有数据" << endl;sjcs ++;while (1){if(kbhit()){cls();return;}}}void clearAllData() {cls();Color(4);cout << "========== 确认清除所有数据?==========\n 按 Y 确认 | 按 N 取消\n=====================================" << endl;while (kbhit() ? (_getch(), true) : true) { // 简化循环char c = _getch();if (c == 'Y' || c == 'y') {// 1. 批量重置基础变量(合并赋值)level = san = food = hp = buff = tili = wuping = xrs = jjyz = hy = hjkl = gzlr = zsq = st = sjcs = sxz = yglgy = man = 0;san = food = hp = tili = 120; // 初始值单独赋值xd = 1, bbrl = 20;// 2. 重置状态/成就变量(添加 yqlyy 和 swfecj 的重置)ynmht = rhmht = hf = jj = sdt = dl = dc = sqdy = bsxh = kj = duandao = equip_duandao =xrscj = scj = sc = llz = ffht = dz = bd = cjyscs = xrssy = LL = ttcg = ha = cjys = xydn =xsqqj = xydn_buff = mosun_budai = swfecj = yqlyy = 0; // 新增 swfecj(训蛾者)、yqlyy(一千零一夜)// 3. 清空数组/容器(简化写法)memset(sbuff, 0, sizeof(sbuff));memset(shiti, 0, sizeof(shiti));memset(wuzi, 0, sizeof(wuzi));L.clear(), swuping.clear();// 4. 删除存档文件(简化提示)Color(2);cout << "\n " << (remove("save.dat") == 0 ? "存档已删除!" : "无存档/删除失败!") << endl;cout << " 所有数据已重置!" << endl;Sleep(1500), cls(), ksfm(); // 链式调用减少行数break;} else if (c == 'N' || c == 'n') {Color(7);cout << "\n 已取消清除操作!" << endl;Sleep(800), cls();break;}}}void Say(char *p,int x){while(1)2 行未改动else break;Sleep(x);}}void jiazai(){cls();cout << endl;cout << endl;cout << endl;Color(11);cout << " - The Backrooms -" << endl;Color(7);cout << " 你曾经来过这里";Sleep(1500);}void my (int x){cout << " ";for (int i = 1; i <= x; i ++) cout << "? ";cout << endl;cout << " ? ? ? ? ?" << endl;cout << " ? ? ? ? ?" << endl;}void cjxt (){cls();Color(0);if (llz == 0) my(3);else {cout << " 流浪者" << endl;cout << " 探索所有12个层级" << endl;}cout << endl;if (ffht == 0) my(4);else {cout << " 反复横跳" << endl;cout << " 使用层级钥匙4次" << endl;}cout << endl;if (sc == 0) my(2);else {cout << " 生存" << endl;cout << " 逃离实体15次" << endl;}cout << endl;if (xrssy == 0) my(3);else {cout << " 杏仁水" << endl;cout << " 使用杏仁水31次" << endl;}cout << endl;if (scj == 0) my(3);else {cout << " 收藏家" << endl;cout << " 获得5个磨损布袋" << endl;}cout << endl;if (swfecj == 0) my(3);else {cout << " 训蛾者" << endl;cout << " 驯服死亡飞蛾" << endl;}cout << endl;if (yqlyy == 0) my(5);else {cout << " 一千零一夜" << endl;cout << " 在一次游戏中存活101个轮回" << endl;}Color(7);cout << endl << " 空格键退出" << endl;while (1){if(kbhit()){char c=_getch();if(c==' '){cls();return;}}}}void kscd(){int kk = 1, k = 1, xz = 1, stou[10]={0, 3, 2, 1, 0};while (k){if (GetAsyncKeyState(38)&0x8000) xz = 1;if (GetAsyncKeyState(40)&0x8000) xz = 2;if(kbhit()){char c=_getch();17 行未改动Color(11);cout << "■■";Color(7);cout << "■■" << endl;int tou = stou[k], jiange = 0;cout << " ";Color(7);cout << "==";19 行未改动Color(11);cout << "==";Color(7);cout << "==";int bian = rand() % 100;if (bian % 24 == 0){cout << endl;Color(8);32 行未改动Color(11);cout << " |" << endl;}}cout << " ";Color(7);cout << "■■";Color(11);cout << "■■";2 行未改动Color(11);cout << "■■";Color(7);cout << "■■" << endl;if (xz == 1) Color(11);else Color(7);cout << " 关于 " << endl;if (xz == 2) Color(11);else Color(7);cout << " 开始游戏" << endl;if (xz == 3) Color(11);else Color(7);cout << " 成就" << endl;int u = 0;while (++ u <= 7000){if(kbhit()){char c=_getch();if(c=='w') {xz = max(1, xz - 1);break;}if(c=='s') {xz = min(3, xz + 1);break;}if(c==' ') {if (xz == 1) guanyu();else if (xz == 2){jiazai();return ;}else if (xz == 3){cjxt();break;}}}}k ++;kk ++;if (k == 5) k = 1;cls();}}void cengji(){Color(0);if (level == 0) cout << "Level 0 -- 前厅";else if (level == 1) cout << "Level 1 -- 宜居区";else if (level == 2) cout << "Level 2 -- 管道噩梦";else if (level == 3) cout << "Level 3 -- 电气室";else if (level == 4) cout << "Level 4 -- 废弃办公室";else if (level == 5) cout << "Level 5 -- 恐怖旅馆";else if (level == 6) cout << "Level 6 -- 熄灯";else if (level == 7) cout << "Level 7 -- 深海恐惧症";else if (level == 8) cout << "Level 8 -- 岩洞系统";else if (level == 9) cout << "Level 9 -- 郊区";else if (level == 10) cout << "Level 10 -- 丰裕";else if (level == 11) cout << "Level 11 -- 无垠城市";}void fenjie2(){if (level == 0){for (int i = 0; i < 30; i ++){Color(10);cout <<"▓";}}else if (level == 1){for (int i = 0; i < 30; i ++){Color(7);cout <<"■";}}else if (level == 2){for (int i = 0; i < 30; i ++){if (i % 7 == 0 || i % 7 == 6){Color(7);cout << "▓";}else if (i % 7 == 3){Color(8);cout << "▌";}else if (i % 7 <= 2 || i % 7 <= 5){Color(8);cout <<"■";}}}else if (level == 3){for (int i = 0; i < 30; i ++){if(i % 7 <= 2){Color(7);cout <<"=";}else if (i % 7 <= 5){Color(11);cout << "#";}else {Color(6);cout << "*";}}}else if (level == 4){for (int i = 0; i < 30; i ++){Color(11);cout <<"▓";}}else if (level == 5){for (int i = 0; i < 30; i ++){Color(11);cout <<"▓";}}else if (level == 5 || level == 8){for (int i = 0; i < 30; i ++){Color(7);cout <<"▓";}}else if (level == 7){for (int i = 0; i < 30; i ++){if (i % 5 == 0) Color(1), cout << "■";else Color(11), cout <<"▓";}}else if (level == 9 || level == 11){for (int i = 0; i < 30; i ++){Color(7);cout <<"■";}}else if (level == 10){for (int i = 0; i < 30; i ++){Color(6);if (i % 5 <= 2) cout <<"■";else cout << "▓";}}}void fenjie1(){if (level == 0){fenjie2();22 行未改动cout << "_";}}}else if (level == 2){fenjie2();cout << endl;for (int i = 0; i < 30; i ++){if (i % 8 <= 3){Color(7);cout << "■";}else {Color(0);cout << "■";}}}else if (level == 3){fenjie2();cout << endl;for (int i = 0; i < 30; i ++){if (i % 6 <= 3){Color(7);cout << "▓";}else {Color(0);cout << "=";}}}else if (level == 5){fenjie2();cout << endl;for (int i = 0; i < 30; i ++){if (i % 3 == 0){Color(8);cout << "▓";}else {Color(6);cout << "■";}}}else if (level == 4){fenjie2();cout << endl;for (int i = 0; i < 30; i ++){if (i % 8 <= 3){Color(7);cout << "▓";}else {Color(0);cout << "■";}}}else if (level == 6 || level == 8){fenjie2();cout << endl;for (int i = 0; i < 30; i ++){Color(7);if (i % 8 <= 3){cout << "▓";}else if (i % 8 <= 5){cout << "▼";}else {Color(0);cout << "■";}}}else if (level == 7){fenjie2();cout << endl;for (int i = 0; i < 30; i ++){Color(7);cout << "▓";}}else if (level == 9){fenjie2();cout << endl;for (int i = 0; i < 30; i ++){if (i % 8 == 0){Color(11);cout << "▓";}else if (i % 8 <= 3 || i % 8 >= 5){Color(7);cout << "■";}else {Color(11);cout << "■";}}}else if (level == 10){fenjie2();cout << endl;for (int i = 0; i < 30; i ++){if (i % 5 <= 1){Color(6);cout << "▓";}else {Color(10);cout << "■";}}}else if (level == 11){fenjie2();cout << endl;for (int i = 0; i < 30; i ++){Color(rand() % 12);cout << "▓";}}}void zhuangtai(){if (level == 0){Color(10);cout << "[] ";}else if (level == 1 || level == 2 || level == 3 || level == 6 || level == 7 || level == 9){Color(7);cout << "[] ";}else if (level == 5 || level == 10){Color(6);cout << "[] ";}else if (level == 4 || level == 11){Color(11);cout << "[] ";}}void Buff(){if (bsxh > 0) {Color(7);cout << "悲尸循环 " ;}if (hf > 0){Color(2);cout << "恢复 " ;}if (jj > 0){Color(9);cout << "安静 ";}}void wpjj(int x){Color(0);if (x == 1){cout << "杏仁水" << endl;cout << "food+15 san+15 hp+5 体力+5";}else if (x == 2){cout << "罐装龙肉" << endl;cout << "food+40 hp+5 体力+5";}else if (x == 3){cout << "皇家口粮" << endl;cout << "珍贵的食物 food+60 san-5 hp+10";}else if (x == 4){cout << "火盐" << endl;cout << "投掷 击退!";}else if (x == 5){cout << "寂静液汁" << endl;cout << "使用后处于安静状态中,不易被发现";}else if (x == 6){cout << "滋水枪" << endl;cout << "加入杏仁水,发射!";}else if (x == 7){cout << "亚格鲁格亚果实" << endl;cout << "恢复效果 food+5 san+5 hp+5";}else if (x == 8){cout << "油腻棉花糖" << endl;cout << "难以下咽,加点杏仁水或许好些";}else if (x == 9){cout << "融化棉花糖" << endl;cout << "美味 food+30 san+5 体力+15";}else if (x == 10){cout << "一节电池" << endl;cout << "为手电筒提供电量";}else if (x == 11){cout << "层级钥匙" << endl;cout << "切换层级";}else if (x == 12){cout << "幸运豆奶" << endl;cout << "幸运效果 san+10 food+10";}else if (x == 13){cout << "现实清新剂" << endl;cout << "恢复san值,消除悲尸循环";}else if (x == 14){cout << "磨损的布袋" << endl;cout << "收纳";}// ===== 新增短刀描述 =====else if (x == 15){cout << "短刀" << endl;cout << "攻击!";}}void sywp(int x){wuping --;if (x == 1){xrs --;food += 15;san += 15;hp += 5;tili += 5;xrssy ++;}else if (x == 2){gzlr --;food += 40;hp += 5;tili += 5;}else if (x == 3){hjkl --;food += 60;san -= 5;hp += 10;}else if (x == 5){jj += rand() % 6 + 8;sbuff[++buff] = 3;jjyz --;}else if (x == 6){if (!xrs){wuping ++;cout << endl;cout << " 你没有填装物!";Sleep(500);}else if (sqdy > 0){wuping ++;cout << endl;cout << " 有填装物了!";Sleep(500);}else {sqdy += 5;xrs --;}}else if (x == 7){yglgy --;food += 5;sbuff[++buff] = 2;hf += 6 + rand() % 6;}else if (x == 8) {if ( !xrs){wuping ++;cout << endl;cout << " 你没有东西融化它!";Sleep(500);}else {xrs --;rhmht ++;ynmht --;}}else if (x == 9){food += 30;san += 5;tili += 15;rhmht --;}else if (x == 10){if (dl == 0){dl = 100;dc --;}else {wuping ++;cout << endl;cout << " 手电筒还有电!";Sleep(500);}}else if (x == 11){cjys --;cout << endl << " 请输入层级编号 " << endl;cout << " 0 1 2 3 4 5 6 7 8 9 A B";char ch = _getch();int target_level = -1;if (ch >= '0' && ch <= '9') {target_level = ch - '0';}else if (ch == 'A' || ch == 'a') {target_level = 10;}else if (ch == 'B' || ch == 'b') {target_level = 11;}if (target_level >= 0 && target_level <= 11){level = target_level;cjyscs ++;}if (target_level >= 0 && target_level <= 11 ){level = target_level;cjyscs ++;} else {cjys ++;cout << endl << " 无效层级";wuping ++;}Sleep(1000);}else if (x == 12){ // 幸运豆奶xydn --;food += 10;san += 10;xydn_buff = 8 + rand() % 3;sbuff[++buff] = 4;}else if (x == 13){ // 现实清新剂xsqqj --;san = 120;if (bsxh > 0){bsxh = 0;buff --;}}else if (x == 14){mosun_budai --;bbrl += 10;}// ===== 新增短刀使用逻辑(装备)=====else if (x == 15){duandao --;equip_duandao = 1; // 装备短刀}}void dqwp(int x){man = 0;Color(0);cout << endl << "丢弃 ";wuping --;if (x == 1){cout << "一瓶杏仁水" << endl;xrs --;}else if (x == 2){cout << "一罐罐装龙肉" << endl;gzlr --;}else if (x == 3){cout << "一盒皇家口粮" << endl;hjkl --;}else if (x == 4){cout << "一块火盐" << endl;hy --;}else if (x == 5){cout << "一瓶寂静液汁" << endl;jjyz --;}else if (x == 6){cout << "一把滋水枪" << endl;zsq --;}else if (x == 7){cout << "一颗亚格鲁格亚果实" << endl;yglgy --;}else if (x == 8){cout << "一包油腻棉花糖" << endl;ynmht --;}else if (x == 9){cout << "一包融化棉花糖" << endl;rhmht --;}else if (x == 10){cout << "电池" << endl;dc --;}else if (x == 11){cout << "一把层级钥匙" << endl;cjys --;}else if (x == 12){cout << "一盒幸运豆奶" << endl;xydn --;}else if (x == 13){cout << "一瓶现实清新剂" << endl;xsqqj --;}else if (x == 14){cout << "一个磨损的布袋" << endl;mosun_budai --;}// ===== 新增短刀丢弃逻辑 =====else if (x == 15){cout << "一把短刀" << endl;duandao --;equip_duandao = 0;}}void beibao(){cls();sjcs = rand() % sjcs;int xz = 0, xzwp, tc = 0;if (wuping > 0) xz = 1;while (1){if (wuping > bbrl) man = 1;else man = 0;int wp = 0, zs = 0, xzwp = 0;cout << endl;Color(0);cout << "背包";if (man) cout << "已满,请丢弃或使用物品";cout << endl;Color(11);cout << "------------------------------" << endl;if (xrs > 0){for (int i = 1; i <= xrs; i ++){wp ++;if (wp == xz) xzwp = 1, Color(11);else Color(7);if (zs + 6 > 30){zs = 8;cout << endl;}else {zs += 8;}cout << "杏仁水 ";}}if (gzlr > 0){for (int i = 1; i <= gzlr; i ++){wp ++;if (wp == xz) xzwp = 2, Color(11);else Color(7);if (zs + 8 > 30){zs = 10;cout << endl;}else {zs += 10;}cout << "罐装龙肉 ";}}if (hjkl > 0){for (int i = 1; i <= hjkl; i ++){wp ++;if (wp == xz) xzwp = 3, Color(11);else Color(7);if (zs + 8 > 30){zs = 10;cout << endl;}else {zs += 10;}cout << "皇家口粮 ";}}if (hy > 0){for (int i = 1; i <= hy; i ++){wp ++;if (wp == xz) xzwp = 4, Color(11);else Color(7);if (zs + 4 > 30){zs = 6;cout << endl;}else {zs += 6;}cout << "火盐 ";}}if (jjyz > 0)for (int i = 1; i <= jjyz; i ++){wp ++;if (wp == xz) xzwp = 5, Color(11);else Color(7);if (zs + 8 > 30){zs = 10;cout << endl;}else {zs += 10;}cout << "寂静液汁 ";}if (zsq > 0)for (int i = 1; i <= zsq; i ++){wp ++;if (wp == xz) xzwp = 6, Color(11);else Color(7);if (zs + 6 > 30){zs = 8;cout << endl;}else {zs += 8;}cout << "滋水枪 ";}if (yglgy > 0)for (int i = 1; i <= yglgy; i ++){wp ++;if (wp == xz) xzwp = 7, Color(11);else Color(7);if (zs + 14 > 30){zs = 16;cout << endl;}else {zs += 16;}cout << "亚格鲁格亚果实 ";}if (ynmht > 0)for (int i = 1; i <= ynmht; i ++){wp ++;if (wp == xz) xzwp = 8, Color(11);else Color(7);if (zs + 10 > 30){zs = 12;cout << endl;}else {zs += 12;}cout << "油腻棉花糖 ";}if (rhmht > 0)for (int i = 1; i <= rhmht; i ++){wp ++;if (wp == xz) xzwp = 9, Color(11);else Color(7);if (zs + 10 > 30){zs = 12;cout << endl;}else {zs += 12;}cout << "融化棉花糖 ";}if (dc > 0)for (int i = 1; i <= dc; i ++){wp ++;if (wp == xz) xzwp = 10, Color(11);else Color(7);if (zs + 4 > 30){zs = 6;cout << endl;}else {zs += 6;}cout << "电池 ";}if (cjys > 0)for (int i = 1; i <= cjys; i ++){wp ++;if (wp == xz) xzwp = 11, Color(11);else Color(7);if (zs + 8 > 30){zs = 10;cout << endl;}else {zs += 10;}cout << "层级钥匙 ";}if (xydn > 0)for (int i = 1; i <= xydn; i ++){wp ++;if (wp == xz) xzwp = 12, Color(11);else Color(7);if (zs + 8 > 30){zs = 10;cout << endl;}else {zs += 10;}cout << "幸运豆奶 ";}if (xsqqj > 0)for (int i = 1; i <= xsqqj; i ++){wp ++;if (wp == xz) xzwp = 13, Color(11);else Color(7);if (zs + 10 > 30){zs = 12;cout << endl;}else {zs += 12;}cout << "现实清新剂 ";}if (mosun_budai > 0)for (int i = 1; i <= mosun_budai; i ++){wp ++;if (wp == xz) xzwp = 14, Color(11);else Color(7);if (zs + 10 > 30){zs = 12;cout << endl;}else {zs += 12;}cout << "磨损的布袋 ";}// ===== 新增短刀显示 =====if (duandao > 0)for (int i = 1; i <= duandao; i ++){wp ++;if (wp == xz) xzwp = 15, Color(11);else Color(7);if (zs + 4 > 30){zs = 6;cout << endl;}else {zs += 6;}cout << "短刀 ";}cout << endl;Color(11), cout << "------------------------------" << endl;wpjj(xzwp);cout << endl;Color(11), cout << "------------------------------" << endl;Color(0), cout << "装备 " << endl;if (sdt == 1){cout << "手电筒 " ;cout << "电量 ";if (dl <= 20) Color(4);cout << dl << "% " << endl;}// 显示已装备的短刀if (equip_duandao == 1){Color(0);cout << "短刀 " << endl;Color(0);}while (1){if(kbhit()){char c=_getch();if (c == 'a'){xz --;if (xz < 1) xz = 1;break;}if (c == 'd' && xz < wuping){xz ++;if (xz > wuping) xz = wuping;break;}if (c == 'q' && !man){tc = 1;break;}if (c == ' '){sywp(xzwp);xz --;if (xz < 1) xz = 1;break;}if (c == 'p'){dqwp(xzwp);xz --;if (xz < 1) xz = 1;break;}}}cls();if (tc == 1) break;}return ;}void qhcj(){cls();cout << endl << endl;int yl = level;while (yl == level) level = rand() % 12;cout << endl;Color(0);cout << " 你切入了";cengji();Sleep(1500);cls();}void tsyy(){int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);for (int i = 1; i <= k; i ++) sj = rand() % 78;if (sj <= 14 || sj >= 72) cout << "继续探索这里" << endl;else if (sj > 14 && sj <= 31) cout << "向四处走走" << endl;else if (sj > 31 && sj <= 56) cout << "碰碰运气,搜寻一番" << endl;else cout << "环顾四周,继续探索" << endl;}void xxyy(){int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);for (int i = 1; i <= k; i ++) sj = rand() % 78;if (sj <= 14 || sj >= 63) cout << "探索很久了,歇歇吧" << endl;else if (sj > 14 && sj <= 31) cout << "休息一会" << endl;else cout << "找处安静地休息" << endl;}void xzyy(){int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);for (int i = 1; i <= k; i ++) sj = rand() % 78;if (sj <= 14 || sj >= 63) cout << "想办法离开这儿" << endl;else if (sj > 14 && sj <= 31) cout << "寻找层级出口" << endl;else cout << "尝试离开这里" << endl;}void mysh(){int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);for (int i = 1; i <= k; i ++) sj = rand() % 78;if (sj <= 14 || sj >= 63) cout << " 嗯..没有任何收获" << endl;else if (sj > 14 && sj <= 31) cout << " 没有任何结果.." << endl;else cout << " 空手而回.." << endl;}void ckdf(){if (level == 0){int sj = rand() % 3;if (sj == 0) cout << "一个通风管道口";else if (sj == 1) cout << "一面墙";else cout << "一扇玻璃门";}else if (level == 1){int sj = rand() % 3;if (sj == 0) cout << "一扇门";else if (sj == 1) cout << "一段阶梯";else cout << "一面带有排水口的墙体";}else if (level == 2){int sj = rand() % 3;if (sj == 0) cout << "一条廊道";else if (sj == 1) cout << "一扇金色大门";else cout << "一个消防出口";}else if (level == 3){int sj = rand() % 3;if (sj == 0) cout << "一扇标有记号的门";else if (sj == 1) cout << "一个破旧机器";else cout << "一条走道";}else if (level == 4){int sj = rand() % 3;if (sj == 0) cout << "一扇活板门";else if (sj == 1) cout << "一个天花板门";else cout << "一个小房间";}else if (level == 5){int sj = rand() % 3;if (sj == 0) cout << "一扇黑暗的门";else if (sj == 1) cout << "一条异常宽敞的走廊";else cout << "一面中式风格的墙";}else if (level == 6){int sj = rand() % 3;if (sj == 0) cout << "一个楼梯井";else if (sj == 1) cout << "一个门径";else cout << "一扇巨大铁门";}else if (level == 7){int sj = rand() % 2;if (sj == 0) cout << "一个岩洞";else if (sj == 1) cout << "一条笔直的路";}else if (level == 8){int sj = rand() % 3;if (sj == 0) cout << "一个通风管道";else if (sj == 1) cout << "一个焦油坑";else cout << "一个狭窄的隧道";}else if (level == 9){int sj = rand() % 3;if (sj == 0) cout << "一片田地";else if (sj == 1) cout << "一片草地";else cout << "一栋房子";}else if (level == 10){int sj = rand() % 2;if (sj == 0) cout << "一条小径";else if (sj == 1) cout << "一片芥花籽";}else if (level == 11){int sj = rand() % 3;if (sj == 0) cout << "一片灌木丛";else if (sj == 1) cout << "一个游戏厅";else cout << "一所房子外表奇形怪的医院";}}int xzcksh(){cout << endl;Color(0);4 行未改动return 1;}else {int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);for (int i = 1; i <= k; i ++) sj = rand() % 78;if (sj <= 34 || sj >= 63) cout << " 好吧,这很难." << endl;else cout << " 什么都没发现" << endl;4 行未改动if (level == 0){int k = rand() % 2;if (k == 0) cout << "地板上";else cout << "墙角边";}else if (level == 1){int k = rand() % 4;if (k == 0) cout << "板条箱里";else if (k == 1) cout << "地板上";else if (k == 2) cout << "墙角";else cout << "柱子边" ;}else if (level == 2){int k = rand() % 4;if (k == 0) cout << "电箱上";else if (k == 1) cout << "地板上";else if (k == 2) cout << "墙边";else cout << "管道上" ;}else if (level == 3){int k = rand() % 4;if (k == 0) cout << "隧道里";else if (k == 1) cout << "地板上";else if (k == 2) cout << "墙边";else cout << "机器上" ;}else if (level == 4){int k = rand() % 4;if (k == 0) cout << "办公桌上";else if (k == 1) cout << "地板上";else if (k == 2) cout << "墙边";else cout << "椅子上" ;}else if (level == 5){int k = rand() % 4;if (k == 0) cout << "椅子上";else if (k == 1) cout << "地毯上";else if (k == 2) cout << "墙角";else cout << "餐桌上" ;}else if (level == 6 || level == 8){cout << "黑暗中";}else if (level == 7){int k = rand() % 2;if (k == 0) cout << "海面上";else cout << "房间里";}else if (level == 9){int k = rand() % 4;if (k == 0) cout << "路灯下";else if (k == 1) cout << "街道上";else if (k == 2) cout << "房子内";else cout << "田地边" ;}else if (level == 10){int k = rand() % 4;if (k == 0) cout << "田里";else if (k == 1) cout << "仓库里";else if (k == 2) cout << "湖边";else cout << "门阶上" ;}else if (level == 11){int k = rand() % 4;if (k == 0) cout << "车上";else if (k == 1) cout << "马路上";else if (k == 2) cout << "草地上";else cout << "房子边" ;}}void ysh(){int sj;sjcs ++;int k = max((sjcs + 11) % 24, 1);Color(0);wuping ++;cout << "你在";fxdf();cout << "发现了 ";for (int i = 1; i <= k; i ++) sj = rand() % 1200;// ========== 概率等级1(3%):层级钥匙(分散为2个区间) ==========if ((sj >= 0 && sj <= 14) || (sj >= 800 && sj <= 814)) {cout << "一把层级钥匙" << endl;cjys ++;}// ========== 概率等级2(5%):磨损的布袋(分散为2个区间) ==========else if ((sj >= 15 && sj <= 40) || (sj >= 815 && sj <= 829)) {cout << "一个磨损的布袋" << endl;bd ++;mosun_budai ++;}// ========== 概率等级2(5%):现实清新剂(分散为2个区间) ==========else if ((sj >= 45 && sj <= 74) || (sj >= 830 && sj <= 844)) {cout << "一瓶现实清新剂" << endl;xsqqj ++;}// ========== 概率等级3(6%):滋水枪(分散为3个区间) ==========else if ((sj >= 75 && sj <= 94) || (sj >= 845 && sj <= 864) || (sj >= 950 && sj <= 959)) {cout << "一把滋水枪" << endl;zsq ++;}// ========== 概率等级3(6%):皇家口粮(分散为3个区间) ==========else if ((sj >= 95 && sj <= 118) || (sj >= 865 && sj <= 888) || (sj >= 960 && sj <= 969)) {cout << "一盒皇家口粮" << endl;hjkl ++;}// ========== 概率等级3(6%):电池/手电筒(分散为3个区间) ==========else if ((sj >= 115 && sj <= 134) || (sj >= 885 && sj <= 904) || (sj >= 970 && sj <= 979)) {if (sdt == 0) {cout << "一个手电筒" << endl;sdt = 1;dl = max(rand() % 101, 20);} else {cout << "一节电池" << endl;dc ++;}}// ========== 概率等级4(8%):火盐(分散为4个区间) ==========else if ((sj >= 135 && sj <= 154) || (sj >= 300 && sj <= 319) || (sj >= 450 && sj <= 469) || (sj >= 600 && sj <= 619)) {cout << "一小块火盐" << endl;hy ++;}// ========== 概率等级4(8%):寂静液汁(分散为4个区间) ==========else if ((sj >= 155 && sj <= 174) || (sj >= 320 && sj <= 339) || (sj >= 470 && sj <= 489) || (sj >= 620 && sj <= 639)) {cout << "一瓶寂静液汁" << endl;jjyz ++;}// ========== 概率等级4(8%):幸运豆奶(分散为4个区间) ==========else if ((sj >= 175 && sj <= 194) || (sj >= 340 && sj <= 359) || (sj >= 490 && sj <= 509) || (sj >= 640 && sj <= 659)) {cout << "一盒幸运豆奶" << endl;xydn ++;}// ========== 概率等级4(8%):油腻棉花糖(分散为4个区间) ==========else if ((sj >= 195 && sj <= 214) || (sj >= 360 && sj <= 379) || (sj >= 510 && sj <= 529) || (sj >= 660 && sj <= 679)) {cout << "一包油腻棉花糖" << endl;ynmht ++;}// ========== 概率等级5(10%):亚格鲁格亚果实(分散为5个区间) ==========else if ((sj >= 215 && sj <= 234) || (sj >= 380 && sj <= 399) || (sj >= 530 && sj <= 549) || (sj >= 680 && sj <= 699) || (sj >= 750 && sj <= 769)) {cout << "一颗亚格鲁格亚果" << endl;yglgy ++;}// ========== 概率等级5(8%):罐装龙肉(分散为4个区间) ==========else if ((sj >= 230 && sj <= 259) || (sj >= 400 && sj <= 419) || (sj >= 550 && sj <= 569) || (sj >= 700 && sj <= 719)) {cout << "一罐罐装龙肉" << endl;gzlr ++;}// ========== 新增:短刀(4%概率,分散为2个区间) ==========else if ((sj >= 260 && sj <= 299) || (sj >= 720 && sj <= 749) && (!duandao || !equip_duandao) ) {cout << "一把短刀" << endl;duandao ++;}// ========== 概率等级5(23%):杏仁水(大幅提升,分散补充所有剩余区间) ==========else {cout << "一瓶杏仁水" << endl;xrs ++;}}int tssh(){int total_range = 1000;int sj = rand() % total_range;int has_item = 0;if (sj == 234 || sj == 567 || sj == 345 || sj == 456 || sj == 678 && swfecj == 0){cout << " 你遇到了一只死亡飞蛾" << endl;cout << " e 洒杏仁水 p 离开" << endl;while (1){if (kbhit()){char c=_getch();if (c == 'e') {int sj = rand() % 5;if (sj >= 3) {cout << " 你驯服了死亡飞蛾" << endl;swfecj = 1;cj(6);}else {cout << " 死亡飞蛾离开了" << endl;}Sleep(1200);return 0;}else return 0;}}}if (level == 0) {// (22%概率):分散为3个区间if ((sj >= 0 && sj <= 99) || (sj >= 300 && sj <= 399) || (sj >= 700 && sj <= 729)) {has_item = 1;}}else if (level == 1) {// (35%概率):分散为3个区间if ((sj >= 0 && sj <= 99) || (sj >= 300 && sj <= 399) || (sj >= 700 && sj <= 799) || (sj >= 800 && sj <= 849)) {has_item = 1;}}else if (level == 2 || level == 6 || level == 8) {// (18%概率):分散为2个区间if ((sj >= 200 && sj <= 299) || (sj >= 500 && sj <= 579)) {has_item = 1;}}else if (level == 3 || level == 7 || level == 9) {// (20%概率):分散为2个区间if ((sj >= 200 && sj <= 299) || (sj >= 500 && sj <= 599)) {has_item = 1;}}else if (level == 4) {// (30%概率):分散为3个区间if ((sj >= 0 && sj <= 99) || (sj >= 300 && sj <= 399) || (sj >= 700 && sj <= 799)) {has_item = 1;}}else if (level == 5 ) {// (37%概率):分散为3个区间if ((sj >= 0 && sj <= 99) || (sj >= 300 && sj <= 399) || (sj >= 700 && sj <= 799) || (sj >= 800 && sj <= 869)) {has_item = 1;}}else if (level == 10 || level == 11) {// (60%概率):分散为3个区间if ((sj >= 200 && sj <= 239) || (sj >= 500 && sj <= 599) || (sj >= 0 && sj <= 99) || (sj >= 300 && sj <= 399) || (sj >= 700 && sj <= 799) || (sj >= 800 && sj <= 869)) {has_item = 1;}}if (xydn_buff > 0 && sj >= 700) has_item = 1;if (dl > 0 && sj >= 800) has_item = 1;return has_item;}void sw(int x){cls();cout << endl << endl;Color(4);cout << " YOU DEAD" << endl;cout << endl;cout << " reason: ";Color(7);if (x == 1){cout << "悲尸循环";}else if (x == 2){cout << "饥饿";}else if (x == 3){cout << "实体攻击";}else if (x == 4){cout << "恐惧";}Sleep(1800);exit(0);}int taotuo(int x){int cg = 0, sj = rand() % 200;if(x==1 && ((sj>=10&&sj<=29)||(sj>=80&&sj<=99))) cg=1; // 40/200=20%if(x==2 && ((sj>=5&&sj<=24)||(sj>=50&&sj<=99))) cg=1; // 80/200=40%if(x==3 && ((sj>=0&&sj<=39)||(sj>=60&&sj<=139))) cg=1; // 110/200=55%if(x==4 && ((sj>=2&&sj<=71)||(sj>=90&&sj<=189))) cg=1; // 150/200=75%if(x==5 && ((sj>=5&&sj<=24)||(sj>=50&&sj<=99))) cg=1; // 150/200=75%return cg;}void guaiwu(){st = 1;int gw;cls();int sj = rand() % 200;if ((sj >= 34 && sj <= 38 || sj >= 140 && sj <= 148 || sj >= 88 && sj <= 93)|| (dl == 0 && sj >= 111 && sj <= 113)) gw = 1;//笑魇else if(sj >= 41 && sj <= 49 || sj >= 21 && sj <= 28 ) gw = 2;//死亡飞蛾else if(sj >= 160 && sj <= 167 || sj >= 189 && sj <= 194|| sj >= 127 && sj <= 130) gw = 3;// 窃皮者else if(sj >= 190 && sj <= 195 || sj >= 30 && sj <= 33|| sj >= 100 && sj <= 108) gw = 4;// 钝人else if(sj >= 63 && sj <= 68 || sj >= 151 && sj <= 158|| sj >= 177 && sj <= 181) gw = 5;//肢团else if(sj >= 69 && sj <= 73 || sj >= 168 && sj <= 170) gw = 6;//悲尸if (level == 7 && sj >= 130) gw = 8;else gw = 7;//猎犬int xh = 0;while (xh <= 460000){cls();san -= rand() % 9;Color(8);cout << "______________________________" << endl;cout << "▉◢!◢◢◢!◢◢◢!◢◢◢!◢◢◢!◢◢◢!◢◢◢!◢◢▉" << endl;cout << "正在遭遇 ";Color(0);if (gw == 1) cout << "笑魇", hp -= max(rand() % 18, 14);else if (gw == 2) cout << "死亡飞蛾", hp -= max(rand() % 13, 10);else if (gw == 3) cout << "窃皮者", hp -= max(rand() % 16, 12);else if (gw == 4) cout << "钝人", hp -= max(rand() % 16, 10);else if (gw == 5) cout << "肢团", hp -= max(rand() % 14, 12);else if (gw == 6) cout << "悲尸", hp -= max(rand() % 15, 9);else if (gw == 7) cout << "猎犬", hp -= max(rand() % 15, 9);else if (gw == 8) cout << "小小", hp -= max(rand() % 16, 10);cout << endl;Color(8);cout << "______________________________" << endl;Color(0);cout << "HP ";if (hp > 20) Color(0);else Color(4);cout << hp << " ";if (hp < 100) cout << " ";if (hp < 10) cout << " ";Color(0);cout << "FOOD ";if (food > 20) Color(0);else Color(4);cout << food << " ";if (food < 100) cout << " ";if (food < 10) cout << " ";Color(0);cout << "SAN ";if (san > 20) Color(0);else Color(4);cout << san << " ";if (san < 100) cout << " ";if (san < 10) cout << " ";//基础数值cout << endl;Color(8);cout << " ○ z 逃跑" << endl;if (xrs > 0) cout << " ○ x 洒杏仁水" << endl;if (hy > 0) cout << " ○ c 扔出火盐" << endl;if (sqdy > 0) cout << " ○ v 滋水枪喷水" << endl;if (equip_duandao > 0) cout << " ○ b 短刀攻击" << endl;int u = 0, tt = 0;while (1){if (hp <= 0) {sw(3);}if(kbhit()){char c=_getch();if (c == 'z') tt = 1;else if (c == 'c' && hy > 0) tt = 2, hy --, hp += rand() % 3;else if (c == 'x' && xrs > 0) tt = 3, xrs --, hp += 3 + rand() % 4;else if (c == 'v' && sqdy > 0) tt = 4, sqdy --, hp += 6 + rand() % 5;else if (c == 'b' && equip_duandao > 0) tt = 5, hp += 4 + rand() % 5;if (tt > 0){if (taotuo(tt)) {ttcg ++;return ;}else break;}}}}}void tradeSystem() {cls();srand((unsigned int)time(NULL)); // 初始化随机数int trade_exit = 0;int select_mode = 1; // 1=购买模式,2=出售模式int select_item = 1;// 物品核心信息(价值、背包指针、是否为装备、是否可作为奖励)struct ItemInfo {int id;double value; // 单位价值(杏仁水=1)string name;int* count; // 指向背包物品数量的指针bool is_equip; // 是否为装备bool can_get; // 是否可作为售卖奖励};// 物品列表(严格按你指定的价值配置)vector<ItemInfo> items = {{1, 1.0, "杏仁水", &xrs, false, true},{2, 4.0, "皇家口粮", &hjkl, false, true},{3, 2.5, "寂静液汁", &jjyz, false, true},{4, 8.0, "层级钥匙", &cjys, false, true},{5, 3.0, "现实清新剂", &xsqqj, false, false},{6, 4.0, "磨损布袋", &mosun_budai, false, false},{7, 3.0, "罐装龙肉", &gzlr, false, true},{8, 1.5, "幸运豆奶", &xydn, false, true},{9, 1.5, "火盐", &hy, false, true},{10, 2.0, "油腻棉花糖", &ynmht, false, true},{12, 1.0, "电池", &dc, false, true},{13, 8.0, "滋水枪", &zsq, false, true},{14, 2.0, "亚格鲁格亚果实", &yglgy, false, true},{15, 10.0, "短刀", &duandao, true, false} // 装备(无限制售卖)};// 购买物品配置struct BuyItem { int id; string name; int cost; int num; };vector<BuyItem> buy_list = {{2,"皇家口粮",4,1}, {3,"寂静液汁",3,1}, {4,"层级钥匙",9,1},{5,"现实清新剂",3,1}, {6,"磨损布袋",5,1}, {7,"罐装龙肉",5,2},{8,"幸运豆奶",2,1}, {9,"火盐",1,1}, {12,"电池",2,3},{10,"油腻棉花糖",3,2}, {14,"亚格鲁格亚果实",2,1}};while (!trade_exit) {cls();// 界面头部Color(11); cout << "======= 交易市场 =======\n";Color(7); cout << "杏仁水: " << xrs << "\n";cout << "========================\n";// 模式选择Color(select_mode==1?2:7); cout << "[1] 购买\n";Color(select_mode==2?2:7); cout << "[2] 出售\n";Color(11); cout << "========================\n";if (select_mode == 1) {// 购买模式:显示可购买物品Color(7); cout << "【可购买】\n";for (int i=0; i<buy_list.size(); i++) {if (i+1 == select_item) Color(2); else Color(7);cout << "[" << i+1 << "]" << buy_list[i].name<< " 价格:" << buy_list[i].cost << " 获得:" << buy_list[i].num << "\n";}} else {// 出售模式:仅过滤 数量>0 + 不是杏仁水(装备无限制)Color(7); cout << "【可出售】\n";vector<ItemInfo> sellable;for (auto& it : items) {if (*it.count <= 0) continue; // 数量为0的物品不显示if (it.id == 1) continue; // 杏仁水禁止售卖sellable.push_back(it); // 所有装备都加入可售卖列表}if (sellable.empty()) {Color(4); cout << " 没有可出售物品\n"; Color(7);} else {// 遍历可售卖物品,选中时显示预计获得的物品for (int i=0; i<sellable.size(); i++) {ItemInfo& item = sellable[i];if (i+1 == select_item) {Color(2);cout << "[" << i+1 << "]" << item.name << " ×" << *item.count << "\n";Color(10); // 浅绿色显示预计奖励// 提前计算选中物品卖出后会获得的物品(仅显示,不执行)vector<ItemInfo> rewards;for (auto& it : items) if (it.can_get) rewards.push_back(it);int r = rand()%rewards.size();ItemInfo& get_item = rewards[r];// 计算价值(控制差值≤1.5)double base_value = item.value;// 波动范围:base_value-1.5 ~ base_value+1.5,且不低于0.1double min_total = max(base_value - 1.5, 0.1);double max_total = base_value + 1.5;double total = min_total + (rand() % (int)((max_total - min_total)*100))/100.0;int cnt = max((int)(total / get_item.value), 1); // 至少1个cout << " → 卖出可获得:" << cnt << "个" << get_item.name << "\n";Color(7);} else {Color(7);cout << "[" << i+1 << "]" << item.name << " ×" << *item.count << "\n";}}}}// 操作提示Color(7);cout << "========================\n";cout << "W上 S下|A买 D卖|空格确认|Q退出\n";// 处理用户输入while (true) {if (!_kbhit()) continue;char op = _getch();// 预筛选可售卖物品(用于上下选择逻辑)vector<ItemInfo> sellable;for (auto& it : items) {if (*it.count <=0 || it.id ==1) continue;sellable.push_back(it);}// 上下选择物品if (op == 'w' || op == 'W') {select_item = max(1, select_item-1); break;}if (op == 's' || op == 'S') {if (select_mode ==1) select_item = min((int)buy_list.size(), select_item+1);else select_item = min((int)sellable.size(), select_item+1);break;}// 切换模式if (op == 'a' || op == 'A') { select_mode=1; select_item=1; break; }if (op == 'd' || op == 'D') { select_mode=2; select_item=1; break; }// 空格确认(购买/出售)if (op == ' ') {if (select_mode ==1) {// 购买逻辑(保持不变)if (select_item <1 || select_item > buy_list.size()) break;auto& b = buy_list[select_item-1];if (xrs >= b.cost) {xrs -= b.cost;for (auto& it : items) if (it.id == b.id) *it.count += b.num;wuping += b.num;Color(2); cout << "\n购买成功!\n"; Sleep(1200);} else { Color(4); cout << "\n杏仁水不足\n"; Sleep(800); }} else {// 出售逻辑(控制价值差值≤1.5)if (sellable.empty()) { Color(4); cout << "\n无可出售\n"; Sleep(800); break; }if (select_item <1 || select_item > sellable.size()) break;auto& sold = sellable[select_item-1];*sold.count -=1; // 直接减少物品数量wuping -=1;// 筛选可作为奖励的物品vector<ItemInfo> rewards;for (auto& it : items) if (it.can_get) rewards.push_back(it);int r = rand()%rewards.size();auto& get = rewards[r];// 核心:控制价值差值≤1.5double base_value = sold.value;double min_total = max(base_value - 1.5, 0.1); // 最低价值0.1,避免负数double max_total = base_value + 1.5;double total = min_total + (rand() % (int)((max_total - min_total)*100))/100.0;int cnt = max((int)(total / get.value), 1); // 至少获得1个// 确保最终差值不超过1.5(兜底校验)double actual_diff = abs(total - base_value);if (actual_diff > 1.5) {total = base_value + (rand()%2==0 ? 1.5 : -1.5);cnt = max((int)(total / get.value), 1);}*get.count += cnt;wuping += cnt;// 提示售卖结果(不显示价值)Color(2);cout << "\n出售成功!\n";Color(7);cout << "卖出:" << sold.name << "\n";cout << "获得:" << cnt << "个" << get.name << "\n";Sleep(1800);}break;}// Q退出交易if (op == 'q' || op == 'Q') { trade_exit=1; break; }}}cls();}bool check_entity_spawn() {int total_range = 1000;int sj = rand() % total_range;int spawn = 0;int entity_level = 0;if (level == 0 || level == 5 || level == 4) entity_level = 0; // 0级 - 0%else if (level == 1 || level == 11) entity_level = 1; // 1级 - 3%else if (level == 2) entity_level = 2; // 2级 - 6%else if (level == 3 || level == 7) entity_level = 3;else if (level == 8) entity_level = 4;else if (level == 9) entity_level = 5;switch(entity_level) {case 0:spawn = 0;break;case 1:if ((sj >= 10 && sj <= 19) ||(sj >= 210 && sj <= 219) ||(sj >= 410 && sj <= 419)) {spawn = 1;}break;case 2: // 2级 - 6% 概率(4个分散区间,总计60个值)if ((sj >= 20 && sj <= 34) ||(sj >= 220 && sj <= 234) ||(sj >= 420 && sj <= 434) ||(sj >= 620 && sj <= 634)) {spawn = 1;}break;case 3: // 3级 - 9% 概率(5个分散区间,总计90个值)if ((sj >= 35 && sj <= 52) ||(sj >= 235 && sj <= 252) ||(sj >= 435 && sj <= 452) ||(sj >= 635 && sj <= 652) ||(sj >= 835 && sj <= 852)) {spawn = 1;}break;case 4: // 4级 - 12% 概率(6个分散区间,总计120个值)// 区间1: 53-72 (20个) + 区间2: 253-272 (20个) + 区间3: 453-472 (20个) + 区间4: 653-672 (20个) + 区间5: 853-872 (20个) + 区间6: 953-972 (20个)if ((sj >= 53 && sj <= 72) ||(sj >= 253 && sj <= 272) ||(sj >= 453 && sj <= 472) ||(sj >= 653 && sj <= 672) ||(sj >= 853 && sj <= 872) ||(sj >= 953 && sj <= 972)) {spawn = 1;}break;case 5: // 5级 - 15% 概率(7个分散区间,总计147个值)if ((sj >= 73 && sj <= 93) ||(sj >= 173 && sj <= 193) ||(sj >= 273 && sj <= 293) ||(sj >= 473 && sj <= 493) ||(sj >= 673 && sj <= 693) ||(sj >= 873 && sj <= 893) ||(sj >= 973 && sj <= 993)) {spawn = 1;}break;}return spawn == 1;}int main(){srand((unsigned)time(NULL));CONSOLE_CURSOR_INFO cursor_info = {1, 0};SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);// ============== 修复:安全读档(先判断文件是否存在)==============ifstream f("save.dat", ios::binary);if (f.is_open()) {f.read((char*)&xrscj, sizeof(xrscj)).read((char*)&scj, sizeof(scj)).read((char*)&sc, sizeof(sc)).read((char*)&llz, sizeof(llz)).read((char*)&ffht, sizeof(ffht)).read((char*)&bd, sizeof(bd)).read((char*)&cjyscs, sizeof(cjyscs)).read((char*)&xrssy, sizeof(xrssy)).read((char*)&LL, sizeof(LL)).read((char*)&ttcg, sizeof(ttcg)).read((char*)&swfecj, sizeof(swfecj)).read((char*)&yqlyy, sizeof(yqlyy));f.close();} else {// 文件不存在,初始化所有成就/计数变量xrscj = 0;scj = 0;sc = 0;llz = 0;ffht = 0;bd = 0;cjyscs = 0;xrssy = 0;LL = 0;ttcg = 0;}ksfm();cls();xd = 1;wuzi[0] = 1;shiti[1] = 1;wuzi[1] = 2;shiti[2] = 2;wuzi[2] = -1;shiti[3] = 3;shiti[7] = shiti[8] = shiti[9] = shiti[11] = 3;while (1){kscd();while (1){int tc = 0, ymy = 0;cls();L[level] ++;LL += (L[level] == 1);if (LL == 12 && llz == 0) LL ++, llz = 1, cj(1), ymy = 1;if (cjyscs == 4 && ffht == 0) ffht = 1, cj(2), ymy = 1;if (ttcg == 15 && sc == 0) sc = 1, cj(3), ymy = 1;if (xrssy == 31 && xrscj == 0) xrscj = 1, cj(4), ymy = 1;if (bd == 5 && scj == 0) scj = 1, cj(5), ymy = 1;if (swfecj == 1) swfecj = 2, ymy = 1;if (ts = 101 && yqlyy == 0)yqlyy = 1, ymy = 1;if (ymy){ifstream f("save.dat",ios::binary);if (f.is_open()) { // 新增:检查文件是否打开f.read((char*)&xrscj, sizeof(xrscj)).read((char*)&scj, sizeof(scj)).read((char*)&sc, sizeof(sc)).read((char*)&llz, sizeof(llz)).read((char*)&ffht, sizeof(ffht)).read((char*)&bd, sizeof(bd)).read((char*)&cjyscs, sizeof(cjyscs)).read((char*)&xrssy, sizeof(xrssy)).read((char*)&LL, sizeof(LL)).read((char*)&ttcg, sizeof(ttcg)).read((char*)&swfecj, sizeof(swfecj)).read((char*)&yqlyy, sizeof(yqlyy));f.close(); // 新增:关闭文件} else {// 初始化成就相关变量为默认值xrscj = 0, scj = 0, sc = 0, llz = 0, ffht = 0;bd = 0, cjyscs = 0, xrssy = 0, LL = 0, ttcg = 0, yqlyy = 0;}}if (level != 2) dz = 0;int ssj = rand() % 200;if (ssj >= 30 && ssj <= 32 || ssj >= 150 && ssj <= 153 || ((level == 8 || level == 9 || level == 3 || level == 10 || level == 11)&& (ssj >= 60 && ssj <= 63 || ssj >= 160 && ssj <= 161))) qhcj();if (level == 2){int sj = rand() % 200;if (sj >= 12 && sj <= 15 || sj >= 120 && sj <= 122){cls();dz = 7;}}int nd = shiti[level];if (shiti[level] != 0) {int my = 0;int ssj = rand() % 90;if (jj > 0 && ssj >= 68) {my = 1;}if (!my && check_entity_spawn()) {guaiwu();cls();st = 0;}else if (!my && dz > 0 && check_entity_spawn()) {guaiwu();cls();st = 0;}}if (sdt) dl = max(0, dl - 1);sjcs ++;// 幸运豆奶buffif (xydn_buff > 0) {xydn_buff --;if (xydn_buff == 0) buff --;}//恐惧buffif (kj > 0){buff ++;kj --;san -= rand() % 4;if (kj == 0) buff --;}if (level == 6 || level == 8){buff ++;ha = 1;san -= rand() % 2;}else if (ha == 1)buff --, ha = 0;if (food == 0) hp -= rand() % 3;if (!xd) food -= rand() % 2, san -= rand() % 3, san += rand() % 2, tili -= rand() % 2, tili += rand() % 2;if (hf){hf --;hp += rand() % 6;if (hf == 0) buff --;}if (jj){jj --;if (jj == 0) buff --;}if (bsxh) san -= rand() % 2, bsxh --;if (1000 - bsxh >= 16 && bsxh > 0){sw(1);}if ((san <= 30 ) || (san <= 40 && level == 4)&& !bsxh){int sj = rand() % 100;if(sj % 12 == 0 || (san <= 20 && sj % 9 == 0)){bsxh = 1000;buff ++;}}if (san >= 30 && bsxh > 0){int sj = rand() % 100;if(sj % 12 == 0 || (san <= 20 && sj % 19 == 0)){buff --;bsxh = 0;}else if (san >= 45 && sj >= 56 && sj <= 59 || sj == 82){buff --;bsxh = 0;}else if (san >= 60 &&( sj >= 130 && sj <= 141 || sj >= 33 && sj <= 37)){buff --;bsxh = 0;}else if (san >= 80){buff --;bsxh = 0;}}if((level == 5 || level == 7 )&& dl == 0 && tili < 40){int sj = rand() % 200;if (sj >= 130 && sj <= 140 || sj >= 170 && sj <= 180 || sj >= 50 && sj <= 55){if (kj == 0) kj += 4;if (kj > 0) kj += rand() % 2 + 1;}}tili = min(tili, 120);tili = max(tili, 0);hp = min(hp, 120);hp = max(hp, 0);food = min(food, 120);food = max(food, 0);san = min(san, 120);san = max(san, 0);if (food == 0) hp -= rand() % 3;xd = 0;if (food == 0 && hp == 0) sw(2);cout << endl;cout << " ";cengji();cout << endl;if (dz > 0){dz --;Color(6);cout << "地震 -实体频出" << endl;}fenjie1();cout << endl;//层级及分界if (food == 0) hp -= rand() % 3;if (hp <= 0 && food == 0) {sw(2);}zhuangtai();Color(0);cout << "HP ";if (hp > 20) Color(0);else Color(4);cout << hp << " ";if (hp < 100) cout << " ";if (hp < 10) cout << " ";Color(0);cout << "FOOD ";if (food > 20) Color(0);else Color(4);cout << food << " ";if (food < 100) cout << " ";if (food < 10) cout << " ";Color(0);cout << "SAN ";if (san > 20) Color(0);else Color(4);cout << san << " ";if (san < 100) cout << " ";if (san < 10) cout << " ";//基础数值cout << endl;fenjie2();cout << endl;//分界Color(0);cout << "BUFF ";if (buff == 0) cout << "--";else {Buff();// 显示幸运豆奶buffif (xydn_buff > 0) {Color(6);cout << " 幸运 ";}if (kj > 0){Color(8);cout << "恐惧 ";}if (ha > 0){Color(7);cout << "黑暗 ";}if (level == 8){Color(11);cout << "流逝 ";hp -= rand() % 2;san -= rand() % 2;tili -= rand() % 2;}}//BUFFcout << endl;Color(0), cout << "体力 " << tili;cout << endl;fenjie2();cout << endl;//分界if (!st){Color(0);cout << "我可以.." << endl;cout << " ○ 1 ";tsyy();cout << " ○ 2 ";xxyy();cout << " ○ 3 ";xzyy();if (level == 11){cout << " ○ 4 交易 ";cout << endl;}}long long xhcs = 0;while(++ xhcs < 50000){if(kbhit()){char c=_getch();if(c=='e'){beibao();break;}if(c=='1' && tili) {cout << endl;Color(11);cout << " 搜寻中";Say("...", rand() % 600 + 400);cout << endl;tili -= rand() % 6;food -= rand() % 7;san -= rand() % 6;hp -= rand() % 2;xd = 1;int sh = tssh();if (sh == 0){mysh();Sleep(500);}else{ysh();Sleep(600);if (wuping > bbrl) {man = 1;beibao();}}break;}if(c=='2') {hp += rand() % 2;san += rand() % 10;tili += rand() % 17;food -= rand() % 5;xd = 1;Color(11);cout << " 休息中";Say("...", rand() % 600 + 500);break;}if(c=='3' && tili){tili -= rand() % 6;food -= rand() % 6;san -= rand() % 6;hp -= rand() % 2;xd = 1;Color(11);cout << " 寻找中";Say("...", rand() % 600 + 400);cout << endl;if (xzcksh()){cout << " 是否切换层级." << endl;Color(0);cout << " 1 是 ";Color(0);cout << "2 否";while (1){if(kbhit()){char c=_getch();if (c == '2') break;if (c == '1'){qhcj();break;}}}}else {Sleep(800);}break;}if(c=='4' && level == 11){tradeSystem(); // 调用交易系统break;}if(c=='m'){cenjijianjie();cout << endl;Color(7);cout << " 空格以退出";while (1){if (kbhit()){char c=_getch();if (c == ' ') break;}}cls();break;}if(c=='l'){saveGame();break;}if(c=='o'){loadGame();break;}if(c=='k' || c=='K'){clearAllData();break;}if (c == 'b'){tc = 1;break;}}}//操作if (tc == 1) {cls();cout << " 1 仅退出 2 退出(重新开始)";while (1){if(kbhit()){char c=_getch();if (c == '2') {level = san = food = hp = buff = tili = wuping = xrs = jjyz = hy = hjkl = gzlr = zsq = st = sjcs = sxz = yglgy = man = 0;san = food = hp = tili = 120; // 初始值单独赋值xd = 1, bbrl = 20;ynmht = rhmht = hf = jj = sdt = dl = dc = sqdy = bsxh = kj = duandao = equip_duandao = xrscj = scj = sc = llz = ffht = dz = bd = cjyscs = xrssy = LL = ttcg = ha = cjys = xydn = xsqqj = xydn_buff = mosun_budai = 0;memset(sbuff, 0, sizeof(sbuff));break;}else break;}}cls();break;}ts ++;}cls();}return 0;}```