CardGame
Rogue-like card videogame
Loading...
Searching...
No Matches
Entity Class Reference

Base class representing a combat-capable entity. More...

#include <entity.h>

Inheritance diagram for Entity:
Collaboration diagram for Entity:

Public Member Functions

 Entity ()
 
 Entity (int hp, int attack=0, int armor=0)
 
std::string_view getName () const
 Returns the display name of the entity.
 
int getArmor () const
 Returns the current armor value.
 
int getAttack () const
 Returns the current attack value.
 
void resetArmor ()
 Resets armor to zero.
 
void resetAttack ()
 Resets attack to zero.
 
void increaseArmor (int amount)
 Increases armor by the given amount.
 
void increaseAttack (int amount)
 Increases attack by the given amount.
 
void lowerArmor (int amount)
 Decreases armor by the given amount.
 
int getHp () const
 Returns the current HP value.
 
void lowerHp (int amount)
 Decreases HP by the given amount.
 
void increaseHp (int amount)
 Increases HP by the given amount.
 

Protected Attributes

int m_hp {}
 
int m_armor {}
 
int m_attack {}
 
std::string m_name {}
 

Detailed Description

Base class representing a combat-capable entity.

Entity stores core combat state such as HP, armor, and attack value. It provides low-level mutation primitives but does not implement combat rules or gameplay logic.

Higher-level systems (e.g., CombatSystem) are responsible for enforcing rules and constraints when mutating entity state.

Constructor & Destructor Documentation

◆ Entity() [1/2]

Entity::Entity ( )
inline

◆ Entity() [2/2]

Entity::Entity ( int  hp,
int  attack = 0,
int  armor = 0 
)
inline

Member Function Documentation

◆ getArmor()

int Entity::getArmor ( ) const
inline

Returns the current armor value.

◆ getAttack()

int Entity::getAttack ( ) const
inline

Returns the current attack value.

◆ getHp()

int Entity::getHp ( ) const
inline

Returns the current HP value.

◆ getName()

std::string_view Entity::getName ( ) const
inline

Returns the display name of the entity.

◆ increaseArmor()

void Entity::increaseArmor ( int  amount)
inline

Increases armor by the given amount.

◆ increaseAttack()

void Entity::increaseAttack ( int  amount)
inline

Increases attack by the given amount.

◆ increaseHp()

void Entity::increaseHp ( int  amount)
inline

Increases HP by the given amount.

◆ lowerArmor()

void Entity::lowerArmor ( int  amount)
inline

Decreases armor by the given amount.

Armor is clamped to zero if the reduction would make it negative.

◆ lowerHp()

void Entity::lowerHp ( int  amount)
inline

Decreases HP by the given amount.

◆ resetArmor()

void Entity::resetArmor ( )
inline

Resets armor to zero.

◆ resetAttack()

void Entity::resetAttack ( )
inline

Resets attack to zero.

Member Data Documentation

◆ m_armor

int Entity::m_armor {}
protected

◆ m_attack

int Entity::m_attack {}
protected

◆ m_hp

int Entity::m_hp {}
protected

◆ m_name

std::string Entity::m_name {}
protected

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