-
-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathbuff_info.cpp
More file actions
42 lines (38 loc) · 1.5 KB
/
buff_info.cpp
File metadata and controls
42 lines (38 loc) · 1.5 KB
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
#include "stdafx.h"
#include "buff_info.h"
#include "creature.h"
#include "pretty_archive.h"
void applyMessage(const BuffMessageInfo& msg, const Creature* c) {
msg.visit(
[&](const YouMessage& msg) {
c->you(msg.type, msg.message);
},
[&](const VerbMessage& msg) {
if (auto s1 = msg.secondPerson.text.getReferenceMaybe<TSentence>())
if (auto s2 = msg.thirdPerson.text.getReferenceMaybe<TSentence>())
c->verb(s1->id, s2->id, msg.message);
}
);
}
void serialize(PrettyInputArchive& ar1, BuffMessageInfo& info, const unsigned int) {
string s = ar1.peek();
if (auto l = EnumInfo<MsgType>::fromStringSafe(s)) {
YouMessage msg;
ar1(msg);
info = msg;
} else {
VerbMessage msg;
ar1(msg);
info = msg;
}
}
template <class Archive>
void BuffInfo::serialize(Archive& ar, const unsigned int version) {
ar(NAMED(modifyDamageAttr), OPTION(inheritsFromSteed), OPTION(canWishFor), OPTION(canAbsorb), OPTION(combatConsumable), OPTION(fx), OPTION(defenseMultiplier), OPTION(defenseMultiplierAttr), NAMED(hatedGroupName), NAMED(name), OPTION(addedMessage), OPTION(removedMessage), NAMED(startEffect), NAMED(tickEffect), NAMED(endEffect), OPTION(stacks), OPTION(consideredBad), NAMED(description), OPTION(price), NAMED(color), NAMED(adjective), OPTION(efficiencyMultiplier));
if (version >= 1)
ar(OPTION(specialAttr));
if (version >= 2)
ar(OPTION(hiddenPredicate));
}
SERIALIZABLE(BuffInfo)
template void BuffInfo::serialize(PrettyInputArchive&, unsigned);