TheCOSCGameProject  1.0
Public Member Functions | List of all members
EnemySpawner Class Reference

Responsible for spawning enemies in the game. More...

#include <enemies.h>

Public Member Functions

 EnemySpawner ()
 Constructor for the EnemySpawner class. More...
 
Enemy spawnEnemy ()
 Spawns a new enemy with randomly generated attributes. More...
 
int getHealth (const Enemy &enemy)
 Gets the health of the specified enemy. More...
 
int getAttack (const Enemy &enemy)
 Gets the attack power of the specified enemy. More...
 
std::string getName (const Enemy &enemy)
 Gets the name of the specified enemy. More...
 
std::string getType (const Enemy &enemy)
 Gets the type of the specified enemy. More...
 
std::string getPersonality (const Enemy &enemy)
 Gets the personality of the specified enemy. More...
 
int getDefence (const Enemy &enemy)
 Gets the defense value of the specified enemy. More...
 
bool isDead (const Enemy &enemy)
 Checks if the specified enemy is dead. More...
 
void damageDelt (Enemy &enemy, int hurt)
 Applies damage to the specified enemy. More...
 
void setAttack (Enemy &enemy, int attack)
 Sets the attack power of the specified enemy. More...
 
void setHealth (Enemy &enemy, int health)
 Sets the health of the specified enemy. More...
 

Detailed Description

Responsible for spawning enemies in the game.

The EnemySpawner class generates enemies with random attributes, and provides methods to interact with and modify the properties of these enemies.

Constructor & Destructor Documentation

◆ EnemySpawner()

EnemySpawner::EnemySpawner ( )

Constructor for the EnemySpawner class.

Initializes the EnemySpawner object, preparing it to generate enemies.

Initializes the random number generator used for generating random enemy attributes.

Member Function Documentation

◆ damageDelt()

void EnemySpawner::damageDelt ( Enemy enemy,
int  hurt 
)

Applies damage to the specified enemy.

Apply damage to a given enemy.

Parameters
enemyThe enemy to damage.
hurtThe amount of damage to apply.
enemyThe enemy to apply damage to.
hurtThe amount of damage to apply.

The damage is reduced based on the enemy's type and defence value. Sardaukar enemies take 20% less damage.

◆ getAttack()

int EnemySpawner::getAttack ( const Enemy enemy)

Gets the attack power of the specified enemy.

Get the attack value of a given enemy.

Parameters
enemyThe enemy whose attack power is to be retrieved.
Returns
The attack power of the enemy.
Parameters
enemyThe enemy whose attack value is to be retrieved.
Returns
The attack value of the enemy.

◆ getDefence()

int EnemySpawner::getDefence ( const Enemy enemy)

Gets the defense value of the specified enemy.

Get the defence value of a given enemy.

Parameters
enemyThe enemy whose defense value is to be retrieved.
Returns
The defense value of the enemy.
Parameters
enemyThe enemy whose defence value is to be retrieved.
Returns
The defence value of the enemy.

◆ getHealth()

int EnemySpawner::getHealth ( const Enemy enemy)

Gets the health of the specified enemy.

Get the health of a given enemy.

Parameters
enemyThe enemy whose health is to be retrieved.
Returns
The health points of the enemy.
Parameters
enemyThe enemy whose health is to be retrieved.
Returns
The health value of the enemy.

◆ getName()

std::string EnemySpawner::getName ( const Enemy enemy)

Gets the name of the specified enemy.

Get the name of a given enemy.

Parameters
enemyThe enemy whose name is to be retrieved.
Returns
The name of the enemy.

◆ getPersonality()

std::string EnemySpawner::getPersonality ( const Enemy enemy)

Gets the personality of the specified enemy.

Get the personality of a given enemy.

Parameters
enemyThe enemy whose personality is to be retrieved.
Returns
The personality of the enemy.

◆ getType()

std::string EnemySpawner::getType ( const Enemy enemy)

Gets the type of the specified enemy.

Get the type of a given enemy.

Parameters
enemyThe enemy whose type is to be retrieved.
Returns
The type of the enemy.

◆ isDead()

bool EnemySpawner::isDead ( const Enemy enemy)

Checks if the specified enemy is dead.

Check if a given enemy is dead.

Parameters
enemyThe enemy to check.
Returns
True if the enemy's health is zero or below, otherwise false.
Parameters
enemyThe enemy to check.
Returns
True if the enemy's health is 0 or less, false otherwise.

◆ setAttack()

void EnemySpawner::setAttack ( Enemy enemy,
int  attack 
)

Sets the attack power of the specified enemy.

Set the attack value of a given enemy.

Parameters
enemyThe enemy whose attack power is to be set.
attackThe attack power to set.
enemyThe enemy whose attack value is to be set.
attackThe new attack value.

◆ setHealth()

void EnemySpawner::setHealth ( Enemy enemy,
int  health 
)

Sets the health of the specified enemy.

Set the health value of a given enemy.

Parameters
enemyThe enemy whose health is to be set.
healthThe health value to set.
enemyThe enemy whose health value is to be set.
healthThe new health value.

◆ spawnEnemy()

Enemy EnemySpawner::spawnEnemy ( )

Spawns a new enemy with randomly generated attributes.

Spawn a new enemy with randomized attributes.

Returns
An Enemy object with generated attributes.
An Enemy object with randomly generated name, health, attack, type, personality, and defence.

The documentation for this class was generated from the following files: