Repository: PathOfBuildingCommunity/PathOfBuilding
File: src/Modules/CalcOffence.lua (Lua)

Code before:
						s_format("%.0f + (%.0f - %.0f) * %.2f%%", output.BleedPhysicalMin, output.BleedPhysicalMax, output.BleedPhysicalMin, bleedRollAverage),
						s_format("^8min source phys + (max source phys - min source phys) * average bleed roll"),
						s_format("* %.2f ^8(Bleed DoT Multi)", output.BleedDotMulti),
						s_format("= %.2f", avgHitBleedDmg),
					}
				else
					globalBreakdown.BleedDPS = {
						s_format("Non-Crit Dmg Derivation:"),
						s_format("%.0f + (%.0f - %.0f) * %.2f%%", output.BleedPhysicalMin, output.BleedPhysicalMax, output.BleedPhysicalMin, bleedRollAverage),
						s_format("^8min source phys + (max source phys - min source phys) * average bleed roll"),
						s_format("* %.2f ^8(Bleed DoT Multi for Non-Crit)", output.BleedDotMulti),
						s_format("= %.0f", avgHitBleedDmg),
						s_format(""),
						s_format("Crit Dmg Derivation:"),
						s_format("%.0f + (%.0f - %.0f) * %.2f%%", output.BleedPhysicalMin, output.BleedPhysicalMax, output.BleedPhysicalMin, bleedRollAverage),
						s_format("^8min source phys + (max source phys - min source phys) * average bleed roll"),
						s_format("* %.2f ^8(Bleed DoT Multi for Crit)", output.CritBleedDotMulti),
						s_format("= %.2f", avgCritBleedDmg),
					}
				end
			end
			local basePercent = skillData.bleedBasePercent or data.misc.BleedPercentBase
			-- over-stacking bleed stacks increases the chance a critical bleed is present
			local ailmentCritChance = 100 * (1 - m_pow(1 - output.CritChance / 100, m_max(globalOutput.BleedStackPotential, 1)))

			-- what are these values even trying to display? If you get really lucky or unlucky this is how much damage you can do?
			local baseMinVal = calcAilmentDamage("Bleed", ailmentCritChance, sourceMinHitDmg, 0, true) * basePercent / 100
			local baseMaxVal = calcAilmentDamage("Bleed", 100, sourceMaxHitDmg, sourceMaxCritDmg, true) * basePercent / 100 * output.RuthlessBlowAilmentEffect * output.FistOfWarDamageEffect * globalOutput.AilmentWarcryEffect
			local averageBaseBleedDps = calcAilmentDamage("Bleed", ailmentCritChance, avgHitBleedDmg, avgCritBleedDmg, false)
			local baseBleedDps = averageBaseBleedDps * basePercent / 100 * output.RuthlessBlowAilmentEffect * output.FistOfWarDamageEffect * globalOutput.AilmentWarcryEffect
			if baseBleedDps > 0 then
				skillFlags.bleed = true
				skillFlags.duration = true
				local effMult = 1
				if env.mode_effective then
					local resist = m_min(m_max(0, enemyDB:Sum("BASE", nil, "PhysicalDamageReduction")), data.misc.DamageReductionCap)
					local takenInc = enemyDB:Sum("INC", dotCfg, "DamageTaken", "DamageTakenOverTime", "PhysicalDamageTaken", "PhysicalDamageTakenOverTime")
					local takenMore = enemyDB:More(dotCfg, "DamageTaken", "DamageTakenOverTime", "PhysicalDamageTaken", "PhysicalDamageTakenOverTime")
					effMult = (1 - resist / 100) * (1 + takenInc / 100) * takenMore
					globalOutput["BleedEffMult"] = effMult
					if breakdown and effMult ~= 1 then
						globalBreakdown.BleedEffMult = breakdown.effMult("Physical", resist, 0, takenInc, effMult, takenMore, nil, true)
					end
				end
				local effectMod = calcLib.mod(skillModList, dotCfg, "AilmentEffect")
				local activeBleeds = m_min(bleedStacks, maxStacks)
				output.BaseBleedDPS = baseBleedDps * effectMod * rateMod * activeBleeds * effMult
				local BleedDPSUncapped = output.BaseBleedDPS
				local BleedDPSCapped = m_min(BleedDPSUncapped, data.misc.DotDpsCap)
				local MinBleedDPSUncapped = baseMinVal * effectMod * rateMod * activeBleeds * effMult
				local MinBleedDPSCapped = m_min(MinBleedDPSUncapped, data.misc.DotDpsCap)

Review comment (suggestion):
Yes that is what it is doing, we display those numbers 
![image](https://github.com/user-attachments/assets/0b3db70a-5df6-450f-829e-f5c1040c3c44)
 so this comment should be changed
 
 
Otherwise the bleed stuff look fine without testing it on more than a handful of builds, but its possible I missed some setup which this has problems

Code after:
					sourceMinCritDmg = min * output.CritBleedDotMulti
					sourceMaxCritDmg = max * output.CritBleedDotMulti
					avgCritBleedDmg = (sourceMinCritDmg + (sourceMaxCritDmg - sourceMinCritDmg) * bleedRollAverage / 100)
				else
					output.BleedDotMulti = 1 + (skillModList:Override(dotCfg, "DotMultiplier") or skillModList:Sum("BASE", dotCfg, "DotMultiplier") + skillModList:Sum("BASE", dotCfg, "PhysicalDotMultiplier")) / 100
					sourceMinHitDmg = min * output.BleedDotMulti
					sourceMaxHitDmg = max * output.BleedDotMulti
					avgHitBleedDmg = (sourceMinHitDmg + (sourceMaxHitDmg - sourceMinHitDmg) * bleedRollAverage / 100)
				end
			end

			if breakdown then
				breakdown.BleedDPS = {}
				t_insert(breakdown.BleedDPS, s_format(colorCodes.CUSTOM.."NOTE: Calculation uses new Weighted Avg formula for critical hits"))
			end

			if globalBreakdown then
				if avgHitBleedDmg == avgCritBleedDmg or output.CritChance == 0 then
					globalBreakdown.BleedDPS = {
						s_format("Dmg Derivation:"),
						s_format("%.0f + (%.0f - %.0f) * %.2f%%", output.BleedPhysicalMin, output.BleedPhysicalMax, output.BleedPhysicalMin, bleedRollAverage),
						s_format("^8min source phys + (max source phys - min source phys) * average bleed roll"),
						s_format("* %.2f ^8(Bleed DoT Multi)", output.BleedDotMulti),
						s_format("= %.2f", avgHitBleedDmg),
					}
				else
					globalBreakdown.BleedDPS = {
						s_format("Non-Crit Dmg Derivation:"),
						s_format("%.0f + (%.0f - %.0f) * %.2f%%", output.BleedPhysicalMin, output.BleedPhysicalMax, output.BleedPhysicalMin, bleedRollAverage),
						s_format("^8min source phys + (max source phys - min source phys) * average bleed roll"),
						s_format("* %.2f ^8(Bleed DoT Multi for Non-Crit)", output.BleedDotMulti),
						s_format("= %.0f", avgHitBleedDmg),
						s_format(""),
						s_format("Crit Dmg Derivation:"),
						s_format("%.0f + (%.0f - %.0f) * %.2f%%", output.BleedPhysicalMin, output.BleedPhysicalMax, output.BleedPhysicalMin, bleedRollAverage),
						s_format("^8min source phys + (max source phys - min source phys) * average bleed roll"),
						s_format("* %.2f ^8(Bleed DoT Multi for Crit)", output.CritBleedDotMulti),
						s_format("= %.2f", avgCritBleedDmg),
					}
				end
			end
			local basePercent = skillData.bleedBasePercent or data.misc.BleedPercentBase
			-- over-stacking bleed stacks increases the chance a critical bleed is present
			local ailmentCritChance = 100 * (1 - m_pow(1 - output.CritChance / 100, m_max(globalOutput.BleedStackPotential, 1)))

			local baseMinVal = calcAilmentDamage("Bleed", ailmentCritChance, sourceMinHitDmg, 0, true) * basePercent / 100
			local baseMaxVal = calcAilmentDamage("Bleed", 100, sourceMaxHitDmg, sourceMaxCritDmg, true) * basePercent / 100 * output.RuthlessBlowAilmentEffect * output.FistOfWarDamageEffect * globalOutput.AilmentWarcryEffect
			local averageBaseBleedDps = calcAilmentDamage("Bleed", ailmentCritChance, avgHitBleedDmg, avgCritBleedDmg, false)
			local baseBleedDps = averageBaseBleedDps * basePercent / 100 * output.RuthlessBlowAilmentEffect * output.FistOfWarDamageEffect * globalOutput.AilmentWarcryEffect
			if baseBleedDps > 0 then
				skillFlags.bleed = true