Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lua] Change bind to use retail accurate random duration #6194

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/globals/spells/enfeebling_spell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ end
xi.spells.enfeebling.calculateDuration = function(caster, target, spellId, spellEffect, skillType)
local duration = pTable[spellId][7] -- Get base duration.

-- BIND spells have a special random duration the follows a normal distribution with mean=30 and std=12
if spellEffect == xi.effect.BIND then
-- Use the Box-Muller transform to change uniform dist sample to the normal dist sample
local z0 = math.sqrt(-2 * math.log(math.random())) * math.cos(2 * math.pi * math.random())
duration = utils.clamp(math.floor(30 + z0 * 12), 1, duration)
end

-- Additions to base duration.
if
spellEffect == xi.effect.BURN or
Expand Down
Loading