Angband
Data Structures | Typedefs | Functions | Variables
mon-lore.h File Reference

Structures and functions for monster recall. More...

#include "z-textblock.h"
#include "monster.h"

Go to the source code of this file.

Data Structures

struct  monster_lore
 Monster "lore" information. More...
 

Typedefs

typedef struct monster_lore monster_lore
 Monster "lore" information. More...
 

Functions

void get_attack_colors (int *melee_colors)
 
void lore_append_kills (textblock *tb, const struct monster_race *race, const struct monster_lore *lore, const bitflag known_flags[RF_SIZE])
 Append the kill history to a texblock for a given monster race. More...
 
void lore_append_flavor (textblock *tb, const struct monster_race *race, bool append_utf8)
 Append the monster race description to a textblock. More...
 
void lore_append_movement (textblock *tb, const struct monster_race *race, const struct monster_lore *lore, bitflag known_flags[RF_SIZE])
 Append the monster type, location, and movement patterns to a textblock. More...
 
void lore_append_toughness (textblock *tb, const struct monster_race *race, const struct monster_lore *lore, bitflag known_flags[RF_SIZE])
 Append the monster AC, HP, and hit chance to a textblock. More...
 
void lore_append_exp (textblock *tb, const struct monster_race *race, const struct monster_lore *lore, bitflag known_flags[RF_SIZE])
 Append the experience value description to a textblock. More...
 
void lore_append_drop (textblock *tb, const struct monster_race *race, const struct monster_lore *lore, bitflag known_flags[RF_SIZE])
 Append the monster drop description to a textblock. More...
 
void lore_append_abilities (textblock *tb, const struct monster_race *race, const struct monster_lore *lore, bitflag known_flags[RF_SIZE])
 Append the monster abilities (resists, weaknesses, other traits) to a textblock. More...
 
void lore_append_awareness (textblock *tb, const struct monster_race *race, const struct monster_lore *lore, bitflag known_flags[RF_SIZE])
 Append how the monster reacts to intruders and at what distance it does so. More...
 
void lore_append_friends (textblock *tb, const struct monster_race *race, const struct monster_lore *lore, bitflag known_flags[RF_SIZE])
 Append information about what other races the monster appears with and if they work together. More...
 
void lore_append_spells (textblock *tb, const struct monster_race *race, const struct monster_lore *lore, bitflag known_flags[RF_SIZE])
 Append the monster's attack spells to a textblock. More...
 
void lore_append_attack (textblock *tb, const struct monster_race *race, const struct monster_lore *lore, bitflag known_flags[RF_SIZE])
 Append the monster's melee attacks to a textblock. More...
 
void lore_learn_spell_if_has (struct monster_lore *lore, const struct monster_race *race, int flag)
 
void lore_learn_spell_if_visible (struct monster_lore *lore, const struct monster *mon, int flag)
 
void lore_learn_flag_if_visible (struct monster_lore *lore, const struct monster *mon, int flag)
 
void lore_update (const struct monster_race *race, struct monster_lore *lore)
 Update which bits of lore are known. More...
 
void cheat_monster_lore (const struct monster_race *race, struct monster_lore *lore)
 Learn everything about a monster. More...
 
void wipe_monster_lore (const struct monster_race *race, struct monster_lore *lore)
 Forget everything about a monster. More...
 
void lore_do_probe (struct monster *m)
 Learn about a monster (by "probing" it) More...
 
bool lore_is_fully_known (const struct monster_race *race)
 Determine whether the monster is fully known. More...
 
void monster_flags_known (const struct monster_race *race, const struct monster_lore *lore, bitflag flags[RF_SIZE])
 Copies into flags the flags of the given monster race that are known to the given lore structure (usually the player's knowledge). More...
 
void lore_treasure (struct monster *mon, int num_item, int num_gold)
 Take note that the given monster just dropped some treasure. More...
 
struct monster_loreget_lore (const struct monster_race *race)
 Get the lore record for this monster race. More...
 
bool lore_save (const char *name)
 Save the lore to a file in the user directory. More...
 

Variables

struct monster_lorel_list
 Array[z_info->r_max] of monster lore. More...
 

Detailed Description

Structures and functions for monster recall.

Copyright (c) 1997-2007 Ben Harrison, James E. Wilson, Robert A. Koeneke

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Typedef Documentation

typedef struct monster_lore monster_lore

Monster "lore" information.

Function Documentation

void cheat_monster_lore ( const struct monster_race race,
struct monster_lore lore 
)

Learn everything about a monster.

Sets the all_known variable, all flags and all relevant spell flags.

References monster_lore::all_known, monster_lore::flags, lore_update(), rf_setall, rsf_copy, monster_lore::spell_flags, and monster_race::spell_flags.

Referenced by get_debug_command(), and lore_description().

void get_attack_colors ( int melee_colors)
struct monster_lore* get_lore ( const struct monster_race race)
void lore_append_abilities ( textblock tb,
const struct monster_race race,
const struct monster_lore lore,
bitflag  known_flags[RF_SIZE] 
)

Append the monster abilities (resists, weaknesses, other traits) to a textblock.

Known race flags are passed in for simplicity/efficiency. Note the macros that are used to simplify the code.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
loreis the known information about the monster race.
known_flagsis the preprocessed bitfield of race flags known to the player.

References COLOUR_L_UMBER, COLOUR_ORANGE, COLOUR_VIOLET, COLOUR_WHITE, create_mon_flag_mask(), describe_race_flag(), flag, FLAG_START, monster_lore::flags, format(), lore_append_clause(), lore_monster_sex(), lore_pronoun_nominative(), lore_pronoun_possessive(), MON_SEX_NEUTER, my_strcpy(), prev, rf_has, rf_inter, rf_is_empty, rf_next, rf_off, rf_on, RF_SIZE, rf_wipe, RFT_ALTER, RFT_DET, RFT_MAX, RFT_PROT, RFT_RES, RFT_VULN, RFT_VULN_I, start, streq, textblock_append(), and textblock_append_c().

Referenced by lore_description().

void lore_append_attack ( textblock tb,
const struct monster_race race,
const struct monster_lore lore,
bitflag  known_flags[RF_SIZE] 
)

Append the monster's melee attacks to a textblock.

Known race flags are passed in for simplicity/efficiency.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
loreis the known information about the monster race.
known_flagsis the preprocessed bitfield of race flags known to the player.
melee_colorsis a list of colors that is associated with each blow effect.

References random::base, monster_race::blow, blow_color(), blow_index(), monster_lore::blow_known, COLOUR_L_GREEN, blow_method::desc, blow_effect::desc, random::dice, monster_blow::dice, monster_blow::effect, i, index, lore_monster_sex(), lore_pronoun_nominative(), lore_pronoun_possessive(), random::m_bonus, monster_blow::method, angband_constants::mon_blows_max, MON_SEX_NEUTER, blow_effect::name, NULL, rf_has, random::sides, textblock_append(), textblock_append_c(), and z_info.

Referenced by lore_description().

void lore_append_awareness ( textblock tb,
const struct monster_race race,
const struct monster_lore lore,
bitflag  known_flags[RF_SIZE] 
)

Append how the monster reacts to intruders and at what distance it does so.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
loreis the known information about the monster race.
known_flagsis the preprocessed bitfield of race flags known to the player.

References COLOUR_L_BLUE, monster_race::hearing, lore_describe_awareness(), lore_monster_sex(), lore_pronoun_nominative(), MON_SEX_NEUTER, monster_race::sleep, monster_lore::sleep_known, textblock_append(), and textblock_append_c().

Referenced by lore_description().

void lore_append_drop ( textblock tb,
const struct monster_race race,
const struct monster_lore lore,
bitflag  known_flags[RF_SIZE] 
)

Append the monster drop description to a textblock.

Known race flags are passed in for simplicity/efficiency.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
loreis the known information about the monster race.
known_flagsis the preprocessed bitfield of race flags known to the player.

References COLOUR_BLUE, monster_lore::drop_known, format(), lore_monster_sex(), lore_pronoun_nominative(), mon_create_drop_count(), MON_SEX_NEUTER, PLURAL, rf_has, textblock_append(), and textblock_append_c().

Referenced by lore_description().

void lore_append_exp ( textblock tb,
const struct monster_race race,
const struct monster_lore lore,
bitflag  known_flags[RF_SIZE] 
)

Append the experience value description to a textblock.

Known race flags are passed in for simplicity/efficiency.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
loreis the known information about the monster race.
known_flagsis the preprocessed bitfield of race flags known to the player.

References buf, COLOUR_BLUE, format(), player::lev, level, monster_race::level, monster_race::mexp, my_strcat(), PLURAL, rf_has, RF_UNIQUE, strnfmt(), textblock_append(), and textblock_append_c().

Referenced by lore_description().

void lore_append_flavor ( textblock tb,
const struct monster_race race,
bool  append_utf8 
)

Append the monster race description to a textblock.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
append_utf8indicates if we should append the flavor text as UTF-8 (which is preferred for spoiler files).

References monster_race::text, textblock_append(), and textblock_append_utf8().

Referenced by lore_description().

void lore_append_friends ( textblock tb,
const struct monster_race race,
const struct monster_lore lore,
bitflag  known_flags[RF_SIZE] 
)

Append information about what other races the monster appears with and if they work together.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
loreis the known information about the monster race.
known_flagsis the preprocessed bitfield of race flags known to the player.

References monster_race::friends, monster_race::friends_base, lore_monster_sex(), lore_pronoun_nominative(), MON_SEX_NEUTER, rf_has, and textblock_append().

Referenced by lore_description().

void lore_append_kills ( textblock tb,
const struct monster_race race,
const struct monster_lore lore,
const bitflag  known_flags[RF_SIZE] 
)

Append the kill history to a texblock for a given monster race.

Known race flags are passed in for simplicity/efficiency.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
loreis the known information about the monster race.
known_flagsis the preprocessed bitfield of race flags known to the player.

References COLOUR_RED, monster_lore::deaths, lore_monster_sex(), lore_pronoun_nominative(), monster_race::max_num, MON_SEX_NEUTER, monster_lore::pkills, rf_has, RF_UNIQUE, textblock_append(), textblock_append_c(), monster_lore::tkills, and VERB_AGREEMENT.

Referenced by lore_description().

void lore_append_movement ( textblock tb,
const struct monster_race race,
const struct monster_lore lore,
bitflag  known_flags[RF_SIZE] 
)

Append the monster type, location, and movement patterns to a textblock.

Known race flags are passed in for simplicity/efficiency.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
loreis the known information about the monster race.
known_flagsis the preprocessed bitfield of race flags known to the player.

References COLOUR_GREEN, COLOUR_L_BLUE, COLOUR_L_GREEN, COLOUR_RED, create_mon_flag_mask(), describe_race_flag(), FLAG_END, FLAG_START, monster_race::flags, flags, flags_test(), monster_race::level, lore_describe_speed(), player::max_depth, rf_has, rf_inter, rf_next, RF_SIZE, RFT_MAX, RFT_RACE_A, RFT_RACE_N, monster_race::speed, textblock_append(), and textblock_append_c().

Referenced by lore_description().

void lore_append_spells ( textblock tb,
const struct monster_race race,
const struct monster_lore lore,
bitflag  known_flags[RF_SIZE] 
)

Append the monster's attack spells to a textblock.

Known race flags are passed in for simplicity/efficiency. Note the macros that are used to simplify the code.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
loreis the known information about the monster race.
known_flagsis the preprocessed bitfield of race flags known to the player.

References monster_lore::armour_known, monster_lore::cast_innate, monster_lore::cast_spell, COLOUR_L_GREEN, COLOUR_L_RED, create_mon_spell_mask(), monster_race::freq_innate, monster_race::freq_spell, lore_append_spell_clause(), lore_monster_sex(), lore_pronoun_nominative(), MON_SEX_NEUTER, rf_has, rsf_copy, rsf_diff, rsf_inter, rsf_is_empty, RSF_SIZE, RST_BREATH, RST_INNATE, RST_NONE, monster_lore::spell_flags, monster_lore::spell_freq_known, textblock_append(), and textblock_append_c().

Referenced by lore_description().

void lore_append_toughness ( textblock tb,
const struct monster_race race,
const struct monster_lore lore,
bitflag  known_flags[RF_SIZE] 
)

Append the monster AC, HP, and hit chance to a textblock.

Known race flags are passed in for simplicity/efficiency.

Parameters
tbis the textblock we are adding to.
raceis the monster race we are describing.
loreis the known information about the monster race.
known_flagsis the preprocessed bitfield of race flags known to the player.

References monster_race::ac, monster_lore::armour_known, monster_race::avg_hp, COLOUR_L_BLUE, equipped_item_by_slot_name(), lore_monster_sex(), lore_pronoun_nominative(), MON_SEX_NEUTER, py_attack_hit_chance(), rf_has, RF_UNIQUE, textblock_append(), and textblock_append_c().

Referenced by lore_description().

void lore_do_probe ( struct monster m)
bool lore_is_fully_known ( const struct monster_race race)
void lore_learn_flag_if_visible ( struct monster_lore lore,
const struct monster mon,
int  flag 
)

References monster_lore::flags, monster_is_visible(), and rf_on.

Referenced by does_resist().

void lore_learn_spell_if_has ( struct monster_lore lore,
const struct monster_race race,
int  flag 
)
void lore_learn_spell_if_visible ( struct monster_lore lore,
const struct monster mon,
int  flag 
)
bool lore_save ( const char *  name)

Save the lore to a file in the user directory.

Parameters
nameis the filename
Returns
true on success, false otherwise.

References ANGBAND_DIR_USER, msg, path, path_build(), text_lines_to_file(), and write_lore_entries().

Referenced by save_game().

void lore_treasure ( struct monster mon,
int  num_item,
int  num_gold 
)

Take note that the given monster just dropped some treasure.

Note that learning the "GOOD"/"GREAT" flags gives information about the treasure (even when the monster is killed for the first time, such as uniques, and the treasure has not been examined yet).

This "indirect" method is used to prevent the player from learning exactly how much treasure a monster can drop from observing only a single example of a drop. This method actually observes how much gold and items are dropped, and remembers that information to be described later by the monster recall code.

References monster_lore::drop_gold, monster_lore::drop_item, monster_lore::flags, get_lore(), player_upkeep::monster_race, PR_MONSTER, monster::race, player_upkeep::redraw, rf_on, and player::upkeep.

Referenced by monster_death().

void lore_update ( const struct monster_race race,
struct monster_lore lore 
)
void monster_flags_known ( const struct monster_race race,
const struct monster_lore lore,
bitflag  flags[RF_SIZE] 
)

Copies into flags the flags of the given monster race that are known to the given lore structure (usually the player's knowledge).

Known flags will be 1 for present, or 0 for not present. Unknown flags will always be 0.

References monster_lore::flags, monster_race::flags, flags, rf_copy, and rf_inter.

Referenced by lore_description().

void wipe_monster_lore ( const struct monster_race race,
struct monster_lore lore 
)

Variable Documentation

struct monster_lore* l_list