# 哈哈哈的坐忘道 **Repository Path**: a3216249711/hahaha-sitting-and-forgetting ## Basic Information - **Project Name**: 哈哈哈的坐忘道 - **Description**: No description available - **Primary Language**: C++ - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-08 - **Last Updated**: 2025-04-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Group Name: default: switch2 -lt PS5 1. 寇鹏博 (Lucas) id: 2023901562 2. 张润洋 (Ray) id: 2023900901 3. 吴杨子骏 (Joseph Wuyang) id: 2023905935 --- ## 🗡️ Dungeon Adventure — Game Documentation --- ### 🏰 Game Overview Dungeon Adventure is a text-based RPG where players navigate a series of interconnected rooms, battling enemies, collecting items, and seeking the legendary Sword of Light. The story follows a brave adventurer (the player) who explores a mysterious dungeon filled with mythical creatures and powerful artifacts. The ultimate goal is to reach the Ancient Temple, defeat the Dark Sorcerer (Wizard), and claim the Sword of Light. --- ### 📜 Story You are a hero venturing into a perilous dungeon filled with ancient evils and treasures. Each room presents unique challenges — from goblins and trolls to the formidable Frost Queen and the reality-warping Wizard. Along the way, you collect items like: - 🧿 Magic Amulet - 🧪 Healing Potion These boost your stats and help you survive. --- ### 🎯 Win Condition To win, the player must: - Navigate to the Ancient Temple. - Defeat all enemies in the temple, including the Wizard. - Ensure the room is clear of enemies, triggering the victory message: "Congratulations! You have found the Sword of Light and defeated the Dark Sorcerer!" --- ### ✨ Special Features - 🔥 **Dynamic Combat**: Turn-based battles with options to attack or heal. - 👹 **Unique Enemies**: Each enemy — like Goblin, Troll, Frost Queen — has distinct abilities (critical hits, dodges). - 💖 **Special Rooms**: Healing and damaging rooms affect the player's health upon entry. - 🎒 **Inventory System**: Collect items to boost health, attack, or defense. - 🎲 **Random Loot**: Rooms may randomly generate items for added replayability. --- ### 🧑‍💻 Class Descriptions #### 1️⃣ Character ``` **Description:** Base class for all characters (player and enemies). Manages core attributes and handles combat mechanics. **Attributes:** - name (std::string) - description (std::string) - _health (unsigned) - maxHealth (unsigned) - _attack (unsigned) - _defense (unsigned) - inventory (std::vector) ``` ``` **Methods:** - Constructor / Destructor - Copy Constructor / Assignment Operator - isAlive() - setDescription(), setMaxHealth(), setName() - setInventory() - takeDamage() - attack() - heal() - Getters for name, description, health, attack, defense - toString() - addToInventory() - displayInventory() - display() - operator<<, operator+=, operator-= ``` #### 2️⃣ FrostQueen ``` **Description:** Derived from Character. An ice-powered boss. **Attributes:** - Inherits all from Character - healthGrowthCounter (int) **Methods:** - Double attack damage, heals self for +5 HP when attacking. ``` #### 3️⃣ Goblin ``` **Description:** Derived from Character. Weak but has critical hit chances. **Attributes:** - Inherits all from Character - critProbability (0.2) - critMultiplier (2.0) **Methods:** - Attack applies critical hit randomly. ``` #### 4️⃣ Troll ``` **Description:** Derived from Character. A tough enemy with a dodge mechanic. **Attributes:** - Inherits all from Character - dodgeProbability (0.3) **Methods:** - takeDamage() uses dodge chance (30%). ``` #### 5️⃣ TungTungTung_sahur ``` **Description:** Derived from Character. Magical enemy with a health-draining attack. **Methods:** - Deals double attack damage. - Heals self by the amount of damage dealt. ``` #### 6️⃣ Wizard ``` **Description:** Final Boss. Master of magic. **Methods:** - Deals double attack damage. - Heals self by damage dealt. ``` #### 7️⃣ Item ``` **Description:** Collectible items that boost stats. **Attributes:** - name, description - healthBoost - attackBoost - defenseBoost **Methods:** - applyEffect() applies stat boosts. - generateRandomItem() creates random loot. ``` #### 8️⃣ Room ``` **Description:** Holds items, enemies, and exits. **Attributes:** - description, items, enemies - north/south/east/west (Room pointers) **Methods:** - Add/remove items/enemies. - Set/get exits. - generateRandomLoot() - display() ``` #### 9️⃣ SpecialRoom ``` **Description:** Derived from Room. Applies health effects on entry. **Attributes:** - effect (int) — positive = heal, negative = damage. **Methods:** - applyEffect() applies the room's health effect. - display() shows effect info. ``` #### 🔟 Menu ``` **Description:** Handles user interface and interaction. **Attributes:** - currentRoom (Room*) - player (Character*) **Methods:** - displayRoomMenu() - displayInventoryMenu() - displayStatsMenu() - displayTakeItemMenu() - displayAttackEnemyMenu() - displayBattleMenu() - getPlayerChoice() ``` #### 1️⃣1️⃣ Game ``` **Description:** Controls the game loop, room setup, and progress. **Attributes:** - player, currentRoom, menu - Rooms: startingChamber, corridor, treasureRoom, ancientTemple, healingRoom, damageRoom **Methods:** - createRooms() - connectRooms() - addItemsAndEnemies() - gameLoop() - start() ``` --- ### 💻 Compilation & Play Instructions #### 🧰 Prerequisites - C++ Compiler: GCC, Clang, or MSVC (C++11 or later). - Supported OS: Windows, macOS, Linux. - Required Libraries: , , , , , , , . #### ⚙️ Compilation **🗃️ Organize Files:** Ensure the following files are present: ``` - Character.cpp / .hh - FrostQueen.cpp / .hh - Goblin.cpp / .hh - Troll.cpp / .hh - TungTungTung_sahur.cpp / .hh - Wizard.cpp / .hh - Item.cpp / .hh - Room.cpp / .hh - SpecialRoom.cpp / .hh - Menu.cpp / .hh - Game.cpp / .hh - ICharacter.hh - main.cpp ``` **main.cpp:** ```cpp #include "Game.hh" int main() { Game game; game.start(); return 0; } ``` **Compile:** - Using GCC/Clang: ```sh g++ -std=c++11 *.cpp -o dungeon_adventure ``` - Using MSVC (Windows): ```sh cl *.cpp /EHsc /Fe:dungeon_adventure.exe ``` **Run:** - Windows: ```sh dungeon_adventure.exe ``` - macOS/Linux: ```sh ./dungeon_adventure ``` --- ### 🎮 How to Play - The game starts in the Starting Chamber. **📋 Menu Options:** ``` - Key | Action - 1-4 | Move North / South / East / West (if path available) - 5 | Pick up items in the room - 6 | Attack enemies - 7 | Heal yourself (+50 HP) - 8 | View Inventory - 9 | View Stats ``` **⚔️ Combat Instructions:** - 1️⃣ Select enemy to attack. - 2️⃣ In battle: - Option | Action - 1 | Attack the enemy - 2 | Heal yourself (+50 HP) - Enemies counterattack if alive. **🏆 Objective:** - Navigate to the Ancient Temple. - Defeat the Wizard. - Clear all enemies to win. **💡 Tips:** - Collect items like Iron Sword to boost attack. - Use healing rooms smartly. - Save healing actions for tough fights. - You must defeat all enemies in a room to unlock movement. **⚠️ Notes:** - Game ends if player health = 0 (Game Over). - Some rooms apply health effects upon entry. - Be mindful of potential double-deletion bugs in the Menu destructor. --- 💖 Enjoy your adventure in the dungeon!