Crossfire Server, Branches 1.12
R18729
|
#include <global.h>
#include <ob_methods.h>
#include <ob_types.h>
#include <sounds.h>
#include <sproto.h>
Go to the source code of this file.
Macros | |
#define | IMPROVE_CHA 9 |
#define | IMPROVE_CON 7 |
#define | IMPROVE_DAMAGE 2 |
#define | IMPROVE_DEX 6 |
#define | IMPROVE_ENCHANT 4 |
#define | IMPROVE_INT 10 |
#define | IMPROVE_POW 11 |
#define | IMPROVE_PREPARE 1 |
#define | IMPROVE_STR 5 |
#define | IMPROVE_WEIGHT 3 |
#define | IMPROVE_WIS 8 |
Functions | |
static int | check_item (object *op, const char *item) |
static int | check_sacrifice (object *op, const object *improver) |
static void | eat_item (object *op, const char *item, uint32 nrof) |
static int | improve_weapon (object *op, object *improver, object *weapon) |
static int | improve_weapon_stat (object *op, object *improver, object *weapon, signed char *stat, int sacrifice_count, const char *statname) |
void | init_type_weapon_improver (void) |
static int | prepare_weapon (object *op, object *improver, object *weapon) |
static method_ret | weapon_improver_type_apply (ob_methods *context, object *op, object *applier, int aflags) |
The implementation of the Weapon Improver class of objects.
Definition in file weapon_improver.c.
#define IMPROVE_CHA 9 |
Increase charisma bonus.
Definition at line 237 of file weapon_improver.c.
Referenced by improve_weapon().
#define IMPROVE_CON 7 |
Increase constitution bonus.
Definition at line 235 of file weapon_improver.c.
Referenced by improve_weapon().
#define IMPROVE_DAMAGE 2 |
#define IMPROVE_DEX 6 |
Increase dexterity bonus.
Definition at line 234 of file weapon_improver.c.
Referenced by improve_weapon().
#define IMPROVE_ENCHANT 4 |
#define IMPROVE_INT 10 |
Increase intelligence bonus.
Definition at line 238 of file weapon_improver.c.
Referenced by improve_weapon().
#define IMPROVE_POW 11 |
Increase power bonus.
Definition at line 239 of file weapon_improver.c.
Referenced by improve_weapon().
#define IMPROVE_PREPARE 1 |
Prepare the weapon.
Definition at line 229 of file weapon_improver.c.
Referenced by improve_weapon().
#define IMPROVE_STR 5 |
Increase strength bonus.
Definition at line 233 of file weapon_improver.c.
Referenced by improve_weapon().
#define IMPROVE_WEIGHT 3 |
#define IMPROVE_WIS 8 |
Increase wisdom bonus.
Definition at line 236 of file weapon_improver.c.
Referenced by improve_weapon().
|
static |
Counts suitable items with specified archetype name. Will not consider unpaid/cursed items.
op | object just before the bottom of the pile, others will be checked through object->below. |
item | what archetype to check for. |
Definition at line 99 of file weapon_improver.c.
References obj::arch, obj::below, FLAG_CURSED, FLAG_DAMNED, FLAG_UNPAID, archt::name, obj::nrof, and QUERY_FLAG.
Referenced by check_sacrifice().
Returns how many items of type improver->slaying there are under op. Will display a message if none found, and 1 if improver->slaying is NULL.
op | item just below the bottom of the pile. |
improver | sacrifice object. |
Definition at line 172 of file weapon_improver.c.
References check_item(), draw_ext_info_format(), MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, NDI_UNIQUE, and obj::slaying.
Referenced by improve_weapon().
This removes 'nrof' items with specified archetype. op is typically the player, which is only really used to determine what space to look at. Modified to only eat 'nrof' of objects.
op | item at the bottom to check. |
item | archetype to look for. |
nrof | count to remove. |
Definition at line 137 of file weapon_improver.c.
References obj::arch, obj::below, decrease_ob_nr(), archt::name, and obj::nrof.
Referenced by improve_weapon().
Does the dirty job for 'improve weapon' scroll, prepare or add something. This is the new improve weapon code.
Checks if weapon was prepared, if enough potions on the floor, ...
We are hiding extra information about the weapon in the level and last_eat numbers for an object. Hopefully this won't break anything ?? level == max improve last_eat == current improve
op | player improving. |
improver | the scroll that was read. |
weapon | wepaon to improve. |
Definition at line 343 of file weapon_improver.c.
References AP_UNAPPLY, apply_special(), liv::Cha, check_sacrifice(), check_weapon_power(), liv::Con, obj::contr, liv::dam, decrease_ob, liv::Dex, draw_ext_info(), draw_ext_info_format(), eat_item(), FLAG_APPLIED, IMPROVE_CHA, IMPROVE_CON, IMPROVE_DAMAGE, IMPROVE_DEX, IMPROVE_ENCHANT, IMPROVE_INT, IMPROVE_POW, IMPROVE_PREPARE, IMPROVE_STR, improve_weapon_stat(), IMPROVE_WEIGHT, IMPROVE_WIS, liv::Int, pl::item_power, obj::item_power, Settings::item_power_factor, obj::last_eat, obj::level, llevError, LOG(), obj::magic, MAX_WEAPON_ITEM_POWER, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, MSG_TYPE_APPLY_SUCCESS, NDI_UNIQUE, PLAYER, liv::Pow, prepare_weapon(), QUERY_FLAG, settings, obj::slaying, liv::sp, obj::stats, liv::Str, obj::type, obj::weight, and liv::Wis.
Referenced by weapon_improver_type_apply().
|
static |
Actually improves the weapon, and tells user. Won't test anything.
op | player improving. |
improver | scroll used to improve. |
weapon | improved weapon. |
stat | what statistic to improve. |
sacrifice_count | how much to improve stat by. |
statname | name of stat to display to player. |
Definition at line 208 of file weapon_improver.c.
References decrease_ob, draw_ext_info(), draw_ext_info_format(), fix_object(), obj::last_eat, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS, and NDI_UNIQUE.
Referenced by improve_weapon().
void init_type_weapon_improver | ( | void | ) |
Initializer for the WEAPON_IMPROVER object type.
Definition at line 44 of file weapon_improver.c.
References register_apply(), WEAPON_IMPROVER, and weapon_improver_type_apply().
Referenced by register_all_ob_types().
This does the prepare weapon scroll.
Checks for sacrifice, and so on. Will inform the player of failures or success.
op | player using the scroll. |
improver | improvement scroll. |
weapon | weapon to improve. |
Definition at line 255 of file weapon_improver.c.
References draw_ext_info(), MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, and NDI_UNIQUE.
Referenced by improve_weapon().
|
static |
Attempts to apply weapon_improver.
context | The method context |
op | The weapon_improver to apply |
applier | The object attempting to apply the weapon_improver. Ignored unless a player |
aflags | Special flags (always apply/unapply) |
Definition at line 57 of file weapon_improver.c.
References BOW, draw_ext_info(), esrv_update_item(), find_marked_object(), FLAG_WIZCAST, get_map_flags(), improve_weapon(), obj::map, METHOD_ERROR, METHOD_OK, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, MSG_TYPE_APPLY_SUCCESS, NDI_UNIQUE, P_NO_MAGIC, PLAYER, QUERY_FLAG, obj::type, UPD_FLAGS, UPD_NAME, UPD_NROF, WEAPON, obj::x, and obj::y.
Referenced by init_type_weapon_improver().