-
个人简介
副作用:药丸轮盘赌
1.12 Beta更新公告 增加商城中心(测试中) 增加难度选择(测试中) 增加联机大厅(测试中) 增加存档功能(测试中)
1.12正式版更新预告 增加难度选择 增加商城和兑换码 增加存档功能 增加双人模式 丰富剧情
根据用户反馈药剂师太强势了,所以将在1.12正式版削弱
如有编译问题请洛谷私信或线下找我
//1.12 Beta(未完成)(测试版)(QZ计划) #include <iostream> #include <cstdlib> #include <ctime> #include <vector> #include <string> #include <algorithm> #include <windows.h> using namespace std; // 游戏常量 const int INITIAL_HEALTH = 6; const int MAX_PILLS = 8; const int MAX_ITEMS = 20; // 药丸类型 enum PillType { RED, // 红色药丸 - 剧毒 BLUE, // 蓝色药丸 - 治疗 YELLOW, // 黄色药丸 - 伤害+特殊 GREEN, // 绿色药丸 - 强力治疗 PURPLE, // 紫色药丸 - 特殊效果 BLACK, // 黑色药丸 - 剧毒 WHITE, // 白色药丸 - 治疗 RAINBOW, // 彩虹药丸 - 特殊 GOLDEN, // 金色药丸 - 无尽模式钥匙 COUNT // 药丸类型总数 }; // 道具类型 enum ItemType { ANTIDOTE, // 解毒剂 - 免疫下一次毒药 EMETIC, // 催吐药 - 吐出一颗已服药丸 MICROSCOPE, // 显微镜 - 查看所有药丸 MAGNIFIER, // 放大镜 - 查看下一颗药丸 FILTER, // 过滤器 - 移除当前药丸 STABILIZER, // 稳定剂 - 将下一颗变为治疗 SHIELD, // 护盾 - 抵挡下一次伤害 MIRROR, // 镜子 - 反弹效果给对手 DILUTER, // 稀释剂 - 减半药效 AMPLIFIER, // 放大器 - 加倍药效 REVERSER, // 逆转剂 - 反转药效 DUPLICATOR, // 复制器 - 复制当前药丸 SHUFFLER, // 洗牌器 - 重新洗牌 TRANSMUTER, // 转化器 - 改变药丸类型 SYRINGE, // 注射器 - 跳过当前药丸 HOLSTER, // 枪套 - 跳过对手回合 LUCKY_CHARM, // 幸运符 - 增加好药几率 CURSED_ITEM, // 诅咒物 - 增加毒药几率 TIME_WARP, // 时间扭曲 - 重做回合 PULVERIZER // 粉碎器 - 摧毁同类型药丸 }; // 药丸结构体 struct Pill { PillType type; string name; string description; int healthEffect; bool isSpecial; bool isPoisonous; }; // 道具结构体 struct Item { ItemType type; string name; string description; }; // 玩家结构体 struct Player { string name; int health; vector<Item> items; int specialEffect; // 特殊效果标记 }; // 游戏状态 struct GameState { int round; vector<Pill> pillBottle; int currentPillIndex; Player player; Player opponent; bool endlessMode; bool goldenPillUsed; int poisonCount; // 毒药计数 }; // 初始化药丸 vector<Pill> initializePills() { vector<Pill> pills = { {RED, "红色药丸", "鲜红如血,散发着甜腻气味", -3, false, true}, {BLUE, "蓝色药丸", "晶莹剔透,表面有细微裂纹", 1, false, false}, {YELLOW, "黄色药丸", "发出微弱荧光,触感油腻", -2, true, true}, {GREEN, "绿色药丸", "薄荷香气,表面有螺旋纹路", 3, false, false}, {PURPLE, "紫色药丸", "不规则形状,偶尔轻微震动", 0, true, false}, {BLACK, "黑色药丸", "吸收周围光线,摸起来冰凉", -4, false, true}, {WHITE, "白色药丸", "纯白无瑕,散发着牛奶香气", 2, false, false}, {RAINBOW,"彩虹药丸", "色彩不断变化,温度忽冷忽热", 0, true, false}, {GOLDEN, "金色药丸", "散发着神秘光芒,表面有奇异纹路", 0, true, false} }; return pills; } // 初始化道具 vector<Item> initializeItems() { vector<Item> items = { {ANTIDOTE, "解毒剂", "免疫下一次毒药效果"}, {EMETIC, "催吐药", "吐出一颗已服用的药丸"}, {MICROSCOPE, "显微镜", "查看药瓶中所有药丸"}, {MAGNIFIER, "放大镜", "查看下一颗药丸"}, {FILTER, "过滤器", "移除当前药丸"}, {STABILIZER, "稳定剂", "将下一颗药丸变为治疗药"}, {SHIELD, "护盾", "抵挡下一次伤害"}, {MIRROR, "镜子", "将效果反弹给对手"}, {DILUTER, "稀释剂", "减半下一颗药丸的效果"}, {AMPLIFIER, "放大器", "加倍下一颗药丸的效果"}, {REVERSER, "逆转剂", "反转下一颗药丸的效果"}, {DUPLICATOR, "复制器", "复制当前药丸放入药瓶"}, {SHUFFLER, "洗牌器", "重新随机药丸顺序"}, {TRANSMUTER, "转化器", "改变当前药丸的类型"}, {SYRINGE, "注射器", "跳过当前药丸"}, {HOLSTER, "枪套", "跳过对手的下回合"}, {LUCKY_CHARM, "幸运符", "增加好药丸的几率"}, {CURSED_ITEM, "诅咒物", "增加毒药的几率"}, {TIME_WARP, "时间扭曲", "重新开始当前回合"}, {PULVERIZER, "粉碎器", "摧毁所有同类型药丸"} }; return items; } // 随机获取道具 Item getRandomItem() { static vector<Item> allItems = initializeItems(); int index = rand() % allItems.size(); return allItems[index]; } // 初始化游戏 GameState initializeGame(bool endless) { GameState game; game.round = 1; game.endlessMode = endless; game.goldenPillUsed = false; game.poisonCount = 0; // 初始化玩家 game.player.name = "玩家"; game.player.health = INITIAL_HEALTH; game.player.specialEffect = 0; // 初始化对手 game.opponent.name = "药剂师"; game.opponent.health = INITIAL_HEALTH; game.opponent.specialEffect = 0; // 初始化药瓶 vector<Pill> allPills = initializePills(); for (int i = 0; i < MAX_PILLS; i++) { int index = rand() % (allPills.size() - 1); // 不包括金色药丸 game.pillBottle.push_back(allPills[index]); if (allPills[index].isPoisonous) { game.poisonCount++; } } // 无尽模式开始时加入金色药丸 if (endless) { game.pillBottle.push_back(allPills[GOLDEN]); random_shuffle(game.pillBottle.begin(), game.pillBottle.end()); } game.currentPillIndex = 0; // 给玩家初始道具 for (int i = 0; i < 3; i++) { game.player.items.push_back(getRandomItem()); } // 给对手初始道具 for (int i = 0; i < 2; i++) { game.opponent.items.push_back(getRandomItem()); } return game; } // 显示游戏状态 void displayGameState(const GameState& game) { system("cls"); cout << "=== 副作用 - 第 " << game.round << " 回合 ===" << endl; cout << "[" << game.player.name << "] 生命: "; for (int i = 0; i < game.player.health; i++) cout << "O"; cout << endl; cout << "[" << game.opponent.name << "] 生命: "; for (int i = 0; i < game.opponent.health; i++) cout << "O"; cout << endl << endl; cout << "药瓶中剩余药丸: " << game.pillBottle.size() - game.currentPillIndex << endl; cout << "其中有毒药丸: " << game.poisonCount << "颗" << endl; } // 显示道具 void displayItems(const vector<Item>& items) { cout << "\n道具列表:" << endl; for (size_t i = 0; i < items.size(); i++) { cout << i+1 << ". " << items[i].name << " - " << items[i].description << endl; } } // 处理药丸效果 void applyPillEffect(GameState& game, Pill pill, bool isPlayer) { Player& target = isPlayer ? game.player : game.opponent; Player& other = isPlayer ? game.opponent : game.player; cout << "\n>>> " << (isPlayer ? "你" : "药剂师") << "服用了: " << pill.name << endl; cout << pill.description << endl; Sleep(2000); // 更新毒药计数 if (pill.isPoisonous) { game.poisonCount--; } // 检查护盾效果 if (target.specialEffect & (1 << SHIELD)) { if (pill.healthEffect < 0) { cout << (isPlayer ? "你的护盾" : "药剂师的护盾") << "抵挡了伤害!" << endl; target.specialEffect &= ~(1 << SHIELD); Sleep(1500); return; } } // 检查解毒剂效果 if (target.specialEffect & (1 << ANTIDOTE)) { if (pill.healthEffect < 0) { cout << (isPlayer ? "你的解毒剂" : "药剂师的解毒剂") << "中和了毒素!" << endl; pill.healthEffect /= 2; target.specialEffect &= ~(1 << ANTIDOTE); } } // 检查镜子效果 if (target.specialEffect & (1 << MIRROR)) { cout << (isPlayer ? "你的镜子" : "药剂师的镜子") << "反弹了效果!" << endl; target.specialEffect &= ~(1 << MIRROR); applyPillEffect(game, pill, !isPlayer); return; } // 应用药丸基础效果 if (pill.healthEffect != 0) { target.health += pill.healthEffect; if (pill.healthEffect > 0) { cout << (isPlayer ? "你" : "药剂师") << "恢复了 " << pill.healthEffect << " 点生命!" << endl; } else { cout << (isPlayer ? "你" : "药剂师") << "受到了 " << -pill.healthEffect << " 点伤害!" << endl; } } // 处理特殊药丸效果 if (pill.isSpecial) { switch(pill.type) { case YELLOW: cout << "你感到一阵眩晕,视线开始模糊..." << endl; target.specialEffect |= (1 << (rand() % 5 + 5)); // 随机负面效果 break; case PURPLE: cout << "周围的空间似乎扭曲了..." << endl; swap(target.health, other.health); cout << "你和药剂师的生命值交换了!" << endl; break; case RAINBOW: cout << "你看到了无数色彩在眼前旋转..." << endl; target.specialEffect = (1 << LUCKY_CHARM) | (1 << AMPLIFIER); cout << "你获得了幸运和强化的效果!" << endl; break; case GOLDEN: cout << "一股强大的能量流遍全身!" << endl; game.goldenPillUsed = true; game.endlessMode = true; cout << "无尽模式已激活!游戏将继续直到一方倒下!" << endl; break; default: break; } } // 确保生命值不会超过上限或低于0 target.health = min(max(target.health, 0), INITIAL_HEALTH * (game.endlessMode ? 2 : 1)); Sleep(2000); } // 使用道具 bool useItem(Player& user, Player& target, vector<Pill>& pillBottle, int& currentPillIndex, int& poisonCount) { if (user.items.empty()) { cout << user.name << "没有可用的道具!" << endl; return false; } cout << user.name << "选择使用道具:" << endl; displayItems(user.items); int choice; if (user.name == "玩家") { cin >> choice; } else { // AI简单逻辑:优先使用防御性道具 for (size_t i = 0; i < user.items.size(); i++) { if (user.items[i].type == ANTIDOTE || user.items[i].type == SHIELD) { choice = i + 1; break; } } if (choice < 1 || choice > static_cast<int>(user.items.size())) { choice = rand() % user.items.size() + 1; } Sleep(1500); } if (choice < 1 || choice > static_cast<int>(user.items.size())) { cout << "无效选择!" << endl; return false; } Item usedItem = user.items[choice-1]; user.items.erase(user.items.begin() + choice - 1); cout << user.name << "使用了: " << usedItem.name << endl; cout << usedItem.description << endl; Sleep(1500); switch(usedItem.type) { case ANTIDOTE: user.specialEffect |= (1 << ANTIDOTE); break; case EMETIC: if (user.health < INITIAL_HEALTH) { user.health += 1; cout << user.name << "吐出了一颗药丸,感觉好多了!" << endl; } else { cout << user.name << "想吐但吐不出来!" << endl; } break; case MICROSCOPE: cout << "药瓶中的药丸:" << endl; for (size_t i = currentPillIndex; i < pillBottle.size(); i++) { cout << i+1 << ". " << pillBottle[i].name << endl; } return false; // 不消耗回合 case MAGNIFIER: if (currentPillIndex + 1 < static_cast<int>(pillBottle.size())) { cout << "下一颗药丸是: " << pillBottle[currentPillIndex+1].name << endl; } else { cout << "这是最后一颗药丸了!" << endl; } break; case FILTER: if (currentPillIndex < static_cast<int>(pillBottle.size())) { cout << "移除了: " << pillBottle[currentPillIndex].name << endl; if (pillBottle[currentPillIndex].isPoisonous) { poisonCount--; } pillBottle.erase(pillBottle.begin() + currentPillIndex); } break; case STABILIZER: user.specialEffect |= (1 << STABILIZER); break; case SHIELD: user.specialEffect |= (1 << SHIELD); break; case MIRROR: user.specialEffect |= (1 << MIRROR); break; case DILUTER: user.specialEffect |= (1 << DILUTER); break; case AMPLIFIER: user.specialEffect |= (1 << AMPLIFIER); break; case REVERSER: user.specialEffect |= (1 << REVERSER); break; case DUPLICATOR: if (currentPillIndex < static_cast<int>(pillBottle.size())) { pillBottle.insert(pillBottle.begin() + currentPillIndex, pillBottle[currentPillIndex]); if (pillBottle[currentPillIndex].isPoisonous) { poisonCount++; } cout << "复制了: " << pillBottle[currentPillIndex].name << endl; } break; case SHUFFLER: random_shuffle(pillBottle.begin() + currentPillIndex, pillBottle.end()); cout << "药丸顺序被打乱了!" << endl; break; case TRANSMUTER: if (currentPillIndex < static_cast<int>(pillBottle.size())) { vector<Pill> allPills = initializePills(); bool wasPoisonous = pillBottle[currentPillIndex].isPoisonous; pillBottle[currentPillIndex] = allPills[rand() % allPills.size()]; if (wasPoisonous && !pillBottle[currentPillIndex].isPoisonous) { poisonCount--; } else if (!wasPoisonous && pillBottle[currentPillIndex].isPoisonous) { poisonCount++; } cout << "药丸变成了: " << pillBottle[currentPillIndex].name << endl; } break; case SYRINGE: cout << "跳过了当前药丸!" << endl; currentPillIndex++; break; case HOLSTER: cout << target.name << "的下回合将被跳过!" << endl; target.specialEffect |= (1 << HOLSTER); break; case LUCKY_CHARM: user.specialEffect |= (1 << LUCKY_CHARM); break; case CURSED_ITEM: target.specialEffect |= (1 << CURSED_ITEM); break; case TIME_WARP: cout << "时间倒流了!" << endl; return false; // 重新开始回合 case PULVERIZER: if (currentPillIndex < static_cast<int>(pillBottle.size())) { PillType typeToDestroy = pillBottle[currentPillIndex].type; int destroyedPoisons = 0; for (auto it = pillBottle.begin() + currentPillIndex; it != pillBottle.end(); ) { if (it->type == typeToDestroy) { if (it->isPoisonous) destroyedPoisons++; cout << "摧毁了: " << it->name << endl; it = pillBottle.erase(it); } else { ++it; } } poisonCount -= destroyedPoisons; } break; } return true; } // 玩家回合 void playerTurn(GameState& game) { bool turnEnded = false; while (!turnEnded) { displayGameState(game); if (game.currentPillIndex >= static_cast<int>(game.pillBottle.size())) { cout << "药瓶已经空了!" << endl; break; } cout << "\n当前药丸: " << game.pillBottle[game.currentPillIndex].name << endl; cout << "描述: " << game.pillBottle[game.currentPillIndex].description << endl; cout << "1. 服用这颗药丸" << endl; cout << "2. 使用道具(按0退出)" << endl; cout << "3. 查看道具说明" << endl; int choice; cin >> choice; if (choice == 1) { // 服用当前药丸 Pill currentPill = game.pillBottle[game.currentPillIndex]; applyPillEffect(game, currentPill, true); game.currentPillIndex++; turnEnded = true; } else if (choice == 2) { // 使用道具 if (useItem(game.player, game.opponent, game.pillBottle, game.currentPillIndex, game.poisonCount)) { turnEnded = true; } Sleep(1500); } else if (choice == 3) { displayItems(game.player.items); system("pause"); } else { cout << "无效选择!" << endl; Sleep(1000); } } // 回合结束时获得新道具 if (turnEnded && game.player.items.size() < 5) { game.player.items.push_back(getRandomItem()); } } // 对手回合 void opponentTurn(GameState& game) { displayGameState(game); // 检查是否被跳过回合 if (game.opponent.specialEffect & (1 << HOLSTER)) { cout << "\n药剂师被跳过回合!" << endl; game.opponent.specialEffect &= ~(1 << HOLSTER); Sleep(1500); return; } cout << "\n药剂师的回合..." << endl; Sleep(1500); // 简单AI逻辑 bool usedItem = false; // 有道具且随机决定使用道具 if (!game.opponent.items.empty() && rand() % 3 != 0) { usedItem = useItem(game.opponent, game.player, game.pillBottle, game.currentPillIndex, game.poisonCount); } // 如果没用道具且药瓶不为空,服药 if (!usedItem && game.currentPillIndex < static_cast<int>(game.pillBottle.size())) { Pill currentPill = game.pillBottle[game.currentPillIndex]; applyPillEffect(game, currentPill, false); game.currentPillIndex++; } // 对手回合结束时获得新道具 if (game.opponent.items.size() < 3) { game.opponent.items.push_back(getRandomItem()); } } // 主游戏循环 void gameLoop(bool endlessMode) { GameState game = initializeGame(endlessMode); // 开场剧情 cout << "=== 副作用 - 剧情===" << endl; cout << "你走进一家昏暗的药店,柜台后站着一位穿着白大褂的古怪药剂师。\n"; cout << "'啊,新来的病人!'他咯咯笑着,'让我们玩个游戏吧...'\n"; cout << "他拿出一个装满各色药丸的瓶子,'每人轮流服药,看看谁的运气更好!'\n"; if (endlessMode) { cout << "'不过这次...我们玩个更大的!'药剂师神秘地笑着,放入一颗金色药丸...\n"; } system("pause"); while (true) { // 检查游戏结束条件 if (game.player.health <= 0 && game.opponent.health <= 0) { cout << "你们双双倒下...平局!\n"; break; } else if (game.player.health <= 0) { cout << "你倒下了...药剂师站在你面前咯咯笑。'看来我的药方更有效!'\n"; break; } else if (game.opponent.health <= 0) { if (game.endlessMode && !game.goldenPillUsed) { cout << "药剂师瘫倒在地!但就在你以为胜利时...\n"; cout << "他突然狂笑起来,掏出一颗金色药丸吞下!'游戏才刚开始!'\n"; game.opponent.health = INITIAL_HEALTH * 2; game.round++; game.goldenPillUsed = true; continue; } else { cout << "药剂师瘫倒在地!你赢得了这场危险的游戏!\n"; break; } } // 检查是否需要重新装填药瓶 if (game.currentPillIndex >= static_cast<int>(game.pillBottle.size())) { cout << "药瓶空了...重新装填!" << endl; vector<Pill> allPills = initializePills(); game.pillBottle.clear(); game.poisonCount = 0; for (int i = 0; i < MAX_PILLS; i++) { int index = rand() % (allPills.size() - 1); // 不包括金色药丸 game.pillBottle.push_back(allPills[index]); if (allPills[index].isPoisonous) { game.poisonCount++; } } // 无尽模式每3轮加入一颗金色药丸 if (game.endlessMode && game.round % 3 == 0) { game.pillBottle.push_back(allPills[GOLDEN]); } random_shuffle(game.pillBottle.begin(), game.pillBottle.end()); game.currentPillIndex = 0; Sleep(2000); } // 玩家回合 playerTurn(game); // 对手回合 if (game.opponent.health > 0 && game.currentPillIndex < static_cast<int>(game.pillBottle.size())) { opponentTurn(game); } game.round++; // 无尽模式难度提升 if (game.endlessMode && game.round % 5 == 0) { cout << "\n你感觉药剂变得更加强烈了...\n"; game.opponent.health += 1; Sleep(1500); } } } // 主菜单 void mainMenu() { while (true) { system("cls"); cout << "=== 副作用 - 药丸轮盘赌 1.12 Beta===" << endl; cout << "1. 开始游戏" << endl; cout << "2. 无尽模式" << endl; cout << "3. 游戏说明" << endl; cout << "4. 商城中心" << endl; cout << "5. 难度选择" << endl; cout << "6. 联机大厅" << endl; cout << "7. 退出" << endl; int choice; cin >> choice; if (choice == 1) { gameLoop(false); system("pause"); } else if (choice == 2) { cout << "\n警告: 无尽模式会越来越难,直到你倒下!\n"; cout << "药剂师会强化,道具也会随着游戏进度越来越少!\n"; cout << "确定要开始吗? (y/n): "; char confirm; cin >> confirm; if (confirm == 'y' || confirm == 'Y') { gameLoop(true); system("pause"); } } else if (choice == 3) { cout << "\n=== 副作用 - 游戏说明 ===" << endl; cout << "1. 轮流服用药瓶中的药丸,有些治疗,有些有毒" << endl; cout << "2. 界面会显示剩余毒药数量,但不会告诉你具体哪颗" << endl; cout << "3. 使用道具来获得优势,每回合会获得新道具" << endl; cout << "4. 无尽模式中,找到金色药丸可解锁真正挑战" << endl; cout << "5. 合理使用道具组合是获胜关键" << endl; cout << "6. @bjlqz_leo出品/. @qfcwyh2运营/. @bjzzr审核/." << endl; cout << "7. 每周更新/." << endl; system("pause"); } else if (choice == 4){ int leo; cout << "欢迎来到leo的商城" << endl; cout << "当前可购买:" << endl; cout << "1. 幸运星\n" << "类型:" << "游戏内道具\n" << "效果:" << "幸运值+100%" << "\n" << "免费获得" << endl; cout << "2. 手机\n" << "类型:" << "游戏内道具\n" << "效果:" << "买通裁判使对手受伤+50%" << "\n" << "一键三连获得" << endl; cout << "买什么?" << endl; cin >> leo; if (leo == 1 || leo == 2){ cout << "购买成功!\n" << "正在返回主页..." << endl; } else{ cout << "无效选择!" << endl; } system("pause"); } else if (choice == 5){ cout << "由于此版本为测试阶段,尚未完善该功能!"<< endl; cout << "正在返回主页..." << endl; system("pause"); } else if (choice == 6){ int baocuo; cout << "公告:" << endl << "欢迎来到联机大厅!" << endl; cout << "由于此服务器非常小(只有一个房间),断连是常有的事,请耐心等待!" << endl; cout << "正在连接房间..." << endl; Sleep(10000); srand(time(NULL)); baocuo = (rand() % 2) + 1; if (baocuo == 1){ cout << "连接成功!" << endl; Sleep(5000); cout << "正在加入!" << endl; Sleep(5000); cout << "Error:无法加入房间1" << endl; Sleep(5000); cout << "正在上报错误" << endl; Sleep(5000); cout << "正在返回主页..." << endl; } else if (baocuo == 2){ cout << "找不到服务器IP地址,请检查是否有误" << endl; Sleep(5000); cout << "正在上报错误" << endl; Sleep(5000); cout << "正在返回主页..." << endl; } system("pause"); } else if (choice == 7) { break; } } } string lianjigongneng(string lianji,string room){ ; } int main() { srand(static_cast<unsigned>(time(0))); mainMenu(); return 0; }
TM的这人抄我主页,一模一样,连我名字都没改!!!
预告
真实世界(正式版) 即将在2026年前上架(本蒟蒻编写) 在这里你将体验到与真实世界无异的生活:消费,赚钱,娱乐,内置多种系统,玩法,NPC...... 本游戏由多个小游戏,再由世界系统合并,保证趣味。
现在入股还来的及,开赌吧!
敬请期待真实世界1.0.0上线!
-
通过的题目
-
最近活动
This person is lazy and didn't join any contests or homework. -
最近编写的题解
题目标签
- 聪明人游戏
- 2
- 贪心
- 1
- 深搜 广搜
- 1
- 广搜
- 1
- 大沥2021
- 1