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

Base class for enemies with a predefined move sequence. More...

#include <enemy.h>

Inheritance diagram for Enemy:
Collaboration diagram for Enemy:

Public Member Functions

const EnemyMovenextMove ()
 Returns the next move in the enemy's move sequence.
 
- Public Member Functions inherited from Entity
 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 Member Functions

 Enemy (int hp)
 Constructs an enemy with the given starting HP.
 

Protected Attributes

std::vector< EnemyMovem_moves {}
 
int m_moveIndex {0}
 
- Protected Attributes inherited from Entity
int m_hp {}
 
int m_armor {}
 
int m_attack {}
 
std::string m_name {}
 

Detailed Description

Base class for enemies with a predefined move sequence.

Enemy represents a non-player combat entity whose behavior is defined by an ordered list of EnemyMove objects.

Each call to nextMove() returns the current move and advances the internal move index, typically cycling through the sequence.

Enemy does not execute its moves directly; orchestration and effect resolution are handled externally (e.g., by CardMatch).

Constructor & Destructor Documentation

◆ Enemy()

Enemy::Enemy ( int  hp)
protected

Constructs an enemy with the given starting HP.

Parameters
hpInitial hit points for the enemy.

Member Function Documentation

◆ nextMove()

const EnemyMove & Enemy::nextMove ( )

Returns the next move in the enemy's move sequence.

The move index is advanced after each call. The sequence is treated as cyclic.

Returns
Reference to the selected EnemyMove.
Precondition
The enemy must define at least one EnemyMove.

Member Data Documentation

◆ m_moveIndex

int Enemy::m_moveIndex {0}
protected

◆ m_moves

std::vector<EnemyMove> Enemy::m_moves {}
protected

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