I looked at this today and found two problems with the code. Here's what I did on my server. I hope it makes sense to someone other than me, heh.
1) Snare and root are supposed to stack. This was a change that was made to EQLive way back in the Kunark-is-still-new days.
in spell_effects.cpp (Zone project), look for this:
Quote:
case SE_Root:
{
#ifdef SPELL_EFFECT_SPAM
snprintf(effect_desc, _EDLEN, "Root: %+i", effect_value);
#endif
//BuffFadeByEffect(SE_MovementSpeed);
rooted = true;
break;
}
|
Notice that I simply commented out the line that was forcing all movement buffs to fade. This includes snare as well as Sow, Wolf Form, etc. None of those fade when you get rooted on EQLive.
2) Snare wasn't making the mobs run slow enough. Ok, this problem took a bit to figure out exactly where the math was wrong, and I changed several lines of code (including other spell types) under the assumption that they were wrong as well. I haven't noticed anything odd due to this assumption yet, but just be aware that I may have changed more than I should have. My changes, however, will not affect buffs. All of these formulas were doing the correct calculations for positive value changes; the sign was just in the wrong place for debuffs.
The change for this was also in the same file as above, spell_effects.cpp (Zone project).
Look for the following function: CalcSpellEffectValue_formula
It should be around line #1886
The problem I found was in the switch statement that does the calculations on the spell formulas, specifically these lines:
Quote:
case 101: // solar: confirmed 2/6/04
result = ubase + updownsign * (caster_level / 2); break;
case 102: // solar: confirmed 2/6/04
result = ubase + updownsign * caster_level; break;
case 103: // solar: confirmed 2/6/04
result = ubase + updownsign * (caster_level * 2); break;
case 104: // solar: confirmed 2/6/04
result = ubase + updownsign * (caster_level * 3); break;
case 105: // solar: confirmed 2/6/04
result = ubase + updownsign * (caster_level * 4); break;
case 107: // Shutting this thing up, this is wrong
result = ubase + updownsign * (caster_level * 4); break;
case 108:
result = ubase + updownsign * (caster_level / 3); break;
case 109: // solar: confirmed 2/6/04
result = ubase + updownsign * (caster_level / 4); break;
|
The formula for snare is type 102. I'll go over what's wrong with this one in particular. Like I said, I modified all of these cases (101 - 109) in the same way.
Quote:
result = ubase + updownsign * caster_level; break;
|
ubase is a variable holding the unsigned value of the base effect. In the case of Ensnare, the base effect value would be -40 (decrease by 40%), so ubase will be 40.
updownsign will be -1 since the effect value is negative (because it's a debuff).
caster_level will be my test ranger, who is level 64.
The result in this case is
result = 40 + (-1 * 64) = -24
This is a 24% reduction in movement speed. This is why griffawns that have a base run speed of 1.25 were being slowed down to 0.95.
So I changed the formula to this:
Quote:
result = updownsign * (ubase + caster_level);
|
What this now does is modify the base
before applying the sign to make it negative. In this case, we would have:
result = -1 * (40 + 64) = -104
This result is capped by the spell's maximum movement reduction of -56, or 56%. The same griffawn now is correctly slowed down from 1.25 movement rate to 0.55.
----
Next, I wanted to verify the math with the regular Snare spell, which decreases movement rate from 41% (L1) to 55% (L15). For Snare, the base effect is -40.
Before at level 1:
result = 40 + (-1 * 1) = 39, or a 39%
increase in speed (theoretically; it will get fixed later on in that function by multiplying by -1, so it will be a 39% decrease).
After:
result = -1 * (40 + 1) = -41, 41% decrease (correct).
Before at level 15:
result = 40 + (-1 * 15) = 25, or 25% increase in speed (also fixed as above)
After:
result = -1 * (40 + 15) = -55, or 55% decrease (correct).
Like I said, I'm not sure how well this applies to the other spell types. I just applied the change to all of the similar ones and am testing it. But I can already see that snare is working as well as it should.
The new code to replace the above section:
Quote:
case 101: // solar: confirmed 2/6/04
result = updownsign * (ubase + (caster_level / 2)); break;
case 102: // solar: confirmed 2/6/04
result = updownsign * (ubase + caster_level); break;
case 103: // solar: confirmed 2/6/04
result = updownsign * (ubase + (caster_level * 2)); break;
case 104: // solar: confirmed 2/6/04
result = updownsign * (ubase + (caster_level * 3)); break;
case 105: // solar: confirmed 2/6/04
result = updownsign * (ubase + (caster_level * 4)); break;
case 107: // Shutting this thing up, this is wrong
result = updownsign * (ubase + (caster_level * 4)); break;
case 108:
result = updownsign * (ubase + (caster_level / 3)); break;
case 109: // solar: confirmed 2/6/04
result = updownsign * (ubase + (caster_level / 4)); break;
|