From 48206c942c23258166b3b7bd3256164ad7ebe83f Mon Sep 17 00:00:00 2001 From: Fate Date: Fri, 5 Dec 2008 22:03:06 -0700 Subject: Finished bounding XP boni by absolute values --- src/map/mob.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/map/mob.c b/src/map/mob.c index 1d29a22..9710441 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -188,7 +188,8 @@ mob_mutate(struct mob_data *md, int stat, int intensity) // intensity: positive: { int old_stat; int new_stat; - int real_intensity; + int real_intensity; // relative intensity + const int mut_base = mutation_base[stat]; int sign = 1; if (!md || stat < 0 || stat >= MOB_XP_BONUS || intensity == 0) @@ -220,7 +221,23 @@ mob_mutate(struct mob_data *md, int stat, int intensity) // intensity: positive: if (old_stat == 0) real_intensity = 0; else - real_intensity = sign * (((new_stat - old_stat) << 8) / old_stat); + real_intensity = (((new_stat - old_stat) << 8) / old_stat); + + if (mut_base != -1) { + // Now compute the mutation intensity relative to an absolute value. + // Take the lesser of the two effects. + int real_intensity2 = (((new_stat - old_stat) << 8) / mut_base); + + if (real_intensity < 0) + if (real_intensity2 > real_intensity) + real_intensity = real_intensity2; + + if (real_intensity > 0) + if (real_intensity2 < real_intensity) + real_intensity = real_intensity2; + } + + real_intensity *= sign; md->stats[stat] = new_stat; -- cgit v1.2.3-70-g09d2