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