Awkward Scaling involving ImprovedDamage (Bug?)
Afternoon ladies/gents/trolls,
Using a spell with effectid1 = 124, effect_base_value1 = 500 as a focus on a spell with base damage 375000, with no other affecting foci, the damage scales weirdly or breaks (goes negative). This is being cast as a wizard. Base Damage: 375,000 Crit Damage: 900,000 With Focus: 13,500,000 Crit With Focus: -10,549,672 Any ideas? -Hate https://github.com/EQEmu/Server/issues/347 Issue Started as well. |
Sounds like an overflow issue.
However, just reviewing the code those numbers aren't really hitting the int32 limits. Question is it healing the NPC when you negative crit? |
This is the function that handles it. Maybe somebody else will see something obviously wrong.
Code:
int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { |
Kayen,
The healing part I cannot tell as it's a target dummy npc that heals to full every 3 seconds with millions of HP. The code block you sent was one the bit I was pouring over. I'm going to setup a devbox and attach a debugger to trace the values when a crit lands. It seems to be only crits. I should have something by Monday, unless you beat me to it. :-) -Hate |
Code:
... int focus = 3600 value *= focus => 3,240,000,000 <-- overflow for signed 32bit value /= 100 .... ? edit: 3,240,000,000 - 2^32 => -1,054,967,296 -1,054,967,296 / 100 => -10,549,672 Seems pretty likely. |
If the final damage would be over ~21 million it seems like it would inevitably hit overflow somewhere in there. Dunno if it would be worth bumping the temporaries up to int64 for most servers, though.
|
At some point a custom server has to take responsibility for what it sets as values for things.
Given all things are relative there is no logical reason to have numbers that high. |
Quote:
Rude comments aside, I am trying to take responsibility and bring up things I find as potential bugs or awkwardly scaling. This scaled so high because another augment was in my test gear that I was unaware of that added an additional 500% via FcDamagePctCrit (302) which was causing the explosive scaling, which created the potential for -2,700,000,000 in the formula on line 99 in effects.cpp (as shown below). Without the extra 500%, it scaled normally (without code changes) and gave appropriate values. Code:
value += int(value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100)*ratio/100; Thanks to those that contributed and this thread can be closed/locked/marked-as-resolved/etc. :-) -Hate |
All times are GMT -4. The time now is 09:55 AM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.