3 * Summary: Tracks monsters the player has killed.
4 * Written by: Darshan Shaligram
20 // Not intended for external use!
21 struct kill_monster_desc
23 kill_monster_desc(const monster
*);
24 kill_monster_desc() { }
26 void save(writer
&) const;
31 M_NORMAL
, M_ZOMBIE
, M_SKELETON
, M_SIMULACRUM
, M_SPECTRE
,
32 M_SHAPESHIFTER
, // A shapeshifter pretending to be 'monnum'
35 int monnum
; // Number of the beast
36 name_modifier modifier
; // Nature of the beast
40 bool operator () (const kill_monster_desc
&m1
,
41 const kill_monster_desc
&m2
) const
43 return (m1
.monnum
< m2
.monnum
44 || (m1
.monnum
== m2
.monnum
&& m1
.modifier
< m2
.modifier
));
49 #define PLACE_LIMIT 5 // How many unique kill places we're prepared to track
53 kill_def(const monster
* mon
);
54 kill_def() : kills(0), exp(0)
56 // This object just says to the world that it's uninitialised
59 void save(writer
&) const;
62 void add_kill(const monster
* mon
, unsigned short place
);
63 void add_place(unsigned short place
, bool force
= false);
65 void merge(const kill_def
&k
, bool unique_monster
);
67 std::string
info(const kill_monster_desc
&md
) const;
68 std::string
base_name(const kill_monster_desc
&md
) const;
70 unsigned short kills
; // How many kills does the player have?
71 int exp
; // Experience gained for slaying the beast.
72 // Only set *once*, even for shapeshifters.
74 std::vector
<unsigned short> places
; // Places where we've killed the beast.
76 std::string
append_places(const kill_monster_desc
&md
,
77 const std::string
&name
) const;
80 // Ghosts and random Pandemonium demons.
84 kill_ghost(const monster
* mon
);
87 void save(writer
&) const;
90 std::string
info() const;
92 std::string ghost_name
;
97 // This is the structure that Lua sees.
102 std::string base_name
;
105 int monnum
; // Number of the beast
106 int modifier
; // Nature of the beast
108 std::vector
<unsigned short> places
;
110 kill_exp(const kill_def
&k
, const kill_monster_desc
&md
)
111 : nkills(k
.kills
), exp(k
.exp
), base_name(k
.base_name(md
)),
113 monnum(md
.monnum
), modifier(md
.modifier
)
118 kill_exp(const kill_ghost
&kg
)
119 : nkills(1), exp(kg
.exp
), base_name(), desc(kg
.info()),
120 monnum(-1), modifier(0)
122 places
.push_back(kg
.place
);
125 // operator< is implemented for a descending sort.
126 bool operator < (const kill_exp
&b
) const
128 return exp
== b
.exp
? (base_name
< b
.base_name
) : (exp
> b
.exp
);
135 void record_kill(const monster
* mon
);
136 void merge(const Kills
&k
);
139 void save(writer
&) const;
142 int get_kills(std::vector
<kill_exp
> &v
) const;
143 int num_kills(const monster
* mon
) const;
145 typedef std::map
<kill_monster_desc
,
147 kill_monster_desc::less_than
> kill_map
;
148 typedef std::vector
<kill_ghost
> ghost_vec
;
153 void record_ghost_kill(const monster
* mon
);
160 KillMaster(const KillMaster
& other
);
163 void record_kill(const monster
* mon
, int killer
, bool ispet
);
166 void save(writer
&) const;
169 // Number of kills, by category.
170 int num_kills(const monster
* mon
, kill_category cat
) const;
171 // Number of kills, any category.
172 int num_kills(const monster
* mon
) const;
174 int total_kills() const;
176 std::string
kill_info() const;
178 const char *category_name(kill_category kc
) const;
180 Kills categorized_kills
[KC_NCATEGORIES
];
182 void add_kill_info(std::string
&, std::vector
<kill_exp
> &,
183 int count
, const char *c
, bool separator
)
187 enum KILL_DUMP_OPTIONS
189 KDO_NO_PLACES
, // Don't dump places at all
190 KDO_ONE_PLACE
, // Show places only for single kills and uniques.
191 KDO_ALL_PLACES
, // Show all available place information