From 519ff4dc5b054b76db341cafeb464ab3645907f4 Mon Sep 17 00:00:00 2001 From: TracentEden <92269743+TracentEden@users.noreply.github.com> Date: Fri, 30 Aug 2024 14:38:21 +0300 Subject: [PATCH] Change bind to random duration --- scripts/globals/spells/enfeebling_spell.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/globals/spells/enfeebling_spell.lua b/scripts/globals/spells/enfeebling_spell.lua index 11448ed3c69..9f93da33778 100644 --- a/scripts/globals/spells/enfeebling_spell.lua +++ b/scripts/globals/spells/enfeebling_spell.lua @@ -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