-
-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathitem_prefix.h
92 lines (74 loc) · 1.86 KB
/
item_prefix.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
#pragma once
#include "util.h"
#include "effect.h"
#include "spell_id.h"
#include "pretty_archive.h"
#include "lasting_effect.h"
#include "special_attr.h"
#include "attr_type.h"
#include "t_string.h"
class ItemPrefix;
namespace ItemPrefixes {
struct ItemAttrBonus {
AttrType SERIAL(attr);
int SERIAL(value);
COMPARE_ALL(attr, value)
};
struct JoinPrefixes {
vector<ItemPrefix> SERIAL(prefixes);
COMPARE_ALL(prefixes)
};
struct VictimEffect {
double SERIAL(chance);
Effect SERIAL(effect);
COMPARE_ALL(chance, effect)
};
struct AttackerEffect {
Effect SERIAL(effect);
COMPARE_ALL(effect)
};
struct Scale {
double SERIAL(value);
COMPARE_ALL(value)
};
struct Prefix {
TString SERIAL(value);
HeapAllocated<ItemPrefix> SERIAL(prefix);
COMPARE_ALL(value, prefix)
};
struct Suffix {
TString SERIAL(value);
HeapAllocated<ItemPrefix> SERIAL(prefix);
COMPARE_ALL(value, prefix)
};
using AssembledCreatureEffect = Effect;
using LastingEffect = LastingOrBuff;
#define VARIANT_TYPES_LIST\
X(LastingEffect, 0)\
X(VictimEffect, 1)\
X(AttackerEffect, 2)\
X(ItemAttrBonus, 3)\
X(JoinPrefixes, 4)\
X(SpellId, 5)\
X(SpecialAttr, 6)\
X(AssembledCreatureEffect, 7)\
X(Scale, 8)\
X(Prefix, 9)\
X(Suffix, 10)\
#define VARIANT_NAME ItemPrefix
#include "gen_variant.h"
#include "gen_variant_serialize.h"
inline
#include "gen_variant_serialize_pretty.h"
#undef VARIANT_TYPES_LIST
#undef VARIANT_NAME
}
class ItemPrefix : public ItemPrefixes::ItemPrefix {
public:
using ItemPrefixes::ItemPrefix::ItemPrefix;
};
class ItemAttributes;
extern void applyPrefix(const ContentFactory*, const ItemPrefix&, ItemAttributes&);
extern optional<TString> getItemName(const ContentFactory*, const ItemPrefix&);
extern TString getGlyphName(const ContentFactory*, const ItemPrefix&);
extern vector<TString> getEffectDescription(const ContentFactory*, const ItemPrefix&);