# Epic Souls **Repository Path**: yuangran/fish ## Basic Information - **Project Name**: Epic Souls - **Description**: A funny game - **Primary Language**: C++ - **License**: BSL-1.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 # Epic Souls - RPG Game ## Group members - 虞盎然 Fish - 张紫嫣 Michelle - 徐有恒 Youheng Xu ## 1. Class Documentation ### Player Class **Header:** `Player.hh` **Implements:** The main character controlled by the player. **Attributes:** - `std::string name`: Name of the player - `std::string description`: Description or backstory - `unsigned health`: Current health - `unsigned maxHealth`: Maximum health - `unsigned attackPower`: Attack power value - `unsigned defense`: Defense value - `std::vector inventory`: Player's inventory (dynamically allocated) **Methods:** - `Player(...)`: Constructor - `~Player()`: Destructor (deletes items in inventory) - `bool isAlive() const`: Returns true if player is alive - `bool takeDamage(unsigned damage)`: Reduces player health based on damage - `bool attack(ICharacter& target)`: Attacks an enemy - `void addToInventory(Item* item)`: Adds an item and applies its bonuses - `void applyItem(const Item* item)`: Applies item's stats to the player - `void displayInventory() const`: Prints player's inventory - `void display() const`: Displays player stats - `int getInventorySize() const`: Returns number of items in inventory - `std::string getName() const`, `getHealth()`, etc.: Accessor functions ### Item Structure **Header:** `Item.hh` **Purpose:** Represents collectible equipment/items that provide stat boosts. **Attributes:** - `std::string name`: Name of the item - `std::string description`: Description - `int bonusAttack`: Bonus to attack - `int bonusDefense`: Bonus to defense - `int bonusHealth`: Bonus to max health **Methods:** - `Item(...)`: Constructor ### Enemy Class **Header:** `Enemy.hh` **Implements:** A basic enemy in the game. Inherits from `ICharacter`. **Attributes:** Health, attack, defense, name, etc. **Methods:** - `bool isAlive() const`: Checks if enemy is alive - `bool takeDamage(unsigned damage)`: Damage handling - `bool attack(Player& player)`: Attacks the player - `std::string getName() const`, `getDescription() const` ### Boss Class **Header:** `Boss.hh` **Inherits:** From `Enemy` **Purpose:** Represents stronger, final boss-like enemies. ### Room Class **Header:** `Room.hh` **Purpose:** Represents a location in the game world. **Attributes:** - `std::string name`: Name of the room - `std::string description`: Room description - `std::vector connectedRooms`: Linked rooms (bidirectional) - `std::vector enemies`: Enemies present in the room - `std::vector items`: Items available in the room **Methods:** - `addEnemy(Enemy*)`, `addItem(Item*)`: Add content to room - `connectRoom(Room*)`: Link with another room - `removeEnemy(...)`, `removeItem(...)`: Remove content - `display()` and related display helpers ### Game Class **Header:** `Game.hh` **Purpose:** Handles main gameplay logic, setup, and loop. **Attributes:** - `Player* player` - `Room* currentRoom` - Room map, enemy list, game state **Methods:** - `void initGame()`: Initializes game state, player, enemies, rooms, etc. - `void run()`: Main game loop - `void processInput()`: Handles user input - `void checkVictory()` / `checkDefeat()`: Game-over logic - `void displayMenu()` / `handleCombat()` / etc. ### ICharacter Interface **Header:** `ICharacter.hh` **Purpose:** Interface for all characters (both players and enemies). **Methods:** - `virtual bool isAlive() const = 0;` - `virtual bool takeDamage(unsigned damage) = 0;` - `virtual bool attack(ICharacter& target) = 0;` - `virtual std::string getName() const = 0;` - `virtual std::string getDescription() const = 0;` - `virtual unsigned getHealth() const = 0;` - `virtual unsigned getAttack() const = 0;` - `virtual unsigned getDefense() const = 0;` - `virtual std::string toString() const = 0;` - `virtual void addToInventory(Item* item) = 0;` - `virtual void displayInventory() const = 0;` - `virtual void display() const = 0;` ### Bossroom Class **Header:** `Bossroom.hh` **Purpose:** Represents a special room where the final boss resides. **Attributes:** - `std::string name`: Name of the boss room - `std::string description`: Room description - `std::vector enemies`: List of enemies (typically the Boss) - `std::vector items`: Items in the room **Methods:** - `addBossEnemy(Enemy* boss)`: Adds the boss to the room. - `removeEnemy(Enemy* enemy)`: Removes an enemy from the room (typically after the boss is defeated). - `display()`: Displays the room and its contents. - `battle()`: Starts the boss battle. --- ## 2. Game Overview ### Story You are an demigod(in Greek mythology) who has entered a mysterious dungeon filled with danger and treasure. Your goal is to collect powerful items and survive deadly battles to ultimately escape or conquer the dungeon.There are four keys scattered in the dungeon.Only all four keys are collected can you escape. ### Win Condition > The player **wins** the game **only if they collect exactly four unique items** in their inventory. ### Loss Condition > The player **loses** the game when their **health reaches zero or below**. ### Features - At least **4 interconnected rooms** - At least **3 types of enemies**, including a final **Boss** - At least **4 collectible items** that grant stat bonuses - A **menu-driven user interface** for exploration and combat - Dynamic memory management for enemies and inventory - Object-oriented architecture using C++ classes --- ## 3. How to Compile and Play ### Requirements - Microsoft **Visual Studio 2022** - C++17 or higher - Windows OS (tested on Windows 10/11) ### File to Open - Open the solution: `Epic Souls.sln` ### Build & Run 1. Open the `.sln` in Visual Studio 2. Set configuration to `Debug` and platform to `x64` 3. Click **Build → Build Solution** (or press `Ctrl+Shift+B`) 4. Click **Debug → Start Without Debugging** (or press `Ctrl+F5`) ### How to Play - Follow the menu instructions - Explore rooms, collect items, and fight enemies - Check inventory with the `Inventory` menu - The game continues until the player **dies or wins** by collecting 4 keys