blob: d10d17fab9120522ae4f5efe9721d11fec3eebe9 (
plain)
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
|
#pragma once
#include "h-basic.h"
/**
* Object theme. Probability in percent for each class of
* objects to be dropped.
*/
struct obj_theme
{
byte treasure = 0;
byte combat = 0;
byte magic = 0;
byte tools = 0;
bool operator == (obj_theme const &other) const
{
return
(treasure == other.treasure) &&
(combat == other.combat) &&
(magic == other.magic) &&
(tools == other.tools);
}
bool operator != (obj_theme const &other) const
{
return !(*this == other);
}
static constexpr obj_theme no_theme()
{
return equal_spread(100);
}
static constexpr obj_theme defaults()
{
return equal_spread(20);
}
private:
static constexpr obj_theme equal_spread(byte v)
{
obj_theme ot;
ot.treasure = v;
ot.combat = v;
ot.magic = v;
ot.tools = v;
return ot;
}
};
|