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

Execution context for resolving combat effects. More...

#include <combatContext.h>

Collaboration diagram for CombatContext:

Classes

class  EffectMessageScope
 

Public Member Functions

 CombatContext (CombatSystem &combatSystem, Entity &actor, Entity &opponent, DeckCombat &deckCombat, TurnData &turnData)
 Constructs a context for effect resolution.
 
void setEffectMessage (std::vector< std::string > *effectMessage)
 
void resetEffectMessage ()
 
void gainArmor (Target target, int amount)
 Grants armor to the selected logical target.
 
void gainAttack (Target target, int amount)
 Grants attack to the selected logical target.
 
DamageResult dealDamage (Target target, int amount, bool ignoreArmor=false)
 
void drawMultipleCardFromEffect (int amount)
 
std::optional< DrawDatagetDrawData ()
 
void gainActions (int amount)
 
void limitCardToPlay (int amount)
 
void takeCardHostage ()
 

Detailed Description

Execution context for resolving combat effects.

CombatContext binds an actor/opponent relationship for the current action and provides a narrow set of combat operations that effects may invoke.

Effects target using logical selectors (Target::Self / Target::Opponent). CombatContext resolves these selectors to Entity references and forwards requests to CombatSystem, which owns the combat rules.

CombatContext does not own any objects; it stores references that must outlive it.

Constructor & Destructor Documentation

◆ CombatContext()

CombatContext::CombatContext ( CombatSystem combatSystem,
Entity actor,
Entity opponent,
DeckCombat deckCombat,
TurnData turnData 
)

Constructs a context for effect resolution.

Parameters
combatSystemCombat rules engine used to apply mutations.
actorEntity performing the current action (Target::Self).
opponentEntity opposing the actor (Target::Opponent).

Member Function Documentation

◆ dealDamage()

DamageResult CombatContext::dealDamage ( Target  target,
int  amount,
bool  ignoreArmor = false 
)

◆ drawMultipleCardFromEffect()

void CombatContext::drawMultipleCardFromEffect ( int  amount)

◆ gainActions()

void CombatContext::gainActions ( int  amount)

◆ gainArmor()

void CombatContext::gainArmor ( Target  target,
int  amount 
)

Grants armor to the selected logical target.

Resolves the target (self/opponent) and forwards the operation to CombatSystem.

Parameters
targetLogical target selector.
amountArmor amount to add.

◆ gainAttack()

void CombatContext::gainAttack ( Target  target,
int  amount 
)

Grants attack to the selected logical target.

Resolves the target (self/opponent) and forwards the operation to CombatSystem.

Parameters
targetLogical target selector.
amountAttack amount to add.

◆ getDrawData()

std::optional< DrawData > CombatContext::getDrawData ( )

◆ limitCardToPlay()

void CombatContext::limitCardToPlay ( int  amount)

◆ resetEffectMessage()

void CombatContext::resetEffectMessage ( )

◆ setEffectMessage()

void CombatContext::setEffectMessage ( std::vector< std::string > *  effectMessage)

◆ takeCardHostage()

void CombatContext::takeCardHostage ( )

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