Angband
Data Structures | Enumerations | Functions
obj-knowledge.h File Reference

Object knowledge. More...

#include "angband.h"
#include "object.h"
#include "player.h"

Go to the source code of this file.

Data Structures

struct  rune
 

Enumerations

enum  rune_variety {
  RUNE_VAR_COMBAT, RUNE_VAR_MOD, RUNE_VAR_RESIST, RUNE_VAR_BRAND,
  RUNE_VAR_SLAY, RUNE_VAR_CURSE, RUNE_VAR_FLAG
}
 
enum  combat_runes { COMBAT_RUNE_TO_A = 0, COMBAT_RUNE_TO_H, COMBAT_RUNE_TO_D, COMBAT_RUNE_MAX }
 

Functions

int max_runes (void)
 

Rune knowledge functions These functions provide details about the rune list for use in

player knowledge screens

More...
 
enum rune_variety rune_variety (size_t i)
 The variety of a rune. More...
 
bool player_knows_rune (struct player *p, size_t i)
 Reports if the player knows a given rune. More...
 
char * rune_name (size_t i)
 The name of a rune. More...
 
char * rune_desc (size_t i)
 The description of a rune. More...
 
quark_t rune_note (size_t i)
 The autoinscription index (if any) of a rune. More...
 
void rune_set_note (size_t i, const char *inscription)
 Set an autoinscription on a rune. More...
 
bool player_knows_brand (struct player *p, int i)
 

Object knowledge predicates

These functions tell how much the player knows about an object

More...
 
bool player_knows_slay (struct player *p, int i)
 Check if a slay is known to the player. More...
 
bool player_knows_curse (struct player *p, int i)
 Check if a curse is known to the player. More...
 
bool player_knows_ego (struct player *p, struct ego_item *ego)
 Check if an ego item type is known to the player. More...
 
bool object_effect_is_known (const struct object *obj)
 Checks whether the player is aware of the object's effect when used. More...
 
bool object_is_known_artifact (const struct object *obj)
 Checks whether the object is known to be an artifact. More...
 
bool object_is_in_store (const struct object *obj)
 Checks whether the object is in a store. More...
 
bool object_has_standard_to_h (const struct object *obj)
 Checks whether the object has the usual to-hit value. More...
 
bool object_has_rune (const struct object *obj, int rune_no)
 Check if an object has a rune. More...
 
bool object_runes_known (const struct object *obj)
 Check if all the runes on an object are known to the player. More...
 
bool object_fully_known (const struct object *obj)
 Check if an object is fully known to the player. More...
 
bool object_flag_is_known (const struct object *obj, int flag)
 Checks whether the player knows whether an object has a given flag. More...
 
bool object_element_is_known (const struct object *obj, int element)
 Checks whether the player knows the given element properties of an object. More...
 
void object_set_base_known (struct object *obj)
 

Object knowledge propagators

These functions transfer player knowledge to objects

More...
 
void object_sense (struct player *p, struct object *obj)
 Gain knowledge based on sensing an object on the floor. More...
 
void object_see (struct player *p, struct object *obj)
 Gain knowledge based on seeing an object on the floor. More...
 
void object_touch (struct player *p, struct object *obj)
 Gain knowledge based on being an the same square as an object. More...
 
void player_know_object (struct player *p, struct object *obj)
 Transfer player object knowledge to an object. More...
 
void update_player_object_knowledge (struct player *p)
 Propagate player knowledge of objects to all objects. More...
 
void player_learn_flag (struct player *p, int flag)
 Learn a flag. More...
 
void player_learn_curse (struct player *p, struct curse *curse)
 Learn a curse. More...
 
void player_learn_innate (struct player *p)
 Learn all innate runes. More...
 
void player_learn_all_runes (struct player *p)
 Learn absolutely everything. More...
 
void equip_learn_on_defend (struct player *p)
 

Functions for learning about equipment properties These functions are for gaining object knowledge from the behaviour of

the player's equipment

More...
 
void equip_learn_on_ranged_attack (struct player *p)
 Learn to-hit bonus on making a ranged attack. More...
 
void equip_learn_on_melee_attack (struct player *p)
 Learn things which happen on making a melee attack. More...
 
void equip_learn_flag (struct player *p, int flag)
 Learn a given object flag on wielded items. More...
 
void equip_learn_element (struct player *p, int element)
 Learn the elemental resistance properties on wielded items. More...
 
void equip_learn_after_time (struct player *p)
 Learn things that would be noticed in time. More...
 
void object_learn_unknown_rune (struct player *p, struct object *obj)
 Learn a random unknown rune from an object. More...
 
void object_learn_on_wield (struct player *p, struct object *obj)
 Learn object properties that become obvious on wielding or wearing. More...
 
void object_learn_on_use (struct player *p, struct object *obj)
 Learn object properties that become obvious on use, mark it as aware and reward the player with some experience. More...
 
void object_learn_brand (struct player *p, struct object *obj, int index)
 Notice any brands on a particular object which affect a particular monster. More...
 
void object_learn_slay (struct player *p, struct object *obj, int index)
 Notice any slays on a particular object which affect a particular monster. More...
 
void missile_learn_on_ranged_attack (struct player *p, struct object *obj)
 Learn attack bonus on making a ranged attack. More...
 
bool easy_know (const struct object *obj)
 

Object kind functions

These deal with knowledge of an object's kind

More...
 
bool object_flavor_is_aware (const struct object *obj)
 Checks whether the player is aware of the object's flavour. More...
 
bool object_flavor_was_tried (const struct object *obj)
 Checks whether the player has tried to use other objects of the same kind. More...
 
void object_flavor_aware (struct object *obj)
 Mark an object's flavour as as one the player is aware of. More...
 
void object_flavor_tried (struct object *obj)
 Mark an object's flavour as tried. More...
 

Detailed Description

Object knowledge.

Copyright (c) 2016 Nick McConnell

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.

Enumeration Type Documentation

Enumerator
COMBAT_RUNE_TO_A 
COMBAT_RUNE_TO_H 
COMBAT_RUNE_TO_D 
COMBAT_RUNE_MAX 
Enumerator
RUNE_VAR_COMBAT 
RUNE_VAR_MOD 
RUNE_VAR_RESIST 
RUNE_VAR_BRAND 
RUNE_VAR_SLAY 
RUNE_VAR_CURSE 
RUNE_VAR_FLAG 

Function Documentation

bool easy_know ( const struct object obj)


Object kind functions

These deal with knowledge of an object's kind

Checks whether an object counts as "known" due to EASY_KNOW status

Parameters
objis the object

References object_kind::aware, kf_has, object::kind, and object_kind::kind_flags.

Referenced by object_flags_known().

void equip_learn_after_time ( struct player p)
void equip_learn_element ( struct player p,
int  element 
)
void equip_learn_flag ( struct player p,
int  flag 
)
void equip_learn_on_defend ( struct player p)


Functions for learning about equipment properties These functions are for gaining object knowledge from the behaviour of

the player's equipment

Learn things which happen on defending.

Parameters
pis the player

References player::body, COMBAT_RUNE_TO_A, player_body::count, i, index, object::known, player::obj_k, object_curses_find_to_a(), player_learn_rune(), rune_index(), RUNE_VAR_COMBAT, slot_object(), and object::to_a.

Referenced by check_hit().

void equip_learn_on_melee_attack ( struct player p)
void equip_learn_on_ranged_attack ( struct player p)

Learn to-hit bonus on making a ranged attack.

Does not apply to weapon or bow

Parameters
pis the player

References player::body, COMBAT_RUNE_TO_H, player_body::count, i, index, object::known, player::obj_k, object_curses_find_to_h(), object_has_standard_to_h(), player_learn_rune(), rune_index(), RUNE_VAR_COMBAT, slot_by_name(), slot_object(), and object::to_h.

Referenced by ranged_helper().

int max_runes ( void  )


Rune knowledge functions These functions provide details about the rune list for use in

player knowledge screens

The number of runes

References rune_max.

Referenced by do_cmd_knowledge_runes(), runes_autoinscribe(), textui_browse_knowledge(), and wr_ignore().

void missile_learn_on_ranged_attack ( struct player p,
struct object obj 
)

Learn attack bonus on making a ranged attack.

Can be applied to the missile or the missile launcher

Parameters
pis the player
objis the missile or launcher

References COMBAT_RUNE_TO_D, COMBAT_RUNE_TO_H, index, object::known, player::obj_k, object_curses_find_to_d(), object_curses_find_to_h(), object_has_standard_to_h(), player_learn_rune(), rune_index(), RUNE_VAR_COMBAT, object::to_d, and object::to_h.

Referenced by make_ranged_shot(), and ranged_helper().

bool object_effect_is_known ( const struct object obj)

Checks whether the player is aware of the object's effect when used.

Parameters
objis the object

References object::effect, and object::known.

Referenced by obj_known_effect(), object_fully_known(), and show_obj().

bool object_element_is_known ( const struct object obj,
int  element 
)

Checks whether the player knows the given element properties of an object.

Parameters
objis the object
elementis the element

References object::el_info, ELEM_MAX, object::known, player::obj_k, object_fully_known(), and element_info::res_level.

Referenced by display_resistance_panel().

bool object_flag_is_known ( const struct object obj,
int  flag 
)

Checks whether the player knows whether an object has a given flag.

Parameters
objis the object
flagis the flag

References object::flags, object::known, player::obj_k, object_fully_known(), and of_has.

Referenced by display_player_sust_info(), display_resistance_panel(), and store_will_buy().

void object_flavor_aware ( struct object obj)
bool object_flavor_is_aware ( const struct object obj)
void object_flavor_tried ( struct object obj)

Mark an object's flavour as tried.

Parameters
objis the object whose flavour should be marked

References object::kind, and object_kind::tried.

Referenced by object_learn_on_wield(), and use_aux().

bool object_flavor_was_tried ( const struct object obj)

Checks whether the player has tried to use other objects of the same kind.

Parameters
objis the object

References object::kind, and object_kind::tried.

Referenced by obj_desc_inscrip().

bool object_fully_known ( const struct object obj)
bool object_has_rune ( const struct object obj,
int  rune_no 
)
bool object_has_standard_to_h ( const struct object obj)
bool object_is_in_store ( const struct object obj)

Checks whether the object is in a store.

Parameters
objis the object

References i, MAX_STORES, object::next, store::stock, and stores.

Referenced by obj_known_effect().

bool object_is_known_artifact ( const struct object obj)

Checks whether the object is known to be an artifact.

Parameters
objis the object

References object::artifact, and object::known.

Referenced by artifact_is_known(), compare_items(), obj_desc_get_basename(), obj_desc_name(), obj_desc_name_prefix(), and object_list_format_name().

void object_learn_brand ( struct player p,
struct object obj,
int  index 
)

Notice any brands on a particular object which affect a particular monster.

Parameters
objis the object on which we are noticing brands
monthe monster we are trying to brand

References angband_constants::brand_max, brand_max, brands, i, player_knows_brand(), player_learn_rune(), rune_index(), RUNE_VAR_BRAND, streq, update_player_object_knowledge(), and z_info.

Referenced by improve_attack_modifier().

void object_learn_on_use ( struct player p,
struct object obj 
)

Learn object properties that become obvious on use, mark it as aware and reward the player with some experience.

Parameters
pis the player
objis the used object

References object::effect, object::kind, object::known, player::lev, object_kind::level, player_upkeep::notice, object_flavor_aware(), player_exp_gain(), PN_IGNORE, update_player_object_knowledge(), and player::upkeep.

Referenced by use_aux().

void object_learn_on_wield ( struct player p,
struct object obj 
)
void object_learn_slay ( struct player p,
struct object obj,
int  index 
)

Notice any slays on a particular object which affect a particular monster.

Parameters
objis the object on which we are noticing slays
monthe monster we are trying to slay

References i, player_knows_slay(), player_learn_rune(), rune_index(), RUNE_VAR_SLAY, same_monsters_slain(), angband_constants::slay_max, slay_max, update_player_object_knowledge(), and z_info.

Referenced by improve_attack_modifier().

void object_learn_unknown_rune ( struct player p,
struct object obj 
)

Learn a random unknown rune from an object.

Parameters
pis the player
objis the object

References i, object_find_unknown_rune(), and player_learn_rune().

Referenced by do_cmd_buy(), do_cmd_sell(), and effect_handler_IDENTIFY().

bool object_runes_known ( const struct object obj)
void object_see ( struct player p,
struct object obj 
)
void object_sense ( struct player p,
struct object obj 
)
void object_set_base_known ( struct object obj)
void object_touch ( struct player p,
struct object obj 
)

Gain knowledge based on being an the same square as an object.

References object::artifact, history_find_artifact(), object::known, object::notice, OBJ_NOTICE_ASSESSED, and player_know_object().

Referenced by square_know_pile().

void player_know_object ( struct player p,
struct object obj 
)
bool player_knows_brand ( struct player p,
int  i 
)


Object knowledge predicates

These functions tell how much the player knows about an object

Check if a brand is known to the player

Parameters
pis the player
bis the brand

References object::brands, i, and player::obj_k.

Referenced by improve_attack_modifier(), object_learn_brand(), player_know_object(), player_knows_ego(), and player_learn_rune().

bool player_knows_curse ( struct player p,
int  index 
)

Check if a curse is known to the player.

Parameters
pis the player
cis the curse

References object::curses, index, player::obj_k, and curse_data::power.

Referenced by curse_menu(), do_curse_effect(), player_knows_ego(), and player_learn_rune().

bool player_knows_ego ( struct player p,
struct ego_item ego 
)
bool player_knows_rune ( struct player p,
size_t  i 
)
bool player_knows_slay ( struct player p,
int  i 
)

Check if a slay is known to the player.

Parameters
pis the player
sis the slay

References i, player::obj_k, and object::slays.

Referenced by improve_attack_modifier(), object_learn_slay(), player_know_object(), player_knows_ego(), and player_learn_rune().

void player_learn_all_runes ( struct player p)

Learn absolutely everything.

Parameters
pis the player

References i, player_learn_rune(), and rune_max.

Referenced by death_knowledge(), and do_cmd_accept_character().

void player_learn_curse ( struct player p,
struct curse curse 
)
void player_learn_flag ( struct player p,
int  flag 
)
void player_learn_innate ( struct player p)
char* rune_desc ( size_t  i)
char* rune_name ( size_t  i)
quark_t rune_note ( size_t  i)

The autoinscription index (if any) of a rune.

References i, and rune::note.

Referenced by display_rune(), rune_add_autoinscription(), rune_xtra_act(), rune_xtra_prompt(), and wr_ignore().

void rune_set_note ( size_t  i,
const char *  inscription 
)

Set an autoinscription on a rune.

References i, rune::note, and quark_add().

Referenced by rd_ignore(), and rune_xtra_act().

enum rune_variety rune_variety ( size_t  i)

The variety of a rune.

References i, and rune::variety.

void update_player_object_knowledge ( struct player p)