34 static int check_item(
object *op,
const char *item);
37 static int improve_weapon_stat(
object *op,
object *improver,
object *weapon,
signed char *stat,
int sacrifice_count,
const char *
statname);
38 static int prepare_weapon(
object *op,
object *improver,
object *weapon);
39 static int improve_weapon(
object *op,
object *improver,
object *weapon);
65 "Something blocks the magic of the scroll.", NULL);
72 "You need to mark a weapon object.", NULL);
77 "Marked item is not a weapon or bow", NULL);
81 "Applied weapon builder.", NULL);
106 if (strcmp(op->
arch->
name, item) == 0) {
144 if (strcmp(op->
arch->
name, item) == 0) {
145 if (op->
nrof >= nrof) {
175 if (improver->
slaying != NULL) {
179 "The gods want more %ss",
180 "The gods want more %ss",
211 "Your sacrifice was accepted.", NULL);
213 *stat += sacrifice_count;
217 "Weapon's bonus to %s improved by %d",
218 "Weapon's bonus to %s improved by %d",
219 statname, sacrifice_count);
229 #define IMPROVE_PREPARE 1
230 #define IMPROVE_DAMAGE 2
231 #define IMPROVE_WEIGHT 3
232 #define IMPROVE_ENCHANT 4
233 #define IMPROVE_STR 5
234 #define IMPROVE_DEX 6
235 #define IMPROVE_CON 7
236 #define IMPROVE_WIS 8
237 #define IMPROVE_CHA 9
238 #define IMPROVE_INT 10
239 #define IMPROVE_POW 11
255 static int prepare_weapon(object *op, object *improver, object *weapon) {
256 int sacrifice_count, i;
259 if (weapon->level != 0) {
261 "Weapon already prepared.", NULL);
265 if (weapon->resist[i])
273 || (weapon->stats.sp && weapon->type ==
WEAPON)
275 || weapon->stats.ac) {
277 "Cannot prepare magic weapons.", NULL);
282 if (sacrifice_count <= 0)
294 if (weapon->nrof >1) {
303 weapon->level =
isqrt(sacrifice_count);
305 "Your sacrifice was accepted.", NULL);
306 eat_item(op, improver->slaying, sacrifice_count);
309 snprintf(buf,
sizeof(buf),
"%s's %s", op->name, weapon->name);
314 "Your %s may be improved %d times.",
315 "Your %s may be improved %d times.",
316 weapon->name, weapon->level);
319 weapon->last_eat = 0;
344 int sacrifice_count, sacrifice_needed = 0;
350 if (weapon->
level == 0) {
352 "This weapon has not been prepared.", NULL);
358 "This weapon cannot be improved any more.", NULL);
365 "Improving the weapon will make it too powerful for you to use. Unready it if you really want to improve it.", NULL);
379 "You can't enchant this weapon without unapplying it because it would consume your soul!", NULL);
393 "Damage has been increased by 5 to %d",
394 "Damage has been increased by 5 to %d",
409 "Weapon weight reduced to %6.1f kg",
410 "Weapon weight reduced to %6.1f kg",
411 (
float)weapon->
weight/1000.0);
422 "Weapon magic increased to %d",
423 "Weapon magic increased to %d",
430 sacrifice_needed = weapon->
stats.
Str
438 if (sacrifice_needed < 1)
439 sacrifice_needed = 1;
440 sacrifice_needed *= 2;
443 if (sacrifice_count < sacrifice_needed) {
445 "You need at least %d %s",
446 "You need at least %d %s",
447 sacrifice_needed, improver->
slaying);
477 "Unknown improvement type.", NULL);
480 LOG(
llevError,
"improve_weapon: Got to end of function\n");
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny)
int apply_special(object *who, object *op, int aflags)
void esrv_update_item(int flags, object *pl, object *op)
static int improve_weapon(object *op, object *improver, object *weapon)
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
static int prepare_weapon(object *op, object *improver, object *weapon)
void init_type_weapon_improver(void)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
static int check_sacrifice(object *op, const object *improver)
const char *const statname[NUM_STATS]
static void eat_item(object *op, const char *item, uint32 nrof)
#define MAX_WEAPON_ITEM_POWER
void register_apply(int ob_type, apply_func method)
object * find_marked_object(object *op)
#define QUERY_FLAG(xyz, p)
object * insert_ob_in_ob(object *op, object *where)
int snprintf(char *dest, int max, const char *format,...)
#define MSG_TYPE_APPLY_SUCCESS
#define FREE_AND_COPY(sv, nv)
object * decrease_ob_nr(object *op, uint32 i)
#define MSG_TYPE_APPLY_ERROR
int check_weapon_power(const object *who, int improvs)
void LOG(LogLevel logLevel, const char *format,...)
object * get_split_ob(object *orig_ob, uint32 nr, char *err, size_t size)
static method_ret weapon_improver_type_apply(ob_methods *context, object *op, object *applier, int aflags)
static int check_item(object *op, const char *item)
void fix_object(object *op)
static int improve_weapon_stat(object *op, object *improver, object *weapon, signed char *stat, int sacrifice_count, const char *statname)