diff --git a/spec/System/TestConfigTab_spec.lua b/spec/System/TestConfigTab_spec.lua index ec5516facfa..4e00d4db03b 100644 --- a/spec/System/TestConfigTab_spec.lua +++ b/spec/System/TestConfigTab_spec.lua @@ -4,6 +4,81 @@ describe("TestConfig", function() runCallback("OnFrame") end) + local stealMod = "When you Kill a Rare monster, you gain its Modifiers for 60 seconds" + local function equip(slot, name, base, mods) + local item = new("Item"):Item("Rarity: UNIQUE\n" .. name .. "\n" .. base .. "\nImplicits: 0\n" .. mods .. "\n") + build.itemsTab:AddItem(item, true) + build.itemsTab.slots[slot]:SetSelItemId(item.id) + end + local function calculate(preset, souls) + if preset then build.configTab.input.headhunterBuffPreset = preset end + if souls then build.configTab.input.multiplierSoulEater = souls end + build.configTab:BuildModList() + build.buildFlag = true + runCallback("OnFrame") + return build.calcsTab.mainOutput, build.calcsTab.mainEnv.player.modDB + end + + it("applies HH presets and ignores stale souls without another source", function() + build.skillsTab:PasteSocketGroup("Freezing Pulse 20/0 1") + equip("Belt", "Headhunter", "Leather Belt", stealMod) + local base = copyTable(calculate("OFF", 45)) + -- Preset, projectiles, fire resistance, increased speed, life as ES, stun immunity. + for _, c in ipairs({ { "LOW", 1, 18, 72.5, 20, false }, { "MODERATE", 2, 37, 145, 40, false }, { "HIGH", 3, 56, 217.5, 60, false }, { "FULL", 4, 75, 295, 80, true }, { "OFF", 0, 0, 0, 0, false } }) do + local out, db = calculate(c[1]) + assert.are.equal(base.ProjectileCount + c[2], out.ProjectileCount) + assert.are.equal(base.FireResistTotal + c[3], out.FireResistTotal) + assert.are.near(base.Speed * round(1 + c[4] / 100, 2), out.Speed, 0.001) + assert.are.equal(c[5], db:Sum("BASE", nil, "LifeGainAsEnergyShield")) + assert.are.equal(c[6], not not db:Flag(nil, "StunImmune")) + end + build.itemsTab.slots.Belt:SetSelItemId(0) + local out, db = calculate("FULL") + assert.are.near(base.Speed, out.Speed, 0.001) + assert.are.equal(base.ProjectileCount, out.ProjectileCount) + assert.is_false(not not db:Flag(nil, "StunImmune")) + end) + + it("keeps HH Off by default and saves manual choices independently of bosses", function() + equip("Belt", "Headhunter", "Leather Belt", stealMod) + for _, boss in ipairs({ "None", "Boss", "Pinnacle", "Uber" }) do + build.configTab.input.enemyIsBoss = boss + calculate() + assert.are.equal("OFF", build.configTab.input.headhunterBuffPreset) + end + for _, preset in ipairs({ "HIGH", "OFF" }) do + calculate(preset) + build.configTab.input.enemyIsBoss = "None" + loadBuildFromXML(build:SaveDB("code"), "HH selection") + assert.are.equal(preset, build.configTab.input.headhunterBuffPreset) + end + end) + + it("requires the rare-stealing line, including on Foulborn and excluding Replica", function() + for _, c in ipairs({ { "Headhunter", stealMod, true }, { "Foulborn Headhunter", stealMod, true }, { "Foulborn Headhunter", "Culling Strike", false }, { "Replica Headhunter", "20% chance when you Kill a Magic Monster to gain its Modifiers for 20 seconds", false }, { "Headhunter", "", false } }) do + equip("Belt", c[1], "Leather Belt", c[2]) + local _, db = calculate("FULL") + assert.are.equal(c[3], not not db:Flag(nil, "Condition:HeadhunterEquipped")) + assert.are.equal(c[3] and 80 or 0, db:Sum("BASE", nil, "LifeGainAsEnergyShield")) + end + end) + + it("combines soul sources without stacking and respects modified maximums", function() + build.skillsTab:PasteSocketGroup("Freezing Pulse 20/0 1") + local baseSpeed = calculate().Speed + equip("Belt", "Headhunter", "Leather Belt", stealMod) + for _, roll in ipairs({ 0, 10, -10 }) do + equip("Gloves", "Soul Ascension", "Carnal Mitts", "Eat a Soul when you Hit a Rare or Unique Enemy, no more than once every 0.5 seconds\n" .. string.format("%+d", roll) .. " to maximum number of Eaten Souls") + -- Preset, manual souls, resulting souls, ordinary speed bonus. + for _, c in ipairs({ { "LOW", 0, 11, 17.5 }, { "MODERATE", 11, 22, 35 }, { "HIGH", 0, 33, 52.5 }, { "FULL", 0, 45 + roll, 70 }, { "MODERATE", 35, 35, 35 }, { "MODERATE", 100, 45 + roll, 35 }, { "OFF", 100, 45 + roll, 0 } }) do + local out = calculate(c[1], c[2]) + assert.are.near(baseSpeed * round(1 + (5 * c[3] + c[4]) / 100, 2), out.Speed, 0.001) + end + end + build.itemsTab.slots.Gloves:SetSelItemId(0) + assert.are.near(baseSpeed * 2.45, calculate("MODERATE", 45).Speed, 0.001) + end) + describe("ConfigTab", function() describe("NewConfigSet", function() it("Creates a new config set with specified ID", function() diff --git a/src/Data/ModCache.lua b/src/Data/ModCache.lua index 94ce6007e71..5924d64db51 100755 --- a/src/Data/ModCache.lua +++ b/src/Data/ModCache.lua @@ -22525,7 +22525,7 @@ c["When you Kill a Rare Monster, 25% chance to gain one of its Modifiers for 10 c["When you Kill a Rare Monster, 26% chance to gain one of its Modifiers for 10 seconds"]={nil,"When you Kill a Rare Monster, 26% chance to gain one of its Modifiers for 10 seconds "} c["When you Kill a Rare Monster, 30% chance to gain one of its Modifiers for 10 seconds"]={nil,"When you Kill a Rare Monster, 30% chance to gain one of its Modifiers for 10 seconds "} c["When you Kill a Rare Monster, 36% chance to gain one of its Modifiers for 10 seconds"]={nil,"When you Kill a Rare Monster, 36% chance to gain one of its Modifiers for 10 seconds "} -c["When you Kill a Rare monster, you gain its Modifiers for 60 seconds"]={nil,"When you Kill a Rare monster, you gain its Modifiers for 60 seconds "} +c["When you Kill a Rare monster, you gain its Modifiers for 60 seconds"]={{[1]={flags=0,keywordFlags=0,name="Condition:HeadhunterEquipped",type="FLAG",value=true}},nil} c["When you Kill a Shocked Enemy, inflict an equivalent Shock on each Enemy within 2 metres"]={nil,"When you Kill a Shocked Enemy, inflict an equivalent Shock on each Enemy within 2 metres "} c["When you Kill a Shocked Enemy, inflict an equivalent Shock on each Enemy within 2 metres When you Kill an Ignited Enemy, inflict an equivalent Ignite on each Enemy within 2 metres"]={nil,"When you Kill a Shocked Enemy, inflict an equivalent Shock on each Enemy within 2 metres When you Kill an Ignited Enemy, inflict an equivalent Ignite on each Enemy within 2 metres "} c["When you Kill a Shocked Enemy, inflict an equivalent Shock on each nearby Enemy"]={nil,"When you Kill a Shocked Enemy, inflict an equivalent Shock on each nearby Enemy "} diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index 2aaa8459a81..fdac6d33c39 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -981,8 +981,15 @@ local function doActorMisc(env, actor) if modDB:Flag(nil, "HasShapersPresence") then modDB:NewMod("BuffExpireFaster", "MORE", -20, "Shapers Presence") end - if modDB:Flag(nil, "Condition:CanHaveSoulEater") then + if modDB:Flag(nil, "Condition:CanHaveSoulEater", "Condition:HeadhunterSoulEater") then local max = modDB:Override(nil, "SoulEaterMax") or modDB:Sum("BASE", nil, "SoulEaterMax") + if modDB:Flag(nil, "Condition:HeadhunterSoulEater") then + local souls = modDB:Flag(nil, "Condition:HeadhunterSoulEaterMaximum") and max or modDB:Sum("BASE", nil, "HeadhunterSoulEaterStack") + if modDB:Flag(nil, "Condition:CanHaveSoulEater") then + souls = m_max(souls, modDB:GetMultiplier("SoulEaterStack")) + end + modDB:NewMod("Multiplier:SoulEaterStack", "OVERRIDE", m_min(souls, max), "Headhunter preset") + end modDB:NewMod("Speed", "INC", 5, "Base", ModFlag.Attack, { type = "Multiplier", var = "SoulEaterStack", limit = max }) modDB:NewMod("Speed", "INC", 5, "Base", ModFlag.Cast, { type = "Multiplier", var = "SoulEaterStack", limit = max }) end diff --git a/src/Modules/ConfigOptions.lua b/src/Modules/ConfigOptions.lua index 18ca0dc1255..9938f9ee286 100644 --- a/src/Modules/ConfigOptions.lua +++ b/src/Modules/ConfigOptions.lua @@ -8,6 +8,43 @@ local m_min = math.min local m_max = math.max local s_format = string.format +-- Provisional HH numerical model, calibrated against three characters' 2026-11-30 +-- measurements and https://repoe-fork.github.io/mods.json (MonsterMod* records). +-- Columns: stat, type, Full value, optional flags. Other presets scale Full by coverage. +-- Coverage is not the HH icon count. +local headhunterModifiers = { + { "Speed", "INC", 70 }, + { "MovementSpeed", "INC", 70 }, + { "Accuracy", "INC", 200 }, + { "CritChance", "INC", 600 }, + { "PhysicalDamageGainAsFire", "BASE", 50 }, + { "PhysicalDamageGainAsCold", "BASE", 50 }, + { "PhysicalDamageGainAsLightning", "BASE", 50 }, + { "NonChaosDamageGainAsChaos", "BASE", 15 }, + { "PhysicalDamage", "INC", 40 }, + { "AreaOfEffect", "INC", 80 }, + { "ProjectileCount", "BASE", 4 }, + { "ChainCountMax", "BASE", 2, ModFlag.Projectile }, + { "EnemyFreezeChance", "BASE", 25 }, + { "Life", "INC", 40 }, + { "Evasion", "INC", 100 }, + { "PhysicalDamageReduction", "BASE", 50 }, + { "FireResist", "BASE", 75 }, + { "ColdResist", "BASE", 75 }, + { "LightningResist", "BASE", 75 }, + { "ChaosResist", "BASE", 60 }, + { "SelfIgniteDuration", "INC", -80 }, + { "SelfChillEffect", "INC", -80 }, + { "SelfShockEffect", "INC", -80 }, + { "SelfFreezeDuration", "INC", 80 }, + { "LifeGainAsEnergyShield", "BASE", 80 }, + { "EnergyShieldRechargeFaster", "INC", 150 }, + { "LifeRegenPercent", "BASE", 3 }, + { "DamageLifeLeech", "BASE", 100 }, + { "LifeLeechRate", "INC", 500 }, + { "BlockChance", "BASE", 50 }, +} + local function applyPantheonDescription(tooltip, mode, index, value) tooltip:Clear() if value.val == "None" then @@ -1014,6 +1051,31 @@ Huge sets the radius to 11. { var = "minionsOverrideEnduranceCharges", type = "count", label = "# of Endurance Charges (if not maximum):", ifFlag = "haveMinion", ifOption = "minionsUseEnduranceCharges", apply = function(val, modList, enemyModList) modList:NewMod("MinionModifier", "LIST", { mod = modLib.createMod("EnduranceCharges", "OVERRIDE", val, "Config", { type = "Condition", var = "Combat" }) }, "Config") end }, + { var = "headhunterBuffPreset", type = "list", label = colorCodes.UNIQUE .. "Headhunter" .. "^7 Power Level:", ifFlag = "Condition:HeadhunterEquipped", defaultIndex = 1, + list = {{val="OFF",label="Off"},{val="LOW",label="Low"},{val="MODERATE",label="Medium"},{val="HIGH",label="High"},{val="FULL",label="Full"}}, + tooltip = "These buffs are an approximation. Power is only sustainable when killing many rare monsters.\n\nLow: 25% + 11 Soul Eater souls.\nMedium: 50% + 22 Soul Eater souls. (recommended)\nHigh: 75% + 33 Soul Eater souls\nFull: 100% + your maximum Soul Eater souls (normally 45).\n\nWith another Soul Eater source, the higher of your configured soul count and this preset is used, up to your maximum souls.\n\nBuffs include: Attack Speed, Cast Speed, Movement Speed, Accuracy, Crit Chance,\nPhys as Extra, AoE, +Projectiles, Max Life, Evasion, PDR, Resistances,\nLife as Extra ES, ES Recharge, Regen, Life Leech, Block, and more.", + apply = function(val, modList, enemyModList) + local coverage = val == "LOW" and 0.25 or val == "MODERATE" and 0.5 or val == "HIGH" and 0.75 or val == "FULL" and 1 + if not coverage then + return + end + for _, entry in ipairs(headhunterModifiers) do + -- Round discrete counts and conservative resistance/freeze estimates down. + local value = entry[3] * coverage + if entry[1] == "ProjectileCount" or entry[1] == "ChainCountMax" or entry[1] == "EnemyFreezeChance" or entry[1]:match("Resist$") then + value = math.floor(value) + end + modList:NewMod(entry[1], entry[2], value, "Headhunter preset", entry[4] or 0, { type = "Condition", var = "HeadhunterEquipped" }, { type = "Condition", var = "Combat" }) + end + -- Supply the preset count separately so the calculation can combine sources without stacking souls. + modList:NewMod("Condition:HeadhunterSoulEater", "FLAG", true, "Headhunter preset", { type = "Condition", var = "HeadhunterEquipped" }, { type = "Condition", var = "Combat" }) + modList:NewMod("HeadhunterSoulEaterStack", "BASE", math.floor(45 * coverage), "Headhunter preset", { type = "Condition", var = "HeadhunterEquipped" }, { type = "Condition", var = "Combat" }) + if val == "FULL" then + modList:NewMod("Condition:HeadhunterSoulEaterMaximum", "FLAG", true, "Headhunter preset", { type = "Condition", var = "HeadhunterEquipped" }, { type = "Condition", var = "Combat" }) + modList:NewMod("StunImmune", "FLAG", true, "Headhunter preset", { type = "Condition", var = "HeadhunterEquipped" }, { type = "Condition", var = "Combat" }) + end + end, + }, { var = "multiplierRampage", type = "count", label = "# of Rampage Kills:", ifFlag = "Condition:Rampage", tooltip = "Rampage grants the following, up to 1000 stacks:\n\t1% increased Movement Speed per 20 Rampage\n\t2% increased Damage per 20 Rampage\nYou lose Rampage if you do not get a Kill within 5 seconds.", apply = function(val, modList, enemyModList) modList:NewMod("Multiplier:Rampage", "BASE", val, "Config", { type = "Condition", var = "Combat" }) end }, diff --git a/src/Modules/ModParser.lua b/src/Modules/ModParser.lua index a7f29d28835..cfbbbf1ceb4 100644 --- a/src/Modules/ModParser.lua +++ b/src/Modules/ModParser.lua @@ -4113,6 +4113,7 @@ local specialModList = { ["onslaught"] = { flag("Condition:Onslaught") }, ["rampage"] = { flag("Condition:Rampage") }, ["soul eater"] = { flag("Condition:CanHaveSoulEater") }, + ["when you kill a rare monster, you gain its modifiers for %d+ seconds"] = { flag("Condition:HeadhunterEquipped") }, ["unholy might"] = { flag("Condition:UnholyMight"), flag("Condition:CanWither"), }, ["chaotic might"] = { flag("Condition:ChaoticMight") }, ["elusive"] = { flag("Condition:CanBeElusive") },