|
TheCOSCGameProject
1.0
|
Manages the content within a room, including items, enemies, and NPCs. More...
#include <room.h>
Public Member Functions | |
| RoomContent () | |
| Constructor for RoomContent. More... | |
| void | enemyRoom () |
| Clears the room content, making it empty. More... | |
| void | gamblingRoom () |
| Sets up a gambling room with an NPC. More... | |
| void | lockedRoom () |
| void | addItem (const std::string &item) |
| Adds an item to the room. More... | |
| void | addEnemy (const EnemyStruct &enemy) |
| Adds an enemy to the room. More... | |
| void | displayContent () const |
| Displays the contents of the room. More... | |
| int | getRoomType () |
| Gets the type of the room. More... | |
| std::string | getRoomDesc () |
| Gets the description of the room. More... | |
| NPC & | getNPC () |
| Gets the NPC in the room. More... | |
| std::vector< EnemyStruct > | getEnemies () |
| Gets the enemies in the room. More... | |
| void | clearEnemies () |
| void | clearText () |
| void | addCoordinates (int x, int y) |
| Sets the coordinates for this room. More... | |
| std::pair< int, int > | getCoordinates () |
| Gets the coordinates for this room. More... | |
| bool | getVisited () |
| Gets whether or not the room has been visited. More... | |
| void | setVisited (bool hasVisited) |
| Sets whether or not the room has been visited. More... | |
| Game * | getNonGamblingGame () |
| std::vector< std::string > | getItems () |
| void | displayRoomItems () |
| bool | collect (Player *player) |
| int | getCoins () |
| bool | emptyItems () |
Manages the content within a room, including items, enemies, and NPCs.
The RoomContent class is responsible for handling the contents of a room, such as items that can be collected, enemies that can be fought, and NPCs that can be interacted with.
| RoomContent::RoomContent | ( | ) |
Constructor for RoomContent.
Constructor for RoomContent class.
Initializes an empty room content.
Initializes a RoomContent object by randomly generating a room type (either empty or gambling room). Depending on the room type, it populates the room with appropriate items, enemies, or NPCs.
| void RoomContent::addCoordinates | ( | int | x, |
| int | y | ||
| ) |
Sets the coordinates for this room.
Add coordinates to the room.
| x | The x coordinate. |
| y | The y coordinate. |
| x | The x-coordinate of the room. |
| y | The y-coordinate of the room. |
| void RoomContent::addEnemy | ( | const EnemyStruct & | enemy | ) |
Adds an enemy to the room.
Add an enemy to the room.
| enemy | The enemy to add. |
| enemy | The enemy to add to the room. |
| void RoomContent::addItem | ( | const std::string & | item | ) |
Adds an item to the room.
Add an item to the room.
| item | The name of the item to add. |
| void RoomContent::clearEnemies | ( | ) |
| void RoomContent::clearText | ( | ) |
| bool RoomContent::collect | ( | Player * | player | ) |
| void RoomContent::displayContent | ( | ) | const |
Displays the contents of the room.
Display the content of the room.
Prints the coordinates, visited status, items, enemies, and NPC details of the room to the console.
| void RoomContent::displayRoomItems | ( | ) |
| bool RoomContent::emptyItems | ( | ) |
| void RoomContent::enemyRoom | ( | ) |
Clears the room content, making it empty.
Generate an empty room with random enemies and items.
This method reads enemy and item details from files, then randomly adds them to the room based on predefined probabilities.
| void RoomContent::gamblingRoom | ( | ) |
| int RoomContent::getCoins | ( | ) |
| std::pair< int, int > RoomContent::getCoordinates | ( | ) |
Gets the coordinates for this room.
Get the coordinates of the room.
| std::vector< EnemyStruct > RoomContent::getEnemies | ( | ) |
Gets the enemies in the room.
Get the list of enemies in the room.
| std::vector< std::string > RoomContent::getItems | ( | ) |
| Game * RoomContent::getNonGamblingGame | ( | ) |
| NPC & RoomContent::getNPC | ( | ) |
| std::string RoomContent::getRoomDesc | ( | ) |
Gets the description of the room.
Get the description of the room.
| int RoomContent::getRoomType | ( | ) |
Gets the type of the room.
Get the type of the room.
| bool RoomContent::getVisited | ( | ) |
Gets whether or not the room has been visited.
Check if the room has been visited.
| void RoomContent::lockedRoom | ( | ) |
| void RoomContent::setVisited | ( | bool | hasVisited | ) |
Sets whether or not the room has been visited.
Set the visited status of the room.
| hasVisited | Whether or not the room has been visited |
| hasVisited | Boolean value to set the visited status. |
1.8.13