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

Central authority for combat rules and state mutation. More...

#include <combatSystem.h>

Collaboration diagram for CombatSystem:

Public Member Functions

void gainArmor (Entity &target, int amount)
 Grants armor to the target entity.
 
void gainAttack (Entity &target, int amount)
 Grants attack to the target entity.
 
void endTurnReset (Entity &player, Entity &enemy)
 
DamageResult dealDamage (Entity &target, int amount, bool ignoreArmor=false)
 Resolves damage against a target according to combat rules.
 
void heal (Entity &target, int amount)
 Heals the target entity by the specified amount.
 
void resetArmor (Entity &target)
 Resets the target entity's armor to zero.
 
bool isDead (const Entity &target)
 Checks whether the target entity is dead.
 

Detailed Description

Central authority for combat rules and state mutation.

CombatSystem implements all rule-driven combat operations such as damage, armor handling, healing, and death checks.

Gameplay logic (effects, match orchestration) must not mutate Entity state directly. All combat-related mutations should be performed through this class.

Member Function Documentation

◆ dealDamage()

DamageResult CombatSystem::dealDamage ( Entity target,
int  amount,
bool  ignoreArmor = false 
)

Resolves damage against a target according to combat rules.

Applies armor interaction based on the specified damage resolution mode and returns a detailed result describing the outcome.

Parameters
damageInfoDamage request (amount, target, resolution mode).
Returns
DamageResult describing blocked damage, HP damage, and death state.

◆ endTurnReset()

void CombatSystem::endTurnReset ( Entity player,
Entity enemy 
)

◆ gainArmor()

void CombatSystem::gainArmor ( Entity target,
int  amount 
)

Grants armor to the target entity.

Parameters
targetEntity receiving the armor.
amountArmor amount to add.

◆ gainAttack()

void CombatSystem::gainAttack ( Entity target,
int  amount 
)

Grants attack to the target entity.

Parameters
targetEntity receiving the armor.
amountAttack amount to add.

◆ heal()

void CombatSystem::heal ( Entity target,
int  amount 
)

Heals the target entity by the specified amount.

Parameters
targetEntity to heal.
amountHP amount to restore.

◆ isDead()

bool CombatSystem::isDead ( const Entity target)

Checks whether the target entity is dead.

Parameters
targetEntity to check.
Returns
true if the entity's HP is zero or below.

◆ resetArmor()

void CombatSystem::resetArmor ( Entity target)

Resets the target entity's armor to zero.

Parameters
targetEntity whose armor is reset.

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