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

Immutable static data representing a card type. More...

#include <cardDefinition.h>

Collaboration diagram for CardDefinition:

Public Member Functions

 CardDefinition (std::string_view cardId, std::string_view cardName, std::string_view cardDescription, const CardParams &cardParams={}, std::vector< std::unique_ptr< Effect > > effectList={}, int baseCost=1)
 Constructs a new CardDefinition with provided base values and effects.
 
std::string_view getName () const
 Returns the display name of the card.
 
std::string_view getID () const
 Returns the internal ID of the card.
 
std::string_view getDescription () const
 
int getBaseDamage () const
 Returns the base damage value defined for the card.
 
int getBaseArmor () const
 Returns the base armor value defined for the card.
 
int getBaseCost () const
 Returns the base energy cost to play the card.
 
const CardParamsgetCardParams () const
 Returns the parameters of the card.
 
const std::vector< std::unique_ptr< Effect > > & getEffectList () const
 Returns a const reference to the list of effects.
 
 ~CardDefinition ()
 Destructor (default).
 

Detailed Description

Immutable static data representing a card type.

CardDefinition defines the core identity and behavior of a card:

  • Unique ID and display name
  • Base damage, armor, and cost values
  • Ordered list of effects to apply when the card is played

CardDefinitions are created once at startup and shared across all matches. They do not contain any runtime state or combat logic.

Effects are owned by the definition and used to build CardInstances at runtime.

Constructor & Destructor Documentation

◆ CardDefinition()

CardDefinition::CardDefinition ( std::string_view  cardId,
std::string_view  cardName,
std::string_view  cardDescription,
const CardParams cardParams = {},
std::vector< std::unique_ptr< Effect > >  effectList = {},
int  baseCost = 1 
)

Constructs a new CardDefinition with provided base values and effects.

Parameters
cardIdUnique identifier for the card (used internally).
cardNameHuman-readable name for display purposes.
baseDamageDefault damage value for the card.
baseArmorDefault armor value for the card.
effectListOrdered list of effects applied when the card is played.
baseCostDefault cost to play the card (1).

◆ ~CardDefinition()

CardDefinition::~CardDefinition ( )
default

Destructor (default).

Member Function Documentation

◆ getBaseArmor()

int CardDefinition::getBaseArmor ( ) const
inline

Returns the base armor value defined for the card.

◆ getBaseCost()

int CardDefinition::getBaseCost ( ) const
inline

Returns the base energy cost to play the card.

◆ getBaseDamage()

int CardDefinition::getBaseDamage ( ) const
inline

Returns the base damage value defined for the card.

◆ getCardParams()

const CardParams & CardDefinition::getCardParams ( ) const
inline

Returns the parameters of the card.

◆ getDescription()

std::string_view CardDefinition::getDescription ( ) const
inline

◆ getEffectList()

const std::vector< std::unique_ptr< Effect > > & CardDefinition::getEffectList ( ) const
inline

Returns a const reference to the list of effects.

Effects are applied in the order they appear in this list. Each effect is owned by this definition and reused by all instances.

◆ getID()

std::string_view CardDefinition::getID ( ) const
inline

Returns the internal ID of the card.

◆ getName()

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

Returns the display name of the card.


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