Skip to content

Commit 8dd3de8

Browse files
github-actions[bot]ltogniolliLocalIdentity
authored
[pob2-port] Add support for Loyalty/damage taken from Companion's Life before you (#9922)
* Apply changes from PathOfBuildingCommunity/PathOfBuilding-PoE2#2159 * Fix merge issues and compact code * Automatically calcs life pools Automatically calcs life values for the different minion types Also compacts the defence code into loops so it's easier to add more mods in the future --------- Co-authored-by: ltogniolli <ltogniolli@users.noreply.github.com> Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 9c7a72d commit 8dd3de8

9 files changed

Lines changed: 764 additions & 301 deletions

File tree

spec/System/TestDefence_spec.lua

Lines changed: 318 additions & 0 deletions
Large diffs are not rendered by default.

src/Data/SkillStatMap.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,6 +2081,9 @@ return {
20812081
value = 100,
20822082
},
20832083
--Golem
2084+
["stone_golem_grants_melee_damage_removed_from_stone_golem_before_life_or_es_%"] = {
2085+
mod("takenFromStoneGolemBeforeYou", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff" }),
2086+
},
20842087
["golem_buff_effect_+%"] = {
20852088
mod("BuffEffect", "INC", nil, 0, 0)
20862089
},

src/Data/Skills/sup_dex.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ skills["SupportCompanionship"] = {
14251425
mod("MinionModifier", "LIST", { mod = mod("Life", "MORE", nil) }, 0, 0, { type = "Condition", var = "OnlyMinion" }),
14261426
},
14271427
["damage_removed_from_minions_before_life_or_es_%_if_only_one_minion"] = {
1428-
mod("takenFromMinionBeforeYou", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff", unscalable = true }),
1428+
mod("takenFromMinionBeforeYou", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff", unscalable = true }, { type = "Condition", var = "OnlyMinion" }),
14291429
},
14301430
},
14311431
qualityStats = {

src/Export/Skills/sup_dex.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ local skills, mod, flag, skill = ...
184184
mod("MinionModifier", "LIST", { mod = mod("Life", "MORE", nil) }, 0, 0, { type = "Condition", var = "OnlyMinion" }),
185185
},
186186
["damage_removed_from_minions_before_life_or_es_%_if_only_one_minion"] = {
187-
mod("takenFromMinionBeforeYou", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff", unscalable = true }),
187+
mod("takenFromMinionBeforeYou", "BASE", nil, 0, 0, { type = "GlobalEffect", effectType = "Buff", unscalable = true }, { type = "Condition", var = "OnlyMinion" }),
188188
},
189189
},
190190
#mods

src/Modules/CalcDefence.lua

Lines changed: 111 additions & 175 deletions
Large diffs are not rendered by default.

src/Modules/CalcOffence.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,13 @@ function calcSkillDuration(skillModList, skillCfg, skillData, env, enemyDB)
310310
return duration
311311
end
312312

313+
-- Keep defensive Totem pools in step with the Totem Life shown in the skill calculations.
314+
function calcs.calcTotemLife(env, activeSkill)
315+
local lifeMod = calcLib.mod(activeSkill.skillModList, activeSkill.skillCfg, "TotemLife")
316+
local life = round(m_floor(env.data.monsterAllyLifeTable[activeSkill.skillData.totemLevel] * env.data.totemLifeMult[activeSkill.skillTotemId]) * lifeMod)
317+
return life, lifeMod
318+
end
319+
313320
-- Performs all offensive calculations
314321
function calcs.offence(env, actor, activeSkill)
315322
local modDB = actor.modDB
@@ -1387,8 +1394,7 @@ function calcs.offence(env, actor, activeSkill)
13871394
"Totems Summoned: "..output.TotemsSummoned..(env.configInput.TotemsSummoned and " ^8(overridden from the Configuration tab)" or " ^8(can be overridden in the Configuration tab)"),
13881395
}
13891396
end
1390-
output.TotemLifeMod = calcLib.mod(skillModList, skillCfg, "TotemLife")
1391-
output.TotemLife = round(m_floor(env.data.monsterAllyLifeTable[skillData.totemLevel] * env.data.totemLifeMult[activeSkill.skillTotemId]) * output.TotemLifeMod)
1397+
output.TotemLife, output.TotemLifeMod = calcs.calcTotemLife(env, activeSkill)
13921398
output.TotemEnergyShield = skillModList:Sum("BASE", skillCfg, "TotemEnergyShield")
13931399
output.TotemBlockChance = skillModList:Sum("BASE", skillCfg, "TotemBlockChance")
13941400
output.TotemArmour = skillModList:Sum("BASE", skillCfg, "TotemArmour")

src/Modules/CalcPerform.lua

Lines changed: 282 additions & 112 deletions
Large diffs are not rendered by default.

src/Modules/CalcSections.lua

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,6 +2179,12 @@ return {
21792179
{ modName = { "FrostGlobeHealth", "FrostGlobeDamageMitigation" } },
21802180
},
21812181
},
2182+
{ label = "Minion Ally", haveOutput = "TotalMinionLife",
2183+
{ format = "{0:output:TotalMinionLife}",
2184+
{ breakdown = "TotalMinionLife" },
2185+
{ modName = { "TotalMinionLife", "takenFromMinionBeforeYou" } },
2186+
},
2187+
},
21822188
{ label = "Spectre Ally", haveOutput = "TotalSpectreLife",
21832189
{ format = "{0:output:TotalSpectreLife}",
21842190
{ breakdown = "TotalSpectreLife" },
@@ -2197,6 +2203,24 @@ return {
21972203
{ modName = { "TotalVaalRejuvenationTotemLife", "takenFromVaalRejuvenationTotemsBeforeYou", "takenFromTotemsBeforeYou" } },
21982204
},
21992205
},
2206+
{ label = "Sentinel of Radiance", haveOutput = "TotalRadianceSentinelLife",
2207+
{ format = "{0:output:TotalRadianceSentinelLife}",
2208+
{ breakdown = "TotalRadianceSentinelLife" },
2209+
{ modName = { "TotalRadianceSentinelLife", "takenFromRadianceSentinelBeforeYou" } },
2210+
},
2211+
},
2212+
{ label = "Void Spawn Ally", haveOutput = "TotalVoidSpawnLife",
2213+
{ format = "{0:output:TotalVoidSpawnLife}",
2214+
{ breakdown = "TotalVoidSpawnLife" },
2215+
{ modName = { "TotalVoidSpawnLife", "takenFromVoidSpawnBeforeYou" } },
2216+
},
2217+
},
2218+
{ label = "Stone Golem Ally", haveOutput = "TotalStoneGolemLife",
2219+
{ format = "{0:output:TotalStoneGolemLife}",
2220+
{ breakdown = "TotalStoneGolemLife" },
2221+
{ modName = { "TotalStoneGolemLife", "takenFromStoneGolemBeforeYou" } },
2222+
},
2223+
},
22002224
{ label = "Soul Link", haveOutput = "AlliedEnergyShield",
22012225
{ format = "{0:output:AlliedEnergyShield}",
22022226
{ breakdown = "AlliedEnergyShield" },

src/Modules/ConfigOptions.lua

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -786,20 +786,26 @@ Huge sets the radius to 11.
786786
{ var = "enemyRadius", type = "integer", label = "Enemy radius:", ifSkill = { "Seismic Trap", "Lightning Spire Trap", "Explosive Trap", "Molten Strike" }, includeTransfigured = true, tooltip = "Configure the radius of an enemy hitbox to calculate some area overlapping (shotgunning) effects.", apply = function(val, modList, enemyModList)
787787
modList:NewMod("EnemyRadius", "OVERRIDE", m_max(val, 1), "Config")
788788
end },
789-
{ var = "TotalSpectreLife", type = "integer", label = "Total Spectre Life:", ifMod = "takenFromSpectresBeforeYou", ifSkill = "Raise Spectre", includeTransfigured = true, tooltip = "The total life of your Spectres that can be taken before yours (used by jinxed juju)", apply = function(val, modList, enemyModList)
790-
modList:NewMod("TotalSpectreLife", "BASE", val, "Config")
789+
{ var = "TotalMinionLife", type = "integer", label = "Minion Life override:", ifMod = "takenFromMinionBeforeYou", tooltip = "Overrides the automatically calculated Life of the minion supported by Companionship.", apply = function(val, modList, enemyModList)
790+
modList:NewMod("TotalMinionLife", "OVERRIDE", val, "Config")
791791
end },
792-
{ var = "TotalTotemLife", type = "integer", label = "Total Totem Life:", ifOption = "conditionHaveTotem", ifMod = "takenFromTotemsBeforeYou", tooltip = "The total life of your Totems (excluding Vaal Rejuvenation Totem) that can be taken before yours (used by totem mastery)", apply = function(val, modList, enemyModList)
793-
modList:NewMod("TotalTotemLife", "BASE", val, "Config")
792+
{ var = "TotalSpectreLife", type = "integer", label = "Total Spectre Life override:", ifMod = "takenFromSpectresBeforeYou", ifSkill = "Raise Spectre", includeTransfigured = true, tooltip = "Overrides the automatically calculated total Life of your Spectres that can be taken before yours (used by Jinxed Juju).", apply = function(val, modList, enemyModList)
793+
modList:NewMod("TotalSpectreLife", "OVERRIDE", val, "Config")
794794
end },
795-
{ var = "TotalRadianceSentinelLife", type = "integer", label = "Total life pool of Sentinel of Radiance", ifMod = "takenFromRadianceSentinelBeforeYou", apply = function(val, modList, enemyModList)
796-
modList:NewMod("TotalRadianceSentinelLife", "BASE", val, "Config")
795+
{ var = "TotalTotemLife", type = "integer", label = "Nearest Totem Life override:", ifOption = "conditionHaveTotem", ifMod = "takenFromTotemsBeforeYou", tooltip = "Overrides the automatically calculated Life of your nearest Totem (excluding Vaal Rejuvenation Totem) that can be taken before yours (used by Totem Mastery).", apply = function(val, modList, enemyModList)
796+
modList:NewMod("TotalTotemLife", "OVERRIDE", val, "Config")
797797
end },
798-
{ var = "TotalVoidSpawnLife", type = "integer", label = "Total life pool of Void Spawn", ifMod = "takenFromVoidSpawnBeforeYou", apply = function(val, modList, enemyModList)
799-
modList:NewMod("TotalVoidSpawnLife", "BASE", val, "Config")
798+
{ var = "TotalRadianceSentinelLife", type = "integer", label = "Sentinel of Radiance Life override:", ifMod = "takenFromRadianceSentinelBeforeYou", tooltip = "Overrides the automatically calculated Life of your Sentinel of Radiance that can be taken before yours.", apply = function(val, modList, enemyModList)
799+
modList:NewMod("TotalRadianceSentinelLife", "OVERRIDE", val, "Config")
800800
end },
801-
{ var = "TotalVaalRejuvenationTotemLife", type = "integer", label = "Total Vaal Rejuvenation Totem Life:", ifSkill = { "Vaal Rejuvenation Totem" }, ifMod = "takenFromVaalRejuvenationTotemsBeforeYou", tooltip = "The total life of your Vaal Rejuvenation Totems that can be taken before yours", apply = function(val, modList, enemyModList)
802-
modList:NewMod("TotalVaalRejuvenationTotemLife", "BASE", val, "Config")
801+
{ var = "TotalVoidSpawnLife", type = "integer", label = "Total Void Spawn Life override:", ifMod = "takenFromVoidSpawnBeforeYou", tooltip = "Overrides the automatically calculated total Life of your Void Spawns that can be taken before yours.", apply = function(val, modList, enemyModList)
802+
modList:NewMod("TotalVoidSpawnLife", "OVERRIDE", val, "Config")
803+
end },
804+
{ var = "TotalStoneGolemLife", type = "integer", label = "Stone Golem Life override:", ifSkill = "Summon Stone Golem of Safeguarding", ifMod = "takenFromStoneGolemBeforeYou", tooltip = "Overrides the automatically calculated Life of your Stone Golem of Safeguarding that can be taken before yours.", apply = function(val, modList, enemyModList)
805+
modList:NewMod("TotalStoneGolemLife", "OVERRIDE", val, "Config")
806+
end },
807+
{ var = "TotalVaalRejuvenationTotemLife", type = "integer", label = "Vaal Rejuvenation Totem Life override:", ifSkill = "Vaal Rejuvenation Totem", ifMod = "takenFromVaalRejuvenationTotemsBeforeYou", tooltip = "Overrides the automatically calculated Life of your Vaal Rejuvenation Totem that can be taken before yours.", apply = function(val, modList, enemyModList)
808+
modList:NewMod("TotalVaalRejuvenationTotemLife", "OVERRIDE", val, "Config")
803809
end },
804810
{ label = "^xAF6025Balance of Terror ^7Curse Disable:", ifCond = { "SelfCastConductivity", "SelfCastDespair", "SelfCastElementalWeakness", "SelfCastEnfeeble", "SelfCastFlammability", "SelfCastFrostbite", "SelfCastPunishment", "SelfCastTemporalChains", "SelfCastVulnerability" } },
805811
{ var = "balanceOfTerrorSelfCastConductivity", type = "check", label = "Conductivity self-only", ifSkill = "Conductivity", ifCond = "SelfCastConductivity", tooltip = "Counts Conductivity as self-cast for Balance of Terror without applying it to enemies." },

0 commit comments

Comments
 (0)