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

calculation of object power and value More...

#include "angband.h"
#include "obj-gear.h"
#include "obj-identify.h"
#include "obj-power.h"
#include "obj-slays.h"
#include "obj-tval.h"
#include "obj-util.h"
#include "init.h"
#include "effects.h"
#include "mon-power.h"
#include "monster.h"

Data Structures

struct  archery
 Define a set of constants for dealing with launchers and ammo: More...
struct  flag_set
 Set the weightings of flag types: More...
struct  element_set
 Similar data for elements. More...
struct  element_powers
 Power data for elements. More...

Enumerations

enum  { T_LRES, T_HRES }

Functions

void log_obj (char *message)
static int bow_multiplier (const object_type *o_ptr)
static int to_damage_power (const object_type *o_ptr)
static int damage_dice_power (const object_type *o_ptr)
static int ammo_damage_power (const object_type *o_ptr, int p)
static int launcher_ammo_damage_power (const object_type *o_ptr, int p)
static int extra_blows_power (const object_type *o_ptr, int p, bool known)
static int extra_shots_power (const object_type *o_ptr, int p, bool known)
static int extra_might_power (const object_type *o_ptr, int p, int mult, bool known)
static s32b slay_power (const object_type *o_ptr, int p, int verbose, int dice_pwr, bool known)
 Calculate the rating for a given slay combination.
static int rescale_bow_power (const object_type *o_ptr, int p)
static int to_hit_power (const object_type *o_ptr, int p)
static int ac_power (const object_type *o_ptr, int p)
static int to_ac_power (const object_type *o_ptr, int p)
static int jewelry_power (const object_type *o_ptr, int p)
static int modifier_power (const object_type *o_ptr, int p, bool known)
static int flags_power (const object_type *o_ptr, int p, int verbose, ang_file *log_file, bool known)
static int element_power (const object_type *o_ptr, int p, bool known)
static int effects_power (const object_type *o_ptr, int p, bool known)
s32b object_power (const object_type *o_ptr, int verbose, ang_file *log_file, bool known)
static s32b object_value_base (const object_type *o_ptr)
 Return the "value" of an "unknown" item Make a guess at the value of non-aware items.
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).

Variables

static struct archery archery []
static struct flag_set flag_sets []
static struct element_set element_sets []
static struct element_powers el_powers []
static s16b ability_power [25]
 Boost ratings for combinations of ability bonuses We go up to +24 here - anything higher is inhibited N.B.
ang_fileobject_log

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.

Enumeration Type Documentation

anonymous enum
Enumerator:
T_LRES 
T_HRES 

Function Documentation

static int ac_power ( const object_type o_ptr,
int  p 
)
static
static int ammo_damage_power ( const object_type o_ptr,
int  p 
)
static
static int bow_multiplier ( const object_type o_ptr)
static

References format(), log_obj(), object::pval, and object::tval.

Referenced by object_power().

static int damage_dice_power ( const object_type o_ptr)
static
static int effects_power ( const object_type o_ptr,
int  p,
bool  known 
)
static
static int element_power ( const object_type o_ptr,
int  p,
bool  known 
)
static
static int extra_blows_power ( const object_type o_ptr,
int  p,
bool  known 
)
static
static int extra_might_power ( const object_type o_ptr,
int  p,
int  mult,
bool  known 
)
static
static int extra_shots_power ( const object_type o_ptr,
int  p,
bool  known 
)
static
static int flags_power ( const object_type o_ptr,
int  p,
int  verbose,
ang_file log_file,
bool  known 
)
static
static int jewelry_power ( const object_type o_ptr,
int  p 
)
static
static int launcher_ammo_damage_power ( const object_type o_ptr,
int  p 
)
static
void log_obj ( char *  message)
static int modifier_power ( const object_type o_ptr,
int  p,
bool  known 
)
static
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().

static s32b object_value_base ( const object_type o_ptr)
static

Return the "value" of an "unknown" item Make a guess at the value of non-aware items.

References object_kind::cost, object::kind, object_all_but_flavor_is_known(), object_flavor_is_aware(), and object::tval.

Referenced by object_value().

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().

static int rescale_bow_power ( const object_type o_ptr,
int  p 
)
static
static s32b slay_power ( const object_type o_ptr,
int  p,
int  verbose,
int  dice_pwr,
bool  known 
)
static
static int to_ac_power ( const object_type o_ptr,
int  p 
)
static
static int to_damage_power ( const object_type o_ptr)
static
static int to_hit_power ( const object_type o_ptr,
int  p 
)
static

References format(), log_obj(), p, object::to_h, and TO_HIT_POWER.

Referenced by object_power().

Variable Documentation

s16b ability_power[25]
static
Initial value:
{0, 0, 0, 0, 0, 0, 0, 2, 4, 6, 8,
12, 16, 20, 24, 30, 36, 42, 48, 56, 64,
74, 84, 96, 110}

Boost ratings for combinations of ability bonuses We go up to +24 here - anything higher is inhibited N.B.

Not all stats count equally towards this total

Referenced by modifier_power().

struct archery archery[]
static
struct element_powers el_powers[]
static

Referenced by element_power().

struct element_set element_sets[]
static

Referenced by element_power().

struct flag_set flag_sets[]
static

Referenced by flags_power().

ang_file* object_log