-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFrameworkPowers.h
636 lines (591 loc) · 33.6 KB
/
FrameworkPowers.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
#ifndef FRAMEWORKPOWERS_H
#define FRAMEWORKPOWERS_H
#include "powers.h"
#ifndef ISHSC
#include "sheet.h"
#endif
class FrameworkPowers: public Power {
public:
FrameworkPowers(): Power() { }
FrameworkPowers(QString name)
: Power()
, v { name, "", { } } { }
FrameworkPowers(const FrameworkPowers& s)
: Power(s)
, v(s.v) { }
FrameworkPowers(FrameworkPowers&& s)
: Power(s)
, v(s.v) { }
FrameworkPowers(const QJsonObject& json)
: Power()
, v { json["name"].toString(), json["powerName"].toString(""), { } } { loadPowers(json["powers"].toArray()); }
~FrameworkPowers() override { }
FrameworkPowers& operator=(const FrameworkPowers& s) {
if (this != &s) v = s.v;
return *this;
}
FrameworkPowers& operator=(FrameworkPowers&& s) {
v = s.v;
return *this;
}
QString description(bool roll = false) override { return roll ? "" : ""; }
Points points(bool noStore = false) override { return noStore ? 0_cp : 0_cp; }
void loadPowers(QJsonArray powers) {
for (const auto& power: powers) {
QJsonObject obj = power.toObject();
v._powers.append(Power::FromJson(obj["name"].toString(), obj));
}
}
bool isFramework() override { return true; }
int count() override { return gsl::narrow<int>(v._powers.count()); }
void append(shared_ptr<Power> p) override { v._powers.append(p); p->parent(this); }
void insert(int n, shared_ptr<Power> p) override { v._powers.insert(n, p); p->parent(this); }
void remove(int n) override { v._powers[n]->parent(nullptr); v._powers.removeAt(n); }
void remove(shared_ptr<Power> p) override { p->parent(nullptr); v._powers.removeOne(p); }
QList<shared_ptr<Power>>& list() override { return v._powers; }
Fraction adv() override { return Fraction(0); }
void checked(bool) override { }
Fraction lim() override { return Fraction(0); }
void numeric(int) override { }
void form(QWidget* widget, QVBoxLayout* layout) override { powerName = createLineEdit(widget, layout, "Nickname of power");
}
QString name() override { return v._name;
}
QString nickname() override { return v._powerName;
}
void restore() override { vars s = v;
powerName->setText(s._powerName);
v = s;
}
void store() override { v._powerName = powerName->text();
}
QJsonObject toJson() const override { QJsonObject obj = Power::toJson();
obj["name"] = v._name;
obj["powerName"] = v._powerName;
QJsonArray powers;
for (int i = 0; i < v._powers.count(); ++i) powers.append(v._powers[i]->toJson());
obj.insert("powers", powers);
return obj;
}
Fraction limitations() {
Fraction limits(1);
limits += lim();
for (const auto& mod: limitationsList()) limits += mod->fraction(Power::NoStore).abs();
return limits;
}
Fraction advantages() {
Fraction advants(1);
advants += adv();
for (const auto& mod: advantagesList())
if (!mod->isAdder()) advants += mod->fraction(Power::NoStore);
return advants;
}
Points modifiers() {
Points pts(0);
for (const auto& mod: advantagesList())
if (mod->isAdder()) pts += mod->points();
return pts;
}
protected:
struct vars {
QString _name = "";
QString _powerName = "";
QList<shared_ptr<Power>> _powers {};
};
vars& super() { return v; }
private:
vars v;
QLineEdit* powerName = nullptr;
};
class Group: public FrameworkPowers {
public:
Group(): FrameworkPowers("Group") { }
Group(const Group& s): FrameworkPowers(s) { }
Group(Group&& s): FrameworkPowers(s) { }
Group(const QJsonObject& json): FrameworkPowers(json) { }
~Group() override { }
Group& operator=(const Group&) {
return *this;
}
Group& operator=(Group&&) {
return *this;
}
bool isValid(shared_ptr<Power>) override { return true; }
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 { FrameworkPowers::form(parent, layout);
}
Fraction lim() override { return Fraction(0); }
Points points(bool noStore = false) override { if (!noStore) store();
return 0_cp; }
void restore() override { FrameworkPowers::restore();
}
void store() override { FrameworkPowers::store();
}
QJsonObject toJson() const override { QJsonObject obj = FrameworkPowers::toJson();
return obj;
}
#ifdef ISHSC
Points display(int&, QTableWidget*) override {
Points points = 0_cp;
#else
Points display(int& row, QTableWidget* tbl) override {
Points points = 0_cp;
QFont font = tbl->font();
QFont italic = font;
italic.setItalic(true);
int r = 1;
auto limit = limitations();
auto advtg = advantages();
auto modif = modifiers();
for (const auto& pe: super()._powers) {
QString descr = pe->description();
if (descr == "-") descr = "";
pe->parent(this);
for (const auto& mod: pe->advantagesList()) {
if (mod->isAdder()) descr += "; (+" + QString("%1").arg(mod->points(Modifier::NoStore).points) + " pts) ";
else descr += "; (+" + mod->fraction(true).toString() + ") ";
descr += mod->description(false);
}
for (const auto& mod: pe->limitationsList()) descr += "; (-" + mod->fraction(Modifier::NoStore).abs().toString() + ") " + mod->description(false);
Fraction pts(pe->real(advtg, modif, limit).points);
if (pts.toInt() == 0 && !pe->isEquipment()) pts = Fraction(1);
Sheet::ref().setCell(tbl, row, 0, descr.isEmpty() ? "" : QString("%1").arg(pts.toInt()), font);
Sheet::ref().setCell(tbl, row, 1, pe->nickname(), italic);
Sheet::ref().setCell(tbl, row, 2, descr.isEmpty() ? "" : QString("%1) %2").arg(r).arg(descr), font, Sheet::WordWrap);
QString end = pe->end();
if (end == "-") end = "";
Sheet::ref().setCell(tbl, row, 3, end, font);
points += Points(pts.toInt());
pe->row(row);
++row;
if (!descr.isEmpty()) ++r;
}
#endif
return points;
}
Points display(QString& out) override {
Points points = 0_cp;
auto limit = limitations();
auto advtg = advantages();
auto modif = modifiers();
int r = 1;
for (const auto& pe: super()._powers) {
QString descr = pe->description();
if (descr == "-") descr = "";
if (!descr.isEmpty()) {
pe->parent(this);
for (const auto& mod: pe->advantagesList()) {
if (mod->isAdder()) descr += "; (+" + QString("%1").arg(mod->points(Modifier::NoStore).points) + " pts) ";
else descr += "; (+" + mod->fraction(true).toString() + ") ";
descr += mod->description(false);
}
for (const auto& mod: pe->limitationsList()) descr += "; (-" + mod->fraction(Modifier::NoStore).abs().toString() + ") " + mod->description(false);
Fraction pts(pe->real(advtg, modif, limit).points);
if (pts.toInt() == 0 && !pe->isEquipment()) pts = Fraction(1);
out += QString("%1\t").arg(pts.toInt(), 3);
out += QString("%1) %2%3").arg(r).arg(pe->nickname().isEmpty() ? "" : "(" + pe->nickname() + ") ", descr);
QString end = pe->end();
if (end == "-") end = "";
out += QString("%1").arg(end.isEmpty() ? "" : " [" + end +"]");
points += Points(pts.toInt());
}
out += "\n";
if (!descr.isEmpty()) ++r;
}
return points;
}
private:
struct vars { };
QString optOut(bool) {
QString res = "Group";
return res;
}
};
class Multipower: public FrameworkPowers {
public:
Multipower(): FrameworkPowers("Multipower") { }
Multipower(const Multipower& s): FrameworkPowers(s) { }
Multipower(Multipower&& s): FrameworkPowers(s) { }
Multipower(const QJsonObject& json): FrameworkPowers(json) { v._points = json["points"].toInt(0);
}
~Multipower() override { }
Multipower& operator=(const Multipower& s) {
if (this != &s) v = s.v;
return *this;
}
Multipower& operator=(Multipower&& s) {
v = s.v;
return *this;
}
bool isMultipower() override { return true; }
bool isValid(shared_ptr<Power> power) override {
if (power->isEquipment()) return false;
auto points = power->acting();
return points <= v._points;
}
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 { FrameworkPowers::form(parent, layout);
pnts = createLineEdit(parent, layout, "Points in the pool?", std::mem_fn(&Power::numeric));
}
Fraction lim() override { return Fraction(0); }
Points points(bool noStore = false) override { if (!noStore) store();
return Points(v._points); }
void restore() override { vars s = v;
FrameworkPowers::restore();
pnts->setText(QString("%1").arg(s._points));
v = s;
}
void store() override { FrameworkPowers::store();
v._points = pnts->text().toInt();
}
QJsonObject toJson() const override { QJsonObject obj = FrameworkPowers::toJson();
obj["points"] = v._points;
return obj;
}
Points display(int& row, QTableWidget* tbl) override {
Points points = 0_cp;
QFont font = tbl->font();
QFont italic = font;
italic.setItalic(true);
int r = 1;
auto limit = limitations();
auto advtg = advantages();
auto modif = modifiers();
for (const auto& pe: FrameworkPowers::super()._powers) {
QString descr = pe->description();
if (descr == "-") descr = "";
pe->parent(this);
for (const auto& mod: pe->advantagesList()) {
if (mod->isAdder()) descr += "; (+" + QString("%1").arg(mod->points(Modifier::NoStore).points) + " pts) ";
else descr += "; (+" + mod->fraction(true).toString() + ") ";
descr += mod->description(false);
}
for (const auto& mod: pe->limitationsList()) descr += "; (-" + mod->fraction(Modifier::NoStore).abs().toString() + ") " + mod->description(false);
Fraction cost(pe->real().points);
Fraction pts(pe->real(advtg, modif, limit).points);
if (pe->varying()) pts = pts / 5; // NOLINT
else pts = pts / 10; // NOLINT
if (pts.toInt(true) == 0) pts = Fraction(1);
#ifndef ISHSC
Sheet::ref().setCell(tbl, row, 0, descr.isEmpty() ? "" : QString("%1%2").arg(pts.toInt(true)).arg(pe->varying() ? "v" : "f"), font);
Sheet::ref().setCell(tbl, row, 1, " " + pe->nickname(), italic);
Sheet::ref().setCell(tbl, row, 2, descr.isEmpty() ? "" : QString("%1) [%3] %2").arg(r).arg(descr).arg(cost.toInt(true)), font, Sheet::WordWrap);
#endif
QString end = pe->end();
if (end == "-") end = "";
#ifndef ISHSC
Sheet::ref().setCell(tbl, row, 3, end, font);
#endif
points += Points(pts.toInt(true));
pe->row(row);
++row;
if (!descr.isEmpty()) ++r;
}
return points;
}
Points display(QString& out) override {
Points points = 0_cp;
int r = 1;
auto limit = limitations();
auto advtg = advantages();
auto modif = modifiers();
for (const auto& pe: FrameworkPowers::super()._powers) {
QString descr = pe->description();
if (descr == "-") descr = "";
pe->parent(this);
for (const auto& mod: pe->advantagesList()) {
if (mod->isAdder()) descr += "; (+" + QString("%1").arg(mod->points(Modifier::NoStore).points) + " pts) ";
else descr += "; (+" + mod->fraction(true).toString() + ") ";
descr += mod->description(false);
}
for (const auto& mod: pe->limitationsList()) descr += "; (-" + mod->fraction(Modifier::NoStore).abs().toString() + ") " + mod->description(false);
Points pnts(pe->real());
Fraction pts(pe->real(advtg, modif, limit).points);
if (pe->varying()) pts = pts / 5; // NOLINT
else pts = pts / 10; // NOLINT
if (pts.toInt() == 0) pts = Fraction(1);
if (!descr.isEmpty()) {
out += QString("%1%2\t").arg(pts.toInt(), 3).arg(pe->varying() ? "v" : "f");
out += QString("%1) [%4] %2%3").arg(r).arg(pe->nickname().isEmpty() ? "" : "(" + pe->nickname() + ") ", descr).arg(pnts.points);
QString end = pe->end();
if (end == "-") end = "";
out += QString("%1").arg(end.isEmpty() ? "" : " [" + end +"]");
points += Points(pts.toInt());
}
out += "\n";
if (!descr.isEmpty()) ++r;
}
return points;
}
private:
struct vars {
int _points = 0;
} v;
QLineEdit* pnts = nullptr;
QString optOut(bool) {
QString res = "Multipower Pool " + QString("(%1 cp)").arg(v._points);
return res;
}
void numeric(int) override {
QLineEdit* edit = dynamic_cast<QLineEdit*>(sender());
QString txt = edit->text();
#ifndef ISHSC
PowerDialog::ref().updateForm();
#endif
if (txt.isEmpty() || isNumber(txt)) return;
edit->undo();
}
};
class VPP: public FrameworkPowers {
public:
VPP(): FrameworkPowers("Variable Power Pool") { }
VPP(const VPP& s): FrameworkPowers(s) { }
VPP(VPP&& s): FrameworkPowers(s) { }
VPP(const QJsonObject& json): FrameworkPowers(json) { v._pool = json["pool"].toInt(0);
v._control = json["control"].toInt(0);
v._time = json["time"].toInt(0);
v._noSkill = json["noSkill"].toBool(false);
v._given = json["given"].toBool(false);
v._circ = json["circ"].toString();
v._how = json["how"].toBool(false);
v._when2 = json["when2"].toBool(false);
v._class = json["class"].toInt(0);
v._what = json["what"].toString();
v._one = json["one"].toInt(0);
v._power = json["power"].toString();
}
~VPP() override { }
VPP& operator=(const VPP& s) {
if (this != &s) v = s.v;
return *this;
}
VPP& operator=(VPP&& s) {
v = s.v;
return *this;
}
bool isVPP() override { return true; }
bool isValid(shared_ptr<Power> power) override {
if (power->isEquipment()) return false;
return power->acting() <= v._control && power->real() <= v._pool;
}
Points pool() override { return Points(v._pool); }
Fraction adv() override { return ((v._time > 3) ? Fraction(1, 2) * (v._time - 3) : Fraction(0)) +
(v._noSkill ? Fraction(1) : Fraction(0)); }
QString description(bool showEND = false) override { return optOut(showEND); }
QString end() override { return noEnd(); }
void form(QWidget* parent, QVBoxLayout* layout) override { FrameworkPowers::form(parent, layout);
Pool = createLineEdit(parent, layout, "Points in the pool?", std::mem_fn(&Power::numeric));
ctrl = createLineEdit(parent, layout, "Control cost?", std::mem_fn(&Power::numeric));
time = createComboBox(parent, layout, "Powers Can be Changed?", {
"VPP Can Only Be Changed Between Adventures",
"VPP Can Only Be Changed Between Scenes",
"Full Action",
"Powers Can be Changed As A Half-Phase Action",
"Powers Can be Changed As A Zero Phase Action" });
skll = createCheckBox(parent, layout, "No Skill Roll Required");
givn = createCheckBox(parent, layout, "VPP Can Only Be Changed In A Given Circumstance");
circ = createLineEdit(parent, layout, "Circumtances?");
how = createCheckBox(parent, layout, "Character Has No Choice Regarding How Powers Change");
whn2 = createCheckBox(parent, layout, "Character Has No Choice Regarding When Powers Change");
clss = createComboBox(parent, layout, "Limited Class Of Powers?", {
"Unlimited",
"Slightly Limited Class Of Powers",
"Limited Class Of Powers",
"Very Limited Class Of Powers" });
what = createLineEdit(parent, layout, "What Class?");
one = createComboBox(parent, layout, "One Type Of Power?", {
"All Powers",
"Very Useful Power",
"Useful Power",
"Almost Useless Power" });
powr = createLineEdit(parent, layout, "What Power?");
}
Fraction lim() override { return ((v._time >= 0 && v._time <= 1) ? 1 - Fraction(1, 2) * v._time : Fraction(0)) +
(v._given ? Fraction(1, 2) : Fraction(0)) +
(v._how ? Fraction(1, 2) : Fraction(0)) +
(v._when2 ? Fraction(1, 2) : Fraction(0)) +
((v._class == 1) ? Fraction(1, 4) : Fraction(0)) +
((v._class == 2) ? Fraction(1, 2) : Fraction(0)) +
((v._class == 3) ? Fraction(1) : Fraction(0)) +
((v._one == 1) ? Fraction(1, 2) : Fraction(0)) +
((v._one == 2) ? Fraction(1) : Fraction(0)) +
((v._one == 3) ? Fraction(1, Fraction(1, 2)) : Fraction(0)); }
Points points(bool noStore = false) override { if (!noStore) store();
return (v._control + 1_cp) / 2; }
void restore() override { vars s = v;
FrameworkPowers::restore();
Pool->setText(QString("%1").arg(s._pool));
ctrl->setText(QString("%1").arg(s._control));
time->setCurrentIndex(s._time);
skll->setChecked(s._noSkill);
givn->setChecked(s._given);
circ->setText(s._circ);
how->setChecked(s._how);
whn2->setChecked(s._when2);
clss->setCurrentIndex(v._class);
what->setText(v._what);
one->setCurrentIndex(v._one);
powr->setText(v._power);
v = s;
}
void store() override { FrameworkPowers::store();
v._pool = Pool->text().toInt();
v._control = ctrl->text().toInt();
v._time = time->currentIndex();
v._noSkill = skll->isChecked();
v._given = givn->isChecked();
v._circ = circ->text();
v._how = how->isChecked();
v._when2 = whn2->isChecked();
v._class = clss->currentIndex();
v._what = what->text();
v._one = one->currentIndex();
v._power = powr->text();
}
QJsonObject toJson() const override { QJsonObject obj = FrameworkPowers::toJson();
obj["pool"] = v._pool;
obj["control"] = v._control;
obj["time"] = v._time;
obj["noSkill"] = v._noSkill;
obj["given"] = v._given;
obj["circ"] = v._circ;
obj["how"] = v._how;
obj["when2"] = v._when2;
obj["class"] = v._class;
obj["what"] = v._what;
obj["one"] = v._one;
obj["power"] = v._power;
return obj;
}
Points display(int& row, QTableWidget* tbl) override {
Points points = 0_cp;
QFont font = tbl->font();
QFont italic = font;
italic.setItalic(true);
int r = 1;
auto limit = limitations() - lim();
auto advtg = advantages() - adv();
auto modif = modifiers();
for (const auto& pe: FrameworkPowers::super()._powers) {
if (pe == nullptr) continue;
QString descr = pe->description();
if (descr == "-") descr = "";
pe->parent(this);
for (const auto& mod: pe->advantagesList()) {
if (mod->isAdder()) descr += "; (+" + QString("%1").arg(mod->points(Modifier::NoStore).points) + " pts) ";
else descr += "; (+" + mod->fraction(true).toString() + ") ";
descr += mod->description(false);
}
for (const auto& mod: pe->limitationsList()) descr += "; (-" + mod->fraction(Modifier::NoStore).abs().toString() + ") " + mod->description(false);
Fraction pts(pe->real(advtg, modif, limit).points);
if (pts.toInt() == 0 && !descr.isEmpty()) pts = Fraction(1);
#ifndef ISHSC
Sheet::ref().setCell(tbl, row, 0, "", font);
Sheet::ref().setCell(tbl, row, 1, pe->nickname(), italic);
if (descr.isEmpty()) Sheet::ref().setCell(tbl, row, 2, "", font, Sheet::WordWrap);
else Sheet::ref().setCell(tbl, row, 2, QString("%1) [%3] %2").arg(r).arg(descr).arg(pts.toInt()), font, Sheet::WordWrap);
#endif
QString end = pe->end();
if (end == "-") end = "";
#ifndef ISHSC
Sheet::ref().setCell(tbl, row, 3, end, font);
#endif
pe->row(row);
++row;
if (!descr.isEmpty()) ++r;
}
return points;
}
Points display(QString& out) override {
Points points = 0_cp;
int r = 1;
auto limit = limitations() - lim();
auto advtg = advantages() - adv();
auto modif = modifiers();
for (const auto& pe: FrameworkPowers::super()._powers) {
QString descr = pe->description();
if (descr == "-") descr = "";
pe->parent(this);
for (const auto& mod: pe->advantagesList()) {
if (mod->isAdder()) descr += "; (+" + QString("%1").arg(mod->points(Modifier::NoStore).points) + " pts) ";
else descr += "; (+" + mod->fraction(true).toString() + ") ";
descr += mod->description(false);
}
for (const auto& mod: pe->limitationsList()) descr += "; (-" + mod->fraction(Modifier::NoStore).abs().toString() + ") " + mod->description(false);
Fraction pts(0);
if (!descr.isEmpty()) {
pts = Fraction(pe->real(advtg, modif, limit).points);
if (pts.toInt() == 0 && !descr.isEmpty()) pts = Fraction(1);
out += "\t";
out += QString("%1) [%3] %4%2").arg(r).arg(descr).arg(pts.toInt()).arg(pe->nickname().isEmpty() ? "" : "(" + pe->nickname() + ") ");
QString end = pe->end();
if (end == "-") end = "";
out += QString("%1").arg(end.isEmpty() ? "" : " [" + end + "]");
}
out += "\n";
if (!descr.isEmpty()) ++r;
}
return points;
}
private:
struct vars {
int _pool = 0;
int _control = 0;
int _time = -1;
bool _noSkill = false;
bool _given = false;
QString _circ = "";
bool _how = false;
bool _when2 = false;
int _class = -1;
QString _what = "";
int _one = -1;
QString _power = "";
} v;
QLineEdit* Pool = nullptr;
QLineEdit* ctrl = nullptr;
QComboBox* time = nullptr;
QCheckBox* skll = nullptr;
QCheckBox* givn = nullptr;
QLineEdit* circ = nullptr;
QCheckBox* how = nullptr;
QCheckBox* whn2 = nullptr;
QComboBox* clss = nullptr;
QLineEdit* what = nullptr;
QComboBox* one = nullptr;
QLineEdit* powr = nullptr;
QString optOut(bool showEND) {
QString res;
if (showEND) res = nickname().isEmpty() ? "" : nickname() + " ";
res += QString("VPP (%1 cp, %2 cp Control)").arg(v._pool).arg(v._control);
QStringList time {
"VPP Can Only Be Changed Between Adventures", "VPP Can Only Be Changed Between Scenes", "Full Action", "Powers Can be Changed As A Half-Phase Action",
"Powers Can be Changed As A Zero Phase Action" };
if (v._time >= 0 && v._time != 2) res += "; " + time[v._time];
if (v._noSkill) res += "; No Skill Roll Required";
if (v._given) res += "; Powers Can Only Be Changed When " + v._circ;
if (v._how) res += "; Character Has No Control Over How Powers Change";
if (v._when2) res += "; Character Has No Control Over When Powers Change";
QStringList clss {
"", "Slightly Limited Class Of Powers",
"Limited Class Of Powers",
"Very Limited Class Of Powers" };
if (v._class > 0) res += "; " + clss[v._class] + " - " + v._what;
if (v._one > 0) res += "; One Type Of Power - " + v._power;
return res;
}
void numeric(int) override {
QLineEdit* edit = dynamic_cast<QLineEdit*>(sender());
QString txt = edit->text();
#ifndef ISHSC
PowerDialog::ref().updateForm();
#endif
if (txt.isEmpty() || isNumber(txt)) return;
edit->undo();
}
};
#endif // FRAMEWORKPOWERS_H