Angband
Macros | Functions
obj-power.h File Reference

calculation of object power and value More...

Go to the source code of this file.

Macros

#define NONWEAP_DAMAGE   15 /* fudge to boost extra blows */
 Constants for the power algorithm:
#define WEAP_DAMAGE   12 /* and for off-weapon combat flags */
#define BASE_JEWELRY_POWER   4
#define BASE_ARMOUR_POWER   1
#define DAMAGE_POWER   5 /* i.e. 2.5 */
#define TO_HIT_POWER   3 /* i.e. 1.5 */
#define BASE_AC_POWER   2 /* i.e. 1 */
#define TO_AC_POWER   2 /* i.e. 1 */
#define MAX_BLOWS   5
#define INHIBIT_POWER   20000
 Some constants used in randart generation and power calculation.
#define INHIBIT_BLOWS   3
#define INHIBIT_MIGHT   4
#define INHIBIT_SHOTS   3
#define HIGH_TO_AC   26
#define VERYHIGH_TO_AC   36
#define INHIBIT_AC   56
#define HIGH_TO_HIT   16
#define VERYHIGH_TO_HIT   26
#define HIGH_TO_DAM   16
#define VERYHIGH_TO_DAM   26
#define AMMO_RESCALER   20 /* this value is also used for torches */

Functions

s32b object_power (const object_type *o_ptr, int verbose, ang_file *log_file, bool known)
s32b object_value_real (const object_type *o_ptr, int qty, int verbose, bool known)
 Return the real price of a known (or partly known) item.
s32b object_value (const object_type *o_ptr, int qty, int verbose)
 Return the price of an item including plusses (and charges).

Detailed Description

calculation of object power and value

Copyright (c) 2001 Chris Carr, Chris Robertson Revised in 2009-11 by Chris Carr, Peter Denison

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.

Macro Definition Documentation

#define AMMO_RESCALER   20 /* this value is also used for torches */

Referenced by object_value_real().

#define BASE_AC_POWER   2 /* i.e. 1 */

Referenced by ac_power().

#define BASE_ARMOUR_POWER   1

Referenced by ac_power().

#define BASE_JEWELRY_POWER   4

Referenced by jewelry_power().

#define DAMAGE_POWER   5 /* i.e. 2.5 */
#define HIGH_TO_AC   26

Referenced by add_to_AC(), and to_ac_power().

#define HIGH_TO_DAM   16

Referenced by add_to_dam().

#define HIGH_TO_HIT   16

Referenced by add_to_hit().

#define INHIBIT_AC   56

Referenced by to_ac_power().

#define INHIBIT_BLOWS   3
#define INHIBIT_MIGHT   4
#define INHIBIT_POWER   20000

Some constants used in randart generation and power calculation.

  • thresholds for limiting to_hit, to_dam and to_ac
  • fudge factor for rescaling ammo cost (a stack of this many equals a weapon of the same damage output)

Referenced by extra_blows_power(), extra_might_power(), extra_shots_power(), modifier_power(), object_power(), scramble_artifact(), store_base_power(), and to_ac_power().

#define INHIBIT_SHOTS   3
#define MAX_BLOWS   5
#define NONWEAP_DAMAGE   15 /* fudge to boost extra blows */

Constants for the power algorithm:

  • fudge factor for extra damage from rings etc. (used if extra blows)
  • assumed damage for off-weapon brands
  • base power for jewelry
  • base power for armour items (for halving acid damage)
  • power per point of damage
  • power per point of +to_hit
  • power per point of base AC
  • power per point of +to_ac (these four are all halved in the algorithm)
  • assumed max blows
  • inhibiting values for +blows/might/shots/immunities (max is one less)

Referenced by extra_blows_power().

#define TO_AC_POWER   2 /* i.e. 1 */

Referenced by to_ac_power().

#define TO_HIT_POWER   3 /* i.e. 1.5 */

Referenced by to_hit_power().

#define VERYHIGH_TO_AC   36

Referenced by add_to_AC(), and to_ac_power().

#define VERYHIGH_TO_DAM   26

Referenced by add_to_dam().

#define VERYHIGH_TO_HIT   26

Referenced by add_to_hit().

#define WEAP_DAMAGE   12 /* and for off-weapon combat flags */

Referenced by damage_dice_power().

Function Documentation

s32b object_power ( const object_type o_ptr,
int  verbose,
ang_file log_file,
bool  known 
)
s32b object_value ( const object_type o_ptr,
int  qty,
int  verbose 
)

Return the price of an item including plusses (and charges).

This function returns the "value" of the given item (qty one).

Never notice unknown bonuses or properties, including curses, since that would give the player information they did not have.

References cursed_p(), FALSE, object::flags, object_attack_plusses_are_visible(), object_defence_plusses_are_visible(), object_flags_known(), object_is_known(), object_value_base(), object_value_real(), object_was_sensed(), object::to_a, object::to_d, object::to_h, TRUE, tval_has_variable_power(), and value.

Referenced by black_market_ok(), do_cmd_sell(), kind_info(), mass_produce(), player_outfit(), price_item(), store_carry(), store_create_random(), store_will_buy(), and wiz_display_item().

s32b object_value_real ( const object_type o_ptr,
int  qty,
int  verbose,
bool  known 
)

Return the real price of a known (or partly known) item.

Wand and staffs get cost for each charge.

Wearable items (weapons, launchers, jewelry, lights, armour) and ammo are priced according to their power rating. All ammo, and normal (non-ego) torches are scaled down by AMMO_RESCALER to reflect their impermanence.

References AMMO_RESCALER, ANGBAND_DIR_USER, buf, object_kind::cost, object::ego, file_close(), file_open(), file_putf(), object::flags, FTYPE_TEXT, object::kind, log_file, MODE_APPEND, MODE_WRITE, msg, object_kind::name, object::number, object_power(), of_has, path_build(), power, object::pval, SGN, tval_can_have_charges(), tval_has_variable_power(), tval_is_ammo(), tval_is_light(), and value.

Referenced by make_object(), and object_value().