Cockatrice 2026-06-01-Development-3.1.0-beta.3
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
card_state.h
Go to the documentation of this file.
1#ifndef COCKATRICE_CARD_STATE_H
2#define COCKATRICE_CARD_STATE_H
3
4#include <QMap>
5#include <QObject>
6
7class CardZoneLogic;
8class CardItem;
9class CardState : public QObject
10{
11 Q_OBJECT
12
13private:
14 bool attacking = false;
15 QMap<int, int> counters;
16 QString annotation;
17 QString pt;
18 bool doesntUntap = false;
19 bool destroyOnZoneChange = false;
20
21 CardItem *attachedTo = nullptr;
22 CardZoneLogic *zone = nullptr;
23
24signals:
26
27 void attackingChanged(bool newValue);
28 void countersChanged(const QMap<int, int> &newCounters);
29 void annotationChanged(const QString &newAnnotation);
30 void ptChanged(const QString &newPt);
31 void doesntUntapChanged(bool newValue);
32 void destroyOnZoneChangeChanged(bool newValue);
33 void attachedToChanged(CardItem *newAttachedTo);
34 void zoneChanged(CardState *changedCard, CardZoneLogic *newZone);
35
36public:
37 explicit CardState(QObject *parent, CardZoneLogic *_zone) : QObject(parent), zone(_zone)
38 {
39 }
40
41 void resetState(bool keepAnnotations);
42
44 {
45 return zone;
46 }
47
48 void setZone(CardZoneLogic *_zone);
49
50 bool getAttacking() const
51 {
52 return attacking;
53 }
54 void setAttacking(bool _attacking);
55
56 const QMap<int, int> &getCounters() const
57 {
58 return counters;
59 }
60
61 void insertCounter(int id, int value);
62
63 void setCounter(int id, int value);
64
65 void clearCounters();
66
67 QString getAnnotation() const
68 {
69 return annotation;
70 }
71
72 void setAnnotation(const QString &_annotation);
73
74 QString getPT() const
75 {
76 return pt;
77 }
78
79 void setPT(const QString &_pt);
80
81 bool getDoesntUntap() const
82 {
83 return doesntUntap;
84 }
85
86 void setDoesntUntap(bool _doesntUntap);
87
89 {
91 }
92
93 void setDestroyOnZoneChange(bool _destroyOnZoneChange);
94
96 {
97 return attachedTo;
98 }
99
100 void setAttachedTo(CardItem *_attachedTo);
101};
102
103#endif // COCKATRICE_CARD_STATE_H
Definition card_item.h:28
CardZoneLogic * zone
Definition card_state.h:22
QMap< int, int > counters
Definition card_state.h:15
void insertCounter(int id, int value)
Definition card_state.cpp:35
QString annotation
Definition card_state.h:16
void setCounter(int id, int value)
Definition card_state.cpp:43
void stateChanged()
void annotationChanged(const QString &newAnnotation)
void resetState(bool keepAnnotations)
Definition card_state.cpp:3
QString getAnnotation() const
Definition card_state.h:67
QString pt
Definition card_state.h:17
CardZoneLogic * getZone() const
Definition card_state.h:43
const QMap< int, int > & getCounters() const
Definition card_state.h:56
bool destroyOnZoneChange
Definition card_state.h:19
void attachedToChanged(CardItem *newAttachedTo)
void attackingChanged(bool newValue)
void destroyOnZoneChangeChanged(bool newValue)
void setAttachedTo(CardItem *_attachedTo)
Definition card_state.cpp:103
CardState(QObject *parent, CardZoneLogic *_zone)
Definition card_state.h:37
void clearCounters()
Definition card_state.cpp:55
void countersChanged(const QMap< int, int > &newCounters)
void setDestroyOnZoneChange(bool _destroyOnZoneChange)
Definition card_state.cpp:92
CardItem * attachedTo
Definition card_state.h:21
void ptChanged(const QString &newPt)
bool getDoesntUntap() const
Definition card_state.h:81
void zoneChanged(CardState *changedCard, CardZoneLogic *newZone)
void setAnnotation(const QString &_annotation)
Definition card_state.cpp:62
bool getDestroyOnZoneChange() const
Definition card_state.h:88
bool doesntUntap
Definition card_state.h:18
void doesntUntapChanged(bool newValue)
void setDoesntUntap(bool _doesntUntap)
Definition card_state.cpp:82
CardItem * getAttachedTo() const
Definition card_state.h:95
void setZone(CardZoneLogic *_zone)
Definition card_state.cpp:14
void setPT(const QString &_pt)
Definition card_state.cpp:72
QString getPT() const
Definition card_state.h:74
bool getAttacking() const
Definition card_state.h:50
bool attacking
Definition card_state.h:14
void setAttacking(bool _attacking)
Definition card_state.cpp:25
Definition card_zone_logic.h:26