-
个人简介
我是小猫粮
你好,我是小猫粮,你可以叫我的笔名,泡泡糖!喜欢腐朽,也喜欢肝代码,常常一只猫肝代码肝两个小时导致第二天的学习学瘫痪,嘻嘻。不过我的文笔倒还不错,尤其是在剧情构思这块,欢迎其他人来找我写剧情,正好我想赚外快(骗你们的,不收钱)。虽然我的想法很自我,但如果你帮了我,我会很感谢你。这就我的自我介绍,可以和我交朋友吗?(想要了解更多自我介绍可以在我发的讨论区里@我并附上想了解的内容,我会抽时间补充)
#include <iostream> using namespace std; struct player { string playername; int playerlv; }; int main() { }2026年计划:
1、做出oiclass大冒险的2~4关
2、做出原神2.0版本
3、做出2个新游戏
4、帮蒋某做好末日生存游戏的存档兼容
简简单单发一个原神小代码,本人在暑假爆肝3天做出来的
#include <iostream> #include <vector> #include <string> #include <ctime> #include <cstdlib> #include <algorithm> #include <map> #include <fstream> #include <sstream> // 跨平台兼容头文件调整 #ifdef _WIN32 #include <conio.h> #include <windows.h> #define SLEEP(ms) Sleep(ms) #define GETCH() _getch() #else #include <unistd.h> #include <termios.h> #define SLEEP(ms) usleep(ms * 1000) // Linux/macOS模拟_getch()(无回显、立即读取) inline int GETCH() { struct termios oldt, newt; int ch; tcgetattr(STDIN_FILENO, &oldt); newt = oldt; newt.c_lflag &= ~(ICANON | ECHO); tcsetattr(STDIN_FILENO, TCSANOW, &newt); ch = getchar(); tcsetattr(STDIN_FILENO, TCSANOW, &oldt); return ch; } #endif using namespace std; // 元素类型 enum Element { ANEMO, // 风 GEO, // 岩 ELECTRO, // 雷 DENDRO, // 草 HYDRO, // 水 PYRO, // 火 CRYO, // 冰 NONE // 无元素 }; // 元素反应类型 enum Reaction { MELT, // 融化 VAPORIZE, // 蒸发 ELECTROCHARGE, // 感电 OVERLOADED, // 超载 SUPERCONDUCT,// 超导 BURNING, // 燃烧 QUICKEN, // 激化 FREEZE, // 冻结 SWIRL, // 扩散 CRYSTALLIZE,// 结晶 NO_REACTION // 无反应 }; // 前向声明 class Enemy; class Character; // 技能类 class Skill { private: string name; Element element; int damage; int energyCost; int cooldown; bool isBurst; bool isAOE; public: Skill(string n, Element e, int dmg, int cost, int cd, bool burst = false, bool aoe = false) : name(n), element(e), damage(dmg), energyCost(cost), cooldown(cd), isBurst(burst), isAOE(aoe) {} string getName() const { return name; } Element getElement() const { return element; } int getDamage() const { return damage; } int getEnergyCost() const { return energyCost; } int getCooldown() const { return cooldown; } bool isElementBurst() const { return isBurst; } bool isAreaAttack() const { return isAOE; } // 存档和读档方法 void save(ofstream& file) const { file << name << endl; file << element << endl; file << damage << endl; file << energyCost << endl; file << cooldown << endl; file << isBurst << endl; file << isAOE << endl; } static Skill load(ifstream& file) { string name; int element, damage, energyCost, cooldown; bool isBurst, isAOE; getline(file, name); file >> element; file >> damage; file >> energyCost; file >> cooldown; file >> isBurst; file >> isAOE; file.ignore(); // 忽略换行符 return Skill(name, (Element)element, damage, energyCost, cooldown, isBurst, isAOE); } }; // 元素转字符串 string elementToString(Element e) { switch(e) { case ANEMO: return "风"; case GEO: return "岩"; case ELECTRO: return "雷"; case DENDRO: return "草"; case HYDRO: return "水"; case PYRO: return "火"; case CRYO: return "冰"; default: return "无"; } } // 字符串转元素 Element stringToElement(const string& s) { if (s == "风") return ANEMO; if (s == "岩") return GEO; if (s == "雷") return ELECTRO; if (s == "草") return DENDRO; if (s == "水") return HYDRO; if (s == "火") return PYRO; if (s == "冰") return CRYO; return NONE; } // 元素反应转字符串 string reactionToString(Reaction r) { switch(r) { case MELT: return "融化"; case VAPORIZE: return "蒸发"; case ELECTROCHARGE: return "感电"; case OVERLOADED: return "超载"; case SUPERCONDUCT: return "超导"; case BURNING: return "燃烧"; case QUICKEN: return "激化"; case FREEZE: return "冻结"; case SWIRL: return "扩散"; case CRYSTALLIZE: return "结晶"; default: return "无反应"; } } // 计算元素反应 Reaction getReaction(Element attacker, Element defender) { if (defender == NONE) return NO_REACTION; // 定义元素反应表 if ((attacker == PYRO && defender == CRYO) || (attacker == CRYO && defender == PYRO)) return MELT; if ((attacker == PYRO && defender == HYDRO) || (attacker == HYDRO && defender == PYRO)) return VAPORIZE; if ((attacker == ELECTRO && defender == HYDRO) || (attacker == HYDRO && defender == ELECTRO)) return ELECTROCHARGE; if ((attacker == PYRO && defender == ELECTRO) || (attacker == ELECTRO && defender == PYRO)) return OVERLOADED; if ((attacker == ELECTRO && defender == CRYO) || (attacker == CRYO && defender == ELECTRO)) return SUPERCONDUCT; if ((attacker == PYRO && defender == DENDRO) || (attacker == DENDRO && defender == PYRO)) return BURNING; if ((attacker == ELECTRO && defender == DENDRO) || (attacker == DENDRO && defender == ELECTRO)) return QUICKEN; if ((attacker == HYDRO && defender == CRYO) || (attacker == CRYO && defender == HYDRO)) return FREEZE; if (attacker == ANEMO && defender != ANEMO) return SWIRL; if (attacker == GEO && defender != GEO) return CRYSTALLIZE; return NO_REACTION; } // 计算反应倍率 float getReactionMultiplier(Reaction r) { switch(r) { case MELT: return 1.5f; case VAPORIZE: return 2.0f; case ELECTROCHARGE: return 1.25f; case OVERLOADED: return 1.5f; case SUPERCONDUCT: return 1.25f; case BURNING: return 1.0f; // 持续伤害 case QUICKEN: return 1.25f; case FREEZE: return 1.0f; // 控制效果 case SWIRL: return 1.2f; case CRYSTALLIZE: return 1.0f; // 护盾效果 default: return 1.0f; } } // 角色类 class Character { protected: string name; Element vision; int level; int maxHealth; int currentHealth; int attack; int defense; int energy; int maxEnergy; vector<Skill> skills; Element infusedElement; int infusionDuration; int freezeDuration; map<int, int> skillCooldowns; public: Character(string n, Element v, int lvl = 1) : name(n), vision(v), level(lvl), maxHealth(1000 + lvl * 100), currentHealth(1000 + lvl * 100), attack(100 + lvl * 10), defense(50 + lvl * 5), energy(0), maxEnergy(100), infusedElement(NONE), infusionDuration(0), freezeDuration(0) {} virtual ~Character() {} void addSkill(const Skill& skill) { skills.push_back(skill); skillCooldowns[skills.size() - 1] = 0; } string getName() const { return name; } Element getVision() const { return vision; } string getVisionString() const { return elementToString(vision); } int getLevel() const { return level; } int getHealth() const { return currentHealth; } int getMaxHealth() const { return maxHealth; } int getAttack() const { return attack; } int getDefense() const { return defense; } int getEnergy() const { return energy; } int getSkillsCount() const { return skills.size(); } bool isFrozen() const { return freezeDuration > 0; } void takeDamage(int damage) { int finalDamage = max(1, damage - (defense / 10)); currentHealth = max(0, currentHealth - finalDamage); cout << name << "受到了" << finalDamage << "点伤害!" << endl; } void heal(int amount) { currentHealth = min(maxHealth, currentHealth + amount); cout << name << "恢复了" << amount << "点生命值!" << endl; } void gainEnergy(int amount) { energy = min(maxEnergy, energy + amount); } bool isAlive() const { return currentHealth > 0; } void levelUp() { level++; maxHealth += 100; currentHealth = maxHealth; attack += 10; defense += 5; cout << name << "升级到了" << level << "级!属性提升了!" << endl; } void showStatus() const { cout << "【" << name << "】 Lv." << level << " (" << getVisionString() << "元素)" << endl; cout << "生命值: " << currentHealth << "/" << maxHealth << endl; cout << "攻击力: " << attack << " 防御力: " << defense << endl; cout << "元素能量: " << energy << "/" << maxEnergy << endl; if (infusedElement != NONE) { cout << "元素附着: " << elementToString(infusedElement) << " (" << infusionDuration << "回合)" << endl; } if (freezeDuration > 0) { cout << "状态: 冻结中 (" << freezeDuration << "回合)" << endl; } cout << endl; } void showSkills() const { cout << name << "的技能:" << endl; for (size_t i = 0; i < skills.size(); i++) { cout << i+1 << ". " << skills[i].getName() << " (" << elementToString(skills[i].getElement()) << ")" << endl; cout << " 伤害: " << skills[i].getDamage() << " 消耗: " << skills[i].getEnergyCost(); if (skillCooldowns.at(i) > 0) { cout << " 冷却中: " << skillCooldowns.at(i) << "回合"; } cout << (skills[i].isElementBurst() ? " [元素爆发]" : "") << endl; } } virtual bool useSkill(int index, Enemy* target, vector<Enemy*>& enemies); virtual void applyAttack(Enemy* target, int damage, Element element); void freeze(int duration) { freezeDuration = duration; cout << name << "被冻结了!" << endl; } void infuse(Element e, int duration) { infusedElement = e; infusionDuration = duration; } void update() { // 更新技能冷却 for (auto& pair : skillCooldowns) { if (pair.second > 0) { pair.second--; } } // 更新元素附着 if (infusionDuration > 0) { infusionDuration--; if (infusionDuration == 0) { infusedElement = NONE; } } // 更新冻结状态 if (freezeDuration > 0) { freezeDuration--; if (freezeDuration == 0) { cout << name << "从冻结中恢复了!" << endl; } } } // 存档和读档方法 virtual void save(ofstream& file) const { file << name << endl; file << vision << endl; file << level << endl; file << maxHealth << endl; file << currentHealth << endl; file << attack << endl; file << defense << endl; file << energy << endl; file << maxEnergy << endl; file << infusedElement << endl; file << infusionDuration << endl; file << freezeDuration << endl; // 保存技能数量和技能 file << skills.size() << endl; for (const auto& skill : skills) { skill.save(file); } // 保存技能冷却状态 file << skillCooldowns.size() << endl; for (const auto& pair : skillCooldowns) { file << pair.first << " " << pair.second << endl; } } virtual void load(ifstream& file) { getline(file, name); int elem; file >> elem; vision = (Element)elem; file >> level; file >> maxHealth; file >> currentHealth; file >> attack; file >> defense; file >> energy; file >> maxEnergy; file >> elem; infusedElement = (Element)elem; file >> infusionDuration; file >> freezeDuration; file.ignore(); // 忽略换行符 // 加载技能 skills.clear(); int skillCount; file >> skillCount; file.ignore(); for (int i = 0; i < skillCount; i++) { skills.push_back(Skill::load(file)); } // 加载技能冷却 skillCooldowns.clear(); int cooldownCount; file >> cooldownCount; file.ignore(); for (int i = 0; i < cooldownCount; i++) { int index, cd; file >> index >> cd; file.ignore(); skillCooldowns[index] = cd; } } }; // 敌人基类 class Enemy { protected: string name; int level; int maxHealth; int currentHealth; int attack; int defense; Element element; Element infusedElement; int infusionDuration; bool isBoss; bool hasShield; int shieldStrength; public: Enemy(string n, int lvl, int hp, int atk, int def, Element e = NONE, bool boss = false) : name(n), level(lvl), maxHealth(hp), currentHealth(hp), attack(atk), defense(def), element(e), infusedElement(NONE), infusionDuration(0), isBoss(boss), hasShield(false), shieldStrength(0) {} virtual ~Enemy() {} string getName() const { return name; } int getLevel() const { return level; } int getHealth() const { return currentHealth; } int getMaxHealth() const { return maxHealth; } Element getElement() const { return element; } Element getInfusedElement() const { return infusedElement; } int getAttack() const { return attack; } int getDefense() const { return defense; } bool isAlive() const { return currentHealth > 0; } bool isBossEnemy() const { return isBoss; } bool hasActiveShield() const { return hasShield && shieldStrength > 0; } virtual void takeDamage(int damage) { // 护盾吸收伤害 if (hasActiveShield()) { int absorbed = min(damage, shieldStrength); shieldStrength -= absorbed; damage -= absorbed; cout << name << "的护盾吸收了" << absorbed << "点伤害!" << endl; if (shieldStrength <= 0) { hasShield = false; cout << name << "的护盾被打破了!" << endl; } if (damage <= 0) return; } int finalDamage = max(1, damage - (defense / 15)); currentHealth = max(0, currentHealth - finalDamage); if (!isAlive()) { cout << name << "被击败了!" << endl; } else { cout << name << "受到了" << finalDamage << "点伤害!" << endl; } } void infuseElement(Element e, int duration) { infusedElement = e; infusionDuration = duration; } void addShield(int strength) { hasShield = true; shieldStrength = strength; cout << name << "生成了护盾!" << endl; } virtual void attackCharacter(Character* character) { if (!isAlive()) return; int damage = attack; if (element != NONE) { cout << name << "使用" << elementToString(element) << "元素攻击了" << character->getName() << "!" << endl; character->takeDamage(damage); character->infuse(element, 3); } else { cout << name << "攻击了" << character->getName() << "!" << endl; character->takeDamage(damage); } } virtual void update() { if (infusionDuration > 0) { infusionDuration--; if (infusionDuration == 0) { infusedElement = NONE; } } } virtual void showStatus() const { cout << "【" << name << "】 Lv." << level; if (element != NONE) { cout << " (" << elementToString(element) << "元素)"; } cout << endl; // 绘制生命值条 int barLength = 30; int currentLength = (int)(((float)currentHealth / maxHealth) * barLength); cout << "生命值: "; for (int i = 0; i < currentLength; i++) cout << "■"; for (int i = currentLength; i < barLength; i++) cout << "□"; cout << " " << currentHealth << "/" << maxHealth << endl; if (hasActiveShield()) { cout << "护盾值: " << shieldStrength << endl; } if (infusedElement != NONE) { cout << "元素附着: " << elementToString(infusedElement) << endl; } cout << endl; } virtual void useSpecialAbility(vector<Character*>& party) {} }; // 实现角色类的战斗方法 bool Character::useSkill(int index, Enemy* target, vector<Enemy*>& enemies) { if (isFrozen()) { cout << name << "被冻结了,无法行动!" << endl; return false; } if (index < 1 || index > (int)skills.size()) return false; index--; if (skillCooldowns[index] > 0) { cout << skills[index].getName() << "还在冷却中!" << endl; return false; } if (energy < skills[index].getEnergyCost()) { cout << "元素能量不足,无法使用" << skills[index].getName() << "!" << endl; return false; } // 消耗能量 energy -= skills[index].getEnergyCost(); // 应用冷却 skillCooldowns[index] = skills[index].getCooldown(); cout << name << "使用了" << skills[index].getName() << "!" << endl; // 计算总伤害 int totalDamage = skills[index].getDamage() + (attack / 5); // 处理范围攻击 if (skills[index].isAreaAttack()) { for (Enemy* e : enemies) { if (e->isAlive()) { applyAttack(e, totalDamage, skills[index].getElement()); } } } else { // 单体攻击 applyAttack(target, totalDamage, skills[index].getElement()); } // 元素爆发回复能量 if (skills[index].isElementBurst()) { gainEnergy(20); } return true; } void Character::applyAttack(Enemy* target, int damage, Element element) { // 计算元素反应 Reaction reaction = getReaction(element, target->getInfusedElement()); float multiplier = getReactionMultiplier(reaction); int finalDamage = (int)(damage * multiplier); // 造成伤害 target->takeDamage(finalDamage); // 显示元素反应 if (reaction != NO_REACTION) { cout << "触发了" << reactionToString(reaction) << "反应!"; if (multiplier > 1.0f) { cout << "伤害提升!"; } cout << endl; } // 处理特殊反应效果 if (reaction == FREEZE) { // 冻结效果已经在敌人的takeDamage中处理 } else if (reaction != SWIRL && reaction != CRYSTALLIZE) { // 大部分反应消耗元素,只有扩散和结晶不消耗 target->infuseElement(element, 5); } // 获得能量 gainEnergy(5 + (int)(multiplier * 5)); } // 特定角色实现 class TravelerAnemo : public Character { public: TravelerAnemo(int lvl = 1) : Character("旅行者", ANEMO, lvl) { addSkill(Skill("风元素攻击", ANEMO, 80, 0, 1)); addSkill(Skill("风涡剑", ANEMO, 200, 20, 5, false, true)); addSkill(Skill("风息激荡", ANEMO, 400, 80, 15, true, true)); } void save(ofstream& file) const override { file << "TravelerAnemo" << endl; // 标识角色类型 Character::save(file); } }; class Amber : public Character { public: Amber(int lvl = 1) : Character("安柏", PYRO, lvl) { addSkill(Skill("火焰箭", PYRO, 100, 0, 2)); addSkill(Skill("兔兔伯爵", PYRO, 150, 30, 8, false, true)); addSkill(Skill("爆炎箭", PYRO, 350, 80, 12, true)); } void save(ofstream& file) const override { file << "Amber" << endl; Character::save(file); } }; class Kaeya : public Character { public: Kaeya(int lvl = 1) : Character("凯亚", CRYO, lvl) { addSkill(Skill("冰刺", CRYO, 90, 0, 2)); addSkill(Skill("冰棱穿刺", CRYO, 180, 25, 6, false, true)); addSkill(Skill("冰域怒放", CRYO, 300, 80, 10, true, true)); } void save(ofstream& file) const override { file << "Kaeya" << endl; Character::save(file); } }; class Lisa : public Character { public: Lisa(int lvl = 1) : Character("丽莎", ELECTRO, lvl) { addSkill(Skill("雷电攻击", ELECTRO, 85, 0, 2)); addSkill(Skill("伏特雷圈", ELECTRO, 170, 25, 7, false, true)); addSkill(Skill("蔷薇的雷光", ELECTRO, 380, 80, 14, true, true)); } void save(ofstream& file) const override { file << "Lisa" << endl; Character::save(file); } }; // 特定敌人实现 class Hilichurl : public Enemy { public: Hilichurl(int lvl) : Enemy("丘丘人", lvl, 300 + lvl * 30, 50 + lvl * 5, 20 + lvl * 2) {} Hilichurl() : Enemy("", 1, 0, 0, 0) {} // 用于存档加载 }; class Mitachurl : public Enemy { public: Mitachurl(int lvl) : Enemy("丘丘暴徒", lvl, 600 + lvl * 50, 80 + lvl * 8, 40 + lvl * 3) {} Mitachurl() : Enemy("", 1, 0, 0, 0) {} // 用于存档加载 }; class CryoHilichurl : public Enemy { public: CryoHilichurl(int lvl) : Enemy("冰丘丘人", lvl, 350 + lvl * 35, 60 + lvl * 6, 25 + lvl * 2, CRYO) {} CryoHilichurl() : Enemy("", 1, 0, 0, 0, CRYO) {} // 用于存档加载 void attackCharacter(Character* character) override { if (!isAlive()) return; cout << name << "使用冰元素攻击了" << character->getName() << "!" << endl; character->takeDamage(attack); character->infuse(CRYO, 3); // 有几率冻结目标 if (rand() % 4 == 0) { // 25%几率 character->freeze(1); } } }; class PyroAbyssMage : public Enemy { public: PyroAbyssMage(int lvl) : Enemy("火深渊法师", lvl, 800 + lvl * 60, 70 + lvl * 7, 30 + lvl * 3, PYRO) { addShield(300 + lvl * 20); // 初始就有护盾 } PyroAbyssMage() : Enemy("", 1, 0, 0, 0, PYRO) {} // 用于存档加载 void useSpecialAbility(vector<Character*>& party) override { if (!isAlive()) return; cout << name << "释放了火焰新星!" << endl; for (Character* c : party) { if (c->isAlive()) { c->takeDamage(60 + level * 5); c->infuse(PYRO, 4); } } } }; // 无相之冰BOSS(保留之前的虚弱期逻辑,无变更) class CryoHypostasis : public Enemy { private: int phase; bool hasFrostCore; // 是否处于濒死状态(生成霜之实) int frostCoreTimer; // 霜之实倒计时(未打破护盾时) bool isWeakened; // 是否处于虚弱期 int weakenedTimer; // 虚弱期倒计时 bool hasUsedWeakened; // 是否已使用过虚弱期(避免无限循环) public: CryoHypostasis(int lvl = 40) : Enemy("无相之冰", lvl, 10000 + lvl * 500, 200 + lvl * 10, 100 + lvl * 5, CRYO, true), phase(1), hasFrostCore(false), frostCoreTimer(0), isWeakened(false), weakenedTimer(0), hasUsedWeakened(false) {} // 用于存档加载的构造函数 CryoHypostasis() : Enemy("", 1, 0, 0, 0, CRYO, true), phase(1), hasFrostCore(false), frostCoreTimer(0), isWeakened(false), weakenedTimer(0), hasUsedWeakened(false) {} void takeDamage(int damage) override { // 虚弱期:受到的伤害提升50% int finalDamage = damage; if (isWeakened) { finalDamage = (int)(finalDamage * 1.5f); } else if (phase > 1) { finalDamage = (int)(finalDamage * 1.2f); // 非虚弱期的正常额外伤害 } Enemy::takeDamage(finalDamage); // 阶段转换(非虚弱期才触发) if (!isWeakened) { if (currentHealth < maxHealth * 0.7f && phase == 1) { phase = 2; addShield(500 + level * 10); cout << endl << name << "进入第二阶段!" << endl; } if (currentHealth < maxHealth * 0.3f && phase == 2) { phase = 3; addShield(800 + level * 15); cout << endl << name << "进入最终阶段!" << endl; } // 生命值低于10%且未使用过虚弱期,触发濒死状态(生成霜之实) if (currentHealth < maxHealth * 0.1f && !hasFrostCore && !hasUsedWeakened) { enterDeathThresholdState(); } } // 核心逻辑:濒死状态下打破护盾 → 进入虚弱期 if (hasFrostCore && !hasActiveShield() && !isWeakened) { enterWeakenedState(); } } // 进入濒死状态(生成霜之实和护盾) void enterDeathThresholdState() { cout << endl << "======================================" << endl; cout << name << "进入了濒死状态,开始自我冰封!" << endl; cout << "======================================" << endl; addShield(700 + phase * 350); // 削弱后的护盾值(降低30%) hasFrostCore = true; frostCoreTimer = 4; // 缩短后的倒计时(4回合) cout << name << "生成了霜之实!打破护盾即可使其进入虚弱期!" << endl; } // 进入虚弱期(打破濒死护盾后触发) void enterWeakenedState() { cout << endl << "======================================" << endl; cout << name << "的霜之实护盾被打破,进入虚弱期!" << endl; cout << "虚弱期内:不生成护盾、伤害降低50%、受到伤害提升50%!" << endl; cout << "======================================" << endl; // 虚弱期状态设置 hasFrostCore = false; // 关闭濒死状态 frostCoreTimer = 0; // 重置霜之实倒计时 isWeakened = true; // 标记为虚弱期 weakenedTimer = 10; // 虚弱期持续10回合 hasUsedWeakened = true; // 标记已使用虚弱期(避免再次触发) // 虚弱期内移除所有护盾(确保无防御) hasShield = false; shieldStrength = 0; } void update() override { Enemy::update(); // 濒死状态倒计时(未打破护盾时) if (hasFrostCore) { frostCoreTimer--; // 只有护盾还在时,才会回血 if (frostCoreTimer <= 0 && hasActiveShield()) { currentHealth = min(maxHealth, currentHealth + 300); cout << name << "吸收了霜之实的能量,恢复了生命值!" << endl; hasFrostCore = false; } } // 虚弱期倒计时 if (isWeakened) { weakenedTimer--; // 显示虚弱期剩余时间(每回合提示) cout << endl << name << "虚弱期剩余" << weakenedTimer << "回合!" << endl; if (weakenedTimer <= 0) { // 虚弱期结束:恢复正常状态(但不再触发濒死状态) isWeakened = false; cout << endl << "======================================" << endl; cout << name << "虚弱期结束,恢复正常状态!" << endl; cout << "======================================" << endl; } } } void useSpecialAbility(vector<Character*>& party) override { if (!isAlive()) return; // 虚弱期:不释放濒死寒气,普通技能伤害降低50% if (isWeakened) { int ability = rand() % 4; switch(ability) { case 0: { // 冰锥突刺(伤害降低50%) cout << name << "虚弱状态下召唤冰锥突刺!" << endl; for (Character* c : party) { if (c->isAlive() && rand() % 2 == 0) { c->takeDamage((180 + phase * 40) / 2); // 伤害减半 c->infuse(CRYO, 5); } } break; } case 1: { // 冰齿轮旋转(伤害降低50%) cout << name << "虚弱状态下变成冰齿轮旋转!" << endl; Character* target = party[rand() % party.size()]; if (target->isAlive()) { for (int i = 0; i < 2; i++) { target->takeDamage((120 + phase * 30) / 2); // 伤害减半 SLEEP(500); } target->freeze(1); } break; } case 2: { // 冰棱霜华(虚弱期不生成护盾) cout << name << "虚弱状态下释放冰棱霜华!" << endl; for (Character* c : party) { if (c->isAlive()) { c->infuse(CRYO, 6); } } break; } case 3: { // 冰锥飞弹(伤害降低50%) cout << name << "虚弱状态下发射冰锥飞弹!" << endl; for (int i = 0; i < 3; i++) { Character* target = party[rand() % party.size()]; if (target->isAlive()) { target->takeDamage((150 + phase * 30) / 2); // 伤害减半 if (i == 2) { target->freeze(1); } } } break; } } return; } // 非虚弱期的濒死状态:释放寒气(之前的削弱逻辑保留) if (hasFrostCore) { cout << name << "在冰封状态下释放寒气!" << endl; for (Character* c : party) { if (c->isAlive()) { c->takeDamage(80 + phase * 24); // 削弱后的伤害(降低20%) if (rand() % 2 == 0) { // 50%冻结概率 c->freeze(2); } else { cout << c->getName() << "成功抵抗了冻结效果!" << endl; } } } return; } // 非虚弱期、非濒死状态:正常技能(无变化) int ability = rand() % 4; switch(ability) { case 0: { // 冰锥突刺 cout << name << "从地面召唤冰锥突刺!" << endl; for (Character* c : party) { if (c->isAlive() && rand() % 2 == 0) { c->takeDamage(180 + phase * 40); c->infuse(CRYO, 5); } } break; } case 1: { // 冰齿轮旋转 cout << name << "变成冰齿轮进行旋转攻击!" << endl; Character* target = party[rand() % party.size()]; if (target->isAlive()) { for (int i = 0; i < 2; i++) { target->takeDamage(120 + phase * 30); SLEEP(500); } target->freeze(1); } break; } case 2: { // 冰棱霜华 cout << name << "释放了冰棱霜华!" << endl; addShield(400 + phase * 150); for (Character* c : party) { if (c->isAlive()) { c->infuse(CRYO, 6); } } break; } case 3: { // 冰锥飞弹 cout << name << "发射了冰锥飞弹!" << endl; for (int i = 0; i < 3; i++) { Character* target = party[rand() % party.size()]; if (target->isAlive()) { target->takeDamage(150 + phase * 30); if (i == 2) { target->freeze(2); } } } break; } } } void showStatus() const override { cout << "【" << name << "】 Lv." << level << " (无相" << elementToString(element) << ")" << endl; cout << "战斗阶段: " << phase << "/3" << endl; int barLength = 50; int currentLength = (int)(((float)currentHealth / maxHealth) * barLength); cout << "生命值: "; for (int i = 0; i < currentLength; i++) cout << "■"; for (int i = currentLength; i < barLength; i++) cout << "□"; cout << " " << currentHealth << "/" << maxHealth << endl; if (hasActiveShield()) { cout << "护盾值: " << shieldStrength << endl; } // 显示濒死/虚弱状态 if (isWeakened) { cout << "状态: 虚弱期 (剩余" << weakenedTimer << "回合) - 受到伤害提升50%!" << endl; } else if (hasFrostCore) { cout << "状态: 濒死状态 (霜之实剩余" << frostCoreTimer << "回合) - 打破护盾触发虚弱!" << endl; } cout << endl; } }; // 游戏管理类(核心修复战斗循环) class GenshinGame { private: vector<Character*> party; vector<Enemy*> enemies; string currentLocation; bool inCombat; int worldLevel; public: GenshinGame() : currentLocation("蒙德城"), inCombat(false), worldLevel(1) { initializeParty(); } ~GenshinGame() { for (Character* c : party) delete c; for (Enemy* e : enemies) delete e; } void initializeParty() { party.push_back(new TravelerAnemo()); party.push_back(new Amber()); party.push_back(new Kaeya()); party.push_back(new Lisa()); } void start() { cout << "======================================" << endl; cout << " 原神 - 冒险开始 " << endl; cout << "======================================" << endl << endl; cout << "欢迎来到提瓦特大陆,旅行者!" << endl; SLEEP(1500); while (true) { showMainMenu(); } } void showMainMenu() { system("cls"); cout << "======================================" << endl; cout << " 原神 - 主菜单 " << endl; cout << "======================================" << endl << endl; cout << "当前位置: " << currentLocation << endl; cout << "世界等级: " << worldLevel << endl << endl; cout << "队伍成员:" << endl; for (size_t i = 0; i < party.size(); i++) { cout << i+1 << ". " << party[i]->getName() << " Lv." << party[i]->getLevel() << " (" << party[i]->getVisionString() << ")" << endl; } cout << endl; cout << "请选择行动:" << endl; cout << "1. 查看角色状态" << endl; cout << "2. 探索区域 (遭遇敌人)" << endl; cout << "3. 挑战BOSS (无相之冰)" << endl; cout << "4. 休息恢复" << endl; cout << "5. 保存游戏" << endl; cout << "6. 加载游戏" << endl; cout << "7. 退出游戏" << endl; cout << "请选择: "; char choice; cin >> choice; switch(choice) { case '1': showCharacterStatus(); break; case '2': exploreArea(); break; case '3': challengeBoss(); break; case '4': restAndRecover(); break; case '5': saveGame(); break; case '6': loadGame(); break; case '7': cout << "感谢游玩原神冒险!" << endl; exit(0); default: cout << "无效选择!" << endl; SLEEP(1000); } } void showCharacterStatus() { system("cls"); cout << "======================================" << endl; cout << " 角色状态 " << endl; cout << "======================================" << endl << endl; for (Character* c : party) { c->showStatus(); } cout << "按任意键返回..." << endl; GETCH(); // 跨平台兼容读键 } void restAndRecover() { system("cls"); cout << "======================================" << endl; cout << " 休息恢复 " << endl; cout << "======================================" << endl << endl; cout << "你在" << currentLocation << "休息恢复..." << endl << endl; for (Character* c : party) { c->heal(c->getMaxHealth()); c->gainEnergy(100); } cout << endl << "所有角色都已恢复到最佳状态!" << endl; cout << "按任意键返回主菜单..." << endl; GETCH(); // 跨平台兼容读键 } void generateEnemies(bool isBoss = false) { for (Enemy* e : enemies) delete e; enemies.clear(); if (isBoss) { enemies.push_back(new CryoHypostasis(20 + worldLevel * 5)); return; } // 根据世界等级生成普通敌人 int enemyCount = 2 + rand() % 2; for (int i = 0; i < enemyCount; i++) { int enemyType = rand() % 4; int enemyLevel = 1 + worldLevel * 5 + rand() % 5; switch(enemyType) { case 0: enemies.push_back(new Hilichurl(enemyLevel)); break; case 1: enemies.push_back(new Mitachurl(enemyLevel)); break; case 2: enemies.push_back(new CryoHilichurl(enemyLevel)); break; case 3: enemies.push_back(new PyroAbyssMage(enemyLevel)); break; } } } void exploreArea() { system("cls"); cout << "======================================" << endl; cout << " 区域探索 " << endl; cout << "======================================" << endl << endl; vector<string> locations = { "蒙德城外", "望风山地", "星落湖", "低语森林", "誓言岬", "风神像" }; currentLocation = locations[rand() % locations.size()]; cout << "你来到了" << currentLocation << "..." << endl; SLEEP(1500); // 70%几率遇敌 if (rand() % 10 < 7) { cout << "前方出现了敌人!" << endl; SLEEP(1000); generateEnemies(); inCombat = true; combatLoop(); } else { cout << "你安全地探索了该区域,没有遇到敌人。" << endl; cout << "获得了一些冒险经验!" << endl; SLEEP(2000); } } void challengeBoss() { system("cls"); cout << "======================================" << endl; cout << " BOSS挑战 " << endl; cout << "======================================" << endl << endl; cout << "你前往了龙脊雪山,准备挑战无相之冰!" << endl; SLEEP(2000); generateEnemies(true); inCombat = true; combatLoop(true); } // 核心修复:战斗循环逻辑(解决卡死+无输入输出问题) void combatLoop(bool isBossFight = false) { while (inCombat) { system("cls"); cout << "======================================" << endl; cout << " 战斗进行中 " << endl; cout << "======================================" << endl << endl; // 第一步:检查战斗是否结束(优先判断,避免无效循环) bool allEnemiesDead = true; for (Enemy* e : enemies) { if (e->isAlive()) { allEnemiesDead = false; break; } } if (allEnemiesDead) { cout << endl << "战斗胜利!" << endl; int totalExp = 0; for (Enemy* e : enemies) { totalExp += (e->isBossEnemy() ? 1000 : 100) + e->getLevel() * 20; } for (Character* c : party) { if (c->isAlive()) { cout << c->getName() << "获得了" << totalExp / party.size() << "点经验!" << endl; if (rand() % 3 == 0) { // 33%概率升级 c->levelUp(); } } } if (isBossFight) { worldLevel++; cout << "世界等级提升至" << worldLevel << "!" << endl; } inCombat = false; SLEEP(3000); return; } bool allPartyDead = true; for (Character* c : party) { if (c->isAlive()) { allPartyDead = false; break; } } if (allPartyDead) { cout << endl << "战斗失败!所有角色都已倒下..." << endl; inCombat = false; SLEEP(3000); return; } // 第二步:显示状态(敌人+玩家关键信息) cout << "敌人状态:" << endl; for (Enemy* e : enemies) { if (e->isAlive()) { e->showStatus(); } } // 第三步:更新所有单位状态(先更新再行动,避免状态不同步) for (Character* c : party) c->update(); for (Enemy* e : enemies) e->update(); // 第四步:玩家回合(逐个行动,行动后检查战斗是否结束) for (Character* c : party) { if (!c->isAlive()) continue; cout << endl << "----- " << c->getName() << "的回合 -----" << endl; c->showStatus(); c->showSkills(); cout << "请选择技能(1-" << c->getSkillsCount() << ",0跳过): "; int choice; // 修复:清空输入缓冲区,避免残留按键导致的无输入响应 cin.clear(); cin.ignore(numeric_limits<streamsize>::max(), '\n'); cin >> choice; if (choice > 0) { // 选择目标 cout << "选择目标 (1-" << enemies.size() << "): "; int target; cin >> target; target--; if (target < 0 || target >= (int)enemies.size() || !enemies[target]->isAlive()) { cout << "无效目标!跳过该回合..." << endl; SLEEP(1000); continue; } c->useSkill(choice, enemies[target], enemies); } else { cout << c->getName() << "跳过了回合!" << endl; } SLEEP(1000); // 行动后检查敌人是否全灭,避免多余循环 allEnemiesDead = true; for (Enemy* e : enemies) { if (e->isAlive()) { allEnemiesDead = false; break; } } if (allEnemiesDead) break; } // 第五步:敌人回合(先再次检查玩家是否全灭,避免无效输出) allPartyDead = true; for (Character* c : party) { if (c->isAlive()) { allPartyDead = false; break; } } if (allPartyDead) { cout << endl << "战斗失败!所有角色都已倒下..." << endl; inCombat = false; SLEEP(3000); return; } cout << endl << "----- 敌人回合 -----" << endl; for (Enemy* e : enemies) { if (!e->isAlive()) continue; // BOSS使用特殊技能 if (e->isBossEnemy() && rand() % 2 == 0) { // 50%几率使用特殊技能 e->useSpecialAbility(party); } else { // 选择目标(只选存活玩家) vector<Character*> aliveParty; for (Character* c : party) { if (c->isAlive()) { aliveParty.push_back(c); } } if (aliveParty.empty()) break; Character* target = aliveParty[rand() % aliveParty.size()]; e->attackCharacter(target); } SLEEP(1000); // 敌人行动后检查玩家是否全灭 allPartyDead = true; for (Character* c : party) { if (c->isAlive()) { allPartyDead = false; break; } } if (allPartyDead) break; } // 第六步:等待玩家确认,避免循环过快 cout << endl << "按任意键继续战斗..." << endl; GETCH(); // 跨平台兼容读键 } } // 保存游戏状态(无变更,确保存档兼容) void saveGame() { system("cls"); cout << "======================================" << endl; cout << " 保存游戏 " << endl; cout << "======================================" << endl << endl; if (inCombat) { cout << "战斗中无法保存游戏!请先结束当前战斗。" << endl; SLEEP(1500); return; } string filename; cout << "请输入存档文件名(例如: save1.txt): "; cin >> filename; ofstream file(filename); if (!file.is_open()) { cout << "无法创建存档文件!" << endl; SLEEP(1500); return; } // 保存基本游戏状态 file << currentLocation << endl; file << worldLevel << endl; // 保存队伍成员数量和所有成员 file << party.size() << endl; for (const auto* c : party) { c->save(file); } file.close(); cout << "游戏已成功保存到 " << filename << "!共保存了" << party.size() << "个角色。" << endl; SLEEP(1500); } // 加载游戏状态(无变更,确保存档兼容) void loadGame() { system("cls"); cout << "======================================" << endl; cout << " 加载游戏 " << endl; cout << "======================================" << endl << endl; string filename; cout << "请输入存档文件名: "; cin >> filename; ifstream file(filename); if (!file.is_open()) { cout << "无法打开存档文件!" << endl; SLEEP(1500); return; } // 清理现有数据 for (Character* c : party) delete c; party.clear(); for (Enemy* e : enemies) delete e; enemies.clear(); inCombat = false; // 加载基本游戏状态 getline(file, currentLocation); file >> worldLevel; file.ignore(); // 加载队伍成员 int partySize; file >> partySize; file.ignore(); int loadedCount = 0; for (int i = 0; i < partySize; i++) { string charType; getline(file, charType); Character* character = nullptr; if (charType == "TravelerAnemo") { character = new TravelerAnemo(); } else if (charType == "Amber") { character = new Amber(); } else if (charType == "Kaeya") { character = new Kaeya(); } else if (charType == "Lisa") { character = new Lisa(); } if (character) { character->load(file); party.push_back(character); loadedCount++; } else { cout << "警告:未知角色类型 " << charType << ",已跳过" << endl; string dummy; for (int j = 0; j < 12; j++) { getline(file, dummy); } } } file.close(); cout << "游戏已成功从 " << filename << " 加载!共加载了" << loadedCount << "个角色。" << endl; SLEEP(1500); } }; // 修复:添加numeric_limits头文件引用(用于清空输入缓冲区) #include <limits> int main() { srand(time(NULL)); #ifdef _WIN32 SetConsoleTitleA("原神 - 提瓦特冒险"); #endif GenshinGame game; game.start(); return 0; }新游戏,oiclass大冒险,还在开发中,不过已经做完第一关的第一幕了
#include <iostream> #include <string> using namespace std; int guanqiaxvhao,yishengmingzhi; string yihuangyandaojua,yihuangyandaojub,yixuanzefenzhi; bool yidangaoshu=1; void yifenzhier() { cout <<"你睁开眼,发现自己在教室里,原来刚刚的一切都只是一场梦,你看向作文题目,这次的作文题目是《谎言》,你会选择:A.选择正常的写(作文拿15分),B.选择以你之前所写的作文都是谎言为线索,去讽刺中式教育(因为过于消极作文拿0分)" <<endl; cin >>yixuanzefenzhi; if (yixuanzefenzhi=="A") { cout <<"恭喜解锁S级结局" <<endl <<"你按照之前一样正常生活"; } else { cout <<"恭喜解锁SSS级结局" <<endl <<"你写出了零分作文,妈妈很生气,不停地打骂你,但你却很开心,因为你第一次写出了真相,写出了心里话"; } } void yifenzhiyi() { cout <<"你睁开眼,发现自己在教室里,原来刚刚的一切都只是一场梦,你看向作文题目,这次的作文题目是《谎言》,你会选择:A.选择正常的写(作文拿15分),B.选择写我妈骗你说不喜欢吃鸡腿,把鸡腿给你吃,写出真情实感(虽然现实里你从来没经过这件事)(作文拿50分)" <<endl; cin >>yixuanzefenzhi; if (yixuanzefenzhi=="A") { cout <<"恭喜解锁S级结局" <<endl <<"你按照之前一样正常生活"; } else { cout <<"恭喜解锁SS级结局" <<endl <<"你写出了满分作文,妈妈很开心,但你却总觉得心里空落落的"; } } void yihuangyanmishi() { while (1) { cin >>yihuangyandaojua >>yihuangyandaojub; if ((yihuangyandaojua =="人" && yihuangyandaojub=="书包") || (yihuangyandaojua=="书包" && yihuangyandaojub=="人")) { cout <<"你打开书包发现了一张四十分的成绩(CZ)单" <<endl; } else if ((yihuangyandaojua =="人" && yihuangyandaojub=="柜子") || (yihuangyandaojua=="柜子" && yihuangyandaojub=="人")) { cout <<"你一拳打向柜子,结果柜子门没打开,你反而被震得疼死了,生命值-1" <<endl; yishengmingzhi--; } else if ((yihuangyandaojua =="人" && yihuangyandaojub=="锤子") || (yihuangyandaojua=="锤子" && yihuangyandaojub=="人")) { cout <<"你突发奇想,如果拿锤子锤自己一下会怎么样,然后你真试了,生命值-1,但你灵光一闪,想到了一个提示,人+书包" <<endl; yishengmingzhi--; } else if ((yihuangyandaojua =="人" && yihuangyandaojub=="报纸") || (yihuangyandaojua=="报纸" && yihuangyandaojub=="人")) { cout <<"你看了会报纸上的许二木,许二木显灵了,他发动了技能复个小盘,给了你一个提示:人+书包" <<endl; } else if ((yihuangyandaojua =="人" && yihuangyandaojub=="门") || (yihuangyandaojua=="门" && yihuangyandaojub=="人")) { cout <<"请输入四位大写字母组成的密码" <<endl; string yimima; cin >>yimima; if (yimima=="CZYL") { cout <<"恭喜通关第一幕密室" <<endl; return; } cout <<"密码错误" <<endl; } else if ((yihuangyandaojua =="柜子" && yihuangyandaojub=="书包") || (yihuangyandaojua=="书包" && yihuangyandaojub=="柜子")) { cout <<"你把书包扔向柜子,结果无事发生" <<endl; } else if ((yihuangyandaojua =="人" && yihuangyandaojub=="窗户") || (yihuangyandaojua=="窗户" && yihuangyandaojub=="人")) { cout <<"你想把窗户打开,发现打不开" <<endl; } else if ((yihuangyandaojua =="锤子" && yihuangyandaojub=="书包") || (yihuangyandaojua=="书包" && yihuangyandaojub=="锤子")) { cout <<"你把锤子扔向书包,以为能发生什么,结果确实发生了什么:锤子砸到书包后弹回你头上,生命值-1" <<endl; yishengmingzhi--; } else if ((yihuangyandaojua =="窗户" && yihuangyandaojub=="书包") || (yihuangyandaojua=="书包" && yihuangyandaojub=="窗户")) { cout <<"你想用书包把窗户砸碎,发现这样打不开,因为这不是普通的窗户,这是王维诗里的窗户" <<endl; } else if ((yihuangyandaojua =="报纸" && yihuangyandaojub=="书包") || (yihuangyandaojua=="书包" && yihuangyandaojub=="报纸")) { cout <<"你把报纸放进了书包里" <<endl; } else if ((yihuangyandaojua =="门" && yihuangyandaojub=="书包") || (yihuangyandaojua=="书包" && yihuangyandaojub=="门")) { cout <<"你想用书包把门砸开,结果门像果冻做的一样,很弹,把书包弹回了你头上,生命值-1" <<endl; yishengmingzhi--; } else if ((yihuangyandaojua =="柜子" && yihuangyandaojub=="锤子") || (yihuangyandaojua=="锤子" && yihuangyandaojub=="柜子")) { cout <<"你用锤子把柜子门砸烂了,你在柜子里找到了一个蛋糕,生命值+1" <<endl; if (yidangaoshu==1) { yishengmingzhi++; yidangaoshu=0; } else { cout <<"但这个加血是一次性的,所以撤回加血" <<endl; } } else if ((yihuangyandaojua =="柜子" && yihuangyandaojub=="窗户") || (yihuangyandaojua=="窗户" && yihuangyandaojub=="柜子")) { cout <<"你想用柜子把窗户砸碎,本作者有话要说:你搬得动柜子吗?你仔细一想,觉得也是" <<endl; } else if (yihuangyandaojua == yihuangyandaojub) { cout <<"干吗要看别人的彩蛋?你侵犯了我隐私权,罚你生命值-1" <<endl; yishengmingzhi--; } else if ((yihuangyandaojua =="柜子" && yihuangyandaojub=="报纸") || (yihuangyandaojua=="报纸" && yihuangyandaojub=="柜子")) { cout <<"你把报纸贴到了柜子上,然后问自己:诶,我为什么要这么做?" <<endl; } else if ((yihuangyandaojua =="报纸" && yihuangyandaojub=="门") || (yihuangyandaojua=="门" && yihuangyandaojub=="报纸")) { cout <<"你把报纸贴到了门上,然后问自己:诶,我为什么要这么做?" <<endl; } else if ((yihuangyandaojua =="窗户" && yihuangyandaojub=="锤子") || (yihuangyandaojua=="锤子" && yihuangyandaojub=="窗户")) { cout <<"你用锤子打碎了王维诗里的窗户,窗户后面有一个阳台,阳台里有一张你因为压力(YL)过大而哭的照片" <<endl; } else if ((yihuangyandaojua =="窗户" && yihuangyandaojub=="报纸") || (yihuangyandaojua=="报纸" && yihuangyandaojub=="窗户")) { cout <<"你把报纸贴到窗户上,以为能触发什么魔法阵,我建议你立刻卸载番茄小说,然后去医院看看你有没有红温" <<endl; } else if ((yihuangyandaojua =="窗户" && yihuangyandaojub=="门") || (yihuangyandaojua=="门" && yihuangyandaojub=="窗户")) { cout <<"达成成就:作者的愤怒,这两个东西怎么组合?惩罚你生命值-1" <<endl; yishengmingzhi--; } else if ((yihuangyandaojua =="锤子" && yihuangyandaojub=="报纸") || (yihuangyandaojua=="报纸" && yihuangyandaojub=="锤子")) { cout <<"你想把报纸钉在墙上,突然想起来,你没有钉子" <<endl; } else if ((yihuangyandaojua =="锤子" && yihuangyandaojub=="门") || (yihuangyandaojua=="门" && yihuangyandaojub=="锤子")) { cout <<"你想用锤子把门砸开,结果门像果冻做的一样,很弹,把锤子弹回了你头上,生命值-1" <<endl; yishengmingzhi--; } else { cout <<"达成成就:作者的愤怒2,都没有这个道具,我怎么组合?惩罚你生命值-1" <<endl; yishengmingzhi--; } if (yishengmingzhi==0) { cout <<"你死了" <<endl; return; } } } void yihuangyan() { cout <<"欢迎来到oiclass大冒险第一关《谎言》,以下是第一幕密室的规则:" <<endl <<"你一觉醒来,发现自己来到了一间密室,密室里有一个“书包”,一个被上锁的“柜子”,一扇不透明的“窗户”,一个“锤子”和一张“报纸”,还有一个需要四位大写字母的密码才能打开的“门”。你有3滴血,血量为零时则游戏失败,关键词+关键词可触发剧情,关键词为双引号圈住的词,“人”也算一个关键词(输入格式为:关键词 关键词)" <<endl; yishengmingzhi=3; yihuangyanmishi(); if (yishengmingzhi==0) { return; } cout <<"你突然想起来,刚刚的密室是你的房间,你的学习很差,你有时候想吃一点零食,妈妈会把零食锁到柜子里说:那些不健康,不能吃。" <<endl <<"欢迎来到第二幕,中式教育" <<endl; cout <<"你走出你的房间后,发现来到了一条街道,街道上面贴着无数张字牌,有的写着:你看看隔壁家孩子多厉害,再看看你。有的写着:别人都能考清华北大,你为什么不行?还有的写着:我辛辛苦苦给你报那么多班,你还考这种成绩,浪费我的血汗钱。而像这类话语,字牌上还写了无数种,每种都不一样,你突然感到无数的压力扑面而来,你会选择:A后退,B直面压力(输入A或B)"; cin >>yixuanzefenzhi; if (yixuanzefenzhi=="A") { cout <<"你害怕的后退"; yifenzhiyi(); } else { cout <<"你直面着压力,但也因此受了伤,生命值-1" <<endl; yishengmingzhi--; if (yishengmingzhi==0) { cout <<"你死了" <<endl; } yifenzhier(); } cout <<endl <<"恭喜通关第一关《谎言》,这关有三个结局,各位玩家可以多玩几次"; } int main() { cout <<"欢迎来到作者(泡泡糖)新做的oiclass大冒险,请输入关卡编号(1~1),虽然作者目前只做了一关,但还是走一下流程" <<endl; cin >>guanqiaxvhao; if (guanqiaxvhao==1) { yihuangyan(); } } -
最近活动
- 2026年小六春季班Class3-单调队列 作业
- 2026年小六春季班Class2-优先队列 作业
- 2026年小六春季班Class2-哈希表 作业
- 2026年小六春季班Class1-链表与List 作业
- TYOI2026年普及组模拟赛#02 OI
- TYOI冬令营(2026)阶段测试3 IOI
- 2025铁一集团新苗秋冬令营5——二分搜索2(最小值最大) 作业
- 2025铁一集团新苗秋冬令营4——二分搜索1(最大值最小) 作业
- TYOI冬令营(2026)阶段测试2 IOI
- 2025铁一集团新苗秋冬令营3---《广度优先搜索2》 作业
- 2025铁一集团新苗秋冬令营2---《广度优先搜索1》 作业
- 2025铁一集团新苗秋冬令营1---《队列》 作业
- 2025铁一集团新苗秋季班作业11---《深度优先搜索算法2》 作业
- 2025铁一集团新苗秋季班作业10----《深度优先搜索算法1》 作业
- 2025铁一集团新苗秋季班作业9----《递归算法》 作业
- 2025铁一集团新苗秋季班作业8----《栈结构》 作业
- 2025OiClass入门组周赛计划#03(周六副本) OI
- 2025铁一集团新苗秋季班作业7----《前缀和&差分前缀和》 作业
- 2025铁一集团新苗秋季班作业7----贪心+递推 作业
- 2025铁一集团新苗秋季班作业5----《枚举算法》 作业
- 2025铁一集团新苗秋季班作业4----《模拟算法》 作业
- 2025铁一集团新苗秋季班作业6----《排序和结构体排序》 作业
- 2025铁一集团新苗周赛计划#02 IOI
- 2025铁一集团新苗秋季班作业3------《位运算》 作业
- 2025铁一集团新苗秋季班作业2----《进制转换》 作业
- 2025铁一集团新苗for循环专题练习赛 IOI
- 2025铁一集团新苗线上模拟赛3 OI
- 2025铁一集团新苗线下测试1 IOI
- 2025铁一集团新苗day8作业-while2 作业
- 2025铁一集团新苗线上(8月4日)-循环专题练习 作业
- 2025铁一集团新苗复习-for循环专题练习1 作业
- 2025铁一集团新苗day15作业-结构体和函数 作业
- 2025铁一集团新苗day14作业-二维数组基础 作业
- 2025铁一集团新苗秋季班作业1-二维数组和二维字符数组 作业
- 2025铁一集团新苗day13作业-普通排序和桶排序 作业
- 2025铁一集团新苗线上模拟赛2 OI
- 2025铁一集团新苗day12作业-数组标记的应用 作业
- 2025铁一集团新苗day11作业-字符、字符数组和字符串 作业
- 2025铁一集团新苗day10作业-一维数组基础 作业
- 2025铁一集团新苗day9作业-多重循环 作业
- 2025铁一集团新苗day7作业-循环语句while1 作业
- 2025铁一集团新苗线上模拟赛1 OI
- 2025铁一集团新苗day6作业-for语句3(数据的在线处理) 作业
- 2025铁一集团新苗day5作业-for语句2(枚举和筛选) 作业
- 2025铁一集团新苗day4作业-循环for语句 作业
- 2025铁一集团新苗day3作业-if条件语句 作业
- 2025铁一集团新苗day2作业-表达式 作业
- 2025铁一集团新苗day1作业-C++程序结构 作业
-
Stat
-
Rating