summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2008-12-05 22:03:06 -0700
committerFate <fate-tmw@googlemail.com>2008-12-05 22:03:06 -0700
commit48206c942c23258166b3b7bd3256164ad7ebe83f (patch)
tree661ab3daf2015ca18567a076311acf1292e124af
parentb2718e6b40767b0b898ed165de29f1621e974b07 (diff)
downloadtmwa-48206c942c23258166b3b7bd3256164ad7ebe83f.tar.gz
tmwa-48206c942c23258166b3b7bd3256164ad7ebe83f.tar.bz2
tmwa-48206c942c23258166b3b7bd3256164ad7ebe83f.tar.xz
tmwa-48206c942c23258166b3b7bd3256164ad7ebe83f.zip
Finished bounding XP boni by absolute values
-rw-r--r--src/map/mob.c21
1 files 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;