-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutomatonPowers.h
192 lines (172 loc) · 9.08 KB
/
AutomatonPowers.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#ifndef AUTOMATONPOWERS_H
#define AUTOMATONPOWERS_H
#include "powers.h"
class CannotBeStunned: public AllPowers {
public:
CannotBeStunned(): AllPowers("Cannot Be Stunnedϴ") { }
CannotBeStunned(const CannotBeStunned& s): AllPowers(s) { }
CannotBeStunned(CannotBeStunned&& s): AllPowers(s) { }
CannotBeStunned(const QJsonObject& json): AllPowers(json) { }
~CannotBeStunned() override { }
CannotBeStunned& operator=(const CannotBeStunned& s) {
if (this != &s) AllPowers::operator=(s);
return *this;
}
CannotBeStunned& operator=(CannotBeStunned&& s) {
AllPowers::operator=(s);
return *this;
}
Fraction adv() override { return Fraction(0); }
QString description(bool showEND = false) override { return optOut(showEND); }
QString end() override { return noEnd(); }
void form(QWidget* parent, QVBoxLayout* layout) override { AllPowers::form(parent, layout);
}
Fraction lim() override { return Fraction(0); }
Points points(bool noStore = false) override { if (!noStore) store();
return 15_cp; } // NOLINT
void restore() override { AllPowers::restore();
}
void store() override { AllPowers::store();
}
QJsonObject toJson() const override { QJsonObject obj = AllPowers::toJson();
return obj;
}
private:
QString optOut(bool showEND) {
QString res;
if (showEND && !nickname().isEmpty()) res = nickname() + " " + end() + " ";
res += "Cannot Be Stunnedϴ";
return res;
}
};
class DoesNotBleed: public AllPowers {
public:
DoesNotBleed(): AllPowers("Does Not Bleedϴ") { }
DoesNotBleed(const DoesNotBleed& s): AllPowers(s) { }
DoesNotBleed(DoesNotBleed&& s): AllPowers(s) { }
DoesNotBleed(const QJsonObject& json): AllPowers(json) { }
~DoesNotBleed() override { }
DoesNotBleed& operator=(const DoesNotBleed& s) {
if (this != &s) AllPowers::operator=(s);
return *this;
}
DoesNotBleed& operator=(DoesNotBleed&& s) {
AllPowers::operator=(s);
return *this;
}
Fraction adv() override { return Fraction(0); }
QString description(bool showEND = false) override { return optOut(showEND); }
QString end() override { return noEnd(); }
void form(QWidget* parent, QVBoxLayout* layout) override { AllPowers::form(parent, layout);
}
Fraction lim() override { return Fraction(0); }
Points points(bool noStore = false) override { if (!noStore) store();
return 15_cp; } // NOLINT
void restore() override { AllPowers::restore();
}
void store() override { AllPowers::store();
}
QJsonObject toJson() const override { QJsonObject obj = AllPowers::toJson();
return obj;
}
private:
QString optOut(bool showEND) {
QString res;
if (showEND && !nickname().isEmpty()) res = nickname() + " " + end() + " ";
res += "Does Not Bleedϴ";
return res;
}
};
class NoHitLocations: public AllPowers {
public:
NoHitLocations(): AllPowers("No Hit Locationsϴ") { }
NoHitLocations(const NoHitLocations& s): AllPowers(s) { }
NoHitLocations(NoHitLocations&& s): AllPowers(s) { }
NoHitLocations(const QJsonObject& json): AllPowers(json) { }
~NoHitLocations() override { }
NoHitLocations& operator=(const NoHitLocations& s) {
if (this != &s) AllPowers::operator=(s);
return *this;
}
NoHitLocations& operator=(NoHitLocations&& s) {
AllPowers::operator=(s);
return *this;
}
Fraction adv() override { return Fraction(0); }
QString description(bool showEND = false) override { return optOut(showEND); }
QString end() override { return noEnd(); }
void form(QWidget* parent, QVBoxLayout* layout) override { AllPowers::form(parent, layout);
}
Fraction lim() override { return Fraction(0); }
Points points(bool noStore = false) override { if (!noStore) store();
return 10_cp; } // NOLINT
void restore() override { AllPowers::restore();
}
void store() override { AllPowers::store();
}
QJsonObject toJson() const override { QJsonObject obj = AllPowers::toJson();
return obj;
}
private:
QString optOut(bool showEND) {
QString res;
if (showEND && !nickname().isEmpty()) res = nickname() + " " + end() + " ";
res += "No Hit Locationsϴ";
return res;
}
};
class TakesNoSTUN: public AllPowers {
public:
TakesNoSTUN(): AllPowers("Takes No STUNϴ") { }
TakesNoSTUN(const TakesNoSTUN& s): AllPowers(s) { }
TakesNoSTUN(TakesNoSTUN&& s): AllPowers(s) { }
TakesNoSTUN(const QJsonObject& json): AllPowers(json) { v._damage = json["damage"].toBool(false);
}
~TakesNoSTUN() override { }
TakesNoSTUN& operator=(const TakesNoSTUN& s) {
if (this != &s) {
AllPowers::operator=(s);
v = s.v;
}
return *this;
}
TakesNoSTUN& operator=(TakesNoSTUN&& s) {
AllPowers::operator=(s);
v = s.v;
return *this;
}
Fraction adv() override { return Fraction(0); }
QString description(bool showEND = false) override { return optOut(showEND); }
QString end() override { return noEnd(); }
void form(QWidget* parent, QVBoxLayout* layout) override { AllPowers::form(parent, layout);
damage = createCheckBox(parent, layout, "Loses powers on BODY damage");
}
Fraction lim() override { return Fraction(0); }
Points points(bool noStore = false) override { if (!noStore) store();
return (v._damage ? 45_cp : 60_cp); } // NOLINT
void restore() override { vars s = v;
AllPowers::restore();
damage->setChecked(s._damage);
v = s;
}
void store() override { AllPowers::store();
v._damage = damage->isChecked();
}
QJsonObject toJson() const override { QJsonObject obj = AllPowers::toJson();
obj["damage"] = v._damage;
return obj;
}
private:
struct vars {
bool _damage = false;
} v;
QCheckBox* damage = nullptr;
QString optOut(bool showEND) {
QString res;
if (showEND && !nickname().isEmpty()) res = nickname() + " " + end() + " ";
res += "Takes No STUNϴ";
if (v._damage) res += "; Loses powers on BODY damage";
return res;
}
};
#endif // AUTOMATONPOWERS_H