new formula thanks to necrolesian

This commit is contained in:
Lilian Jónsdóttir 2021-08-10 11:09:34 -07:00
parent 74dee76029
commit a40d07df18
2 changed files with 11 additions and 1 deletions

View file

@ -7,7 +7,7 @@ this.modInfo = "No longer can you swim in heavy plate; now your armour, equipmen
"What is dead may never die."
this.version = "1.0.4"
this.configString = string.gsub(this.modName, "%s+", "")
this.modes = {equippedArmour = 0, allEquipment = 1, encumbrancePercentage = 2}
this.modes = {equippedArmour = 0, allEquipment = 1, encumbrancePercentage = 2, allEquipmentNecroEdit = 3}
this.log = function(...) mwse.log("[%s] %s", this.modName, string.format(...)) end
return this

View file

@ -67,6 +67,16 @@ local function sinkInWater(e)
debugStr = string.format("Pulling %s down by %s using equipment weight mode (%s total equipment weight)",
ref.id, downPull, totalWeight)
elseif config.mode == common.modes.allEquipmentNecroEdit then
local totalWeight = getTotalEquipmentWeight(actor)
-- Thanks Necrolesian for this formula
-- https://forums.nexusmods.com/index.php?/topic/10349253-a-sinking-feeling/page-2#entry97870268
local term1 = ((config.downPullMultiplier / 100) * totalWeight) * 2
local term2 = ((config.downPullMultiplier / 100) * (totalWeight - 135) * 0.2) + 270
downPull = math.min(term1, term2)
debugStr = string.format("Pulling %s down by %s (instead of %s) using equipment weight mode (necro edit) (%s total equipment weight)",
ref.id, downPull, math.max(term1, term2), totalWeight)
elseif config.mode == common.modes.encumbrancePercentage then
local encumbrance = mobile.encumbrance
-- tripling this keeps this formula somewhat uniform with armour class @ multiplier 100