summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-08-03 14:32:09 -0300
committerJesusaves <cpntb1@ymail.com>2019-08-03 14:32:09 -0300
commitce8f08fbaec2ffd67b16e2716ed3d6dbe304e7db (patch)
tree7268cac0a039c87229a213243d9946bb8eafff04 /npc
parente16deb169c9510c19f6602181dd31ae24cbde140 (diff)
downloadserverdata-ce8f08fbaec2ffd67b16e2716ed3d6dbe304e7db.tar.gz
serverdata-ce8f08fbaec2ffd67b16e2716ed3d6dbe304e7db.tar.bz2
serverdata-ce8f08fbaec2ffd67b16e2716ed3d6dbe304e7db.tar.xz
serverdata-ce8f08fbaec2ffd67b16e2716ed3d6dbe304e7db.zip
Remove double-precision ponderate average, use a simple average instead with
overflow/underflow protection because I don't trust this code.
Diffstat (limited to 'npc')
-rw-r--r--npc/items/legacy_heal.txt6
1 files changed, 5 insertions, 1 deletions
diff --git a/npc/items/legacy_heal.txt b/npc/items/legacy_heal.txt
index 57a3da2d8..7664c4be9 100644
--- a/npc/items/legacy_heal.txt
+++ b/npc/items/legacy_heal.txt
@@ -38,9 +38,13 @@ OnUse:
.@d=getstatus(.@skill, 4) * 1000;
// If there WAS an effect previously, get ponderate average
+ // Note: never use double-precision ponderate averages
if (.@v > 0) {
@val1=ponderate_avg(@val1, @delay, .@v, .@d);
- @delay=ponderate_avg(@delay, @val1, .@d, .@v);
+ // Overflow and Underflow protection
+ if (@delay+.@d < @delay*5 && .@d > 0)
+ @delay=@delay+.@d;
+ //@delay=ponderate_avg(@delay, @val1, .@d, .@v);
}
// Apply the effect and finish