Skip to content

Commit 7c8ec05

Browse files
committed
Add temporary workaround for missing Reload Time data on item bases
1 parent 55c8b07 commit 7c8ec05

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

src/Modules/CalcOffence.lua

+41-6
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,53 @@ local function setMoltenStrikeTertiaryRadiusBreakdown(breakdown, deadzoneRadius,
274274
-- Trigger the inclusion of the radius display.
275275
breakdownRadius.radius = currentDist
276276
end
277+
-- Returns base reload time according to stored values of Crossbow item base that is used for the skill
278+
-- NOTE: This is a temporary workaround to allow for testing until the export of Reload Time data from the game files is sorted out
279+
-- TODO: get data from item base itself rather than using hardcoded values
280+
---@param actor table @actor table that contains the data for the weapon
281+
---@return number
282+
local function getCrossbowBaseReloadTime(actor)
283+
local weaponName = actor.weaponData1.name or "No Weapon Equipped" -- assuming Crossbows can only be wielded in mainhand for now
284+
local crossbowBases = {
285+
["Makeshift Crossbow"] = 0.8,
286+
["Tense Crossbow"] = 0.85,
287+
["Sturdy Crossbow"] = 0.75,
288+
["Varnished Crossbow"] = 0.8,
289+
["Dyad Crossbow"] = 1.1,
290+
["Alloy Crossbow"] = 0.7,
291+
["Bombard Crossbow"] = 0.75,
292+
["Construct Crossbow"] = 0.8,
293+
["Blackfire Crossbow"] = 0.85,
294+
["Piercing Crossbow"] = 0.85,
295+
["Cumbrous Crossbow"] = 0.9,
296+
["Dedalian Crossbow"] = 0.85,
297+
["Esoteric Crossbow"] = 0.8,
298+
["Advanced Tense Crossbow"] = 0.85,
299+
["Advanced Sturdy Crossbow"] = 0.75,
300+
["Advanced Varnished Crossbow"] = 0.8,
301+
["Advanced Dyad Crossbow"] = 1.1,
302+
["Advanced Bombard Crossbow"] = 0.75,
303+
["Advanced Forlorn Crossbow"] = 0.8,
304+
["Expert Sturdy Crossbow"] = 0.75,
305+
["Expert Varnished Crossbow"] = 0.8,
306+
["Expert Tense Crossbow"] = 0.85,
307+
["Expert Dyad Crossbow"] = 1.1,
308+
["Expert Bombard Crossbow"] = 0.75,
309+
["Expert Forlorn Crossbow"] = 0.8,
310+
}
277311

312+
for baseName, reloadTime in pairs(crossbowBases) do
313+
if string.find(weaponName, ", " .. baseName) then return reloadTime end -- need to add ", " to avoid false matches from non-Advanced/Expert versions
314+
end
315+
return 0 -- in case there are no matches, it's an invalid base and reload time is ignored
316+
end
278317
-- Calculate and return reload time in seconds for a specific Crossbow skill
279318
---@param actor table @actor using the skill
280319
---@param ammoSkill table @skill of type SkillType.CrossbowAmmoSkill
281320
---@param boltSkill table @skill that uses the ammo to shoot bolts
282321
---@return number
283322
local function calcCrossbowReloadTime(actor, ammoSkill, boltSkill)
284-
--todo remove placeholder
285-
-- Currently using 0.8 seconds as placeholder value until I can get the proper base values exported
286-
local baseReloadTime = 0.8
323+
local baseReloadTime = getCrossbowBaseReloadTime(actor)
287324
local reloadTimeMulti = calcLib.mod(boltSkill.skillModList, boltSkill.skillCfg, "ReloadSpeed" )
288325
return baseReloadTime / reloadTimeMulti
289326
end
@@ -2470,9 +2507,7 @@ function calcs.offence(env, actor, activeSkill)
24702507
t_insert(globalBreakdown.TotalFiringTime, s_format("= %.2fs ^8(total firing time)", output.TotalFiringTime))
24712508

24722509
globalBreakdown.ReloadTime = { }
2473-
--TODO remove placeholder
2474-
-- Currently using 0.8 seconds as placeholder value until I can get the proper base values exported
2475-
local baseReloadTime = 0.8
2510+
local baseReloadTime = getCrossbowBaseReloadTime(actor)
24762511
local incReloadSpeed = skillModList:Sum("INC", skillCfg, "ReloadSpeed")
24772512
local moreReloadSpeed = (100 + skillModList:Sum("MORE", skillCfg, "ReloadSpeed")) / 100
24782513
t_insert(globalBreakdown.ReloadTime, s_format(" 1.00s / %.2f ^8(base reload time)", baseReloadTime))

0 commit comments

Comments
 (0)