正文
增加 264 行删除 264 行
1234567896 行未改动161718192021222324252627282930313212 行未改动45464748495051525354559 行未改动6566676869707172737475767778798081828384858687888911 行未改动1011021031041051061071081091102 行未改动11311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523610 行未改动2472482492502512522532542553 行未改动25926026126226326426526626726826927027158 行未改动33033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037120 行未改动39239339439539639739839940052 行未改动45345445545645745845946046146246346446546646746846947017 行未改动48848949049149249349449549649719 行未改动51751851952052152252352452552632 行未改动5595605615625635645655665675685692 行未改动57257357457557657757857958058126 行未改动60860961061161261361461561661761861962062162231 行未改动6546556566576586596606616622 行未改动665666667668669670671672673199 行未改动全部展开8738748758768778788798808818828838848858868878888898908918928938948958968978987 行未改动906907908909910911912913914915916917918919920921922923924925926927928929930103 行未改动全部展开103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110623 行未改动106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610974 行未改动11021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411357 行未改动11431144114511461147114811491150115120 行未改动1172117311741175117611771178117911801181118211831184118511861187118811891190220 行未改动全部展开14111412141314141415141614171418141948 行未改动14681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915104 行未改动15151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015814 行未改动1586158715881589159015911592159315944 行未改动159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416452 行未改动16481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169262 行未改动175517561757175817591760176117621763176417651766176717681769177017711772177317745 行未改动178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118029 行未改动1812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118625 行未改动186818691870187118721873187418751876187718781879188018811882188318841885188619 行未改动19061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192984 行未改动20142015201620172018201920202021202211 行未改动2034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205911 行未改动20712072207320742075207620772078207975 行未改动2155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223131 行未改动2263226422652266226722682269227022712 行未改动2274227522762277227822792280228122822 行未改动228522862287228822892290229122922293229422952296229713 行未改动23112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023413 行未改动234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237533 行未改动240924102411241224132414241524162417241824192420242124222423242424253 行未改动2429243024312432243324342435243624372 行未改动244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248217 行未改动2500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253194 行未改动26262627262826292630263126322633263426352636263726382639264026412642264326442 行未改动264726482649265026512652265326542655265626575 行未改动26632664266526662667266826692670# **The** **Backrooms** *后室·无限**你终于累垮了,在平地上摔了一跤,切出了地板。你回过神来,站起身,却发现脚下并不是潮湿的地毯,而是一片草地……“我真的逃出来了吗?”“我回家了吗?”*初次游玩请看菜单内<关于>了解游戏及操作菜单内请用W/S选择~~不知为何层级简介的文字介绍部分不能过QAQ~~6 行未改动#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);12 行未改动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)9 行未改动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);11 行未改动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)) // 反复横跳成就标记2 行未改动.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);10 行未改动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))3 行未改动.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;58 行未改动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;20 行未改动cls();cout << endl;cout << endl;cout << endl;Color(11);cout << " - The Backrooms -" << endl;Color(7);cout << " 你曾经来过这里";Sleep(1500);}void my (int x){52 行未改动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);26 行未改动}}}}k ++;kk ++;if (k == 5) k = 1;cls();}}void cengji(){Color(0);if (level == 0) cout << "Level 0 -- 前厅";31 行未改动else if (i % 7 == 3){Color(8);cout << "▌";}else if (i % 7 <= 2 || i % 7 <= 5){Color(8);cout <<"■";}}2 行未改动for (int i = 0; i < 30; i ++){if(i % 7 <= 2){Color(7);cout <<"=";}else if (i % 7 <= 5){Color(11);cout << "#";}199 行未改动全部展开}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 << "安静 ";7 行未改动}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";}103 行未改动全部展开}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;}3 行未改动}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;}// ===== 新增短刀使用逻辑(装备)=====4 行未改动}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 --;}7 行未改动}else if (x == 10){cout << "电池" << endl;dc --;}else if (x == 11){cout << "一把层级钥匙" << endl;cjys --;}20 行未改动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 ++){220 行未改动全部展开cout << "手电筒 " ;cout << "电量 ";if (dl <= 20) Color(4);cout << dl << "% " << endl;}// 显示已装备的短刀if (equip_duandao == 1){Color(0);cout << "短刀 " << endl;48 行未改动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 << "一个通风管道口";4 行未改动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 << "房间里";2 行未改动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)) {62 行未改动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);5 行未改动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;9 行未改动// (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%5 行未改动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;19 行未改动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;84 行未改动// 购买模式:显示可购买物品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 + 不是杏仁水(装备无限制)11 行未改动// 遍历可售卖物品,选中时显示预计获得的物品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);11 行未改动// 处理用户输入while (true) {if (!_kbhit()) continue;char op = _getch();// 预筛选可售卖物品(用于上下选择逻辑)vector<ItemInfo> sellable;for (auto& it : items) {if (*it.count <=0 || it.id ==1) continue;75 行未改动}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(){31 行未改动ttcg = 0;}ksfm();cls();xd = 1;wuzi[0] = 1;shiti[1] = 1;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();2 行未改动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))13 行未改动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;3 行未改动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 --;33 行未改动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);3 行未改动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;2 行未改动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 {17 行未改动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();94 行未改动}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){2 行未改动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;5 行未改动ts ++;}cls();}return 0;}```1234567896 行未改动161718192021222324252627282930313212 行未改动45464748495051525354559 行未改动6566676869707172737475767778798081828384858687888911 行未改动1011021031041051061071081091102 行未改动11311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523610 行未改动2472482492502512522532542553 行未改动25926026126226326426526626726826927027158 行未改动33033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037120 行未改动39239339439539639739839940052 行未改动45345445545645745845946046146246346446546646746846947017 行未改动48848949049149249349449549649719 行未改动51751851952052152252352452552632 行未改动5595605615625635645655665675685692 行未改动57257357457557657757857958058126 行未改动60860961061161261361461561661761861962062162231 行未改动6546556566576586596606616622 行未改动665666667668669670671672673199 行未改动全部展开8738748758768778788798808818828838848858868878888898908918928938948958968978987 行未改动906907908909910911912913914915916917918919920921922923924925926927928929930103 行未改动全部展开103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110623 行未改动106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610974 行未改动11021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411357 行未改动11431144114511461147114811491150115120 行未改动1172117311741175117611771178117911801181118211831184118511861187118811891190220 行未改动全部展开14111412141314141415141614171418141948 行未改动14681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915104 行未改动15151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015814 行未改动1586158715881589159015911592159315944 行未改动159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416452 行未改动16481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169262 行未改动175517561757175817591760176117621763176417651766176717681769177017711772177317745 行未改动178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118029 行未改动1812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118625 行未改动186818691870187118721873187418751876187718781879188018811882188318841885188619 行未改动19061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192984 行未改动20142015201620172018201920202021202211 行未改动2034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205911 行未改动20712072207320742075207620772078207975 行未改动2155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223131 行未改动2263226422652266226722682269227022712 行未改动2274227522762277227822792280228122822 行未改动228522862287228822892290229122922293229422952296229713 行未改动23112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023413 行未改动234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237533 行未改动240924102411241224132414241524162417241824192420242124222423242424253 行未改动2429243024312432243324342435243624372 行未改动244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248217 行未改动2500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253194 行未改动26262627262826292630263126322633263426352636263726382639264026412642264326442 行未改动264726482649265026512652265326542655265626575 行未改动26632664266526662667266826692670# **The** **Backrooms** *后室·无限**你终于累垮了,在平地上摔了一跤,切出了地板。你回过神来,站起身,却发现脚下并不是潮湿的地毯,而是一片草地……“我真的逃出来了吗?”“我回家了吗?”*初次游玩请看菜单内<关于>了解游戏及操作菜单内请用W/S选择~~不知为何层级简介的文字介绍部分不能过QAQ~~6 行未改动#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);12 行未改动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)9 行未改动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);11 行未改动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)) // 反复横跳成就标记2 行未改动.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);10 行未改动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))3 行未改动.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;58 行未改动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;20 行未改动cls();cout << endl;cout << endl;cout << endl;Color(11);cout << " - The Backrooms -" << endl;Color(7);cout << " 你曾经来过这里";Sleep(1500);}void my (int x){52 行未改动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);26 行未改动}}}}k ++;kk ++;if (k == 5) k = 1;cls();}}void cengji(){Color(0);if (level == 0) cout << "Level 0 -- 前厅";31 行未改动else if (i % 7 == 3){Color(8);cout << "▌";}else if (i % 7 <= 2 || i % 7 <= 5){Color(8);cout <<"■";}}2 行未改动for (int i = 0; i < 30; i ++){if(i % 7 <= 2){Color(7);cout <<"=";}else if (i % 7 <= 5){Color(11);cout << "#";}199 行未改动全部展开}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 << "安静 ";7 行未改动}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";}103 行未改动全部展开}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;}3 行未改动}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;}// ===== 新增短刀使用逻辑(装备)=====4 行未改动}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 --;}7 行未改动}else if (x == 10){cout << "电池" << endl;dc --;}else if (x == 11){cout << "一把层级钥匙" << endl;cjys --;}20 行未改动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 ++){220 行未改动全部展开cout << "手电筒 " ;cout << "电量 ";if (dl <= 20) Color(4);cout << dl << "% " << endl;}// 显示已装备的短刀if (equip_duandao == 1){Color(0);cout << "短刀 " << endl;48 行未改动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 << "一个通风管道口";4 行未改动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 << "房间里";2 行未改动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)) {62 行未改动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);5 行未改动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;9 行未改动// (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%5 行未改动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;19 行未改动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;84 行未改动// 购买模式:显示可购买物品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 + 不是杏仁水(装备无限制)11 行未改动// 遍历可售卖物品,选中时显示预计获得的物品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);11 行未改动// 处理用户输入while (true) {if (!_kbhit()) continue;char op = _getch();// 预筛选可售卖物品(用于上下选择逻辑)vector<ItemInfo> sellable;for (auto& it : items) {if (*it.count <=0 || it.id ==1) continue;75 行未改动}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(){31 行未改动ttcg = 0;}ksfm();cls();xd = 1;wuzi[0] = 1;shiti[1] = 1;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();2 行未改动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))13 行未改动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;3 行未改动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 --;33 行未改动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);3 行未改动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;2 行未改动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 {17 行未改动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();94 行未改动}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){2 行未改动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;5 行未改动ts ++;}cls();}return 0;}```