Skip to content

Commit 334a02b

Browse files
LocalIdentityLocalIdentity
andauthored
Add support for Constricting Command Surrounded mod (#1349)
Implements auto applying the surrounded mod If you are within range of the enemy and only need 1 nearby enemy or will always apply with 0 needed enemies Now displays surrounded area on the calcs page too Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 9d1e121 commit 334a02b

File tree

6 files changed

+39
-21
lines changed

6 files changed

+39
-21
lines changed

src/Data/ModCache.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,7 @@ c["50% increased Skill Effect Duration"]={{[1]={flags=0,keywordFlags=0,name="Dur
27642764
c["50% increased Spell damage for each 200 total Mana you have Spent Recently"]={{[1]={[1]={div=200,type="Multiplier",var="ManaSpentRecently"},flags=2,keywordFlags=0,name="Damage",type="INC",value=50}},nil}
27652765
c["50% increased Spirit"]={{[1]={flags=0,keywordFlags=0,name="Spirit",type="INC",value=50}},nil}
27662766
c["50% increased Strength Requirement"]={{[1]={flags=0,keywordFlags=0,name="StrRequirement",type="INC",value=50}},nil}
2767-
c["50% increased Surrounded Area of Effect"]={{[1]={flags=0,keywordFlags=0,name="AreaOfEffect",type="INC",value=50}}," Surrounded "}
2767+
c["50% increased Surrounded Area of Effect"]={{[1]={flags=0,keywordFlags=0,name="SurroundedArea",type="INC",value=50}},nil}
27682768
c["50% increased Thorns damage if you've consumed an Endurance Charge Recently"]={{[1]={[1]={limit=1,type="Multiplier",var="RemovableEnduranceCharge"},flags=0,keywordFlags=0,name="ThornsDamage",type="INC",value=50}},nil}
27692769
c["50% increased Totem Placement range"]={{[1]={flags=0,keywordFlags=16384,name="WeaponRange",type="INC",value=50}}," Placement "}
27702770
c["50% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxManaLeechRate",type="INC",value=50}},nil}
@@ -5287,6 +5287,7 @@ c["Physical Damage Reduction from Armour is based on your combined Armour and Ev
52875287
c["Physical Damage is Pinning"]={nil,"Physical Damage is Pinning "}
52885288
c["Physical Spell Critical Hits build Pin"]={nil,"Physical Spell Critical Hits build Pin "}
52895289
c["Pin Enemies which are Primed for Pinning"]={nil,"Pin Enemies which are Primed for Pinning "}
5290+
c["Pin Enemies which are Primed for Pinning Require 5 fewer enemies to be Surrounded"]={nil,"Pin Enemies which are Primed for Pinning Require 5 fewer enemies to be Surrounded "}
52905291
c["Pinned Enemies cannot deal Critical Hits"]={nil,"Pinned Enemies cannot deal Critical Hits "}
52915292
c["Pinned enemies cannot perform actions"]={nil,"Pinned enemies cannot perform actions "}
52925293
c["Possessed by Spirit Of The Bear for 20 seconds on use"]={nil,"Possessed by Spirit Of The Bear for 20 seconds on use "}
@@ -5426,6 +5427,8 @@ c["Remnants have 10% increased effect"]={nil,"Remnants have 10% increased effect
54265427
c["Remnants you create reappear once, 3 seconds after being collected"]={nil,"Remnants you create reappear once, 3 seconds after being collected "}
54275428
c["Remove Ignite when you Warcry"]={nil,"Remove Ignite when you Warcry "}
54285429
c["Remove a Curse when you use a Mana Flask"]={nil,"Remove a Curse when you use a Mana Flask "}
5430+
c["Require 4 fewer enemies to be Surrounded"]={{[1]={flags=0,keywordFlags=0,name="SurroundedMinimum",type="BASE",value=-4}},nil}
5431+
c["Require 5 fewer enemies to be Surrounded"]={{[1]={flags=0,keywordFlags=0,name="SurroundedMinimum",type="BASE",value=-5}},nil}
54295432
c["Reserves 25% of Life"]={{[1]={flags=0,keywordFlags=0,name="ExtraLifeReserved",type="BASE",value=25}},nil}
54305433
c["Reveal Weaknesses against Rare and Unique enemies"]={nil,"Reveal Weaknesses against Rare and Unique enemies "}
54315434
c["Reveal Weaknesses against Rare and Unique enemies 50% more damage against enemies with an Open Weakness"]={nil,"Reveal Weaknesses against Rare and Unique enemies 50% more damage against enemies with an Open Weakness "}

src/Modules/CalcPerform.lua

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,32 +97,37 @@ local function addWeaponBaseStats(actor)
9797
end
9898
end
9999
end
100-
-- Calculate Presence radius
100+
101+
-- Generic radius/area calculator for a given key prefix (e.g. "Presence", "Surrounded")
101102
---@param actor table
102-
local function calcPresenceRadius(actor)
103+
---@param key string -- e.g. "Presence" or "Surrounded"
104+
local function calcBuffRadius(actor, key)
105+
local radiusKey, areaKey , modKey = key .. "Radius", key .. "Area", key .. "Mod"
103106
-- Calculate modifications to radius first
104-
local baseRadius = actor.modDB:Sum("BASE", nil, "PresenceRadius")
105-
local incRadius = actor.modDB:Sum("INC", nil, "PresenceRadius")
106-
local moreRadius = actor.modDB:More(nil, "PresenceRadius")
107-
local scaledRadius = actor.modDB:Override(nil, "PresenceRadius") or baseRadius * (1 + incRadius / 100) * moreRadius
107+
local baseRadius = actor.modDB:Sum("BASE", nil, radiusKey)
108+
local incRadius = actor.modDB:Sum("INC", nil, radiusKey)
109+
local moreRadius = actor.modDB:More(nil, radiusKey)
110+
local scaledRadius = actor.modDB:Override(nil, radiusKey) or (baseRadius * (1 + incRadius / 100) * moreRadius)
108111
-- Calculate modifications to area second
109112
local baseArea = math.pi * (scaledRadius * scaledRadius)
110-
local incArea = actor.modDB:Sum("INC", nil, "PresenceArea")
111-
local moreArea = actor.modDB:More(nil, "PresenceArea")
112-
local scaledArea = actor.modDB:Override(nil, "PresenceArea") or baseArea * (1 + incArea / 100) * moreArea
113+
local incArea = actor.modDB:Sum("INC", nil, areaKey)
114+
local moreArea = actor.modDB:More(nil, areaKey)
115+
local scaledArea = actor.modDB:Override(nil, areaKey) or (baseArea * (1 + incArea / 100) * moreArea)
113116
-- Convert back to final radius
114117
local finalRadius = math.floor(math.sqrt(scaledArea / math.pi))
115-
actor.output["PresenceRadius"] = finalRadius
116-
actor.output["PresenceRadiusMetres"] = finalRadius / 10
117-
if scaledRadius / baseRadius ~= 1 then actor.output["PresenceMod"] = scaledRadius / baseRadius end
118+
actor.output[radiusKey] = finalRadius
119+
actor.output[radiusKey .. "Metres"] = finalRadius / 10
120+
if scaledRadius / baseRadius ~= 1 then
121+
actor.output[modKey] = scaledRadius / baseRadius
122+
end
118123
if actor.breakdown then
119-
actor.breakdown.PresenceRadius = actor.breakdown.area(scaledRadius, (1 + incArea / 100) * moreArea, finalRadius)
124+
actor.breakdown[radiusKey] = actor.breakdown.area(scaledRadius, (1 + incArea / 100) * moreArea, finalRadius)
120125
if baseRadius ~= scaledRadius then
121-
actor.breakdown.PresenceMod = {}
122-
t_insert(actor.breakdown.PresenceMod, s_format( "%.1fm ^8(base radius)", baseRadius / 10))
123-
t_insert(actor.breakdown.PresenceMod, s_format( " x %.2f ^8(inc)", 1 + incRadius / 100))
124-
t_insert(actor.breakdown.PresenceMod, s_format( " x %.2f ^8(more)", moreRadius))
125-
t_insert(actor.breakdown.PresenceMod, s_format( "= %.1fm", scaledRadius / 10))
126+
actor.breakdown[modKey] = {}
127+
t_insert(actor.breakdown[modKey], s_format("%.1fm ^8(base radius)", baseRadius / 10))
128+
t_insert(actor.breakdown[modKey], s_format(" x %.2f ^8(inc)", 1 + incRadius / 100))
129+
t_insert(actor.breakdown[modKey], s_format(" x %.2f ^8(more)", moreRadius))
130+
t_insert(actor.breakdown[modKey], s_format(" = %.1fm", scaledRadius / 10))
126131
end
127132
end
128133
end
@@ -384,10 +389,13 @@ local function doActorAttribsConditions(env, actor)
384389
end
385390
end
386391
end
387-
-- Calculate Presence value and set condition
388-
calcPresenceRadius(actor)
392+
-- Calculate Presence / Surrounded value and set condition
393+
calcBuffRadius(actor, "Presence")
394+
calcBuffRadius(actor, "Surrounded")
389395
local enemyDistance = m_max(modDB:Sum("BASE", nil, "Multiplier:enemyDistance"), 0)
396+
local surroundedMinimum= m_max(modDB:Sum("BASE", nil, "SurroundedMinimum"), 0)
390397
condList["EnemyInPresence"] = output.PresenceRadius >= enemyDistance
398+
condList["Surrounded"] = surroundedMinimum == 0 or surroundedMinimum == 1 and output.SurroundedRadius >= enemyDistance
391399
end
392400

393401
-- Helper function to determine curse priority when processing curses beyond the curse limit

src/Modules/CalcSections.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,8 @@ return {
14051405
}, },
14061406
{ label = "Presence Mod", haveOutput = "PresenceMod", { format = "{2:output:PresenceMod}", { breakdown = "PresenceMod" }, { modName = "PresenceRadius", cfg = "skill" }} , },
14071407
{ label = "Presence Radius", haveOutput = "PresenceRadius", { format = "{1:output:PresenceRadiusMetres}m", { breakdown = "PresenceRadius" }, { modName = "PresenceArea", cfg = "skill"} }, },
1408+
{ label = "Surrounded Mod", haveOutput = "SurroundedMod", { format = "{2:output:SurroundedMod}", { breakdown = "SurroundedMod" }, { modName = "SurroundedRadius", cfg = "skill" }} , },
1409+
{ label = "Surrounded Radius", haveOutput = "SurroundedRadius", { format = "{1:output:SurroundedRadiusMetres}m", { breakdown = "SurroundedRadius" }, { modName = "SurroundedArea", cfg = "skill"} }, },
14081410
{ label = "Chance to Blind", { format = "{0:mod:1}%", { modName = "BlindChance", modType = "BASE", cfg = "skill" }, }, },
14091411
{ label = "Chance to Daze", { format = "{0:mod:1}%", { modName = "DazeChance", modType = "BASE", cfg = "skill" }, }, },
14101412
{ label = "Chance to Rearm", haveOutput = "HazardRearmChance", { format = "{2:mod:1}%", { modName = "HazardRearmChance", modType = "BASE", cfg = "skill"}, }, },

src/Modules/CalcSetup.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ function calcs.initModDB(env, modDB)
9191
modDB:NewMod("PhysicalDamageReduction", "BASE", -15, "Base", { type = "Condition", var = "Crushed" })
9292
modDB:NewMod("CritChanceCap", "BASE", 100, "Base")
9393
modDB:NewMod("PresenceRadius", "BASE", data.characterConstants["base_presence_radius"], "Base")
94+
modDB:NewMod("SurroundedRadius", "BASE", data.misc.SurroundedRadiusBase, "Base")
95+
modDB:NewMod("SurroundedMinimum", "BASE", data.gameConstants["BaseRequiredEnemiesToBeConsideredSurrounded"], "Base")
9496
modDB.conditions["Buffed"] = env.mode_buffs
9597
modDB.conditions["Combat"] = env.mode_combat
9698
modDB.conditions["Effective"] = env.mode_effective

src/Modules/Data.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ data.misc = { -- magic numbers
208208
TrapTriggerRadiusBase = 10,
209209
MineDetonationRadiusBase = 60,
210210
MineAuraRadiusBase = 35,
211+
SurroundedRadiusBase = 30,
211212
MinionRevivalTimeBase = data.characterConstants["global_resummon_time_ms"] / 1000,
212213
BrandAttachmentRangeBase = 30,
213214
ProjectileDistanceCap = 150,

src/Modules/ModParser.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ local modNameList = {
623623
["firestorm explosion area of effect"] = { "AreaOfEffectSecondary", tag = { type = "SkillName", skillName = "Firestorm", includeTransfigured = true } },
624624
["presence area of effect"] = "PresenceArea",
625625
["presence radius"] = "PresenceRadius",
626+
["surrounded area of effect"] = "SurroundedArea",
626627
["duration"] = "Duration",
627628
["skill effect duration"] = "Duration",
628629
["fuse duration"] = "Duration",
@@ -4204,6 +4205,7 @@ local specialModList = {
42044205
["elemental ailments are inflicted on you instead of linked targets"] = { mod("ExtraLinkEffect", "LIST", { mod = flag("ElementalAilmentImmune") }) },
42054206
["non%-unique utility flasks you use apply to linked targets"] = { mod("ExtraLinkEffect", "LIST", { mod = mod("ParentNonUniqueFlasksAppliedToYou", "FLAG", true, { type = "GlobalEffect", effectType = "Global", unscalable = true } ), }) },
42064207
["gain unholy might on block for (%d) seconds"] = { flag("Condition:UnholyMight", { type = "Condition", var = "BlockedRecently"}) },
4208+
["require (%d+) fewer enemies to be surrounded"] = function(num) return { mod("SurroundedMinimum", "BASE", -num) } end,
42074209
-- Traps, Mines
42084210
["traps and mines deal (%d+)%-(%d+) additional physical damage"] = function(_, min, max) return { mod("PhysicalMin", "BASE", tonumber(min), nil, 0, bor(KeywordFlag.Trap, KeywordFlag.Mine)), mod("PhysicalMax", "BASE", tonumber(max), nil, 0, bor(KeywordFlag.Trap, KeywordFlag.Mine)) } end,
42094211
["traps and mines deal (%d+) to (%d+) additional physical damage"] = function(_, min, max) return { mod("PhysicalMin", "BASE", tonumber(min), nil, 0, bor(KeywordFlag.Trap, KeywordFlag.Mine)), mod("PhysicalMax", "BASE", tonumber(max), nil, 0, bor(KeywordFlag.Trap, KeywordFlag.Mine)) } end,

0 commit comments

Comments
 (0)