Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
card_relation.h
Go to the documentation of this file.
1#ifndef COCKATRICE_CARD_RELATION_H
2#define COCKATRICE_CARD_RELATION_H
3
5
6#include <QObject>
7#include <QString>
8#include <qtmetamacros.h>
9
24class CardRelation : public QObject
25{
26 Q_OBJECT
27
28private:
29 QString name;
36
37public:
49 explicit CardRelation(const QString &_name = QString(),
51 bool _isCreateAllExclusion = false,
52 bool _isVariableCount = false,
53 int _defaultCount = 1,
54 bool _isPersistent = false,
55 bool _isFaceDown = false);
56
62 [[nodiscard]] inline const QString &getName() const
63 {
64 return name;
65 }
66
72 [[nodiscard]] CardRelationType getAttachType() const
73 {
74 return attachType;
75 }
76
82 [[nodiscard]] bool getDoesAttach() const
83 {
85 }
86
92 [[nodiscard]] bool getDoesTransform() const
93 {
95 }
96
102 [[nodiscard]] QString getAttachTypeAsString() const
103 {
105 }
106
112 [[nodiscard]] bool getCanCreateAnother() const
113 {
114 return !getDoesAttach();
115 }
116
122 [[nodiscard]] bool getIsCreateAllExclusion() const
123 {
125 }
126
132 [[nodiscard]] bool getIsVariable() const
133 {
134 return isVariableCount;
135 }
136
142 [[nodiscard]] int getDefaultCount() const
143 {
144 return defaultCount;
145 }
146
154 [[nodiscard]] bool getIsPersistent() const
155 {
156 return isPersistent;
157 }
158
164 [[nodiscard]] bool getIsFaceDown() const
165 {
166 return isFaceDown;
167 }
168};
169
170#endif // COCKATRICE_CARD_RELATION_H
QString cardAttachTypeToString(CardRelationType type)
Definition card_relation_type.h:23
bool getDoesAttach() const
Returns true if the card is attached to another.
Definition card_relation.h:82
CardRelationType attachType
Type of attachment.
Definition card_relation.h:30
bool isFaceDown
True if this relation creates the tokens facedown.
Definition card_relation.h:35
QString getAttachTypeAsString() const
Returns a string description of the attachment type.
Definition card_relation.h:102
bool getIsVariable() const
Returns whether the relation count is variable.
Definition card_relation.h:132
bool getDoesTransform() const
Returns true if this card transforms into another card.
Definition card_relation.h:92
int defaultCount
Default number of cards created or involved.
Definition card_relation.h:33
QString name
Name of the related card.
Definition card_relation.h:29
CardRelation(const QString &_name=QString(), CardRelationType _attachType=CardRelationType::DoesNotAttach, bool _isCreateAllExclusion=false, bool _isVariableCount=false, int _defaultCount=1, bool _isPersistent=false, bool _isFaceDown=false)
Constructs a CardRelation with optional parameters.
Definition card_relation.cpp:3
bool getIsCreateAllExclusion() const
Returns whether this relation is excluded from "create all" operations.
Definition card_relation.h:122
int getDefaultCount() const
Returns the default count of related cards.
Definition card_relation.h:142
bool isVariableCount
True if the number of creations is variable.
Definition card_relation.h:32
bool getIsPersistent() const
Returns whether the relation is persistent.
Definition card_relation.h:154
bool getCanCreateAnother() const
Determines whether another instance can be created.
Definition card_relation.h:112
bool getIsFaceDown() const
Returns whether the relation creates the token facedown.
Definition card_relation.h:164
CardRelationType getAttachType() const
Returns the type of attachment.
Definition card_relation.h:72
bool isCreateAllExclusion
True if this relation should exclude multiple creations in "create all" operations.
Definition card_relation.h:31
const QString & getName() const
Returns the name of the related card.
Definition card_relation.h:62
bool isPersistent
True if this relation persists (i.e. is not destroyed) on zone change.
Definition card_relation.h:34
CardRelationType
Types of attachments between cards.
Definition card_relation_type.h:16
@ TransformInto
Definition card_relation_type.h:19
@ DoesNotAttach
Definition card_relation_type.h:17