summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-09 17:19:47 +0100
committerHaru <haru@dotalux.com>2016-02-09 17:19:47 +0100
commit46e502d5f4a84e4d977644e6050a910aa06d64f6 (patch)
treeb5f418b2462e15fe348bf6f02094cab3df48fc68
parented3387430588f2786d2e9b72723c1d54401f65da (diff)
downloadhercules-46e502d5f4a84e4d977644e6050a910aa06d64f6.tar.gz
hercules-46e502d5f4a84e4d977644e6050a910aa06d64f6.tar.bz2
hercules-46e502d5f4a84e4d977644e6050a910aa06d64f6.tar.xz
hercules-46e502d5f4a84e4d977644e6050a910aa06d64f6.zip
Small tweaks to mob_drop_adjust
Related to #1152 Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/mob.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index bc78c6098..86f3ddc0d 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3634,13 +3634,19 @@ unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned short rate_
{
int64 rate = baserate;
- if (battle_config.logarithmic_drops && rate_adjust > 0 && rate_adjust != 100 && baserate > 0) //Logarithmic drops equation by Ishizu-Chan
- //Equation: Droprate(x,y) = x * (5 - log(x)) ^ (ln(y) / ln(5))
- //x is the normal Droprate, y is the Modificator.
- rate = rate * pow((5.0 - log10(rate)), (log(rate_adjust/100.) / log(5.0))) + 0.5;
- else
- //Classical linear rate adjustment.
- rate = apply_percentrate64(rate, rate_adjust, 100);
+ Assert_ret(baserate >= 0);
+
+ if (rate_adjust != 100 && baserate > 0) {
+ if (battle_config.logarithmic_drops && rate_adjust > 0) {
+ // Logarithmic drops equation by Ishizu-Chan
+ //Equation: Droprate(x,y) = x * (5 - log(x)) ^ (ln(y) / ln(5))
+ //x is the normal Droprate, y is the Modificator.
+ rate = (int64)(baserate * pow((5.0 - log10(baserate)), (log(rate_adjust/100.) / log(5.0))) + 0.5);
+ } else {
+ //Classical linear rate adjustment.
+ rate = apply_percentrate64(baserate, rate_adjust, 100);
+ }
+ }
return (unsigned int)cap_value(rate,rate_min,rate_max);
}