版本比较
The Backrooms 后室·无限 游戏代码
正文
增加 2219 行删除 703 行
1234567891011121314151617189101112131920212223242526151627282930313233343536377 行未改动454647483249503451525354555657586 行未改动6566676869707172737475767778798081828352538485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127257 行未改动3303313323331193343351213363373381243393403413423431291301311321331341351361371381391401411421431441451461471483443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833842 行未改动38738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446516146646746846947017 行未改动48848949049118718849249349449549649719 行未改动51751851952021621752152252352452552632 行未改动5595605615622582592605635645655665675685692 行未改动57257357457527127257657757857927558058158227827928028128228328458358458558658758858959059159259359459559659759859960060160260360460560660760860961061128728828961261361429229361561661729661861962062162262330262462562662762862963063163263363463563663763830863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972022 行未改动7437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888893578908913598928933618948953638968978988999009013693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084099029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659664124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414429679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105544444544644744810561057105845045145210591060106145445545645745845946046146246346446510621063106410651066467468469470471472473474475476477478479480481482483484485486487488489490106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110349349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553611041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014617461462146314647491465146614671468146914701471754147214731474147514761477147814791480148176414821483148414851486148714881489149077314911492149314941495149614971498149978215001501150215031504150578815061507150815091510151115121513796151415151516151715188011519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015814 行未改动1586158715881589814159015911592159315944 行未改动159916001601160282782816031604160516061607160883383483583683783883984084184284384484584684784884916091610851852853854161116121613161416151616161785685785885916181619162016211622162316248618628638641625162616271628162916301631866867868869870163216331634163516361637163887287387487516391640164187787887988016421643164416451646882883884885164716481649165016511652165388788888916541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175889389489589689789889990090190290390490590690790890991091191217591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318349151835183618371838183992018401841184292218431844184518461847184818491850185118521853185418551856928929930931932933934185718581859186018611862186318641865186618671868186993693793893918701871187218731874187518761877187818791880188118821883188418859419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869871886188718881889189018911892189318941895189618971898189919009899909919929939949951901190219031904190519061907190819091003191019111912191319141915191619171011191819191920192119221923192410181019192519261021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104919271928192919301931193219331934193519361937193819391052105310541055105610571058105910601061106210631064106510661067106810691070194019411942194319441945194619471948194910721073107410751076107710781079108019501951108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113919521141195319541143114419551146114711481149195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162115211532163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670# **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;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; //新层级 物品发现地点 分界线 层级名称 实体多少 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;//新层级 物品发现地点 分界线 层级名称 实体多少//新物品 物品简介 背包物品名称 使用 丢弃//buff 显示buff buff效用
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 // 白 较青蓝 绿 紫 大红 青 淡黄 深灰 较深红 较深蓝 较棕黄 浅灰 // 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 查看层级信息" << endl; cout << " M 查看层级信息 L 存档 O 读档 B 返回菜单 K 清除所有数据" << endl; sjcs ++;
while (1){ if(kbhit()){ cls(); 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 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){ 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 << " ";
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; 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 ; 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; } } } } if(GetAsyncKeyState(38)&0x8000) xz = 1; if(GetAsyncKeyState(40)&0x8000) xz = 2;
k ++; kk ++; if (k == 5) k = 1; Sleep(500); 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 <<"■"; 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 << "悲尸循环" ; cout << "悲尸循环 " ; } else if (hf > 0){ if (hf > 0){ Color(2); cout << "恢复" ; cout << "恢复 " ; } else if (jj > 0){ 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 << "为手电筒提供电量"; } 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 --; 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); 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 (sqdy > 0){ wuping ++; cout << endl; cout << " 有填装物了!"; Sleep(500); else if (ch == 'A' || ch == 'a') { target_level = 10; } else { sqdy += 5; xrs --; else if (ch == 'B' || ch == 'b') { target_level = 11; } } else if (x == 7){ yglgy --; sbuff[++buff] = 2; hf += 6 + rand() % 6; } else if (x == 8) { if ( !xrs){ wuping ++; cout << endl; cout << " 你没有东西融化它!"; Sleep(500);
if (target_level >= 0 && target_level <= 11){ level = target_level; cjyscs ++; } 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); } } 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 --; } 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 = 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 ; 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() % 2; while (yl == level) level = rand() % 12; cout << endl; Color(0); cout << " 你来到了";cengji(); cout << " 你切入了"; cengji(); Sleep(1500); cls();}void tsyy(){ int sj; sjcs ++; 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 ++; 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 ++; 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 ++; 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){ 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 ++; 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){ } else 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 cout << "柱子边" ; } else if (sj >= 664 && sj <= 677 || sj >= 232 && sj <= 243 || sj == 279 || sj == 378){ cout << "一颗亚格鲁格亚果" << endl; yglgy ++; 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 (sj >= 74 && sj <= 88 || sj >= 491 && sj <= 512 || sj >= 98 && sj <= 112 || sj == 11){ cout << "一小块火盐" << endl; hy ++; 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 (sj >= 700 && sj <= 703 || sj >= 410 && sj <= 423 || sj >= 33 && sj <= 35 || sj >= 632 && sj <= 635){ cout << "一包油腻棉花糖" << endl; ynmht ++; 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 (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 (level == 5){ int k = rand() % 4; if (k == 0) cout << "椅子上"; else if (k == 1) cout << "地毯上"; else if (k == 2) cout << "墙角"; else cout << "餐桌上" ; } else if (sj >= 179 && sj <= 187 || sj >= 512 && sj <= 522 || sj >= 441 && sj <= 445){ cout << "一瓶寂静液汁" << endl; jjyz ++; else if (level == 6 || level == 8){ cout << "黑暗中"; } else if (sj >= 189 && sj <= 197 || sj >= 371 && sj <= 377 || sj >= 67 && sj <= 73){ cout << "一盒皇家口粮" << endl; hjkl ++; else if (level == 7){ int k = rand() % 2; if (k == 0) cout << "海面上"; else cout << "房间里"; } 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 if (level == 9){ int k = rand() % 4; if (k == 0) cout << "路灯下"; else if (k == 1) cout << "街道上"; else if (k == 2) cout << "房子内"; else cout << "田地边" ; } else { cout << "一瓶杏仁水" << endl; xrs ++; 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 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; 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(); cls(); cout << endl << endl; Color(4); cout << " YOU DEAD" << endl; cout << endl; cout << " reason "; cout << " reason: "; Color(7); if (x == 1){ Color(7); cout << "悲尸循环"; } else if (x == 2){ cout << "饥饿"; } else if (x == 3){ cout << "实体攻击"; } else if (x == 4){ 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();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(); xd = 1; shiti[1] = 1; wuzi[1] = 2; while (1){ 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(); 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; 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; cout << " "; cengji(); cout << endl; fenjie1(); cout << endl;//层级及分界 zhuangtai(); 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 << " ";//基础数值 if (san < 10) cout << " ";//基础数值 cout << endl; fenjie2(); cout << endl;//分界 Color(0); cout << "BUFF "; if (buff == 0) cout << "--"; else { Buff(); }//BUFF cout << 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){ 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=='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); 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{ ysh(); Sleep(600); if (wuping > bbrl) { man = 1; beibao(); } } break; else 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<<"空格!发射子弹!";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.1 double 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.5 double 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 ++;
// 幸运豆奶buff if (xydn_buff > 0) { xydn_buff --; if (xydn_buff == 0) buff --; } //恐惧buff if (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(); // 显示幸运豆奶buff if (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; } }//BUFF
cout << 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;}```