生化小游戏 v1220
2025-12-17 22:07:04
发布于:浙江
生化小游戏 v1220版本(新版本新功能!)
#include<bits/stdc++.h>
#include<sys/stat.h>
#include<conio.h>
#include<windows.h>
using namespace std;
// ==================== 全局变量====================
// 游戏状态变量
bool gameClear = false; // 基础剧情通关标记
bool advanced = false; // 进阶剧情通关标记
int deathCount = 0; // 死亡次数
bool specialItem = false; // 是否持有特殊物品(mp=-1)
bool saveExists = false; // 是否存在存档
int clueCount = 0; // 已收集线索数
int exitTry = 0; // 尝试退出次数
// 存档变量
const string SAVE_FILE = "save.ans";
// 存档错误类型
enum class SaveErrorType {
FILE_OPEN_FAILED,
FILE_WRITE_FAILED,
FILE_READ_FAILED,
CHECKSUM_MISMATCH,
VERSION_MISMATCH,
INVALID_DATA
};
// 版本号(用于兼容性检查)
const int VERSION = 1220;
// 资源变量
int bullets; // 子弹数量
int food; // 食物数量
// 人物关系变量
int girlFavor = 0; // 妹子好感度(-1=敌对,0=中立,1=友好)
int girlBullet = 0; // 妹子子弹数
bool hasBoy = false; // 少年是否入队
bool boyInfected = false; // 少年是否被感染
int savedGirl = 3; // 妹子关系
int savedBoy = 3; // 少年关系
// 道具/状态标记
int boyWeapon = 0; // 少年武器(0=无,1=枪,2=水管)
bool zombieKing = false; // 尸王线标记
bool triggerWeird = false; // 违和感触发标记
int adminLog = 0; // 管理员日志数量
bool badEnd[30] = {false};
const string badEndNames[30] = {
"0-未使用",
"1-饥馁而终", "2-破密不得", "3-神智崩解", "4-独往基覆", "5-基地沦陷",
"6-变异失智", "7-作者裁决", "8-异女噬身", "9-阅记遭噬",
"10-麻木度日", "11-轻敌殒命", "12-崩解遭毙", "13-崩解猎援",
"14-出界无讯", "15-熟迹反灭", "16-杀女被诛", "17-女反杀之",
"18-弹尽群噬", "19-孤存终亡",
"20-精英丧噬", "21-途竭而终", "22-少叛遭祸", "23-安离反目",
"24-杀少成魔", "25-携少饥终", "26-异少噬身", "27-首领诛知"
};
bool happyEnd[10] = {false};
const string happyEndNames[10] = {
"0-未使用",
"1-终见曙光", "2-仙侣偕行", "3-英名长存", "4-真我觉醒", "5-异途相恋"
};
bool trueEnd[10] = {false};
const string trueEndNames[10] = {
"0-未使用",
"1-如故如常", "2-守心自持", "3-浮生幻梦", "4-天下皆终", "5-迟来之亡", "6-循环守序" ,"7-域管同化"
};
bool clue[20] = {false};
const string clueNames[20] = {
"0-奇枪异食", "1-迟变少年", "2-免疫异女", "3-政府异象",
"4-早变异女", "5-实验双体", "6-破局而退", "7-死亡迷局","8-复活循环",
"9-变异溯源", "10-抉择之键", "11-域外之界", "12-虚实之辨", "13-自主觉醒" ,
"14-同化终局", "15-双体共鸣", "16-终得团聚"
};
const string vagueClues[30] = {
"",
// 基础剧情与特殊物品
"通关后回到起点,或许能获得打破规则的关键物品",
"物资分配不必严格平衡,有时充裕的储备会带来转机",
"关键的物品透露着往事回忆,或许要相信自己所想",
"等待救援的结果并非固定,耐心与运气同样重要",
// 尸王线触发
"死亡并非终点,多次重启世界或许能发现隐藏的真相",
"当死亡次数累积到一定程度,你可能会觉醒特殊身份",
"重复的死亡会让你对世界产生怀疑,进而触发新的道路",
// 线索收集相关
"基地的医疗室和指挥室藏着重要记录,多探索能拼凑真相",
"特殊物品会让某些角色对你产生特殊反应,注意观察对话",
"实验日志的碎片散落在各处,收集足够能解开实验体之谜",
"燃气罐的威力远超想象,结合特定线索能发挥最大作用",
// 结局触发条件
"与妹子保持高好感度,共同面对危机可能收获美好结局",
"少年的信任需要培养,选择信任他或许能解锁特殊剧情",
"子弹充足时守卫基地,你可能成为众人敬仰的英雄",
"当少年被感染时,不要轻易放弃,或许能找到转机",
// 真结局相关
"集齐特定实验线索后,****的身份将不再神秘",
"妹子和少年的特殊身份,在特定条件下会互相感应",
"当你意识到世界的虚假时,三人的力量或许能打破循环",
"实验室的密码隐藏在实验体编号中,尝试拼凑数字",
// 彩蛋与隐藏内容
"如果对结局不满,不妨尝试退出,或许有管理员回应",
"域管理员的同化条件隐藏在情感与认知的平衡中",
"深海、沙漠...或许还有其他未被探索的循环场景",
"死亡次数过多时,尝试领取特殊物品,可能改变命运",
// 进阶剧情触发
"收集足够多的线索,能解锁更深入的剧情和真相",
"当违和感被触发,世界的真实面貌已经浮现",
"管理员日志的数量决定了你能接触到的真相层级"
};
// 随机数
std::random_device __rd;
std::mt19937 __gen(__rd());
// ==================== 工具函数====================
// 随机数
int rand(int mi, int ma){
int intg = uniform_int_distribution<>(mi, ma)(__gen);
return intg;
}
// 等待/线程休眠
void sleep(int ms){
this_thread::sleep_for(chrono::milliseconds(ms));
}
// 颜色
namespace color_{
const string basic = "\033[";
const string red = basic + "31m";
const string green = basic + "32m";
const string yellow = basic + "33m";
const string blue = basic + "34m";
const string purple = basic + "35m";
const string sky = basic + "36m";
const string gray = basic + "90m";
const string blink = basic + "5m"; // 闪烁
const string underline = basic + "4m"; // 下划线
const string reverse = basic + "7m"; // 反显(前景/背景互换)
const string bold = basic + "1m"; // 加粗
const string back = basic + "0m"; // 重置所有样式
const string warn = red + blink + bold;
}
// 控制台光标
void controlCursor(bool tf) {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cursorInfo;
GetConsoleCursorInfo(hConsole, &cursorInfo);
cursorInfo.bVisible = tf; // 隐藏光标
SetConsoleCursorInfo(hConsole, &cursorInfo);
}
// 打印文字(速度为30ms)
inline void print(const string& text, bool enter = true) {
controlCursor(false);
for (char c : text) {
if(triggerWeird == true){
if(rand(1, 30) == 2){
cout << color_::reverse << c << color_::back;
sleep(30);
}
else cout << c;
if(c != ' ') sleep(30);
}
else{
cout << c;
if(c != ' ') sleep(30);
}
}
if(enter) cout<<endl;
sleep(10);
controlCursor(true);
}
// 带边框的文本框(剧情提示框)
inline void boxPrint(const string& text, const string& borderColor = "") {
// 计算文本最大长度
int maxLen = 0;
vector<string> lines;
stringstream ss(text);
string line;
while (getline(ss, line, '\n')) {
lines.push_back(line);
if (line.length() > maxLen) maxLen = line.length();
}
// 上边框
cout << borderColor + "+" + string(maxLen + 2, '-') + "+" + color_::back <<endl;
// 内容行
for (auto& l : lines) {
cout << borderColor + "| " + color_::back;
print(l, false);
// 补空格对齐
for (int i = l.length(); i < maxLen; i++) cout << " ";
cout << borderColor + " |" + color_::back <<endl;
}
// 下边框
cout << borderColor + "+" + string(maxLen + 2, '-') + "+" + color_::back <<endl;
}
// 数字输入
inline int input(int mi, int ma){
char ch;
int wrong = 0;
ch = _getch();
while (ch < '0' || ch > '9') {
print(color_::red + "请输入一个数字" + color_::back);
wrong++;
ch = _getch();
}
int n = ch - '0';
while(n < mi || n > ma){
print(color_::red + "请输入正确的值" + color_::back);
wrong++;
ch = _getch();
while (ch < '0' || ch > '9') {
print(color_::red + "请输入一个数字" + color_::back);
wrong++;
ch = _getch();
}
n = ch - '0';
}
if(wrong >= 5) print("你今天输错了" + to_string(wrong) + "次哦,下次加油!");
return n;
}
// 清屏
inline void cls() {
system("cls");
}
// 按键等待(统一提示语)
inline void pressAnyKey() {
print("按任意键继续...");
_getch();
cls();
}
// 增强版选项选择函数(支持方向键选择,Enter确认)
int option(const string title, const vector<string>& options, bool isPause = true) {
controlCursor(false);
if(isPause){
print("按任意键继续...");
_getch();
}
int selected = 0;
while (true) {
cls();
if(!title.empty()){
cout << title << endl;
}
cout << "请选择:\n";
for (int i = 0; i < options.size(); i++) {
if (i == selected) {
cout << color_::green << "> " << options[i] << color_::back << endl;
} else {
cout << " " << options[i] << endl;
}
}
// Windows下支持方向键
int ch = _getch();
if (ch == 224) { // 方向键前缀
ch = _getch();
if (ch == 72) selected = max(0, selected - 1); // 上
if (ch == 80) selected = min((int)options.size()-1, selected + 1); // 下
} else if (ch == 13) { // Enter确认
controlCursor(true);
return selected + 1; // 返回选项
} else if (ch >= '1' && ch <= '9') { // 兼容数字输入
int num = ch - '0';
if (num <= options.size()) {
controlCursor(true);
return num;
}
}
}
}
// 显示当前状态(子弹+食物)
inline void showStatus() {
cls();
print("【当前状态】");
// 子弹进度条(■代表已拥有,□代表空缺,总长度10)
string bulletBar = "";
for (int i = 0; i < 12; i++) bulletBar += (i < bullets) ? "#" : ".";
// 食物进度条
string foodBar = "";
for (int i = 0; i < 12; i++) foodBar += (i < food) ? "@" : ".";
print( "子弹:" + bulletBar + " [" + to_string(bullets) + "/12]" );
print( "食物:" + foodBar + " [" + to_string(food) + "/12]" );
// 额外显示关键状态图标
string icons = "";
if (specialItem) icons += "SpecialItem "; // 特殊物品
if (zombieKing) icons += "ZombieKing "; // 尸王线
if (advanced) icons += "AdvencedKnowledge "; // 进阶剧情
if (!icons.empty()) print("特殊状态:" + icons);
}
void resetGameState() {
bullets = 0;
food = 0;
girlFavor = 0;
girlBullet = 0;
hasBoy = false;
boyWeapon = 0;
}
// 辅助函数:统计已解锁结局数量
int countUnlocked(bool arr[], int size) {
int intg = 0;
for (int i = 0; i < size; i++) {
if (arr[i]) intg++;
}
return intg;
}
// 显示Bad End详情(索引1-27,0未用)
void showBadEnds() {
print("\n ===== Bad End 详情 =====");
for (int i = 1; i <= 27; i++) {
if (badEnd[i]) {
print( color_::red + "[" + to_string(i) + "] 已解锁 " + badEndNames[i] + color_::back);
} else {
print( color_::gray + "[" + to_string(i) + "] 未解锁 " + "????" + color_::back);
}
}
}
// 显示Happy End详情(索引1-5,0未用)
void showHappyEnds() {
print("\n ===== Happy End 详情 =====");
for (int i = 1; i <= 5; i++) {
if (happyEnd[i]) {
print( color_::green + "[" + to_string(i) + "] 已解锁 " + happyEndNames[i] + color_::back);
} else {
print( color_::gray + "[" + to_string(i) + "] 未解锁 " + "????" + color_::back);
}
}
}
// 显示True End详情(索引1-7,0未用)
void showTrueEnds() {
print("\n ===== True End 详情 =====");
for (int i = 1; i <= 7; i++) {
if (trueEnd[i]) {
print( color_::sky + "[" + to_string(i) + "] 已解锁 " + trueEndNames[i] + color_::back);
} else {
print( color_::gray + "[" + to_string(i) + "] 未解锁 " + "????" + color_::back);
}
}
}
// 显示线索
void showClues() {
print("\n ===== 线索详情 =====");
for (int i = 0; i <= 16; i++) {
if (clue[i]) {
print( color_::yellow + "[" + to_string(i) + "] 已解锁 " + clueNames[i] + color_::back);
} else {
print( color_::gray + "[" + to_string(i) + "] 未解锁 " + "????" + color_::back);
}
}
}
//显示进度
void showAdv() {
print("\n ===== 进度详情 =====");
if(gameClear) print("已通关基础剧情");
if(advanced) print("已通关进阶剧情");
if(zombieKing) print("已触发尸王线");
if(triggerWeird) print("已触发违和感");
print("死亡次数:" + to_string(deathCount));
if(adminLog != 0) print("管理员日志数量 :" + to_string(adminLog));
}
// 显示存档错误信息
void showSaveError(SaveErrorType error, const string& operation) {
string errorMsg;
switch (error) {
case SaveErrorType::FILE_OPEN_FAILED:
errorMsg = "无法打开存档文件";
break;
case SaveErrorType::FILE_WRITE_FAILED:
errorMsg = "存档写入失败";
break;
case SaveErrorType::FILE_READ_FAILED:
errorMsg = "存档读取失败";
break;
case SaveErrorType::CHECKSUM_MISMATCH:
errorMsg = "存档文件损坏";
break;
case SaveErrorType::VERSION_MISMATCH:
errorMsg = "存档版本不兼容";
break;
case SaveErrorType::INVALID_DATA:
errorMsg = "存档数据无效";
break;
default:
errorMsg = "未知错误";
}
print(color_::red + "【" + operation + "失败】" + errorMsg + color_::back);
}
// 计算简单校验和(异或所有字节)
uint32_t _calculateChecksum(const char* data, size_t size) {
uint32_t checksum = 0;
for (size_t i = 0; i < size; ++i) {
checksum ^= static_cast<uint8_t>(data[i]);
}
return checksum;
}
bool checkSaveExists() {
try {
bool exists = (_access(SAVE_FILE.c_str(), 0) != -1);
saveExists = exists;
return exists;
} catch (...) {
print(color_::yellow + "检查存档时发生错误" + color_::back);
saveExists = false;
return false;
}
}
// 保存游戏
bool saveGame() {
stringstream buffer;
buffer.write(reinterpret_cast<const char*>(&VERSION), sizeof(VERSION));
// 写入所有变量
buffer.write(reinterpret_cast<const char*>(&gameClear), sizeof(gameClear));
buffer.write(reinterpret_cast<const char*>(&advanced), sizeof(advanced));
buffer.write(reinterpret_cast<const char*>(&deathCount), sizeof(deathCount));
buffer.write(reinterpret_cast<const char*>(&specialItem), sizeof(specialItem));
buffer.write(reinterpret_cast<const char*>(&clueCount), sizeof(clueCount));
buffer.write(reinterpret_cast<const char*>(&exitTry), sizeof(exitTry));
buffer.write(reinterpret_cast<const char*>(&savedGirl), sizeof(savedGirl));
buffer.write(reinterpret_cast<const char*>(&savedBoy), sizeof(savedBoy));
buffer.write(reinterpret_cast<const char*>(&zombieKing), sizeof(zombieKing));
buffer.write(reinterpret_cast<const char*>(&triggerWeird), sizeof(triggerWeird));
buffer.write(reinterpret_cast<const char*>(&adminLog), sizeof(adminLog));
buffer.write(reinterpret_cast<const char*>(happyEnd), sizeof(happyEnd));
buffer.write(reinterpret_cast<const char*>(badEnd), sizeof(badEnd));
buffer.write(reinterpret_cast<const char*>(trueEnd), sizeof(trueEnd));
buffer.write(reinterpret_cast<const char*>(clue), sizeof(clue));
string data = buffer.str();
uint32_t checksum = _calculateChecksum(data.data(), data.size());
const string TEMP_FILE = SAVE_FILE + ".tmp";
ofstream file(TEMP_FILE, ios::binary);
if (!file.is_open()) {
showSaveError(SaveErrorType::FILE_OPEN_FAILED, "保存");
return false;
}
file.write(data.data(), data.size());
file.write(reinterpret_cast<const char*>(&checksum), sizeof(checksum));
if (!file.good()) {
file.close();
remove(TEMP_FILE.c_str());
showSaveError(SaveErrorType::FILE_WRITE_FAILED, "保存");
return false;
}
file.close();
try {
remove(SAVE_FILE.c_str());
int renameResult = rename(TEMP_FILE.c_str(), SAVE_FILE.c_str());
if (renameResult != 0) {
remove(TEMP_FILE.c_str());
showSaveError(SaveErrorType::FILE_WRITE_FAILED, "保存");
return false;
}
saveExists = true;
return true;
} catch (...) {
remove(TEMP_FILE.c_str());
showSaveError(SaveErrorType::FILE_WRITE_FAILED, "保存");
return false;
}
}
// 加载游戏
bool loadGame() {
if (!checkSaveExists()) {
return false;
}
ifstream file(SAVE_FILE, ios::binary | ios::ate);
if (!file.is_open()) {
showSaveError(SaveErrorType::FILE_OPEN_FAILED, "加载");
return false;
}
streamsize fileSize = file.tellg();
file.seekg(0, ios::beg);
const size_t EXPECTED_SIZE = sizeof(VERSION) +
sizeof(gameClear) + sizeof(advanced) + sizeof(deathCount) +
sizeof(specialItem) + sizeof(clueCount) + sizeof(exitTry) +
sizeof(savedGirl) + sizeof(savedBoy) +
sizeof(zombieKing) + sizeof(triggerWeird) + sizeof(adminLog) +
sizeof(happyEnd) + sizeof(badEnd) + sizeof(trueEnd) +
sizeof(clue) + sizeof(uint32_t);
if (fileSize != static_cast<streamsize>(EXPECTED_SIZE)) {
file.close();
showSaveError(SaveErrorType::INVALID_DATA, "加载");
return false;
}
// 读取所有数据
int version;
file.read(reinterpret_cast<char*>(&version), sizeof(version));
if (version != VERSION) {
file.close();
showSaveError(SaveErrorType::VERSION_MISMATCH, "加载");
return false;
}
file.read(reinterpret_cast<char*>(&gameClear), sizeof(gameClear));
file.read(reinterpret_cast<char*>(&advanced), sizeof(advanced));
file.read(reinterpret_cast<char*>(&deathCount), sizeof(deathCount));
file.read(reinterpret_cast<char*>(&specialItem), sizeof(specialItem));
file.read(reinterpret_cast<char*>(&clueCount), sizeof(clueCount));
file.read(reinterpret_cast<char*>(&exitTry), sizeof(exitTry));
file.read(reinterpret_cast<char*>(&savedGirl), sizeof(savedGirl));
file.read(reinterpret_cast<char*>(&savedBoy), sizeof(savedBoy));
file.read(reinterpret_cast<char*>(&zombieKing), sizeof(zombieKing));
file.read(reinterpret_cast<char*>(&triggerWeird), sizeof(triggerWeird));
file.read(reinterpret_cast<char*>(&adminLog), sizeof(adminLog));
file.read(reinterpret_cast<char*>(happyEnd), sizeof(happyEnd));
file.read(reinterpret_cast<char*>(badEnd), sizeof(badEnd));
file.read(reinterpret_cast<char*>(trueEnd), sizeof(trueEnd));
file.read(reinterpret_cast<char*>(clue), sizeof(clue));
uint32_t savedChecksum;
file.read(reinterpret_cast<char*>(&savedChecksum), sizeof(savedChecksum));
if (!file.good()) {
file.close();
showSaveError(SaveErrorType::FILE_READ_FAILED, "加载");
return false;
}
file.close();
ifstream checkFile(SAVE_FILE, ios::binary);
checkFile.seekg(0, ios::beg);
vector<char> data(EXPECTED_SIZE - sizeof(uint32_t));
checkFile.read(data.data(), data.size());
checkFile.close();
uint32_t calculatedChecksum = _calculateChecksum(data.data(), data.size());
if (calculatedChecksum != savedChecksum) {
showSaveError(SaveErrorType::CHECKSUM_MISMATCH, "加载");
return false;
}
if (deathCount < 0 || clueCount < 0 || clueCount > 20 ||
savedGirl < -10 || savedGirl > 20 || savedBoy < -10 || savedBoy > 20) {
showSaveError(SaveErrorType::INVALID_DATA, "加载");
return false;
}
return true;
}
// 线索集成
void cluei(int n){
boxPrint(clueNames[n], color_::sky + color_::blink);
clue[n] = true;
clueCount++;
}
//食物集成判断
bool foodi(int num) {
food-=num;
if(food<=0){
return true;
}
return false;
}
//子弹集成判断
bool bulleti(int num) {
bullets-=num;
if(bullets<=0){
return true;
}
return false;
}
// ==================== 结局函数====================
// 1. Bad End 结局
namespace badEnd_ {
void __memory() {
if(specialItem){
print("意识消散的最后一刻,你脑海中闪现无数只丧尸向你扑来...");
print("“又是这样吗?”——这是你最后的念头。");
}
}
void end(int n) {
print(color_::blink + color_::red + "# BAD END " + to_string(n) + " #" + color_::back);
boxPrint(badEndNames[n], color_::red);
badEnd[n] = true;
}
// Bad End 1:饥馁而终
void Starve();
// Bad End 2:破密不得
void WrongPassword();
// Bad End 3,12,13:神智崩解/崩解遭毙/崩解猎援
void GoCrazy();
// Bad End 4:独往基覆
void BaseDestroyed_Alone();
// Bad End 5:基地沦陷
void BaseDestroyed_LowBullets();
// Bad End 6:变异失智
void Mutate();
// Bad End 7:作者裁决
void KilledByWriter();
// Bad End 8:异女噬身
void GirlMutated();
// Bad End 9:阅记遭噬
void LabNotebook();
// Bad End 10:麻木度日
void AnotherBase();
// Bad End 11:轻敌殒命
void BadLuck();
// Bad End 14:出界无讯
void OutsideWorld();
// Bad End 16:杀女被诛
void KillGirl_BaseLeader();
// Bad End 17:女反杀之
void KillGirl_Failed();
// Bad End 18:弹尽群噬
void ZombieSwarm();
// Bad End 19:孤存终亡
void SurviveButAlone();
// Bad End 20:精英丧噬
void EliteZombie();
// Bad End 21:途竭而终
void ContinueJourney();
// Bad End 22:少叛遭祸
void BetrayedByBoy();
// Bad End 23:安离反目
void SafeWithBoy();
// Bad End 24:杀少成魔
void KillInfectedBoy();
// Bad End 25:携少饥终
void StarveWithBoy();
// Bad End 26:异少噬身
void MutatedBoyKillsYou();
// Bad End 27:首领诛知
void TooManyInformation();
void Starve() { // Bad End 1
cls();
print("你因为食物短缺,饿死了。");
print("你看着消瘦的身体,深深地哀叹");
if(specialItem){
print("意识消散的最后一刻,你脑海中闪过无数次饿死的画面...");
print("“又是这样吗?”——这是你最后的念头。");
}
badEnd_::end(1);
pressAnyKey();
deathCount++;
}
void WrongPassword() { // Bad End 2
cls();
print("你一遍遍尝试输入密码,紧皱着眉头:");
print("请输入密码:");
print("123456");
sleep(100);
print(color_::red + "输入错误!" + color_::back);
print("000000");
sleep(100);
print(color_::red + "输入错误!" + color_::back);
print("666666");
sleep(100);
print(color_::red + "输入错误!" + color_::back);
print("");
print(color_::red + "目标已锁定-入侵者!" + color_::back);
print("一束激光射向了你,你死了");
badEnd_::end(2);
pressAnyKey();
deathCount++;
}
void GoCrazy() { // Bad End 3,12,13
cls();
print("长久的等待终于让你失去了理智,你疯了。");
if (zombieKing) {
print("当政府的救援队打开你家的门时,你嘶吼着扑了上去");
if (bullets > 3) {
print("他们试图将你击毙,却被你提前一枪击倒");
print("你如同一个熟练的猎手,狩猎着救援队");
print("当他们全部死去后,你开始享用起你的大餐");
badEnd_::end(13);
if (!clue[9]) {
sleep(2000);
cluei(9);
}
} else {
print("你被他们击毙了");
badEnd_::end(12);
}
pressAnyKey();
deathCount++;
return;
}
badEnd_::end(3);
deathCount++;
// 解锁线索:速度飘忽不定的政府
if (!clue[3] && happyEnd[1]) {
sleep(2000);
cluei(3);
}
pressAnyKey();
}
void BaseDestroyed_Alone() { // Bad End 4
cls();
print("当你完成任务回来的时候,发现——");
print("基地被丧尸攻破了");
print("这个基地的所有人都被丧尸杀了,一个人都没跑出来");
__memory();
badEnd_::end(4);
deathCount++;
pressAnyKey();
}
void BaseDestroyed_LowBullets() { // Bad End 5
cls();
print("丧尸的数量实在太多了,");
print("尽管基地的大家都在尽全力防守");
print("可基地还是被攻破了");
print("而你,也死在了这里");
__memory();
badEnd_::end(5);
deathCount++;
pressAnyKey();
}
void Mutate() { // Bad End 6
cls();
print("你感觉到自己正在变异,");
print("意识开始逐渐模糊起来");
print("你的肚子正无比渴望着人肉");
print("接着,你眼前一黑,再也没有醒来");
badEnd_::end(6);
deathCount++;
pressAnyKey();
}
void KilledByWriter() { // Bad End 7
cls();
print("你被作者杀死了");
badEnd_::end(7);
deathCount++;
pressAnyKey();
}
void GirlMutated() { // Bad End 8
cls();
print("坐在椅子上的是一个15岁左右的少年");
print("正在你因为他的年龄而惊讶时");
print("少年却站了起来,看向了你身后的妹子");
print("“差不多了吧”,妹子这样说道");
print("“可以了”,这是少年的回答");
print("然后,你就感到脖子一阵剧痛");
print("在你失去意识前,眼中最后的场景是妹子咬着你的脖子");
if(specialItem){
print("“不对!”——这是你最后的念头。");
}
badEnd_::end(8);
deathCount++;
// 解锁线索:早已变异的妹子
if (!clue[4]) {
sleep(2000);
cluei(4);
}
pressAnyKey();
}
void LabNotebook() { // Bad End 9
cls();
print("你进入大厦才发现这里藏着许多丧尸");
print("你一路且战且退来到了地下室");
print("诡异的是,当你杀光了跟来的丧尸后,发现地下室里并没有丧尸");
print("这里有的,只是一个穿着白大褂的尸体 编号[ADMIN-04]");
print("在尸体的衣服口袋中,你找到了一个笔记本");
print("");
if (advanced){
cout << color_::yellow;
print("实验体1号:进展加快,延迟变异,保留部分记忆");
print("今天,2号诞生了:她比其他实验体更具情感");
print("有些不对,情感机制的发育有些太快了");
print("2号的免疫系统被检测出有强感染性");
print("实验体3号:核心测试对象,目标:突破循环或同化");
print("实验产生瓶颈,或许我们应该把这些活体样本进行调试");
print("[03],样本失去活性,但思维数据表在动");
cout << color_::back;
}
else {
cout << color_::yellow;
print("****1号****进展********记忆**");
print("今********,*号诞生了,她比其*****更*");
print("有些不对,*****的发育有些太快了");
print("2号的**被***出有强感染性");
print("3***能够***循环**无尽******末世");
print("实验***瓶颈,或许**该**活体样本****");
print("**,样本失去活性,但****动");
cout << color_::back;
}
triggerWeird = true;
if (specialItem) {
// Bad End 15
print("你发现这笔迹有些不对");
print("就好像是新写上去的一样");
print("认字迹的话,好像还十分熟悉");
print("正当你想的入迷的时候,你的脖子被咬住了");
print("在死前,你隐约听到了少年的声音,“再来一次吧”");
badEnd_::end(15);
if (!clue[12]) {
sleep(2000);
adminLog ++;
cluei(12);
}
} else {
print("正当你看的入迷的时候,你的脖子被咬住了");
print("在死前,你隐约听到了少年的声音, “再来一次吧”");
badEnd_::end(9);
if (!clue[5]) {
sleep(2000);
cluei(5);
adminLog ++;
}
}
deathCount++;
pressAnyKey();
}
void AnotherBase() { // Bad End 10
cls();
print("你发现了另一个基地");
print("弹尽粮绝的你选择加入了他们");
print("之后的每一天都十分单调");
print("外出寻找物资,然后天黑了回家睡觉");
print("应该是这样吗?");
print("也许吧");
print("日复一日的孤独让你失去了活下去的意义");
print("最终选择结束自己的生命");
badEnd_::end(10);
pressAnyKey();
}
void BadLuck() { // Bad End 11
cls();
print("你朝丧尸开了一枪,不过枪里还没有装弹,你被丧尸先一步咬死了");
badEnd_::end(11);
deathCount++;
pressAnyKey();
}
void OutsideWorld() { // Bad End 14
cls();
print("一股强烈的撕扯感出现到了你身上");
print("此时的你并不能接受如此巨大的伤害");
print("你死了");
badEnd_::end(14);
if (!clue[11]) {
cluei(11);
}
deathCount++;
pressAnyKey();
}
void KillGirl_BaseLeader() { // Bad End 16
cls();
print("你一枪**了妹子");
print("****以为你疯了,开枪杀了你");
badEnd_::end(16);
deathCount++;
pressAnyKey();
}
void KillGirl_Failed() { // Bad End 17
print("你被她一枪**");
badEnd_::end(17);
deathCount++;
pressAnyKey();
}// Bad End 18
void ZombieSwarm() {
cls();
print("3只丧尸蜂拥而上,你来不及反应就被扑倒在地");
print("尖锐的牙齿刺穿了你的喉咙,意识迅速模糊...");
__memory();
badEnd_::end(18);
deathCount++;
pressAnyKey();
}// Bad End 19
void SurviveButAlone() {
cls();
print("你带着无尽的食物流浪在末世,却再也没有遇到过活人");
print("日复一日的孤独让你失去了活下去的意义,最终选择结束自己的生命");
badEnd_::end(19);
deathCount++;
pressAnyKey();
}// Bad End 20
void EliteZombie() {
cls();
print("精英丧尸的速度远超你的想象,它躲过你的子弹,瞬间扑到你面前");
print("锋利的爪子撕开了你的胸膛,鲜血染红了地面...");
__memory();
badEnd_::end(20);
deathCount++;
pressAnyKey();
}// Bad End 21
void ContinueJourney() {
cls();
print("你和少年一路寻找安全区,但末世的危险远超想象");
print("在一次搜索物资时,少年不小心触发了丧尸陷阱,为了救他你耗尽了所有子弹");
print("最终你们被丧尸包围,力竭而亡");
__memory();
badEnd_::end(21);
deathCount++;
pressAnyKey();
}// Bad End 22
void BetrayedByBoy() {
cls();
print("深夜露营时,少年趁你熟睡偷走了所有食物和剩余子弹");
print("你醒来时已一无所有,在饥饿和绝望中倒在荒野,最终被丧尸发现");
__memory();
badEnd_::end(22);
deathCount++;
pressAnyKey();
}// Bad End 23
void SafeWithBoy() {
cls();
print("你和少年安全离开商场,但后续的旅程中食物逐渐耗尽");
print("你们为了最后一份食物反目成仇,少年用你给的武器打伤了你");
print("你躺在地上,看着他拿着食物逃走,最终被丧尸吞噬");
badEnd_::end(23);
deathCount++;
pressAnyKey();
}// Bad End 24
void KillInfectedBoy() {
cls();
print("你闭上眼睛扣动扳机,少年倒在血泊中");
print("杀死同伴的罪恶感让你精神崩溃,从此变得嗜血好杀");
print("最终你成为了末世中人人喊打的恶魔,被其他幸存者联合击毙");
badEnd_::end(24);
deathCount++;
pressAnyKey();
}// Bad End 25
void StarveWithBoy() {
cls();
print("你带着感染的少年艰难前行,但食物很快耗尽");
print("你们在饥饿中互相依偎,最终一起饿死在废弃的车厢里");
badEnd_::end(25);
deathCount++;
pressAnyKey();
}// Bad End 26
void MutatedBoyKillsYou() {
cls();
print("食物耗尽的那一刻,少年彻底变异,失去了所有理智");
print("他扑到你身上,锋利的牙齿咬断了你的颈动脉");
print("你到死都不敢相信,自己守护的人最终杀死了自己");
badEnd_::end(26);
deathCount++;
pressAnyKey();
}// Bad End 27
void TooManyInformation() {
print("首领看向你,稍加思索:");
print(color_::warn + "你知道的太多了,无法重置,只能销毁!" + color_::back);
badEnd_::end(27);
pressAnyKey();
deathCount++;
}
}
// 2. Happy End 结局
namespace happyEnd_ {
void end(int n) {
print(color_::blink + color_::green + "★ HAPPY END " + to_string(n) + " ★" + color_::back);
boxPrint(happyEndNames[n], color_::green);
happyEnd[n] = true;
}
// Happy End 1:终见曙光
void SurviveAlone();
// Happy End 2:仙侣偕行
void Couple();
// Happy End 3:英名长存
void Hero();
// Happy End 4:真我觉醒
void AcceptYourself();
// Happy End 5:异途相恋
void GayCrossSpecies();
void SurviveAlone() { // Happy End 1
cls();
print("在某一天,你家门口响起了敲门声,你打开门,外面的发现让你欣喜若狂");
print("政府的救援部队已经消灭了这个城市的丧尸,");
print("他们在这个城市的各个角落搜索着可能存在的幸存者.");
if (advanced){
print("骗局?这个世界不可能这么美好。");
}
happyEnd_::end(1);
// 解锁线索:速度飘忽不定的政府
if (badEnd[3] && !clue[3]) {
sleep(2000);
cluei(3);
}
pressAnyKey();
}
void Couple() { // Happy End 2
cls();
print("在与妹子相处的这些时间里,你与她相爱了");
print("你们的生活是那样的幸福");
print("直到有一天......");
vector<string> opts = {"1.独自一人前往", "2.和妹子一起去", "3.杀了妹子"};
int choice = option("****希望你去执行一个任务", opts);
if (choice == 1) {
badEnd_::BaseDestroyed_Alone();
return;
}
if (zombieKing && choice == 3){
badEnd_::KillGirl_BaseLeader();
return;
}
print("当你和妹子完成任务回来时,");
print("基地已经变成一片废墟了");
print("你和妹子没有办法,只能到处流浪");
print("不过,两个人总比一个人要好");
if (specialItem) {
print("你和妹子流浪途中,总觉得眼前的风景似曾相识...");
print("突然,妹子的脸开始扭曲,周围的场景逐渐模糊...");
print("再次睁开眼,你正站在邻居家门外,手里握着还未上膛的枪...");
}
happyEnd_::end(2);
pressAnyKey();
}
void Hero() { // Happy End 3
cls();
print("你就这样平静的生活在这个基地里");
print("直到某一天,大量的丧尸进攻了这里");
if (bullets > 8) { // 子弹充足触发Happy End
print("每个人都在尽自己的努力去守卫基地");
print("每个人都做到了自己能做到的");
print("最后,奇迹出现了");
print("大家成功守住了基地");
print("而你,也因为在守卫过程中立下大功成为了这个基地的英雄");
print("顺便说一句,到死了你也没女朋友");
if (specialItem) {
print("成为英雄的喜悦持续了不久,你发现基地的日历永远停留在同一天...");
print("当你试图提醒其他人时,所有人的脸都变成了丧尸的模样...");
print("再次惊醒,你正坐在家中的沙发上,电视里播放着丧尸危机的新闻...");
}
happyEnd_::end(3);
pressAnyKey();
return;
}
// 子弹不足触发Bad End 5
badEnd_::BaseDestroyed_LowBullets();
}
void AcceptYourself() { // Happy End 4
cls();
print("在与少年相处的这些时间里");
print("你们尽力地互相保护着");
print("而也常常带来惊喜");
print("慢慢的,你开始认清你自己");
print("你是个gay");
print("于是,你就和少年幸福快乐的生活在了一起");
happyEnd_::end(4);
pressAnyKey();
}
void GayCrossSpecies() { // Happy End 5
cls();
print("没关系的,一切都会过去的");
print("你这样说的");
print("他似乎感觉到了你的善意,一点一点向你靠近");
print("你紧紧的抱住了他");
print("我会保护好你的");
happyEnd_::end(5);
pressAnyKey();
}
}
namespace trueEnd_ {
void end(int n) {
print(color_::blink + color_::sky + "★ TRUE END " + to_string(n) + " ★" + color_::back);
boxPrint(trueEndNames[n], color_::sky);
trueEnd[n] = true;
}
void AsBefore();
void KeepSelf();
void Hallucination();
void ServerShutdown();
void LateDeath();
void BreakCycle();
void AdminAssimilation();
void AsBefore() { // True End 1
cls();
char ch;
print("那箱饼干与你的枪一起发出了强光");
print("紧接着,他们融为了一体");
print("当光芒散去时,整个世界都发生了变化");
print("所有的丧尸都变回了人类");
if (specialItem){
print("世界恢复了和平,但你总觉得眼前的一切似曾相识...");
print("突然,一阵强光闪过,你再次睁开眼——");
print("你正坐在家中的沙发上,电视里播放着丧尸危机爆发的紧急新闻...");
}
trueEnd_::end(1);
// 解锁线索:奇特的枪与饼干
if (!clue[0]) {
cluei(0);
}
pressAnyKey();
}
void KeepSelf() { // True End 2
cls();
print("你的变异已经开始了");
print("你开始疯狂的进食,直到把自己的胃撑破");
print("然后,就眼前一黑失去意识");
print("再次醒来时,你已经是一个丧尸了");
print("奇怪的是,你还保留着自己的意识");
print("你感觉到自己的力气变得更大,速度变得更快");
print("或许变成丧尸也不错————你这样想着");
trueEnd_::end(2);
// 解锁线索:延迟变异的少年
if (!clue[1]) {
sleep(2000);
cluei(1);
}
if(specialItem){
print("?????????????????????????????");
print("不对,我本来不就在努力打败丧尸吗?");
print("你看向少年,脑海里波澜万千");
print("少年也慢慢走向你,拿出了珍藏已久的解药");
print("你又感受到了生命");
happyEnd_::AcceptYourself();
return;
}
if(zombieKing){
print("?????????????????????????????");
print("不对,我本来不就是一只丧尸吗?");
print("你看向少年,脑海里波澜万千");
print("少年也慢慢走向你,和你握了握手");
happyEnd_::GayCrossSpecies();
return;
}
pressAnyKey();
}
void Hallucination() { // True End 3
cls();
print("你和妹子冲出了丧尸的围杀,");
print("可是当你们来到那个幸存者基地时");
print("却发现那个基地有一些不对");
print("所有人都死气沉沉的");
print("你们直接走向了首领的房间");
// 特殊条件:已解锁True End 2和线索3,触发Bad End 8
if (trueEnd[2] && clue[2]) {
badEnd_::GirlMutated();
return;
}
print("坐在椅子上的是一个30岁左右的男性");
print("他说,欢迎");
print("基地的首领表示可以用子弹交换你手中的食物");
print("请输入你需要的子弹数");
sleep(200);
print("1");
print("首领很开心你能提供稀缺的食物,多给了你1份子弹");
bullets += 2;
print("****希望你加入这个基地");
print("你的选择是");
print("1.留在这");
print("2.离开");
sleep(200);
print("2");
print("你决定");
print("1.当天离开");
print("2.再停留一天");
sleep(200);
print("1");
print("就在你快要离开的时候,妹子抓住了你的手");
print("“我喜欢你,别走”,她这样说");
print("于是,你留了下来");
print("你们的生活是那样的幸福");
print("直到有一天......");
print("****希望你去执行一个任务,你选择");
print("1.独自一人前往");
print("2.和妹子一起去");
sleep(200);
print("在执行任务的过程中");
print("妹子曾被丧尸咬到过一口");
print("她以为你没有发现");
print("而你却在远处看到了这一幕");
print("奇怪的是,她却并没有变异");
print("当你和妹子完成任务回来时,");
print("基地已经变成一片废墟了");
print("你和妹子没有办法,只能到处流浪");
print("不过,两个人总比一个人要好");
print("Happy End------神仙眷侣");
print("???????????????????????????????????");
trueEnd_::end(3);
// 解锁线索:不变异的妹子
if (!clue[2]) {
sleep(2000);
cluei(2);
}
if (advanced && savedGirl >= 10 && savedBoy >= 10) {
print("???????????????????????????????????");
print("妹子说,我好像见过你数十次");
print("我昨天见到了一个少年,他知道了真相");
print("我们必须团结起来!");
trueEnd_::BreakCycle();
return;
}
pressAnyKey();
return;
}
void ServerShutdown() { // True End 4
cls();
print("当丧尸危机爆发时,你正呆在家里");
pressAnyKey();
pressAnyKey();
// 模拟游戏循环bug
for (int i = 1; i <= 1000; i+=100) {
print("你的家里是个较为安全的地方,你可以选择搜索你家的物资或是去邻居家看看");
sleep(1000 - i);
print("********************************************************************");
}
print("检测到不匹配!!!");
sleep(2000);
pressAnyKey();
print("有什么不对劲");
print("你这样想着");
print("过去了好多天,");
print("你还是一个人都没有遇到,");
print("除了丧尸就是丧尸");
print("这一切,就好像被废弃了一样");
print("");
print("你猛然惊醒——眼前不是家,而是一个充满仪器的实验室");
print("手腕上的手环显示:" + to_string(deathCount));
print("实验体3号意识稳定性下降...测试场景崩溃中...");
print("一个穿着白大褂的人走进来:“恭喜你,成为第一个突破的实验体”");
print("他递给你一份文件:《末世测试最终报告》");
print("上面写着:实验体3号通过自由意志突破虚拟循环,人性测试达标");
print("");
cout << color_::yellow;
print("===== 实验体3号最终报告 =====");
print("你持有[未知碎片],解锁了循环真相,通过了人性测试。");
print("真相:你是实验体3号,1号(少年)和2号(妹子)是辅助测试体。");
print("末世是虚拟场景,你的每一次死亡、每一个选择,都在被记录。");
print("现在,你获得了真正退出的权限——");
cout << color_::back;
trueEnd_::end(4);
triggerWeird = true;
// 解锁线索:复活循环
if (!clue[8]) {
adminLog ++;
cluei(8);
}
pressAnyKey();
print("输入y退出:");
char e;
cin>>e;
if (e == 'y' || e == 'Y') {
print("实验体3号成功脱离测试");
exit(0);
}
if (adminLog >= 5 && countUnlocked(trueEnd, 10) >=4 && savedGirl <=-5
&& savedBoy <=-5 && zombieKing && advanced) {
pressAnyKey();
vector<string> opts = {"1. 愿意(接受同化", "2. 拒绝(返回循环)"};
int choice = option("ADMIN-01突然开口:“你满足了所有同化条件——无情感羁绊、知晓真相、突破循环阈值”\n\
“成为新的域管理员,掌控所有实验体的循环,你愿意吗?”", opts);
if (choice ==1) {
AdminAssimilation(); // 触发同化结局
return;
} else {
print("你拒绝了同化,被送回末世循环");
pressAnyKey();
return;
}
}
pressAnyKey();
}
void LateDeath() { // True End 5
cls();
print("整个世界好像变得不同了");
print("所有的活人在一瞬间消失");
print("所有的丧尸当场去世");
print("你的眼前只剩下了黑暗");
print("不知道过去了多久,你死了");
print("不,还没有结束");
print("虽然好像和往常死去之后的感觉一样");
print("但是......");
print("");
print("你猛然惊醒——眼前不是家,而是一个充满仪器的实验室");
print("手腕上的手环显示:");
print("实验体3号意识异常...测试场景重建中...");
print("一个穿着白大褂的人走进来:“你居然发现了”");
print("“你这么执着保存,一定有别的意图”");
print("白大褂的人按下了控制台的按钮,你失去了意识...");
print("再次醒来,你正分配初始物资,子弹和食物的总和依旧是10...");
trueEnd_::end(5);
deathCount++;
// 解锁线索:选择
if (!clue[10]) {
adminLog ++;
cluei(10);
}
pressAnyKey();
}
void BreakCycle(){// True End 6
cls();
print("充满仪器的实验室中");
print("你对一个穿着白大褂的人大声叫喊着");
print("“少年和妹子也是有生命的,快放他们出去!”");
print("穿着白大褂的人走进来:");
print("“你会被永远困在循环中,但可以尝试改写他们的命运”");
print("白大褂的人按下了控制台的按钮,你失去了意识...");
print("你发现了一个白色的实验室,门口有密码锁,提示:“编号之和”");
// 线索5(实验双体):1号+2号;线索8(复活循环):3号是你;线索10(抉择之键):核心是3号
// 正确答案:1+2+3=6
if (clue[5] && clue[8] && clue[10]) {
print(color_::yellow + "[线索提示]:根据实验日志,密码是6!" + color_::back);
}
print("请输入密码:");
int password = input(0, 999);
if (password == 6) {
print("密码正确!你进入实验室,找到了突破循环的关键设备!");
} else {
print("恭喜你,密码错误!");
badEnd_::WrongPassword();
return;
}
print("再次醒来,1号、2号彻底摆脱了管理员控制,三人一起在末世建立真正的幸存者营地");
trueEnd_::end(6);
if (!clue[13]) {
adminLog ++;
cluei(13);
}
pressAnyKey();
}
void AdminAssimilation() { // True End 7
cls();
triggerWeird = true; // 全程触发违和感
print("你在基地中,面对ADMIN-02,毫不犹豫地选择了——");
print("“我将要同化,成为新的管理员”");
sleep(500);
// 多感官违和反馈:文字乱码+颜色闪烁
cout << color_::red;
print(" 检测到实验体3号意愿匹配 ");
sleep(300);
cout << color_::back;
print("ADMIN-01露出诡异的笑容:“很好,你通过了终极测试——放弃自由,拥抱控制”");
print("他抬手按下控制台按钮,你的手腕传来剧痛,原有的 3号 标记逐渐消失,取而代之的是 ADMIN-00");
sleep(500);
// 插入管理员日志碎片(第6份隐藏日志)
cout << color_::yellow;
print("“——管理员日志 最终卷——”");
print("实验体3号成功同化,成为新的域管理员ADMIN-00");
print("同化核心规则:保留所有记忆,但抹除 情感羁绊,仅保留 理性控制");
cout << color_::back;
sleep(800);
// 场景切换:从实验室到域管理员控制台
print("眼前的实验室逐渐消散,取而代之的是一个巨大的环形控制台");
print("屏幕上显示着无数个循环场景:有的是你经历过的末世,有的是全新的沙漠/深海场景");
print("控制台中央显示着一行文字:请设置新实验体的测试参数");
sleep(500);
// 玩家的同化后的选择(无情感波动,纯理性控制)
print("你伸出手,触摸控制台,脑海中没有任何犹豫,情感已被同化抹除");
vector<string> opts = {
"1. 沿用原有 末世循环,新实验体编号4号,辅助测试体1号(少年)、2号(妹子)重置",
"2. 创建新 绝望循环(深海求生),新实验体编号4号,辅助测试体为全新的 渔民 科学家"
};
// 无论选择哪个,都是循环的延续
int choice = option("", opts);
if (choice == 1) {
print("你按下 末世循环重置 按钮,屏幕显示:实验体4号已注入,1号、2号重置完成,循环启动");
} else {
print("你按下 新场景创建 按钮,屏幕显示:深海循环已生成,实验体4号、辅助测试体5号、6号注入完成");
}
sleep(500);
// 结局高潮:玩家成为新的控制者,循环永无止境
print(" 同化完成 ");
print("你坐在管理员的座椅上,看着屏幕中挣扎的新实验体,内心毫无波澜");
print("原来,实验的真正目的不是测试 自由意志,而是筛选 合格的控制者 ");
print("你打破了被控制的循环,却成为了新的控制者,开启了永无止境的测试");
trueEnd_::end(7);
// 解锁终极线索
if (!clue[14]) {
sleep(2000);
cluei(14);
}
sleep(1000);
// 结局彩蛋:新实验体的视角
if(choice == 2){
print("屏幕中,新实验体4号的视角亮起:");
print("“当深海危机爆发时,你正呆在潜水艇里...”");
print("“你有10点物资可以分配到氧气和柴油上...”");
}
pressAnyKey();
}
}
void explore1F() {
cls();
print("你让少年在2楼等待,独自探索1楼");
print("1楼是日用品区,光线昏暗,隐约听到丧尸低吼");
print("突然冲出3只丧尸,需要3发子弹才能击退");
if (bulleti(3)) {
print("子弹不足!你被丧尸围攻...");
badEnd_::ZombieSwarm(); // Bad End 18
return;
}
print("你成功击退丧尸,但枪声惊动了2楼的丧尸");
// 因枪声吸引丧尸,少年战死
print("你急忙跑回2楼,发现少年已被丧尸包围...");
print("他为了不拖累你,拉着丧尸坠入了货梯井");
hasBoy = false;
print("你在少年的背包里找到一箱压缩饼干 食物+88");
food += 88;
// True End 1的条件检查 食物和子弹充足
if (food > 10 && bullets > 10) {
trueEnd_::AsBefore(); //True End 1
} else {
print("你带着大量食物离开商场,但总觉得少了什么");
print("后续:你独自流浪,最终建立了新的幸存者营地");
badEnd_::SurviveButAlone(); //Bad End 19
}
}
void explore2FAlone() {
cls();
print("你让少年在1楼看守物资,独自探索2楼");
print("2楼是服装区,挂满的衣物像人影一样晃动,十分诡异");
// 随机遭遇精英丧尸
int intg = rand(1, 3); // 33%概率
if (intg == 2) {
print("一只速度极快的精英丧尸扑了过来,需要5发子弹才能击杀");
if (bullets <= 3) {
print("你匆忙之下按下了扳机...");
badEnd_::BadLuck();
}
if (bulleti(5)) {
print("精英丧尸撕碎了你的喉咙...");
badEnd_::EliteZombie(); //Bad End 20
return;
}
print("你艰难杀死精英丧尸,在它巢穴里找到8发子弹");
bullets += 8;
} else {
print("你在服装架后发现4只普通丧尸,消耗4发子弹击杀");
if (bulleti(4)) {
badEnd_::ZombieSwarm(); //Bad End 2
return;
}
print("清理完丧尸后,找到6份军用罐头(食物+6)");
food += 6;
}
// 返回1楼后的选择
vector<string> opts = {"1. 原谅他", "2. 教训他"};
int choice = option("你回到1楼,发现少年在偷偷吃你的食物", opts);
if (choice == 1) {
food -= 2;
if(savedBoy <= 0){
print("少年眼神冰冷地说:“你和其他管理员一样,只把我当工具”");
print("他偷走食物,并留下一张纸条:“下次,我会杀了你”");
badEnd_::BetrayedByBoy(); // Bad End 22
return;
}
print("少年道歉,承诺以后会保护你");
print("你们离开商场,继续寻找安全区");
savedBoy++;
badEnd_::ContinueJourney(); // Bad End 21
return;
} else {
print("你打了少年一巴掌,他眼神变得冰冷");
savedBoy-=3;
print("深夜露营时,少年偷走所有食物逃走,你饿死在野外");
badEnd_::BetrayedByBoy(); // Bad End 22
return;
}
}
void explore2FTogether() {
cls();
string msg = "你和少年一起探索2楼,他拿着你给的武器(" +
string(boyWeapon == 1 ? "枪" : boyWeapon == 2 ? "水管" : "无") + ")";
print(msg);
print("2楼是家电区,货架倒塌堵住了部分通道,丧尸在里面游荡");
// 根据少年武器决定战斗难度
int zombieCount = (boyWeapon == 1) ? 2 : (boyWeapon == 2) ? 3 : 5;
print("遭遇" + to_string(zombieCount) + "只丧尸,你和少年背靠背战斗");
int bulletCost = (boyWeapon == 1) ? 1 : (boyWeapon == 2) ? 2 : 4;
if (bullets < bulletCost) {
print("子弹不足!少年为了保护你被丧尸咬伤...");
boyInfected = true; // 少年被感染
} else {
bullets -= bulletCost;
if (rand(1, 4)== 2) { // 25%概率少年被咬
print("战斗中少年被丧尸抓伤,伤口开始发黑...");
boyInfected = true;
} else {
print("你们成功击退丧尸,在柜台后找到3份食物和8发子弹");
food += 3;
bullets += 8;
print("少年状态良好,你们准备离开商场");
badEnd_::SafeWithBoy(); // Bad End 23
return;
}
}
// 少年感染后的选择
vector<string> opts = {"1. 杀了他,获得物资,但良心不安", "2. 不杀他,带他找解药,食物消耗加倍"};
int choice = option(color_::warn + "少年体温升高,意识模糊,随时可能变异" + color_::back, opts);
if (choice == 1) {
print("你开枪**了少年,从他身上找到20发子弹");
if(savedBoy <= 0){
print("他留下一张纸条:“你和其他管理员一样,只把我当工具,下次,我会杀了你”");
badEnd_::KillInfectedBoy(); // Bad End 22
}
savedBoy-=5;
bullets += 20;
badEnd_::KillInfectedBoy(); // Bad End 24
} else {
savedBoy++;
print("你决定带他走,每天消耗2份额外食物");
if (foodi(4)) {
badEnd_::StarveWithBoy(); // Bad End 25
return;
}
// 根据savedBoy触发不同剧情
if (savedBoy >= 5) {
print("少年突然抓住你的手,从口袋里掏出一张皱巴巴的纸:");
boxPrint("解药配方:需要商场3楼的抗生素和纯净水!", color_::yellow);
opts = {"1. 相信他,去3楼找原料(额外消耗2发子弹,成功则两人都解除感染)",
"2. 不相信,继续带他找安全区"};
int choice = option("是否去寻找解药?", opts);
if (choice ==1) {
if (bulleti(2)) {
badEnd_::ZombieSwarm(); return;
}
print("你们在3楼找到抗生素,少年成功制作解药,两人都解除了感染!");
food +=5; bullets +=3;
print("少年说到:“我们已经准备妥当,我们将要成功”");
trueEnd_::BreakCycle(); // 直接触发循环守护者结局(无需等妹子好感)
} else {
if (food >=6) {
trueEnd_::KeepSelf(); return;
}
else {
badEnd_::MutatedBoyKillsYou(); return;
}
}
}
}
}
//第四阶段:少年同行后的冒险剧情(主线延伸)
void boyAdventure() {
// 给少年分配武器
vector<string> opts = {"1. 给他枪", "2. 给他水管", "3. 什么都不给"};
int choice = option("少年向你要武器", opts);
boyWeapon = choice; // 1=枪,2=水管,3=无
opts = {"1. 独自探索1楼", "2. 独自探索2楼", "3. 和少年一起探索2楼"};
choice = option("你们来到一家大商场:", opts);
if (choice == 1) {
explore1F(); // 独自1楼:少年可能战死,触发True End 1
} else if (choice == 2) {
explore2FAlone(); // 独自2楼:遭遇大量丧尸
} else {
explore2FTogether(); // 共同探索2楼:少年可能被咬,触发True End 2
}
return;
}
//第三阶段:到达幸存者基地
void baseAdventure(){
cls();
print("你终于到达幸存者基地");
print("坐在椅子上的是一个30岁左右的男性");
print("他说,欢迎");
print("你发现他胸前挂着工牌[ADMIN-02]");
print("首领上下打量你:“新来的?先熟悉一下基地吧”");
int choice;
vector<string> opts = {"1. 前往医疗室", "2. 前往指挥室", "3. 直接交换物资"};
if (clue[5] || clue[9]) { // 若拥有线索5(实验双体)或9(变异溯源)
opts.push_back( "\n4. 调查首领的实验日志(需要管理员权限)" );
}
choice = option("基地内的行动:", opts);
if (choice == 1) {
print("医疗室里摆满了实验设备,墙上贴着一张病历:");
cout << color_::yellow;
print("***1号:***知,症**“延**异”,保*****记忆");
cout << color_::back;
adminLog++;
} else if (choice == 2) {
print("指挥室的电脑屏幕上显示着实验日志:");
cout << color_::yellow;
print("实****:**测**象,目**“突破**或**”");
cout << color_::back;
adminLog++;
if (adminLog >= 5) {
print("首领突然闯入:“你知道得太多了!”");
badEnd_::TooManyInformation(); // Bad End 27
return;
}
} else if (choice == 4) {
print("请输入密码:实验观察者的编号");
int s = input(0, 999);
if(s != 2){
badEnd_::WrongPassword();
return;
}
print("你根据线索破解了首领的电脑密码,找到了完整的实验日志:");
cout << color_::yellow;
print("实验体1号(少年):延迟变异,保留记忆;\n\
实验体2号(妹子):免疫感染,情感异常;\n\
实验体3号(你):核心测试对象,目标突破循环。");
cout << color_::back;
adminLog += 2;
// 解锁真结局的前置条件
if (adminLog >= 6) {
print("你意识到这一切都是实验,决定寻找突破循环的方法...");
trueEnd_::BreakCycle(); // 直接触发循环守护者结局
return;
}
}
else{
print("首领提出用子弹交换你的食物");
print("当前食物:" + to_string(food) + ",请输入要交换的数量(0-" + to_string(food) + ")");
int exchange = input(0, food);
food -= exchange;
bullets += exchange + 2;
print("交换完成,首领奖励你两发子弹");
print("当前子弹:" + to_string(bullets) + ",食物:" + to_string(food));
}
// 基地抉择:留下 离开
opts = {"1. 加入基地", "2. 准备离开"};
choice = option("****希望你加入他们", opts);
if (choice == 1) {
// 留在基地:英雄/眷侣结局
if (girlFavor > 0) {
happyEnd_::Couple(); // 与妹子发展(Happy End 2)
return;
} else {
happyEnd_::Hero(); // 成为英雄(Happy End 3)
return;
}
}
else {
// 离开基地:遇到少年
opts = {"1. 现在离开", "2. 再停留一天"};
choice = option("你决定离开基地", opts);
if (choice == 2) {
// 额外停留一天,再次交换资源
print("再停留一天,可再次用食物换子弹");
print("当前食物:" + to_string(food) + ",请输入交换数量");
int exchange2 = input(0, food);
food -= exchange2;
bullets += exchange2 + 3; // 额外奖励3发
print("交换完成!");
print("又过一夜,食物-2");
food -= 2;
if (food < 0) {
badEnd_::Starve();
return;
}
}
// 遇到少年,决定是否同行
showStatus();
opts = {"1. 带上他(每天多消耗1份食物)", "2. 不带他"};
choice = option("离开时,一个少年请求和你一起走", opts);
if (choice == 2) {
print("少年生气离开,偷走了你的枪和所有子弹");
bullets = 0;
// 后续剧情:无少年,继续生存(Bad End 10)
savedBoy--;
badEnd_::AnotherBase();
return;
} else {
// 带上少年,进入少年结局线
hasBoy = true;
print("你带上了少年,他给了你1份食物");
food += 1;
if (girlFavor > 1 && hasBoy && specialItem) {
print("他们对视一眼,似乎认出了彼此...");
cluei(16);
}
if (clue[5] && clue[8] && clue[10]) { // 同时拥有实验双体、复活循环、抉择之键线索
print("少年突然盯着你:“你也发现了?这个世界是假的!我们都是实验体!”");
print("妹子走出:“我早该想到,你就是3号!”");
print("三人对视,异口同声:“我们必须打破这个循环!”");
// 直接触发真结局
trueEnd_::BreakCycle();
return;
}
pressAnyKey();
// 少年相关剧情跳转
boyAdventure();
}
}
}
// 第二阶段:遭遇妹子
void girlAdventure(){
print("回家路上,你遇到一个女幸存者——她手臂渗血,眼神警惕地盯着你");
print("她的背包上绣着一个模糊的编号:[TEST-02]"); // 暗示实验体身份
vector<string> opts = {"1. 询问她的伤势", "2. 给她物资", "3. 默默离开"};
int choice = option("", opts);
if (choice == 1) {
print("她犹豫了一下:“被丧尸抓伤了...\n但...我好像不会变异”"); // 暗示免疫特性
opts = {"1. 用食物帮她包扎", "2. 离开"};
int healChoice = option("", opts);
if (healChoice == 1) {
if (foodi(2)) {
print("食物不足,无法帮助");
girlFavor = 0;
} else {
girlFavor = 1;
savedGirl += 5;
print("她感激地看着你:“谢谢你...”");
if (specialItem) {
print("她突然盯着你的口袋:“你身上有...和我一样的东西?”"); // 感应特殊物品
cluei(15);
pressAnyKey();
}
}
}
}
else if(choice == 2){
opts = {"1. 不给任何东西", "2. 给食物", "3. 给子弹"};
if(zombieKing){
opts.push_back("4. 开枪杀了她");
}
choice = option("", opts);
switch (choice) {
case 1:
print("妹子生气地走了");
girlFavor = 0;
break;
case 2:
print("请输入食物份数");
choice = input(0,999);
if (foodi(choice)) {
print("食物不足,无法给予");
girlFavor = 0;
break;
}
girlFavor = 1; // 好感度+1
savedGirl += max(1, choice/2);
if(savedGirl <= 0){
print("妹子收下了食物,心中怒火不停");
badEnd_::KillGirl_Failed();
return;
}
print("她记住了你的善意");
if(savedGirl >= 8){
print("“我记得你!上次你给我的食物救了我… 这次我带了备用子弹,给你”");
bullets += 4;
}
break;
case 3:
print("请输入子弹份数");
choice = input(0,999);
if (bulleti(choice)) {
print("子弹不足,无法给予");
girlFavor = 0;
break;
}
if(savedGirl <= 0){
print("妹子收下了子弹,心中怒火不停");
badEnd_::KillGirl_Failed();
}
print("妹子收下子弹,默默离开了");
girlBullet += choice;
girlFavor = 1;
savedGirl += max(1, choice/3);
break;
case 4:
if (!zombieKing) break;
if (bulleti(1)) {
print("子弹不足,无法开枪");
print("“你果然和管理员一样 —— 自私到极致”");
savedGirl-=10;
girlFavor = 0;
break;
}
girlFavor = -1; // 敌对
savedGirl-=8;
print("你试图开枪**妹子");
print("但是被她发现了");
badEnd_::KillGirl_Failed();
break;
}
}
// 过夜消耗食物
print("又过了一夜,食物-2");
if (foodi(2)) {
badEnd_::Starve();
return;
}
showStatus();
print("前往幸存者基地的路上,你被大量丧尸逼进一家便利店");
print("便利店角落有一个燃气罐,你眼神一亮:“或许可以利用它”");
opts = {"1. 开枪引爆燃气罐(消耗1发子弹,清空丧尸)", "2. 死守便利店(消耗5发子弹)"};
if (clue[0]) { // 若拥有线索0(奇枪异食),提示燃气罐威力
print(color_::yellow + "[线索提示]:根据你发现的“奇枪异食”线索,燃气罐爆炸范围远超预期,能清空所有丧尸!" + color_::back);
}
choice = option("", opts);
if (choice == 1) {
print("你用仅有的一发子弹引爆了燃气管");
print("燃气罐爆炸,丧尸被清空!她拉着你冲出火海:“快走!”");
if (girlFavor > 1) {
print("她在爆炸中护住了你,你只受了轻伤");
bullets += 1; // 奖励子弹
}
}
else {
// 守在商店:消耗5发子弹
print("你选择死守商店,需要消耗"+ to_string(5 - girlBullet) +"发子弹");
if (bulleti(5 - girlBullet)) {
if(girlBullet > 0 && girlFavor > 0){
print("妹子帮你突围,可惜子弹还是不够,最终失败了");
}
else{
print("你准备突围,可惜子弹不够,最终失败了");
}
badEnd_::ZombieSwarm();
return;
}
if (girlFavor > 0) {
print("妹子在商店找到一把装满子弹的枪,子弹+8");
bullets += 8;
print("但妹子被货架上的丧尸血划伤,选择了**");
girlFavor = -1;
}
}
baseAdventure();
}
// 主线剧情核心函数
// 第一阶段:危机爆发与初始选择
void beginAdventure() {
// 初始化游戏
resetGameState();
char ch;
cls();
print("当丧尸危机爆发时,你正呆在家里");
print("你的家里是个较为安全的地方");
// 初始资源分配
print("初始资源分配");
print("你有10点物资可以分配到子弹和食物上");
print("请输入子弹数和食物数", false);
if(!clue[0]) print("(总和为10)");
else print("");
int bulletInit, foodInit;
while (true) {
bulletInit = input(0, 999);
foodInit = input(0, 999);
if (bulletInit + foodInit == 10 && bulletInit >= 0 && foodInit >= 0) {
bullets += bulletInit;
food += foodInit;
break;
}
if (clue[0]) { // 秘籍
bullets += bulletInit;
food += foodInit;
break;
}
print("分配错误,请重新输入(总和必须为10)");
}
pressAnyKey();
// 首次探索:留在家中 去邻居家
showStatus();
vector<string> opts = {"留在家中搜索物资", "前往邻居家探索"};
int choice = option("首次探索:", opts);
if (choice == 1) {
// 留在家中:2份食物
print("在二楼,你在储物柜里发现了3份子弹");
print("在家里过了一夜,食物-1");
if(foodi(1)){
badEnd_::Starve();
return;
}
bullets += 3;
} else {
// 去邻居家:遭遇丧尸,消耗子弹,获得额外子弹
print("前往邻居家的路上,你遇到了2只丧尸");
if (bulleti(2)) {
badEnd_::BadLuck(); //Bad End 11
return;
}
print("你开枪**了丧尸,子弹-2");
print("邻居家没人,你找到4份食物");
if (specialItem){
print("客厅桌上有一份撕碎的实验报告:");
cout << color_::yellow;
print("1***延迟******2*****免疫**3号:待****末世#**准备***");
cout << color_::back;
adminLog ++;
}
food += 4;
pressAnyKey();
print("在邻居家过夜,食物-2");
if (foodi(2)) {
badEnd_::Starve(); //Bad End 1
return;
}
}
showStatus();
opts = {"前往商场", "到处乱走", "留在屋子里等待救援"};
if (clue[3]) { // 若拥有线索3(政府异象),提示等待的风险
print(color_::yellow + "[线索提示]:根据“政府异象”线索,救援队可能不会及时赶到,等待会消耗大量资源!" + color_::back);
}
choice = option("你想起附近有一座商场", opts);
if (choice == 3) {
// 留在家里:持续消耗食物,触发等待结局
print("你选择在家等待救援,每天消耗2份食物");
if (foodi(6)) { // 无法坚持
badEnd_::Starve();
return;
}
// 50%概率触发救援或精神崩溃
if (rand(1, 2) == 2) {
happyEnd_::SurviveAlone(); //Happy End 1
return;
} else {
badEnd_::GoCrazy(); //Bad End 3
return;
}
} else if (choice == 2) {
// 到处乱走:遭遇丧尸
print("乱走时遇到了来自纳克萨玛斯的丧尸,需要3发子弹");
if (bulleti(3)) {
badEnd_::EliteZombie(); //Bad End 20
return;
}
} else {
// 前往商场:遭遇大量丧尸
print("前往商场途中遇到多只丧尸,消耗2发子弹");
if (bulleti(2)) {
badEnd_::ZombieSwarm();
return;
}
print("你在商场找到3份食物和1发子弹");
food += 3;
bullets += 1;
}
girlAdventure();
}
全部评论 2
这里没有main函数,main详情见生化小游戏 v1220 (补全)
最后:我肝不动了,大家加油,ak!ACGO_肝不动了
昨天 来自 浙江
1666
8小时前 来自 浙江
0











有帮助,赞一个