Orchestrates a single combat encounter between one player and one enemy.
More...
#include <cardmatch.h>
Orchestrates a single combat encounter between one player and one enemy.
CardMatch coordinates encounter-level flow:
- builds a combat deck from the player's persistent deck (DeckCombat + CardFactory)
- draws cards into the player's hand
- resolves a played card by executing its ordered Effect list
- runs the enemy turn by resolving the next EnemyMove
CardMatch owns the runtime combat deck (DeckCombat) and the rules engine (CombatSystem). Player and Enemy objects are referenced and must outlive the CardMatch.
Effect resolution is performed using CombatContext, which routes effect requests to CombatSystem. See Combat Effect Resolution Pipeline for the full resolution flow.
◆ CardMatch()
Constructs a match for the given player and enemy.
Builds a fresh DeckCombat from the player's persistent deck.
- Parameters
-
| player | Player participating in the encounter (must outlive the CardMatch). |
| enemy | Enemy participating in the encounter (must outlive the CardMatch). |
◆ canPlayerAct()
| bool CardMatch::canPlayerAct |
( |
TurnData & |
currentTurnData | ) |
|
◆ damagePhase()
| void CardMatch::damagePhase |
( |
| ) |
|
◆ drawMultipleCardsNoEffect()
| void CardMatch::drawMultipleCardsNoEffect |
( |
int |
amount | ) |
|
Draws multiple cards into the player's hand.
Delegates empty-deck behavior to DeckCombat.
- Parameters
-
| amount | Number of cards to draw. If amount <= 0, no action is taken. |
◆ enemyTurn()
| void CardMatch::enemyTurn |
( |
TurnData & |
currentTurnData | ) |
|
Executes the enemy's next move and resolves its effects.
The enemy provides an EnemyMove via Enemy::nextMove(). Effects are resolved in order using a CombatContext where the enemy is the actor and the player is the opponent.
◆ gainArmor()
| void CardMatch::gainArmor |
( |
int |
defense | ) |
|
Legacy helper that directly increases the player's armor.
- Warning
- This bypasses CombatSystem and exists only for older code paths. Current effects should grant armor via CombatContext/CombatSystem.
◆ playCard()
| void CardMatch::playCard |
( |
int |
handIndex, |
|
|
CombatContext & |
currentContext |
|
) |
| |
Plays a card from the hand and resolves all of its effects.
The selected card is removed from the hand immediately via DeckCombat::takeFromHand() Effects are then resolved in the order defined by the card's CardDefinition. After resolution, the card is moved to the discard pile.
If the hand index is invalid, no action is taken.
- Parameters
-
| handIndex | Zero-based index of the card in the hand. |
◆ playerTurn()
| void CardMatch::playerTurn |
( |
TurnData & |
currentTurnData | ) |
|
◆ playerTurnSetup()
| void CardMatch::playerTurnSetup |
( |
const TurnData & |
currentTurnData | ) |
|
◆ reduceAction()
| void CardMatch::reduceAction |
( |
TurnData & |
turnData, |
|
|
int |
amount |
|
) |
| |
◆ resetPhase()
| void CardMatch::resetPhase |
( |
| ) |
|
◆ spendAction()
| void CardMatch::spendAction |
( |
TurnData & |
turnData | ) |
|
◆ turnLoop()
| void CardMatch::turnLoop |
( |
| ) |
|
◆ updateMatchState()
| bool CardMatch::updateMatchState |
( |
| ) |
|
◆ writeDrawnCardMessage()
| void CardMatch::writeDrawnCardMessage |
( |
std::string & |
drawMessage, |
|
|
const DrawData & |
drawData |
|
) |
| |
The documentation for this class was generated from the following files: