Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CardRelation Class Reference

Represents a relationship between two cards. More...

#include <card_relation.h>

Inheritance diagram for CardRelation:
[legend]
Collaboration diagram for CardRelation:
[legend]

Public Member Functions

 CardRelation (const QString &_name=QString(), CardRelationType _attachType=CardRelationType::DoesNotAttach, bool _isCreateAllExclusion=false, bool _isVariableCount=false, int _defaultCount=1, bool _isPersistent=false)
 Constructs a CardRelation with optional parameters.
const QString & getName () const
 Returns the name of the related card.
CardRelationType getAttachType () const
 Returns the type of attachment.
bool getDoesAttach () const
 Returns true if the card is attached to another.
bool getDoesTransform () const
 Returns true if this card transforms into another card.
QString getAttachTypeAsString () const
 Returns a string description of the attachment type.
bool getCanCreateAnother () const
 Determines whether another instance can be created.
bool getIsCreateAllExclusion () const
 Returns whether this relation is excluded from "create all" operations.
bool getIsVariable () const
 Returns whether the relation count is variable.
int getDefaultCount () const
 Returns the default count of related cards.
bool getIsPersistent () const
 Returns whether the relation is persistent.

Private Attributes

QString name
 Name of the related card.
CardRelationType attachType
 Type of attachment.
bool isCreateAllExclusion
 True if this relation should exclude multiple creations in "create all" operations.
bool isVariableCount
 True if the number of creations is variable.
int defaultCount
 Default number of cards created or involved.
bool isPersistent
 True if this relation persists (i.e. is not destroyed) on zone change.

Detailed Description

Represents a relationship between two cards.

CardRelation objects define directional relationships, such as:

  • One card attaching to another.
  • One card transforming into another.
  • One card creating another instance.

Relations may also define metadata such as whether multiple creations are possible, whether the relation is persistent, and default counts.

Constructor & Destructor Documentation

◆ CardRelation()

CardRelation::CardRelation ( const QString & _name = QString(),
CardRelationType _attachType = CardRelationType::DoesNotAttach,
bool _isCreateAllExclusion = false,
bool _isVariableCount = false,
int _defaultCount = 1,
bool _isPersistent = false )
explicit

Constructs a CardRelation with optional parameters.

Parameters
_nameName of the related card.
_attachTypeType of attachment.
_isCreateAllExclusionWhether this relation excludes mass creation.
_isVariableCountWhether the count is variable.
_defaultCountDefault number for creations or transformations.
_isPersistentWhether the relation persists across zone changes.

Member Function Documentation

◆ getAttachType()

CardRelationType CardRelation::getAttachType ( ) const
inlinenodiscard

Returns the type of attachment.

Returns
Enum value representing the attachment type.
Here is the caller graph for this function:

◆ getAttachTypeAsString()

QString CardRelation::getAttachTypeAsString ( ) const
inlinenodiscard

Returns a string description of the attachment type.

Returns
"attach" for AttachTo, "transform" for TransformInto, empty string otherwise.
Here is the call graph for this function:

◆ getCanCreateAnother()

bool CardRelation::getCanCreateAnother ( ) const
inlinenodiscard

Determines whether another instance can be created.

Returns
True if creation is allowed, false if constrained by attachment.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDefaultCount()

int CardRelation::getDefaultCount ( ) const
inlinenodiscard

Returns the default count of related cards.

Returns
Integer representing default number.
Here is the caller graph for this function:

◆ getDoesAttach()

bool CardRelation::getDoesAttach ( ) const
inlinenodiscard

Returns true if the card is attached to another.

Returns
True if attached, false otherwise.
Here is the caller graph for this function:

◆ getDoesTransform()

bool CardRelation::getDoesTransform ( ) const
inlinenodiscard

Returns true if this card transforms into another card.

Returns
True if it transforms, false otherwise.

◆ getIsCreateAllExclusion()

bool CardRelation::getIsCreateAllExclusion ( ) const
inlinenodiscard

Returns whether this relation is excluded from "create all" operations.

Returns
True if excluded, false otherwise.

◆ getIsPersistent()

bool CardRelation::getIsPersistent ( ) const
inlinenodiscard

Returns whether the relation is persistent.

Persistent relations are not destroyed on zone changes.

Returns
True if persistent, false otherwise.
Here is the caller graph for this function:

◆ getIsVariable()

bool CardRelation::getIsVariable ( ) const
inlinenodiscard

Returns whether the relation count is variable.

Returns
True if variable, false otherwise.
Here is the caller graph for this function:

◆ getName()

const QString & CardRelation::getName ( ) const
inlinenodiscard

Returns the name of the related card.

Returns
Name as QString reference.
Here is the caller graph for this function:

Member Data Documentation

◆ attachType

CardRelationType CardRelation::attachType
private

Type of attachment.

◆ defaultCount

int CardRelation::defaultCount
private

Default number of cards created or involved.

◆ isCreateAllExclusion

bool CardRelation::isCreateAllExclusion
private

True if this relation should exclude multiple creations in "create all" operations.

◆ isPersistent

bool CardRelation::isPersistent
private

True if this relation persists (i.e. is not destroyed) on zone change.

◆ isVariableCount

bool CardRelation::isVariableCount
private

True if the number of creations is variable.

◆ name

QString CardRelation::name
private

Name of the related card.


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