Angband
Data Structures | Macros | Enumerations | Functions | Variables
obj-power.h File Reference

calculation of object power and value More...

Go to the source code of this file.

Data Structures

struct  iterate
 
struct  power_calc
 

Macros

#define INHIBIT_POWER   20000
 Some constants used in randart generation and power calculation. More...
 
#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 */
 

Enumerations

enum  power_calc_operation {
  POWER_CALC_NONE, POWER_CALC_ADD, POWER_CALC_ADD_IF_POSITIVE, POWER_CALC_SQUARE_ADD_IF_POSITIVE,
  POWER_CALC_MULTIPLY, POWER_CALC_DIVIDE, POWER_CALC_MAX
}
 

Functions

expression_base_value_f power_calculation_by_name (const char *name)
 
int object_power (const struct object *obj, bool verbose, ang_file *log_file)
 Run all the power calculations on an object to find its power. More...
 
int object_value_real (const struct object *obj, int qty)
 Return the real price of a known (or partly known) item. More...
 
int object_value (const struct object *obj, int qty)
 Return the price of an item including plusses (and charges). More...
 

Variables

struct power_calccalculations
 

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 HIGH_TO_AC   26

Referenced by add_to_AC().

#define HIGH_TO_DAM   16

Referenced by add_to_dam().

#define HIGH_TO_HIT   16

Referenced by add_to_hit().

#define INHIBIT_AC   56
#define INHIBIT_BLOWS   3

Referenced by try_supercharge().

#define INHIBIT_MIGHT   4

Referenced by try_supercharge().

#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 add_activation(), and store_base_power().

#define INHIBIT_SHOTS   3

Referenced by try_supercharge().

#define VERYHIGH_TO_AC   36

Referenced by add_to_AC().

#define VERYHIGH_TO_DAM   26

Referenced by add_to_dam().

#define VERYHIGH_TO_HIT   26

Referenced by add_to_hit().

Enumeration Type Documentation

Enumerator
POWER_CALC_NONE 
POWER_CALC_ADD 
POWER_CALC_ADD_IF_POSITIVE 
POWER_CALC_SQUARE_ADD_IF_POSITIVE 
POWER_CALC_MULTIPLY 
POWER_CALC_DIVIDE 
POWER_CALC_MAX 

Function Documentation

int object_power ( const struct object obj,
bool  verbose,
ang_file log_file 
)
int object_value ( const struct object obj,
int  qty 
)

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 object::kind, object::known, object_flavor_is_aware(), object_value_base(), object_value_real(), tval_can_have_flavor_k(), tval_has_variable_power(), and value.

Referenced by do_cmd_sell(), earlier_object(), kind_info(), price_item(), store_carry(), store_will_buy(), and wiz_display_item().

int object_value_real ( const struct object obj,
int  qty 
)

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, NULL, object::number, object_power(), of_has, path_build(), obj_property::power, object::pval, SGN, tval_can_have_charges(), tval_has_variable_power(), tval_is_ammo(), tval_is_light(), and value.

Referenced by black_market_ok(), do_cmd_sell(), make_object(), mass_produce(), object_value(), player_outfit(), price_item(), store_carry(), and store_create_random().

expression_base_value_f power_calculation_by_name ( const char *  name)

References my_stricmp(), name, NULL, object_power_calculation_AC(), object_power_calculation_ALL_BASE_RES(), object_power_calculation_ALL_BRANDS(), object_power_calculation_ALL_HIGH_RES(), object_power_calculation_ALL_IMM(), object_power_calculation_ALL_KILLS(), object_power_calculation_ALL_MISC(), object_power_calculation_ALL_PROTECTS(), object_power_calculation_ALL_SLAYS(), object_power_calculation_ALL_SUSTAINS(), object_power_calculation_BEST_SLAY(), object_power_calculation_BOW_MULTIPLIER(), object_power_calculation_BRAND_BRAND(), object_power_calculation_DICE(), object_power_calculation_EFFECT_POWER(), object_power_calculation_EXTRA_BLOWS(), object_power_calculation_EXTRA_MIGHT(), object_power_calculation_EXTRA_SHOTS(), object_power_calculation_FLAG_POWER(), object_power_calculation_FLAG_TYPE_MULT(), object_power_calculation_IGNORE(), object_power_calculation_IMM(), object_power_calculation_IS_EGO(), object_power_calculation_KILL_KILL(), object_power_calculation_MOD_MULT(), object_power_calculation_MOD_POWER(), object_power_calculation_MOD_TYPE_MULT(), object_power_calculation_MODIFIER(), object_power_calculation_NUM_BASE_RES(), object_power_calculation_NUM_HIGH_RES(), object_power_calculation_NUM_IMM(), object_power_calculation_NUM_MISC(), object_power_calculation_NUM_PROTECTS(), object_power_calculation_NUM_SUSTAINS(), object_power_calculation_RESIST(), object_power_calculation_SLAY_BRAND(), object_power_calculation_SLAY_SLAY(), object_power_calculation_TO_ARMOR(), object_power_calculation_TO_DAM(), object_power_calculation_TO_HIT(), object_power_calculation_TOTAL_ARMOR(), object_power_calculation_VULN(), and object_power_calculation_WEIGHT().

Referenced by parse_object_power_expr().

Variable Documentation

struct power_calc* calculations