From 8148c83307f611c68af86b178041d0543eb08067 Mon Sep 17 00:00:00 2001 From: Mickael Cagnion Date: Tue, 10 Nov 2026 10:23:57 +0100 Subject: [PATCH 1/3] Support numeric additional tincture modifiers --- spec/System/TestTinctures_spec.lua | 41 ++++++++++++++++++++++++++++++ src/Modules/ModParser.lua | 1 + 2 files changed, 42 insertions(+) create mode 100644 spec/System/TestTinctures_spec.lua diff --git a/spec/System/TestTinctures_spec.lua b/spec/System/TestTinctures_spec.lua new file mode 100644 index 00000000000..740fe50af6e --- /dev/null +++ b/spec/System/TestTinctures_spec.lua @@ -0,0 +1,41 @@ +describe("Tinctures", function() + before_each(function() + newBuild() + end) + + it("applies the numeric additional tincture limit and preserves the singular modifier", function() + runCallback("OnFrame") + local baseline = {} + -- Synthetic resistance markers identify each tincture's contribution independently. + local tinctures = { + { base = "Prismatic Tincture", resist = "Fire", value = 11 }, + { base = "Rosethorn Tincture", resist = "Cold", value = 13 }, + { base = "Ironwood Tincture", resist = "Lightning", value = 17 }, + { base = "Ashbark Tincture", resist = "Chaos", value = 19 }, + } + for index, tincture in ipairs(tinctures) do + baseline[tincture.resist] = build.calcsTab.mainOutput[tincture.resist .. "Resist"] + build.itemsTab:CreateDisplayItemFromRaw("Rarity: NORMAL\n" .. tincture.base .. "\nImplicits: 0\n+" .. tincture.value .. "% to " .. tincture.resist .. " Resistance") + local item = build.itemsTab.displayItem + build.itemsTab:AddDisplayItem() + local slot = build.itemsTab.slots["Flask " .. index] + slot:SetSelItemId(item.id) + slot.active = true + end + for _, case in ipairs({ + { text = "", limit = 1 }, + { text = "You can have an additional Tincture active", limit = 2 }, + { text = "You can have 2 additional Tinctures active", limit = 3 }, + { text = "", limit = 1 }, + }) do + build.configTab.input.customMods = case.text + build.configTab:BuildModList() + runCallback("OnFrame") + assert.are.equal(case.limit, build.calcsTab.mainOutput.TinctureLimit) + for index, tincture in ipairs(tinctures) do + local expected = baseline[tincture.resist] + (index <= case.limit and tincture.value or 0) + assert.are.equal(expected, build.calcsTab.mainOutput[tincture.resist .. "Resist"], tincture.resist) + end + end + end) +end) diff --git a/src/Modules/ModParser.lua b/src/Modules/ModParser.lua index 6355f995fea..0c927562514 100644 --- a/src/Modules/ModParser.lua +++ b/src/Modules/ModParser.lua @@ -5302,6 +5302,7 @@ local specialModList = { ["tinctures inflict weeping wounds instead of mana burn"] = { flag("Condition:WeepingWoundsInsteadOfManaBurn"), }, ["tincture effects also apply to ranged weapons"] = { flag("TinctureRangedWeapons"), }, ["you can have an additional tincture active"] = { mod("TinctureLimit", "BASE", 1), }, + ["you can have (%d+) additional tinctures active"] = function(num) return { mod("TinctureLimit", "BASE", num) } end, ["(%d+)%% increased tincture cooldown recovery rate"] = function(num) return { mod("TinctureCooldownRecovery", "INC", num) } end, ["adds (%d+) passive skills"] = function(num) return { mod("JewelData", "LIST", { key = "clusterJewelNodeCount", value = num }) } end, ["1 added passive skill is a jewel socket"] = { mod("JewelData", "LIST", { key = "clusterJewelSocketCount", value = 1 }) }, From 425adfae60a90ae5004f95dd9306cddc4c3e0ab3 Mon Sep 17 00:00:00 2001 From: Mickael Cagnion Date: Tue, 10 Nov 2026 15:31:55 +0100 Subject: [PATCH 2/3] Support the Scales of Justice ailment condition Compare maximum Life and Mana before reservation and apply the existing Ignite and Shock effect reductions within the item threshold. --- spec/System/TestDefence_spec.lua | 48 ++++++++++++++++++++++++++++++++ src/Data/ModCache.lua | 2 +- src/Modules/CalcPerform.lua | 2 ++ src/Modules/ModParser.lua | 4 +++ 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/spec/System/TestDefence_spec.lua b/spec/System/TestDefence_spec.lua index 84a726515aa..1a7f3289598 100644 --- a/spec/System/TestDefence_spec.lua +++ b/spec/System/TestDefence_spec.lua @@ -27,6 +27,54 @@ describe("TestDefence", function() end end) + it("applies the Scales of Justice ailment condition to maximum life and mana", function() + -- Exercise the parser rather than the checked-in result for this item. + modLib.parseModCache["Unaffected by Ignite or Shock if Maximum Life and Maximum Mana are within 500"] = nil + for _, raw in ipairs(dofile("Data/Uniques/shield.lua")) do + if raw:match("^The Scales of Justice\n") then + build.itemsTab:CreateDisplayItemFromRaw("Rarity: UNIQUE\n" .. raw) + break + end + end + local item = build.itemsTab.displayItem + assert.is_not_nil(item) + build.itemsTab:AddDisplayItem() + build.itemsTab.slots["Weapon 2"]:SetSelItemId(item.id) + build.configTab:BuildModList() + runCallback("OnFrame") + local baseLife = build.calcsTab.mainOutput.Life + local baseMana = build.calcsTab.mainOutput.Mana + for _, case in ipairs({ + { life = 1000, mana = 1499, effect = 0 }, + { life = 1000, mana = 1500, effect = 0 }, + { life = 1000, mana = 1501, effect = 100 }, + { life = 1501, mana = 1000, effect = 100 }, + { life = 1499, mana = 1000, effect = 0 }, + { life = 1500, mana = 1000, effect = 0 }, + }) do + build.configTab.input.customMods = "+" .. (case.life - baseLife) .. " to maximum Life\n+" .. (case.mana - baseMana) .. " to maximum Mana" + build.configTab:BuildModList() + runCallback("OnFrame") + local output = build.calcsTab.mainOutput + assert.are.equal(case.life, output.Life) + assert.are.equal(case.mana, output.Mana) + assert.are.equal(case.effect, output.SelfIgniteEffect) + assert.are.equal(case.effect, output.SelfShockEffect) + assert.are.equal(0, output.ShockAvoidChance) + end + build.skillsTab:PasteSocketGroup("Clarity 1/0 1") + runCallback("OnFrame") + local output = build.calcsTab.mainOutput + assert.is_true(output.ManaUnreserved < output.Mana) + assert.are.equal(0, output.SelfIgniteEffect) + assert.are.equal(0, output.SelfShockEffect) + build.itemsTab.slots["Weapon 2"]:SetSelItemId(0) + build.buildFlag = true + runCallback("OnFrame") + assert.are.equal(100, build.calcsTab.mainOutput.SelfIgniteEffect) + assert.are.equal(100, build.calcsTab.mainOutput.SelfShockEffect) + end) + -- a small helper function to calculate damage taken from limited test parameters local function takenHitFromTypeMaxHit(type, enemyDamageMulti) return build.calcsTab.calcs.takenHitFromDamage(build.calcsTab.calcsOutput[type.."MaximumHitTaken"] * (enemyDamageMulti or 1), type, build.calcsTab.calcsEnv.player) diff --git a/src/Data/ModCache.lua b/src/Data/ModCache.lua index e0ede6c2653..4d4a80ad1ff 100755 --- a/src/Data/ModCache.lua +++ b/src/Data/ModCache.lua @@ -22179,7 +22179,7 @@ c["Unaffected by Flammability while affected by Purity of Fire"]={{[1]={[1]={ski c["Unaffected by Frostbite while affected by Purity of Ice"]={{[1]={[1]={skillName="Frostbite",type="SkillName"},[2]={type="Condition",var="AffectedByPurityofIce"},[3]={effectType="Global",type="GlobalEffect",unscalable=true},flags=0,keywordFlags=0,name="CurseEffectOnSelf",type="MORE",value=-100}},nil} c["Unaffected by Ignite"]={{[1]={flags=0,keywordFlags=0,name="SelfIgniteEffect",type="MORE",value=-100}},nil} c["Unaffected by Ignite if 2 Warlord Items are Equipped"]={{[1]={[1]={threshold=2,type="MultiplierThreshold",var="WarlordItem"},flags=0,keywordFlags=0,name="SelfIgniteEffect",type="MORE",value=-100}},nil} -c["Unaffected by Ignite or Shock if Maximum Life and Maximum Mana are within 500"]={nil,"Unaffected by Ignite or Shock if Maximum Life and Maximum Mana are within 500 "} +c["Unaffected by Ignite or Shock if Maximum Life and Maximum Mana are within 500"]={{[1]={[1]={stat="AbsoluteDifferenceOfMaximumLifeAndMaximumMana",threshold=500,type="StatThreshold",upper=true},flags=0,keywordFlags=0,name="SelfIgniteEffect",type="MORE",value=-100},[2]={[1]={stat="AbsoluteDifferenceOfMaximumLifeAndMaximumMana",threshold=500,type="StatThreshold",upper=true},flags=0,keywordFlags=0,name="SelfShockEffect",type="MORE",value=-100}},nil} c["Unaffected by Poison"]={{[1]={flags=0,keywordFlags=0,name="SelfPoisonEffect",type="MORE",value=-100}},nil} c["Unaffected by Poison if 2 Hunter Items are Equipped"]={{[1]={[1]={threshold=2,type="MultiplierThreshold",var="HunterItem"},flags=0,keywordFlags=0,name="SelfPoisonEffect",type="MORE",value=-100}},nil} c["Unaffected by Poison while affected by Malevolence"]={{[1]={[1]={type="Condition",var="AffectedByMalevolence"},[2]={effectType="Global",type="GlobalEffect",unscalable=true},flags=0,keywordFlags=0,name="SelfPoisonEffect",type="MORE",value=-100}},nil} diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index cda09c77378..d5d45af93fc 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -10,6 +10,7 @@ local pairs = pairs local ipairs = ipairs local t_insert = table.insert local t_remove = table.remove +local m_abs = math.abs local m_min = math.min local m_max = math.max local m_ceil = math.ceil @@ -130,6 +131,7 @@ function doActorLifeMana(actor) end end output.LowestOfMaximumLifeAndMaximumMana = m_min(output.Life, output.Mana) + output.AbsoluteDifferenceOfMaximumLifeAndMaximumMana = m_abs(output.Life - output.Mana) end -- Calculate attributes, and set conditions diff --git a/src/Modules/ModParser.lua b/src/Modules/ModParser.lua index 0c927562514..ad650d3e1ad 100644 --- a/src/Modules/ModParser.lua +++ b/src/Modules/ModParser.lua @@ -5028,6 +5028,10 @@ local specialModList = { ["immun[ei]t?y? to curses while you have at least (%d+) rage"] = function(num) return { flag("CurseImmune", { type = "MultiplierThreshold", var = "Rage", threshold = num }) } end, ["you cannot be cursed with silence"] = { flag("SilenceImmune") }, ["unaffected by ignite"] = { mod("SelfIgniteEffect", "MORE", -100) }, + ["unaffected by ignite or shock if maximum life and maximum mana are within (%d+)"] = function(num) return { + mod("SelfIgniteEffect", "MORE", -100, { type = "StatThreshold", stat = "AbsoluteDifferenceOfMaximumLifeAndMaximumMana", threshold = num, upper = true }), + mod("SelfShockEffect", "MORE", -100, { type = "StatThreshold", stat = "AbsoluteDifferenceOfMaximumLifeAndMaximumMana", threshold = num, upper = true }), + } end, ["unaffected by chill"] = { mod("SelfChillEffect", "MORE", -100) }, ["unaffected by chill while leeching mana"] = { mod("SelfChillEffect", "MORE", -100, { type = "Condition", var = "LeechingMana" }) }, ["unaffected by chill while channelling"] = { mod("SelfChillEffect", "MORE", -100, { type = "Condition", var = "Channelling" }) }, From 95e30352772c1db79587f8ea372ec5283ec4d50d Mon Sep 17 00:00:00 2001 From: Mickael Cagnion Date: Wed, 11 Nov 2026 08:15:43 +0100 Subject: [PATCH 3/3] Cache the updated Living Blade modifiers --- src/Data/ModCache.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Data/ModCache.lua b/src/Data/ModCache.lua index 4d4a80ad1ff..6e64a0d0997 100755 --- a/src/Data/ModCache.lua +++ b/src/Data/ModCache.lua @@ -22617,8 +22617,7 @@ c["You can catch Exotic Fish"]={nil,"You can catch Exotic Fish "} c["You can catch Exotic Fish 40% reduced Quantity of Fish Caught"]={nil,"You can catch Exotic Fish 40% reduced Quantity of Fish Caught "} c["You can catch Foulborn Fish"]={nil,"You can catch Foulborn Fish "} c["You can catch Scourged Fish"]={nil,"You can catch Scourged Fish "} -c["You can have 2 additional Tinctures active"]={nil,"You can have 2 additional Tinctures active "} -c["You can have 2 additional Tinctures active 10% chance to remove 1 Mana Burn on Kill"]={nil,"You can have 2 additional Tinctures active 10% chance to remove 1 Mana Burn on Kill "} +c["You can have 2 additional Tinctures active"]={{[1]={flags=0,keywordFlags=0,name="TinctureLimit",type="BASE",value=2}},nil} c["You can have an Offering of each type"]={nil,"You can have an Offering of each type "} c["You can have an Offering of each type Offering Skills have 50% reduced Duration"]={nil,"You can have an Offering of each type Offering Skills have 50% reduced Duration "} c["You can have an additional Brand Attached to an Enemy"]={{[1]={flags=0,keywordFlags=0,name="BrandsAttachedLimit",type="BASE",value=1}},nil}