Crossfire Server, Trunk
|
#include "global.h"
#include <string.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_t 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 (object *op, object *applier, int aflags) |
The implementation of the Weapon Improver class of objects.
Definition in file weapon_improver.cpp.
#define IMPROVE_CHA 9 |
Increase charisma bonus.
Definition at line 227 of file weapon_improver.cpp.
#define IMPROVE_CON 7 |
Increase constitution bonus.
Definition at line 225 of file weapon_improver.cpp.
#define IMPROVE_DAMAGE 2 |
Increase damage.
Definition at line 220 of file weapon_improver.cpp.
#define IMPROVE_DEX 6 |
Increase dexterity bonus.
Definition at line 224 of file weapon_improver.cpp.
#define IMPROVE_ENCHANT 4 |
Increase magic.
Definition at line 222 of file weapon_improver.cpp.
#define IMPROVE_INT 10 |
Increase intelligence bonus.
Definition at line 228 of file weapon_improver.cpp.
#define IMPROVE_POW 11 |
Increase power bonus.
Definition at line 229 of file weapon_improver.cpp.
#define IMPROVE_PREPARE 1 |
Prepare the weapon.
Definition at line 219 of file weapon_improver.cpp.
#define IMPROVE_STR 5 |
Increase strength bonus.
Definition at line 223 of file weapon_improver.cpp.
#define IMPROVE_WEIGHT 3 |
Decrease weight.
Definition at line 221 of file weapon_improver.cpp.
#define IMPROVE_WIS 8 |
Increase wisdom bonus.
Definition at line 226 of file weapon_improver.cpp.
|
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 93 of file weapon_improver.cpp.
References disinfect::count, FLAG_CURSED, FLAG_DAMNED, FLAG_UNPAID, FOR_BELOW_FINISH, FOR_BELOW_PREPARE, give::op, QUERY_FLAG, and Ice::tmp.
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 165 of file weapon_improver.cpp.
References check_item(), disinfect::count, draw_ext_info_format(), MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, NDI_UNIQUE, give::op, and object::slaying.
Referenced by improve_weapon().
|
static |
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 130 of file weapon_improver.cpp.
References object_decrease_nrof(), and give::op.
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 332 of file weapon_improver.cpp.
References AP_UNAPPLY, apply_check_weapon_power(), apply_special(), living::Cha, check_sacrifice(), living::Con, living::dam, living::Dex, draw_ext_info(), draw_ext_info_format(), eat_item(), esrv_update_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, living::Int, object::item_power, Settings::item_power_factor, object::last_eat, object::level, llevError, LOG(), object::magic, MAX_WEAPON_ITEM_POWER, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, MSG_TYPE_APPLY_SUCCESS, NDI_UNIQUE, object_decrease_nrof_by_one, give::op, PLAYER, living::Pow, prepare_weapon(), QUERY_FLAG, settings, object::slaying, living::sp, object::stats, living::Str, UPD_WEIGHT, object::weight, and living::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 200 of file weapon_improver.cpp.
References draw_ext_info(), draw_ext_info_format(), fix_object(), object::last_eat, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS, NDI_UNIQUE, object_decrease_nrof_by_one, give::op, and statname.
Referenced by improve_weapon().
void init_type_weapon_improver | ( | void | ) |
Initializer for the WEAPON_IMPROVER object type.
Definition at line 38 of file weapon_improver.cpp.
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 245 of file weapon_improver.cpp.
References draw_ext_info(), MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, NDI_UNIQUE, and give::op.
Referenced by improve_weapon().
|
static |
Attempts to apply weapon_improver.
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 50 of file weapon_improver.cpp.
References BOW, draw_ext_info(), esrv_update_item(), find_marked_object(), FLAG_WIZCAST, get_map_flags(), improve_weapon(), object::map, METHOD_ERROR, METHOD_OK, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, MSG_TYPE_APPLY_SUCCESS, NDI_UNIQUE, give::op, P_NO_MAGIC, PLAYER, QUERY_FLAG, object::type, UPD_FLAGS, UPD_NAME, UPD_NROF, nlohmann::detail::void(), WEAPON, object::x, and object::y.
Referenced by init_type_weapon_improver().