blob: 6911f8363ac5fd591debd5fdd5c9cf0e7d576036 (
plain) (
blame)
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
|
#ifndef MON_ENCH_H
#define MON_ENCH_H
#define INFINITE_DURATION 30000
class actor;
class mon_enchant
{
public:
enchant_type ench;
int degree; // The higher the degree, the faster the degree
// decays, but degrees of 1 do not decay -- they
// just run out when the duration does.
int duration, maxduration;
kill_category who; // Source's alignment.
mid_t source; // Who set this enchantment?
public:
mon_enchant(enchant_type e = ENCH_NONE, int deg = 0,
const actor *whose = 0,
int dur = 0);
killer_type killer() const;
int kill_agent() const;
actor* agent() const;
operator string () const;
const char *kill_category_desc(kill_category) const;
void merge_killer(kill_category who, mid_t whos);
void cap_degree();
void set_duration(const monster* mons, const mon_enchant *exist);
bool operator < (const mon_enchant &other) const
{
return ench < other.ench;
}
bool operator == (const mon_enchant &other) const
{
// NOTE: This does *not* check who/degree.
return ench == other.ench;
}
mon_enchant &operator += (const mon_enchant &other);
mon_enchant operator + (const mon_enchant &other) const;
private:
int modded_speed(const monster* mons, int hdplus) const;
int calc_duration(const monster* mons, const mon_enchant *added) const;
};
enchant_type name_to_ench(const char *name);
#endif
|