Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform 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
23class CardRelation : public QObject
24{
25 Q_OBJECT
26
27private:
28 QString name;
34
35public:
46 explicit CardRelation(const QString &_name = QString(),
48 bool _isCreateAllExclusion = false,
49 bool _isVariableCount = false,
50 int _defaultCount = 1,
51 bool _isPersistent = false);
52
58 [[nodiscard]] inline const QString &getName() const
59 {
60 return name;
61 }
62
68 [[nodiscard]] CardRelationType getAttachType() const
69 {
70 return attachType;
71 }
72
78 [[nodiscard]] bool getDoesAttach() const
79 {
81 }
82
88 [[nodiscard]] bool getDoesTransform() const
89 {
91 }
92
98 [[nodiscard]] QString getAttachTypeAsString() const
99 {
101 }
102
108 [[nodiscard]] bool getCanCreateAnother() const
109 {
110 return !getDoesAttach();
111 }
112
118 [[nodiscard]] bool getIsCreateAllExclusion() const
119 {
121 }
122
128 [[nodiscard]] bool getIsVariable() const
129 {
130 return isVariableCount;
131 }
132
138 [[nodiscard]] int getDefaultCount() const
139 {
140 return defaultCount;
141 }
142
150 [[nodiscard]] bool getIsPersistent() const
151 {
152 return isPersistent;
153 }
154};
155
156#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:78
CardRelationType attachType
Type of attachment.
Definition card_relation.h:29
QString getAttachTypeAsString() const
Returns a string description of the attachment type.
Definition card_relation.h:98
bool getIsVariable() const
Returns whether the relation count is variable.
Definition card_relation.h:128
bool getDoesTransform() const
Returns true if this card transforms into another card.
Definition card_relation.h:88
int defaultCount
Default number of cards created or involved.
Definition card_relation.h:32
QString name
Name of the related card.
Definition card_relation.h:28
bool getIsCreateAllExclusion() const
Returns whether this relation is excluded from "create all" operations.
Definition card_relation.h:118
int getDefaultCount() const
Returns the default count of related cards.
Definition card_relation.h:138
bool isVariableCount
True if the number of creations is variable.
Definition card_relation.h:31
bool getIsPersistent() const
Returns whether the relation is persistent.
Definition card_relation.h:150
bool getCanCreateAnother() const
Determines whether another instance can be created.
Definition card_relation.h:108
CardRelationType getAttachType() const
Returns the type of attachment.
Definition card_relation.h:68
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.
Definition card_relation.cpp:5
bool isCreateAllExclusion
True if this relation should exclude multiple creations in "create all" operations.
Definition card_relation.h:30
const QString & getName() const
Returns the name of the related card.
Definition card_relation.h:58
bool isPersistent
True if this relation persists (i.e. is not destroyed) on zone change.
Definition card_relation.h:33
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