Skip to content

Commit

Permalink
Rebalance Self Repair modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaakma committed Jul 30, 2023
1 parent aebea36 commit 4a04ea4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion Data Files/MWSE/mods/mer/drip/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ local config = {
modDescription = [[
Drip adds Diablo 2 style loot to Morrowind. Unique weapons, armor, clothing and accesories are dynamically generated, with over a hundred unique modifiers and more than a million possible combinations.
]],
selfRepairPercentPerHour = 1,
multiplierFieldDecimals= {
speed = 2,
},
Expand Down
20 changes: 12 additions & 8 deletions Data Files/MWSE/mods/mer/drip/customEffects/effects/selfRepair.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ tes3.claimSpellEffectId("selfRepair", 8500)
interop.registerModifier{
suffix = "Self-Repair",
value = 50,
valueMulti = 1.1,
castType = tes3.enchantmentType.constant,
effects = {
{
Expand All @@ -23,12 +24,14 @@ interop.registerModifier{
}
interop.registerModifier{
suffix = "Fast-Repair",
value = 100,
valueMulti = 1.2,
castType = tes3.enchantmentType.constant,
effects = {
{
id = tes3.effect.selfRepair,
min = 10,
max = 10,
min = 20,
max = 20,
},
},
validObjectTypes = {
Expand All @@ -37,15 +40,13 @@ interop.registerModifier{
},
}



event.register("magicEffectsResolved", function()
logger:trace("Creating Self Repair Magic Effect")
tes3.addMagicEffect{
id = tes3.effect.selfRepair,
name = "Self Repair",
school = tes3.magicSchool.alteration,
description = "Slowly restores item condition.",
description = "Slowly restores item condition while equipped.",
icon = "drip\\selfRepair_s.dds",
particleTexture = "vfx_alt_glow.tga",
castSound = "alteration cast",
Expand Down Expand Up @@ -90,16 +91,19 @@ event.register("magicEffectsResolved", function()
local condition = itemData.condition
local maxCondition = item.maxCondition


logger:trace("self-repair magnitude: %s", magnitude)
if condition and maxCondition then
logger:trace("Current condition: %s", condition)
local repairAmount = maxCondition * (magnitude/100) * e.deltaTime

local hoursPassed = (e.deltaTime / 60 / 60)
local repairPerHour = magnitude/100
local repairAmount = maxCondition * repairPerHour * hoursPassed
itemData.data.selfRepairLeftover = itemData.data.selfRepairLeftover or 0
logger:trace("Leftover from previous: %s", itemData.data.selfRepairLeftover)
repairAmount = repairAmount + itemData.data.selfRepairLeftover
logger:trace("initial Repair Amount: %s", repairAmount)
itemData.data.selfRepairLeftover = 0
local leftOver = repairAmount - math.floor(repairAmount)
logger:trace("new Leftover: %s", leftOver)
itemData.data.selfRepairLeftover = leftOver
repairAmount = math.floor(repairAmount)

Expand Down

0 comments on commit 4a04ea4

Please sign in to comment.
  翻译: