diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-08-03 14:32:09 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-08-03 14:32:09 -0300 |
commit | ce8f08fbaec2ffd67b16e2716ed3d6dbe304e7db (patch) | |
tree | 7268cac0a039c87229a213243d9946bb8eafff04 | |
parent | e16deb169c9510c19f6602181dd31ae24cbde140 (diff) | |
download | serverdata-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.
-rw-r--r-- | npc/items/legacy_heal.txt | 6 |
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 |