Skip to content

Commit 275d89c

Browse files
author
LocalIdentity
committed
Revert to dev
1 parent 1e761bf commit 275d89c

1 file changed

Lines changed: 5 additions & 124 deletions

File tree

src/Modules/CalcOffence.lua

Lines changed: 5 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -138,104 +138,14 @@ local function calcDamage(activeSkill, output, cfg, breakdown, damageType, typeF
138138
round(((baseMax * inc * more) * genericMoreMaxDamage + addMax) * moreMaxDamage)
139139
end
140140

141-
-- Calculate how much of a source damage type contributes to the target ailment type through conversion chain
142-
local function calcAilmentConversionMultiplier(activeSkill, sourceDamageType, targetAilmentType)
143-
local conversionTable = activeSkill.conversionTable
144-
145-
-- Safety check: if no conversion table, no conversion is possible
146-
if not conversionTable then
147-
return 0
148-
end
149-
150-
-- For poison, the target damage type is Chaos
151-
local targetDamageType = "Chaos"
152-
if targetAilmentType == "ignite" then
153-
targetDamageType = "Fire"
154-
elseif targetAilmentType == "chill" or targetAilmentType == "freeze" then
155-
targetDamageType = "Cold"
156-
elseif targetAilmentType == "shock" then
157-
targetDamageType = "Lightning"
158-
end
159-
160-
-- If source equals target, check if it stays unconverted
161-
if sourceDamageType == targetDamageType then
162-
return conversionTable[sourceDamageType] and conversionTable[sourceDamageType].mult or 0
163-
end
164-
165-
-- Calculate conversion multiplier through the damage type chain
166-
-- PoE damage conversion order: Physical → Lightning → Cold → Fire → Chaos
167-
local dmgTypeOrder = {"Physical", "Lightning", "Cold", "Fire", "Chaos"}
168-
local sourceIndex, targetIndex
169-
170-
for i, damageType in ipairs(dmgTypeOrder) do
171-
if damageType == sourceDamageType then
172-
sourceIndex = i
173-
end
174-
if damageType == targetDamageType then
175-
targetIndex = i
176-
end
177-
end
178-
179-
-- Can't convert backwards in the chain
180-
if not sourceIndex or not targetIndex or sourceIndex >= targetIndex then
181-
return 0
182-
end
183-
184-
-- Calculate the multiplier through the conversion chain
185-
local multiplier = 1.0
186-
for i = sourceIndex, targetIndex - 1 do
187-
local fromType = dmgTypeOrder[i]
188-
local toType = dmgTypeOrder[i + 1]
189-
190-
-- Safety check: ensure conversion table structure exists
191-
local convRate = 0
192-
if conversionTable[fromType] and conversionTable[fromType][toType] then
193-
convRate = conversionTable[fromType][toType]
194-
end
195-
196-
-- Each step in the chain multiplies the conversion rate
197-
multiplier = multiplier * convRate
198-
199-
-- If any step has 0 conversion, the whole chain stops
200-
if convRate == 0 then
201-
return 0
202-
end
203-
end
204-
205-
return multiplier
206-
end
207-
208141
local function calcAilmentSourceDamage(activeSkill, output, cfg, breakdown, damageType, typeFlags)
209142
local min, max = calcDamage(activeSkill, output, cfg, breakdown, damageType, typeFlags)
210143
local conversionTable = (cfg and cfg.conversionTable) or activeSkill.conversionTable
211-
local convMult = activeSkill.conversionTable[damageType].mult
212-
213-
-- For ailment calculations, we need to consider damage that converts through the conversion chain
214-
-- Check what ailment we're calculating by looking at typeFlags
215-
local ailmentType = nil
216-
if band(typeFlags, dmgTypeFlags.Chaos) ~= 0 then
217-
ailmentType = "poison"
218-
elseif band(typeFlags, dmgTypeFlags.Fire) ~= 0 then
219-
ailmentType = "ignite"
220-
end
221-
222-
if ailmentType then
223-
-- Calculate how much of this damage type contributes to the ailment through conversions
224-
local ailmentContribution = calcAilmentConversionMultiplier(activeSkill, damageType, ailmentType)
225-
if ailmentContribution > 0 then
226-
convMult = ailmentContribution
227-
end
228-
end
229-
144+
local convMult = conversionTable[damageType].mult
230145
if breakdown and convMult ~= 1 then
231146
t_insert(breakdown, "Source damage:")
232147
t_insert(breakdown, s_format("%d to %d ^8(total damage)", min, max))
233-
if ailmentType and convMult ~= activeSkill.conversionTable[damageType].mult then
234-
local targetDamageType = ailmentType == "poison" and "chaos" or (ailmentType == "ignite" and "fire" or "unknown")
235-
t_insert(breakdown, s_format("x %g ^8(%g%% converts to %s through conversion chain)", convMult, convMult*100, targetDamageType))
236-
else
237-
t_insert(breakdown, s_format("x %g ^8(%g%% converted to other damage types)", convMult, (1-convMult)*100))
238-
end
148+
t_insert(breakdown, s_format("x %g ^8(%g%% converted to other damage types)", convMult, (1-convMult)*100))
239149
t_insert(breakdown, s_format("= %d to %d", min * convMult, max * convMult))
240150
end
241151
return min * convMult, max * convMult
@@ -3994,10 +3904,7 @@ function calcs.offence(env, actor, activeSkill)
39943904
if not skillFlags.hit or skillModList:Flag(cfg, "CannotPoison") then
39953905
output.PoisonChanceOnCrit = 0
39963906
else
3997-
local regularPoisonChance = skillModList:Sum("BASE", cfg, "PoisonChance") + enemyDB:Sum("BASE", nil, "SelfPoisonChance")
3998-
local chaosPoisonChance = skillModList:Sum("BASE", cfg, "ChaosPoisonChance")
3999-
-- For conversion builds, we need to consider chaos poison chance as contributing to overall poison chance
4000-
output.PoisonChanceOnCrit = m_min(100, regularPoisonChance + chaosPoisonChance)
3907+
output.PoisonChanceOnCrit = m_min(100, skillModList:Sum("BASE", cfg, "PoisonChance") + enemyDB:Sum("BASE", nil, "SelfPoisonChance"))
40013908
end
40023909
if not skillFlags.hit then
40033910
output.ImpaleChanceOnCrit = 0
@@ -4015,27 +3922,12 @@ function calcs.offence(env, actor, activeSkill)
40153922
else
40163923
output.BleedChanceOnHit = m_min(100, skillModList:Sum("BASE", cfg, "BleedChance") + enemyDB:Sum("BASE", nil, "SelfBleedChance"))
40173924
end
4018-
4019-
-- Enable poison calculation for damage types that convert to chaos when chaos can poison
4020-
-- This handles cases like The Consuming Dark where Fire converts to Chaos and Chaos can poison
4021-
if skillModList:Sum("BASE", cfg, "ChaosPoisonChance") > 0 then
4022-
for _, damageType in ipairs({"Physical", "Lightning", "Cold", "Fire"}) do
4023-
local chaosMult = calcAilmentConversionMultiplier(activeSkill, damageType, "poison")
4024-
if chaosMult > 0 then
4025-
skillModList:NewMod(damageType.."CanPoison", "FLAG", true, "Conversion to Chaos", cfg.flags)
4026-
end
4027-
end
4028-
end
4029-
40303925
if not skillFlags.hit or skillModList:Flag(cfg, "CannotPoison") then
40313926
output.PoisonChanceOnHit = 0
40323927
output.ChaosPoisonChance = 0
40333928
else
4034-
local regularPoisonChance = skillModList:Sum("BASE", cfg, "PoisonChance") + enemyDB:Sum("BASE", nil, "SelfPoisonChance")
4035-
local chaosPoisonChance = skillModList:Sum("BASE", cfg, "ChaosPoisonChance")
4036-
-- For conversion builds, we need to consider chaos poison chance as contributing to overall poison chance
4037-
output.PoisonChanceOnHit = m_min(100, regularPoisonChance + chaosPoisonChance)
4038-
output.ChaosPoisonChance = m_min(100, chaosPoisonChance)
3929+
output.PoisonChanceOnHit = m_min(100, skillModList:Sum("BASE", cfg, "PoisonChance") + enemyDB:Sum("BASE", nil, "SelfPoisonChance"))
3930+
output.ChaosPoisonChance = m_min(100, skillModList:Sum("BASE", cfg, "ChaosPoisonChance"))
40393931
end
40403932
-- Elemental Ailment Affliction Chance | Elemental Ailment Additionals
40413933
for _, ailment in ipairs(elementalAilmentTypeList) do
@@ -4911,17 +4803,6 @@ function calcs.offence(env, actor, activeSkill)
49114803
for sub_pass = 1, 2 do
49124804
dotCfg.skillCond["CriticalStrike"] = sub_pass ~= 1
49134805

4914-
-- Enable ignite calculation for damage types that convert to fire when fire can ignite
4915-
-- This handles cases like Avatar of Fire or other conversion effects
4916-
if output.IgniteChanceOnHit + output.IgniteChanceOnCrit > 0 then
4917-
for _, damageType in ipairs({"Physical", "Lightning", "Cold", "Chaos"}) do
4918-
local fireMult = calcAilmentConversionMultiplier(activeSkill, damageType, "ignite")
4919-
if fireMult > 0 then
4920-
skillModList:NewMod(damageType.."CanIgnite", "FLAG", true, "Conversion to Fire", cfg.flags)
4921-
end
4922-
end
4923-
end
4924-
49254806
local totalMin, totalMax = 0, 0
49264807
if canDeal.Physical and skillModList:Flag(cfg, "PhysicalCanIgnite") then
49274808
local min, max = calcAilmentSourceDamage(activeSkill, output, dotCfg, sub_pass == 1 and breakdown and breakdown.IgnitePhysical, "Physical", dmgTypeFlags.flags.Fire)

0 commit comments

Comments
 (0)