landsandboat/scripts/globals/magicburst.lua
Xaver-DaRed 8df4dea7b3 Convert skillchain damage calculations to lua
Co-Authored-By: WinterSolstice8 <WinterSolstice8@users.noreply.github.com>
2026-06-29 19:34:56 +02:00

45 lines
1.1 KiB
Lua

xi = xi or {}
xi.magicburst = xi.magicburst or {}
---@param target CBaseEntity
---@param actionElement number
---@return number, number
xi.magicburst.formMagicBurst = function(target, actionElement)
if not target then
return 0, 0
end
if not actionElement then
return 0, 0
end
if actionElement <= xi.element.NONE or actionElement > xi.element.DARK then
return 0, 0
end
local resonance = target:getStatusEffect(xi.effect.SKILLCHAIN)
if not resonance then
return 0, 0
end
local resonanceTier = resonance:getTier()
if resonanceTier <= 0 then
return 0, 0
end
local isMatch = xi.data.element.skillchainElementTable[actionElement][resonance:getPower()] > 0 and true or false
if not isMatch then
return 0, 0
end
return resonanceTier, resonance:getSubPower()
end
-- Returns a boolean if the element matches the skillchain property given
xi.magicburst.doesElementMatchWeaponskill = function(actionElement, SCProp)
if SCProp == 0 then
return false
end
return xi.data.element.skillchainElementTable[actionElement][SCProp] > 0 and true or false
end