1 /**
2  * \file mon-lore.h
3  * \brief Structures and functions for monster recall.
4  *
5  * Copyright (c) 1997-2007 Ben Harrison, James E. Wilson, Robert A. Koeneke
6  *
7  * This work is free software; you can redistribute it and/or modify it
8  * under the terms of either:
9  *
10  * a) the GNU General Public License as published by the Free Software
11  *    Foundation, version 2, or
12  *
13  * b) the "Angband licence":
14  *    This software may be copied and distributed for educational, research,
15  *    and not for profit purposes provided that this copyright and statement
16  *    are included in all such copies.  Other copyrights may also apply.
17  */
18 
19 #ifndef MONSTER_LORE_H
20 #define MONSTER_LORE_H
21 
22 #include "z-textblock.h"
23 #include "monster.h"
24 
25 /**
26  * Monster "lore" information
27  */
28 typedef struct monster_lore
29 {
30 	int ridx;				/* Index of monster race */
31 
32 	u16b sights;			/* Count sightings of this monster */
33 	u16b deaths;			/* Count deaths from this monster */
34 
35 	u16b pkills;			/* Count monsters killed in this life */
36 	u16b thefts;			/* Count objects stolen in this life */
37 	u16b tkills;			/* Count monsters killed in all lives */
38 
39 	byte wake;				/* Number of times woken up (?) */
40 	byte ignore;			/* Number of times ignored (?) */
41 
42 	byte drop_gold;			/* Max number of gold dropped at once */
43 	byte drop_item;			/* Max number of item dropped at once */
44 
45 	byte cast_innate;		/* Max number of innate spells seen */
46 	byte cast_spell;		/* Max number of other spells seen */
47 
48 	struct monster_blow *blows; /* Knowledge of blows */
49 
50 	bitflag flags[RF_SIZE]; /* Observed racial flags - a 1 indicates
51 	                         * the flag (or lack thereof) is known to
52 	                         * the player */
53 	bitflag spell_flags[RSF_SIZE];  /* Observed racial spell flags */
54 
55 	struct monster_drop *drops;
56     struct monster_friends *friends;
57 	struct monster_friends_base *friends_base;
58 	struct monster_mimic *mimic_kinds;
59 
60 	/* Derived known fields, put here for simplicity */
61 	bool all_known;
62 	bool *blow_known;
63 	bool armour_known;
64 	bool drop_known;
65 	bool sleep_known;
66 	bool spell_freq_known;
67 	bool innate_freq_known;
68 } monster_lore;
69 
70 /**
71  * Array[z_info->r_max] of monster lore
72  */
73 extern struct monster_lore *l_list;
74 
75 void get_attack_colors(int *melee_colors);
76 void lore_append_kills(textblock *tb, const struct monster_race *race,
77 					   const struct monster_lore *lore,
78 					   const bitflag known_flags[RF_SIZE]);
79 void lore_append_flavor(textblock *tb, const struct monster_race *race);
80 void lore_append_movement(textblock *tb, const struct monster_race *race,
81 						  const struct monster_lore *lore,
82 						  bitflag known_flags[RF_SIZE]);
83 void lore_append_toughness(textblock *tb, const struct monster_race *race,
84 						   const struct monster_lore *lore,
85 						   bitflag known_flags[RF_SIZE]);
86 void lore_append_exp(textblock *tb, const struct monster_race *race,
87 					 const struct monster_lore *lore,
88 					 bitflag known_flags[RF_SIZE]);
89 void lore_append_drop(textblock *tb, const struct monster_race *race,
90 					  const struct monster_lore *lore,
91 					  bitflag known_flags[RF_SIZE]);
92 void lore_append_abilities(textblock *tb, const struct monster_race *race,
93 						   const struct monster_lore *lore,
94 						   bitflag known_flags[RF_SIZE]);
95 void lore_append_awareness(textblock *tb, const struct monster_race *race,
96 						   const struct monster_lore *lore,
97 						   bitflag known_flags[RF_SIZE]);
98 void lore_append_friends(textblock *tb, const struct monster_race *race,
99 						 const struct monster_lore *lore,
100 						 bitflag known_flags[RF_SIZE]);
101 void lore_append_spells(textblock *tb, const struct monster_race *race,
102 						const struct monster_lore *lore,
103 						bitflag known_flags[RF_SIZE]);
104 void lore_append_attack(textblock *tb, const struct monster_race *race,
105 						const struct monster_lore *lore,
106 						bitflag known_flags[RF_SIZE]);
107 
108 void lore_learn_spell_if_has(struct monster_lore *lore, const struct monster_race *race, int flag);
109 void lore_learn_spell_if_visible(struct monster_lore *lore, const struct monster *mon, int flag);
110 void lore_learn_flag_if_visible(struct monster_lore *lore, const struct monster *mon, int flag);
111 
112 void lore_update(const struct monster_race *race, struct monster_lore *lore);
113 void cheat_monster_lore(const struct monster_race *race,
114 						struct monster_lore *lore);
115 void wipe_monster_lore(const struct monster_race *race,
116 					   struct monster_lore *lore);
117 void lore_do_probe(struct monster *m);
118 bool lore_is_fully_known(const struct monster_race *race);
119 void monster_flags_known(const struct monster_race *race,
120 						 const struct monster_lore *lore,
121 						 bitflag flags[RF_SIZE]);
122 void lore_treasure(struct monster *mon, int num_item, int num_gold);
123 struct monster_lore *get_lore(const struct monster_race *race);
124 bool lore_save(const char *name);
125 
126 #endif /* MONSTER_LORE_H */
127