Go to the documentation of this file.
59 "Something blocks the magic of the scroll.");
66 "You need to mark a weapon object.");
71 "Marked item is not a weapon or bow");
75 "Applied weapon builder.");
100 if (strcmp(
tmp->arch->name,
item) == 0) {
137 if (strcmp(
op->arch->name,
item) == 0) {
138 if (
op->nrof >= nrof) {
168 if (improver->
slaying != NULL) {
172 "The gods want more %ss",
202 "Your sacrifice was accepted.");
204 *stat += sacrifice_count;
208 "Weapon's bonus to %s improved by %d",
219 #define IMPROVE_PREPARE 1
220 #define IMPROVE_DAMAGE 2
221 #define IMPROVE_WEIGHT 3
222 #define IMPROVE_ENCHANT 4
223 #define IMPROVE_STR 5
224 #define IMPROVE_DEX 6
225 #define IMPROVE_CON 7
226 #define IMPROVE_WIS 8
227 #define IMPROVE_CHA 9
228 #define IMPROVE_INT 10
229 #define IMPROVE_POW 11
245 static int prepare_weapon(object *op, object *improver, object *weapon) {
246 int sacrifice_count, i;
249 if (weapon->level != 0) {
251 "Weapon already prepared.");
255 if (weapon->resist[i])
263 || (weapon->stats.sp && weapon->type ==
WEAPON)
265 || weapon->stats.ac) {
267 "Cannot prepare magic weapons.");
272 if (sacrifice_count <= 0)
284 if (weapon->nrof >1) {
293 weapon->level =
isqrt(sacrifice_count);
295 "Your sacrifice was accepted.");
296 eat_item(
op, improver->slaying, sacrifice_count);
299 snprintf(
buf,
sizeof(
buf),
"%s's %s",
op->name, weapon->name);
304 "Your %s may be improved %d times.",
305 weapon->name, weapon->level);
308 weapon->last_eat = 0;
333 int sacrifice_count, sacrifice_needed = 0;
339 if (weapon->
level == 0) {
341 "This weapon has not been prepared.");
347 "This weapon cannot be improved any more.");
354 "Improving the weapon will make it too powerful for you to use. Unready it if you really want to improve it.");
368 "You can't enchant this weapon without unapplying it because it would consume your soul!");
382 "Damage has been increased by 5 to %d",
398 "Weapon weight reduced to %6.1f kg",
399 (
float)weapon->
weight/1000.0);
411 "Weapon magic increased to %d",
418 sacrifice_needed = weapon->
stats.
Str
426 if (sacrifice_needed < 1)
427 sacrifice_needed = 1;
428 sacrifice_needed *= 2;
431 if (sacrifice_count < sacrifice_needed) {
433 "You need at least %d %s",
434 sacrifice_needed, improver->
slaying);
464 "Unknown improvement type.");
467 LOG(
llevError,
"improve_weapon: Got to end of function\n");
void LOG(LogLevel logLevel, const char *format,...)
static int check_item(object *op, const char *item)
#define QUERY_FLAG(xyz, p)
void register_apply(int ob_type, apply_func method)
#define FOR_BELOW_PREPARE(op_, it_)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void fix_object(object *op)
void init_type_weapon_improver(void)
object * object_insert_in_ob(object *op, object *where)
#define FOR_BELOW_FINISH()
static int check_sacrifice(object *op, const object *improver)
#define object_decrease_nrof_by_one(xyz)
#define MSG_TYPE_APPLY_SUCCESS
static void eat_item(object *op, const char *item, uint32_t nrof)
#define FREE_AND_COPY(sv, nv)
const char *const statname[NUM_STATS]
static method_ret weapon_improver_type_apply(object *op, object *applier, int aflags)
static int prepare_weapon(object *op, object *improver, object *weapon)
object * object_decrease_nrof(object *op, uint32_t i)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
int apply_check_weapon_power(const object *who, int improves)
static int improve_weapon(object *op, object *improver, object *weapon)
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
void esrv_update_item(int flags, object *pl, object *op)
int apply_special(object *who, object *op, int aflags)
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
#define MAX_WEAPON_ITEM_POWER
#define MSG_TYPE_APPLY_ERROR
object * find_marked_object(object *op)
static int improve_weapon_stat(object *op, object *improver, object *weapon, signed char *stat, int sacrifice_count, const char *statname)