diff --git a/spec/System/TestLeech_spec.lua b/spec/System/TestLeech_spec.lua new file mode 100644 index 0000000000..50812cab39 --- /dev/null +++ b/spec/System/TestLeech_spec.lua @@ -0,0 +1,90 @@ +describe("TestLeech", function() + before_each(function() + newBuild() + build.configTab.input.enemyLevel = 1 + end) + + local function setMods(mods) + build.configTab.input.customMods = mods + build.configTab:BuildModList() + runCallback("OnFrame") + return build.calcsTab.mainOutput + end + + local hitMods = "Your hits can't be Evaded\nAdds 10 to 100 Physical Damage\nLeeches 10% of Physical Damage as Life\n" + local baseMods = hitMods .. "Never deal Critical Hits\n" + + it("leeches a portion of hit damage over one second", function() + local output = setMods(baseMods) + assert.True(output.LifeLeechPerHit > 0) + assert.are.near(0.1 * output.MainHand.PhysicalHitAverage, output.LifeLeechPerHit, 1e-9) + assert.are.equals(1, output.LifeLeechDuration) + end) + + it("only recovers from the strongest instance at a time", function() + local output = setMods(baseMods) + local hitRate = output.LifeLeechInstances / output.LifeLeechDuration + assert.True(output.LifeLeechInstances > 1) + assert.True(output.LifeLeechRate < output.LifeLeechPerHit * hitRate) + -- the active instance rolls towards the top of the damage range + assert.True(output.LifeLeechInstanceAmount > output.LifeLeechPerHit) + assert.are.equals(output.LifeLeechInstanceAmount, output.LifeLeechRate) + end) + + it("averages leech when instances do not overlap", function() + local output = setMods(baseMods .. "75% reduced Attack Speed") + local hitRate = output.LifeLeechInstances / output.LifeLeechDuration + assert.True(output.LifeLeechInstances < 1) + assert.are.near(output.LifeLeechPerHit * hitRate, output.LifeLeechRate, 1e-9) + end) + + it("has no leech rate cap", function() + local output = setMods(baseMods .. "Leeches 1000% of Physical Damage as Life") + assert.True(output.LifeLeechRate > output.Life * 0.2) + end) + + it("increases the amount leeched with amount modifiers", function() + local base = setMods(baseMods).LifeLeechPerHit + assert.are.near(base * 1.5, setMods(baseMods .. "50% increased amount of Life Leeched").LifeLeechPerHit, 1e-9) + assert.are.near(base * 1.5, setMods(baseMods .. "50% more amount of Life Leeched").LifeLeechPerHit, 1e-9) + end) + + it("slows leech without reducing the amount leeched", function() + local base = setMods(baseMods).LifeLeechPerHit + local output = setMods(baseMods .. "Leech Life 50% slower") + assert.are.near(base, output.LifeLeechPerHit, 1e-9) + assert.are.near(2, output.LifeLeechDuration, 1e-9) + output = setMods(baseMods .. "Leech Life 67% less quickly") + assert.are.near(1 / 0.33, output.LifeLeechDuration, 1e-9) + end) + + it("treats hits above 40000 damage as 40000 damage", function() + local output = setMods(baseMods .. "Adds 100000 to 100000 Physical Damage") + assert.True(output.MainHand.PhysicalHitAverage > 40000) + assert.are.near(4000, output.LifeLeechPerHit, 1e-6) + end) + + it("shortens the duration with instant leech", function() + local base = setMods(baseMods).LifeLeechPerHit + local output = setMods(baseMods .. "25% of Leech is Instant") + assert.are.near(base, output.LifeLeechPerHit, 1e-9) + assert.are.near(base * 0.25, output.LifeLeechInstant, 1e-9) + assert.are.near(0.75, output.LifeLeechDuration, 1e-9) + end) + + it("is reduced by enemy leech resistance", function() + local base = setMods(baseMods).LifeLeechPerHit + build.configTab.input.enemyLevel = 83 + local output = setMods(baseMods) + assert.are.near(base * (1 - data.monsterLeechResistanceTable[83] / 10000), output.LifeLeechPerHit, 1e-9) + assert.True(output.LifeLeechPerHit < base) + end) + + it("favours critical hits when instances overlap", function() + local output = setMods(hitMods .. "+30% to Critical Hit Chance") + local critChance = output.CritChance + assert.True(critChance > 0 and critChance < 100) + assert.True(output.LifeLeechInstances > 1) + assert.True(output.LifeLeechCritActive > critChance) + end) +end) diff --git a/src/Data/Misc.lua b/src/Data/Misc.lua index eae10bd175..5d74a74a93 100644 --- a/src/Data/Misc.lua +++ b/src/Data/Misc.lua @@ -12,6 +12,7 @@ data.monsterAllyDamageTable = { 3.1099998950958, 4.4200000762939, 5.820000171661 data.monsterArmourTable = { 3, 6, 8, 10, 13, 16, 19, 22, 26, 30, 34, 39, 43, 49, 54, 60, 67, 73, 81, 89, 97, 106, 116, 126, 137, 149, 161, 174, 189, 204, 220, 237, 255, 274, 295, 317, 340, 364, 391, 418, 448, 479, 512, 547, 585, 624, 666, 711, 758, 808, 861, 917, 976, 1039, 1105, 1176, 1250, 1329, 1412, 1500, 1594, 1692, 1796, 1906, 2023, 2146, 2276, 2413, 2558, 2712, 2874, 3044, 3225, 3416, 3617, 3829, 4053, 4290, 4540, 4803, 5081, 5375, 5684, 6011, 6355, 6718, 7101, 7505, 7930, 8379, 8852, 9351, 9877, 10431, 11015, 11630, 12279, 12962, 13682, 14441, } data.monsterAilmentThresholdTable = { 15, 20, 24, 28, 34, 39, 46, 52, 60, 70, 81, 95, 110, 126, 144, 171, 193, 218, 245, 275, 306, 340, 376, 413, 455, 497, 543, 590, 641, 695, 752, 812, 874, 950, 1033, 1123, 1220, 1326, 1442, 1568, 1705, 1854, 2015, 2192, 2384, 2564, 2757, 2966, 3188, 3426, 3681, 3955, 4247, 4560, 4895, 5254, 5638, 6049, 6489, 6959, 7462, 8001, 8576, 9193, 9649, 10228, 10841, 11492, 12181, 18272, 19369, 20531, 21763, 23068, 34602, 36679, 38879, 41212, 43685, 65527, 68415, 71303, 74191, 77079, 79967, 82855, 85743, 88631, 91519, 94407, 97295, 100183, 103071, 105959, 108847, 111735, 114623, 117511, 120399, 123287, } data.monsterPoiseThresholdTable = { 30, 40, 48, 57, 67, 79, 93, 106, 122, 142, 165, 192, 220, 254, 290, 344, 390, 437, 488, 542, 599, 659, 724, 791, 862, 937, 1015, 1097, 1183, 1273, 1367, 1464, 1567, 1660, 1758, 1864, 1976, 2093, 2219, 2352, 2494, 2644, 2804, 2971, 3150, 3369, 3598, 3846, 4109, 4387, 4685, 5002, 5338, 5697, 6078, 6485, 6915, 7377, 7866, 8386, 8940, 9528, 10153, 10819, 26703, 28651, 30662, 32890, 35192, 53405, 57263, 61392, 65810, 70537, 106973, 114630, 122820, 131580, 140949, 213635, 225270, 236905, 248540, 260175, 271810, 283445, 295080, 306715, 318350, 329985, 341620, 353255, 364890, 376525, 388160, 399795, 411430, 423065, 434700, 446335, } +data.monsterLeechResistanceTable = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 638, 987, 1416, 1835, 2246, 2634, 3013, 3384, 3742, 4077, 4405, 4717, 5022, 5307, 5453, 5601, 5749, 5892, 6038, 6178, 6314, 6453, 6586, 6718, 6848, 6973, 7097, 7218, 7336, 7453, 7565, 7674, 7781, 7884, 8003, 8119, 8227, 8332, 8432, 8528, 8619, 8706, 8789, 8867, 8942, 9013, 9080, 9144, 9204, 9262, 9316, 9367, 9415, 9460, 9502, 9542, 9579, 9613, 9645, 9675, 9703, 9729, 9752, 9775, 9795, 9814, 9831, 9847, 9861, } -- From MinionGemLevelScaling.dat data.minionLevelTable = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, } diff --git a/src/Data/ModCache.lua b/src/Data/ModCache.lua index 50484e61c0..e866c08baf 100644 --- a/src/Data/ModCache.lua +++ b/src/Data/ModCache.lua @@ -1702,9 +1702,9 @@ c["10% increased Warcry Buff Effect"]={{[1]={flags=0,keywordFlags=4,name="BuffEf c["10% increased Warcry Cooldown Recovery Rate"]={{[1]={flags=0,keywordFlags=4,name="CooldownRecovery",type="INC",value=10}},nil} c["10% increased Weapon Damage per 10 Strength"]={{[1]={[1]={div=10,stat="Str",type="PerStat"},flags=8192,keywordFlags=0,name="Damage",type="INC",value=10}},nil} c["10% increased Withered Magnitude"]={{[1]={flags=0,keywordFlags=0,name="WitherEffect",type="INC",value=10}},nil} -c["10% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=10}},nil} -c["10% increased amount of Life Leeched while Shapeshifted"]={{[1]={[1]={type="Condition",var="Shapeshifted"},flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=10}},nil} -c["10% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxManaLeechRate",type="INC",value=10}},nil} +c["10% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=10}},nil} +c["10% increased amount of Life Leeched while Shapeshifted"]={{[1]={[1]={type="Condition",var="Shapeshifted"},flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=10}},nil} +c["10% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="ManaLeechAmount",type="INC",value=10}},nil} c["10% increased chance to Shock"]={{[1]={flags=0,keywordFlags=0,name="EnemyShockChance",type="INC",value=10}},nil} c["10% increased chance to inflict Ailments"]={{[1]={flags=0,keywordFlags=0,name="AilmentChance",type="INC",value=10}},nil} c["10% increased effect of Arcane Surge on you"]={{[1]={flags=0,keywordFlags=0,name="ArcaneSurgeEffect",type="INC",value=10}},nil} @@ -1859,7 +1859,7 @@ c["100% increased Stun Threshold for each time you've been Stunned Recently"]={{ c["100% increased Thorns damage"]={{[1]={flags=32,keywordFlags=0,name="Damage",type="INC",value=100}},nil} c["100% increased Thorns damage if you've consumed an Endurance Charge Recently"]={{[1]={[1]={limit=1,type="Multiplier",var="RemovableEnduranceCharge"},flags=32,keywordFlags=0,name="Damage",type="INC",value=100}},nil} c["100% increased Vaal Skill Critical Hit Chance"]={{[1]={flags=0,keywordFlags=512,name="CritChance",type="INC",value=100}},nil} -c["100% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=100}},nil} +c["100% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=100}},nil} c["100% increased chance to Shock"]={{[1]={flags=0,keywordFlags=0,name="EnemyShockChance",type="INC",value=100}},nil} c["100% increased effect of Socketed Augment Items"]={{[1]={flags=0,keywordFlags=0,name="SocketedAugmentItemEffect",type="INC",value=100}},nil} c["100% increased effect of Socketed Soul Cores"]={{[1]={flags=0,keywordFlags=0,name="SocketedSoulCoreEffect",type="INC",value=100}},nil} @@ -1919,8 +1919,8 @@ c["11% increased Reload Speed"]={{[1]={flags=1,keywordFlags=0,name="ReloadSpeed" c["11% increased Spell Damage"]={{[1]={flags=2,keywordFlags=0,name="Damage",type="INC",value=11}},nil} c["11% increased Stun Threshold"]={{[1]={flags=0,keywordFlags=0,name="StunThreshold",type="INC",value=11}},nil} c["11% increased Trap Damage"]={{[1]={flags=0,keywordFlags=4096,name="Damage",type="INC",value=11}},nil} -c["11% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=11}},nil} -c["11% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxManaLeechRate",type="INC",value=11}},nil} +c["11% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=11}},nil} +c["11% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="ManaLeechAmount",type="INC",value=11}},nil} c["11% increased speed of Recoup Effects"]={{[1]={flags=0,keywordFlags=0,name="LocalEffect",type="INC",value=11}}," speed of Recoup s "} c["11% less damage taken while on Low Life"]={{[1]={[1]={type="Condition",var="LowLife"},flags=0,keywordFlags=0,name="DamageTaken",type="MORE",value=-11}},nil} c["11% of Damage taken Recouped as Life"]={{[1]={flags=0,keywordFlags=0,name="LifeRecoup",type="BASE",value=11}},nil} @@ -2036,7 +2036,7 @@ c["12% increased Stun Duration on Enemies"]={{[1]={flags=0,keywordFlags=0,name=" c["12% increased Stun Threshold"]={{[1]={flags=0,keywordFlags=0,name="StunThreshold",type="INC",value=12}},nil} c["12% increased Stun Threshold if you haven't been Stunned Recently"]={{[1]={[1]={neg=true,type="Condition",var="StunnedRecently"},flags=0,keywordFlags=0,name="StunThreshold",type="INC",value=12}},nil} c["12% increased Thorns damage"]={{[1]={flags=32,keywordFlags=0,name="Damage",type="INC",value=12}},nil} -c["12% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=12}},nil} +c["12% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=12}},nil} c["12% increased chance to Shock"]={{[1]={flags=0,keywordFlags=0,name="EnemyShockChance",type="INC",value=12}},nil} c["12% increased maximum Energy Shield"]={{[1]={[1]={type="Global"},flags=0,keywordFlags=0,name="EnergyShield",type="INC",value=12}},nil} c["12% of Damage is taken from Mana before Life"]={{[1]={flags=0,keywordFlags=0,name="DamageTakenFromManaBeforeLife",type="BASE",value=12}},nil} @@ -2072,7 +2072,7 @@ c["125% increased Physical Damage"]={{[1]={flags=0,keywordFlags=0,name="Physical c["125% increased Rarity of Items Dropped by Slain Magic Enemies"]={{[1]={flags=0,keywordFlags=0,name="LootRarityMagicEnemies",type="INC",value=125}},nil} c["125% increased Thorns damage"]={{[1]={flags=32,keywordFlags=0,name="Damage",type="INC",value=125}},nil} c["125% increased Thorns damage if you've Blocked Recently"]={{[1]={[1]={type="Condition",var="BlockedRecently"},flags=32,keywordFlags=0,name="Damage",type="INC",value=125}},nil} -c["125% increased amount of Mana Leeched if you've dealt a Critical Hit Recently"]={{[1]={[1]={type="Condition",var="CritRecently"},flags=0,keywordFlags=0,name="MaxManaLeechRate",type="INC",value=125}},nil} +c["125% increased amount of Mana Leeched if you've dealt a Critical Hit Recently"]={{[1]={[1]={type="Condition",var="CritRecently"},flags=0,keywordFlags=0,name="ManaLeechAmount",type="INC",value=125}},nil} c["13 Mana gained when you Block"]={{[1]={flags=0,keywordFlags=0,name="ManaOnBlock",type="BASE",value=13}},nil} c["13 to 23 Physical Thorns damage"]={{[1]={flags=32,keywordFlags=0,name="PhysicalMin",type="BASE",value=13},[2]={flags=32,keywordFlags=0,name="PhysicalMax",type="BASE",value=23}},nil} c["13% chance for Flasks you use to not consume Charges"]={{[1]={flags=0,keywordFlags=0,name="FlaskChanceNotConsumeCharges",type="BASE",value=13}},nil} @@ -2433,8 +2433,8 @@ c["15% increased Trap Damage"]={{[1]={flags=0,keywordFlags=4096,name="Damage",ty c["15% increased Volatility Explosion delay"]={{}," Volatility Explosion delay "} c["15% increased Warcry Cooldown Recovery Rate"]={{[1]={flags=0,keywordFlags=4,name="CooldownRecovery",type="INC",value=15}},nil} c["15% increased Warcry Speed"]={{[1]={flags=0,keywordFlags=4,name="WarcrySpeed",type="INC",value=15}},nil} -c["15% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=15}},nil} -c["15% increased amount of Life Leeched while Shapeshifted"]={{[1]={[1]={type="Condition",var="Shapeshifted"},flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=15}},nil} +c["15% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=15}},nil} +c["15% increased amount of Life Leeched while Shapeshifted"]={{[1]={[1]={type="Condition",var="Shapeshifted"},flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=15}},nil} c["15% increased chance to Poison"]={{[1]={flags=0,keywordFlags=0,name="PoisonChance",type="INC",value=15}}," chance "} c["15% increased chance to Shock"]={{[1]={flags=0,keywordFlags=0,name="EnemyShockChance",type="INC",value=15}},nil} c["15% increased chance to inflict Ailments"]={{[1]={flags=0,keywordFlags=0,name="AilmentChance",type="INC",value=15}},nil} @@ -2516,7 +2516,7 @@ c["150% increased Global Evasion Rating when on Low Life"]={{[1]={[1]={type="Glo c["150% increased Mana Regeneration Rate if you've dealt a Critical Hit Recently"]={{[1]={[1]={type="Condition",var="CritRecently"},flags=0,keywordFlags=0,name="ManaRegen",type="INC",value=150}},nil} c["150% increased Physical Damage"]={{[1]={flags=0,keywordFlags=0,name="PhysicalDamage",type="INC",value=150}},nil} c["150% increased Spell Damage"]={{[1]={flags=2,keywordFlags=0,name="Damage",type="INC",value=150}},nil} -c["150% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=150}},nil} +c["150% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=150}},nil} c["16% increased Accuracy Rating at Close Range"]={{[1]={[1]={type="Condition",var="AtCloseRange"},flags=0,keywordFlags=0,name="AccuracyVsEnemy",type="INC",value=16}},nil} c["16% increased Accuracy Rating with One Handed Melee Weapons"]={{[1]={flags=21474836484,keywordFlags=0,name="Accuracy",type="INC",value=16}},nil} c["16% increased Accuracy Rating with Two Handed Melee Weapons"]={{[1]={flags=38654705668,keywordFlags=0,name="Accuracy",type="INC",value=16}},nil} @@ -2565,8 +2565,8 @@ c["16% increased Thorns damage"]={{[1]={flags=32,keywordFlags=0,name="Damage",ty c["16% increased Totem Life"]={{[1]={flags=0,keywordFlags=0,name="TotemLife",type="INC",value=16}},nil} c["16% increased Trap Throwing Speed"]={{[1]={flags=0,keywordFlags=0,name="TrapThrowingSpeed",type="INC",value=16}},nil} c["16% increased Warcry Speed"]={{[1]={flags=0,keywordFlags=4,name="WarcrySpeed",type="INC",value=16}},nil} -c["16% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=16}},nil} -c["16% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxManaLeechRate",type="INC",value=16}},nil} +c["16% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=16}},nil} +c["16% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="ManaLeechAmount",type="INC",value=16}},nil} c["16% increased maximum Energy Shield"]={{[1]={[1]={type="Global"},flags=0,keywordFlags=0,name="EnergyShield",type="INC",value=16}},nil} c["16% reduced Charges per use"]={{[1]={flags=0,keywordFlags=0,name="FlaskChargesUsed",type="INC",value=-16}},nil} c["16% reduced Skill Effect Duration"]={{[1]={flags=0,keywordFlags=0,name="Duration",type="INC",value=-16}},nil} @@ -2994,7 +2994,7 @@ c["20% increased Tribute"]={{[1]={flags=0,keywordFlags=0,name="Tribute",type="IN c["20% increased Warcry Speed"]={{[1]={flags=0,keywordFlags=4,name="WarcrySpeed",type="INC",value=20}},nil} c["20% increased Weapon Swap Speed"]={{[1]={flags=0,keywordFlags=0,name="WeaponSwapSpeed",type="INC",value=20}},nil} c["20% increased Withered Magnitude"]={{[1]={flags=0,keywordFlags=0,name="WitherEffect",type="INC",value=20}},nil} -c["20% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=20}},nil} +c["20% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=20}},nil} c["20% increased bonuses gained from Equipped Quiver"]={{[1]={flags=0,keywordFlags=0,name="EffectOfBonusesFromQuiver",type="INC",value=20}},nil} c["20% increased chance to Shock"]={{[1]={flags=0,keywordFlags=0,name="EnemyShockChance",type="INC",value=20}},nil} c["20% increased chance to inflict Ailments"]={{[1]={flags=0,keywordFlags=0,name="AilmentChance",type="INC",value=20}},nil} @@ -3096,7 +3096,7 @@ c["200% increased Ice Crystal Life"]={{[1]={flags=0,keywordFlags=0,name="IceCrys c["200% increased Physical Damage"]={{[1]={flags=0,keywordFlags=0,name="PhysicalDamage",type="INC",value=200}},nil} c["200% increased Spell Damage if you've dealt a Critical Hit in the past 8 seconds"]={{[1]={[1]={type="Condition",var="CritInPast8Sec"},flags=2,keywordFlags=0,name="Damage",type="INC",value=200}},nil} c["200% increased Stun Recovery"]={{[1]={flags=0,keywordFlags=0,name="StunRecovery",type="INC",value=200}},nil} -c["200% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=200}},nil} +c["200% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=200}},nil} c["200% increased bonuses gained from Equipped Quiver"]={{[1]={flags=0,keywordFlags=0,name="EffectOfBonusesFromQuiver",type="INC",value=200}},nil} c["200% increased effect of Socketed Runes"]={{[1]={flags=0,keywordFlags=0,name="SocketedRuneEffect",type="INC",value=200}},nil} c["200% increased effect of Socketed Soul Cores"]={{[1]={flags=0,keywordFlags=0,name="SocketedSoulCoreEffect",type="INC",value=200}},nil} @@ -3152,7 +3152,7 @@ c["23% increased Skill Speed"]={{[1]={flags=0,keywordFlags=0,name="Speed",type=" c["23% 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=23}},nil} c["23% increased Strength"]={{[1]={flags=0,keywordFlags=0,name="Str",type="INC",value=23}},nil} c["23% increased Trap Damage"]={{[1]={flags=0,keywordFlags=4096,name="Damage",type="INC",value=23}},nil} -c["23% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=23}},nil} +c["23% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=23}},nil} c["23% more Global Evasion Rating and Energy Shield"]={{[1]={flags=0,keywordFlags=0,name="Evasion",type="MORE",value=23},[2]={flags=0,keywordFlags=0,name="EnergyShield",type="MORE",value=23}},nil} c["23% of Damage taken during effect Recouped as Life"]={{[1]={[1]={type="Condition",var="UsingFlask"},flags=0,keywordFlags=0,name="DamageTaken",type="BASE",value=23}}," Recouped as Life "} c["23% reduced Duration"]={{[1]={flags=0,keywordFlags=0,name="Duration",type="INC",value=-23}},nil} @@ -3387,9 +3387,9 @@ c["25% increased Trap Damage"]={{[1]={flags=0,keywordFlags=4096,name="Damage",ty c["25% increased Warcry Cooldown Recovery Rate"]={{[1]={flags=0,keywordFlags=4,name="CooldownRecovery",type="INC",value=25}},nil} c["25% increased Warcry Speed"]={{[1]={flags=0,keywordFlags=4,name="WarcrySpeed",type="INC",value=25}},nil} c["25% increased Weapon Swap Speed"]={{[1]={flags=0,keywordFlags=0,name="WeaponSwapSpeed",type="INC",value=25}},nil} -c["25% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=25}},nil} -c["25% increased amount of Life Leeched if you've consumed a Frenzy Charge Recently"]={{[1]={[1]={limit=1,type="Multiplier",var="RemovableFrenzyCharge"},flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=25}},nil} -c["25% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxManaLeechRate",type="INC",value=25}},nil} +c["25% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=25}},nil} +c["25% increased amount of Life Leeched if you've consumed a Frenzy Charge Recently"]={{[1]={[1]={limit=1,type="Multiplier",var="RemovableFrenzyCharge"},flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=25}},nil} +c["25% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="ManaLeechAmount",type="INC",value=25}},nil} c["25% increased bonuses gained from Equipped Rings and Amulets"]={{[1]={flags=0,keywordFlags=0,name="EffectOfBonusesFromRing 1",type="INC",value=25},[2]={flags=0,keywordFlags=0,name="EffectOfBonusesFromRing 2",type="INC",value=25},[3]={flags=0,keywordFlags=0,name="EffectOfBonusesFromRing 3",type="INC",value=25},[4]={flags=0,keywordFlags=0,name="EffectOfBonusesFromAmulet",type="INC",value=25}},nil} c["25% increased bonuses gained from left Equipped Ring"]={{[1]={flags=0,keywordFlags=0,name="EffectOfBonusesFromRing 1",type="INC",value=25}},nil} c["25% increased bonuses gained from right Equipped Ring"]={{[1]={flags=0,keywordFlags=0,name="EffectOfBonusesFromRing 2",type="INC",value=25}},nil} @@ -3785,8 +3785,8 @@ c["30% increased Totem Duration"]={{[1]={flags=0,keywordFlags=0,name="TotemDurat c["30% increased Totem Life"]={{[1]={flags=0,keywordFlags=0,name="TotemLife",type="INC",value=30}},nil} c["30% increased Totem Placement speed"]={{[1]={flags=0,keywordFlags=0,name="TotemPlacementSpeed",type="INC",value=30}},nil} c["30% increased Warcry Speed"]={{[1]={flags=0,keywordFlags=4,name="WarcrySpeed",type="INC",value=30}},nil} -c["30% increased amount of Life Leeched if you've consumed a Frenzy Charge Recently"]={{[1]={[1]={limit=1,type="Multiplier",var="RemovableFrenzyCharge"},flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=30}},nil} -c["30% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxManaLeechRate",type="INC",value=30}},nil} +c["30% increased amount of Life Leeched if you've consumed a Frenzy Charge Recently"]={{[1]={[1]={limit=1,type="Multiplier",var="RemovableFrenzyCharge"},flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=30}},nil} +c["30% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="ManaLeechAmount",type="INC",value=30}},nil} c["30% increased bonuses gained from left Equipped Ring"]={{[1]={flags=0,keywordFlags=0,name="EffectOfBonusesFromRing 1",type="INC",value=30}},nil} c["30% increased bonuses gained from right Equipped Ring"]={{[1]={flags=0,keywordFlags=0,name="EffectOfBonusesFromRing 2",type="INC",value=30}},nil} c["30% increased chance to Shock"]={{[1]={flags=0,keywordFlags=0,name="EnemyShockChance",type="INC",value=30}},nil} @@ -3970,7 +3970,7 @@ c["35% increased Spell Damage if you have consumed an Elemental Infusion Recentl c["35% increased Stun Buildup"]={{[1]={flags=0,keywordFlags=0,name="EnemyHeavyStunBuildup",type="INC",value=35}},nil} c["35% increased Stun Threshold"]={{[1]={flags=0,keywordFlags=0,name="StunThreshold",type="INC",value=35}},nil} c["35% increased Trap Damage"]={{[1]={flags=0,keywordFlags=4096,name="Damage",type="INC",value=35}},nil} -c["35% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=35}},nil} +c["35% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=35}},nil} c["35% increased bonuses gained from Equipped Quiver"]={{[1]={flags=0,keywordFlags=0,name="EffectOfBonusesFromQuiver",type="INC",value=35}},nil} c["35% increased effect of Fully Broken Armour"]={{[1]={flags=0,keywordFlags=0,name="FullyBrokenArmourEffect",type="INC",value=35}},nil} c["35% increased maximum Energy Shield"]={{[1]={[1]={type="Global"},flags=0,keywordFlags=0,name="EnergyShield",type="INC",value=35}},nil} @@ -4617,7 +4617,7 @@ c["50% increased Stun Threshold while Channelling"]={{[1]={[1]={type="Condition" c["50% increased Surrounded Area of Effect"]={{[1]={flags=0,keywordFlags=0,name="SurroundedArea",type="INC",value=50}},nil} c["50% increased Totem Placement range"]={{}," Placement range "} c["50% increased Trap Trigger Area of Effect"]={{[1]={flags=0,keywordFlags=0,name="TrapTriggerAreaOfEffect",type="INC",value=50}},nil} -c["50% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxManaLeechRate",type="INC",value=50}},nil} +c["50% increased amount of Mana Leeched"]={{[1]={flags=0,keywordFlags=0,name="ManaLeechAmount",type="INC",value=50}},nil} c["50% increased chance to inflict Ailments against Enemies affected by Abyssal Wasting"]={{[1]={flags=0,keywordFlags=0,name="AbyssalWastingAlsoGrants",type="LIST",value={mod={flags=0,keywordFlags=0,name="AilmentChance",type="INC",value=50},unscalable=true}}},nil} c["50% increased effect of Curses on you"]={{[1]={flags=0,keywordFlags=0,name="CurseEffectOnSelf",type="INC",value=50}},nil} c["50% increased effect of Incision"]={{[1]={flags=0,keywordFlags=0,name="IncisionEffect",type="INC",value=50}},nil} @@ -4640,7 +4640,7 @@ c["50% more Critical Damage Bonus"]={{[1]={flags=0,keywordFlags=0,name="CritMult c["50% more Damage with Arrow Hits at Close Range"]={{[1]={[1]={type="Condition",var="AtCloseRange"},flags=4,keywordFlags=2048,name="Damage",type="MORE",value=50}},nil} c["50% more Magnitude of Bleeding you inflict"]={{[1]={flags=0,keywordFlags=4194304,name="AilmentMagnitude",type="MORE",value=50}},nil} c["50% more Mana Cost of Skills if you have no Energy Shield"]={{[1]={[1]={neg=true,type="Condition",var="HaveEnergyShield"},flags=0,keywordFlags=0,name="ManaCost",type="MORE",value=50}},nil} -c["50% more amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="MORE",value=50}},nil} +c["50% more amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="MORE",value=50}},nil} c["50% more damage against enemies with an Open Weakness"]={{[1]={[1]={type="Condition",var="EnemyHasOpenWeakness"},flags=0,keywordFlags=0,name="Damage",type="MORE",value=50}},nil} c["50% of Chaos damage you prevent when Hit Recouped as Life and Mana during effect"]={{[1]={[1]={type="Condition",var="UsingFlask"},flags=0,keywordFlags=0,name="ChaosDamage",type="BASE",value=50}}," you prevent when Hit Recouped as Life and Mana "} c["50% of Charges consumed by used Charms are granted to your Life Flasks"]={{[1]={flags=0,keywordFlags=0,name="FlaskCharges",type="BASE",value=50}}," consumed by used Charms are granted to your Life Flasks "} @@ -4811,7 +4811,7 @@ c["6% increased Totem Damage"]={{[1]={flags=0,keywordFlags=16384,name="Damage",t c["6% increased Trap Throwing Speed"]={{[1]={flags=0,keywordFlags=0,name="TrapThrowingSpeed",type="INC",value=6}},nil} c["6% increased Warcry Buff Effect"]={{[1]={flags=0,keywordFlags=4,name="BuffEffect",type="INC",value=6}},nil} c["6% increased Warcry Cooldown Recovery Rate"]={{[1]={flags=0,keywordFlags=4,name="CooldownRecovery",type="INC",value=6}},nil} -c["6% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=6}},nil} +c["6% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=6}},nil} c["6% increased bonuses gained from Equipped Quiver"]={{[1]={flags=0,keywordFlags=0,name="EffectOfBonusesFromQuiver",type="INC",value=6}},nil} c["6% increased chance to inflict Ailments"]={{[1]={flags=0,keywordFlags=0,name="AilmentChance",type="INC",value=6}},nil} c["6% increased maximum Life"]={{[1]={flags=0,keywordFlags=0,name="Life",type="INC",value=6}},nil} @@ -5139,7 +5139,7 @@ c["8% increased Strength"]={{[1]={flags=0,keywordFlags=0,name="Str",type="INC",v c["8% increased Stun Threshold"]={{[1]={flags=0,keywordFlags=0,name="StunThreshold",type="INC",value=8}},nil} c["8% increased Warcry Speed"]={{[1]={flags=0,keywordFlags=4,name="WarcrySpeed",type="INC",value=8}},nil} c["8% increased Withered Magnitude"]={{[1]={flags=0,keywordFlags=0,name="WitherEffect",type="INC",value=8}},nil} -c["8% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="MaxLifeLeechRate",type="INC",value=8}},nil} +c["8% increased amount of Life Leeched"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechAmount",type="INC",value=8}},nil} c["8% increased chance to Shock"]={{[1]={flags=0,keywordFlags=0,name="EnemyShockChance",type="INC",value=8}},nil} c["8% increased chance to inflict Ailments"]={{[1]={flags=0,keywordFlags=0,name="AilmentChance",type="INC",value=8}},nil} c["8% increased maximum Energy Shield"]={{[1]={[1]={type="Global"},flags=0,keywordFlags=0,name="EnergyShield",type="INC",value=8}},nil} @@ -8404,7 +8404,7 @@ c["Leech 10% of Physical Attack Damage as Life"]={{[1]={flags=1,keywordFlags=0,n c["Leech 15% of Physical Attack Damage as Life"]={{[1]={flags=1,keywordFlags=0,name="PhysicalDamageLifeLeech",type="BASE",value=15}},nil} c["Leech 2% of Physical Attack Damage as Mana"]={{[1]={flags=1,keywordFlags=0,name="PhysicalDamageManaLeech",type="BASE",value=2}},nil} c["Leech 3% of Physical Attack Damage as Life"]={{[1]={flags=1,keywordFlags=0,name="PhysicalDamageLifeLeech",type="BASE",value=3}},nil} -c["Leech 30% faster"]={nil,"Leech 30% faster "} +c["Leech 30% faster"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechRate",type="INC",value=30},[2]={flags=0,keywordFlags=0,name="ManaLeechRate",type="INC",value=30},[3]={flags=0,keywordFlags=0,name="EnergyShieldLeechRate",type="INC",value=30}},nil} c["Leech 5% of Physical Attack Damage as Life"]={{[1]={flags=1,keywordFlags=0,name="PhysicalDamageLifeLeech",type="BASE",value=5}},nil} c["Leech 5% of Physical Attack Damage as Mana"]={{[1]={flags=1,keywordFlags=0,name="PhysicalDamageManaLeech",type="BASE",value=5}},nil} c["Leech 6% of Physical Attack Damage as Mana"]={{[1]={flags=1,keywordFlags=0,name="PhysicalDamageManaLeech",type="BASE",value=6}},nil} @@ -8417,13 +8417,11 @@ c["Leech Life 20% slower"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechRate",ty c["Leech Life 23% slower"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechRate",type="INC",value=-23}},nil} c["Leech Life 5% slower"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechRate",type="INC",value=-5}},nil} c["Leech Life 50% faster"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechRate",type="INC",value=50}},nil} -c["Leech Life 67% less quickly"]={nil,"Leech Life 67% less quickly "} -c["Leech Life 67% less quickly Cannot Recover Life other than from Leech"]={nil,"Leech Life 67% less quickly Cannot Recover Life other than from Leech "} -c["Leech Life 67% less quickly Cannot Recover Life other than from Leech Life Leech effects are not removed when Unreserved Life is Filled"]={nil,"Leech Life 67% less quickly Cannot Recover Life other than from Leech Life Leech effects are not removed when Unreserved Life is Filled "} +c["Leech Life 67% less quickly"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechRate",type="MORE",value=-67}},nil} c["Leech Life 750% faster"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechRate",type="INC",value=750}},nil} c["Leech Life 8% faster"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechRate",type="INC",value=8}},nil} c["Leech Life 8% slower"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechRate",type="INC",value=-8}},nil} -c["Leech Mana 750% faster"]={nil,"Leech Mana 750% faster "} +c["Leech Mana 750% faster"]={{[1]={flags=0,keywordFlags=0,name="ManaLeechRate",type="INC",value=750}},nil} c["Leech from Critical Hits is instant"]={{[1]={[1]={type="Condition",var="CriticalStrike"},flags=0,keywordFlags=0,name="InstantLifeLeech",type="BASE",value=100},[2]={[1]={type="Condition",var="CriticalStrike"},flags=0,keywordFlags=0,name="InstantManaLeech",type="BASE",value=100},[3]={[1]={type="Condition",var="CriticalStrike"},flags=0,keywordFlags=0,name="InstantEnergyShieldLeech",type="BASE",value=100}},nil} c["Leech recovers based on Chaos Damage as well as Physical Damage"]={{[1]={flags=0,keywordFlags=0,name="LifeLeechBasedOnChaosDamage",type="FLAG",value=true},[2]={flags=0,keywordFlags=0,name="ManaLeechBasedOnChaosDamage",type="FLAG",value=true},[3]={flags=0,keywordFlags=0,name="EnergyShieldLeechBasedOnChaosDamage",type="FLAG",value=true}},nil} c["Leeches 0.1% of Physical Damage as Life"]={{[1]={flags=0,keywordFlags=0,name="PhysicalDamageLifeLeech",type="BASE",value=0.1}},nil} @@ -10003,9 +10001,9 @@ c["Your speed is Unaffected by Slows while Sprinting"]={nil,"Your speed is Unaff c["Your speed is Unaffected by Slows while Sprinting 10% less Movement and Skill Speed per Dodge Roll in the past 20 seconds"]={nil,"Your speed is Unaffected by Slows while Sprinting 10% less Movement and Skill Speed per Dodge Roll in the past 20 seconds "} c["Your speed is unaffected by Slows"]={{[1]={flags=0,keywordFlags=0,name="UnaffectedBySlows",type="FLAG",value=true}},nil} c["Your spells have 100% chance to Shock against Frozen Enemies"]={nil,"Your spells have 100% chance to Shock against Frozen Enemies "} -end)();(function() c["Zealot's Oath"]={{[1]={flags=0,keywordFlags=0,name="Keystone",type="LIST",value="Zealot's Oath"},[2]={flags=0,keywordFlags=0,name="Condition:HaveZealot'sOath",type="FLAG",value=true}},nil} c["Zealot's Oath during Effect"]={{[1]={[1]={type="Condition",var="UsingFlask"},flags=0,keywordFlags=0,name="ZealotsOath",type="FLAG",value=true}},nil} +end)();(function() c["additional Elemental Infusion of the same type"]={nil,"additional Elemental Infusion of the same type "} c["additional Rune-only sockets:"]={{},nil} c["as being boosted by Chilled Ground"]={nil,"as being boosted by Chilled Ground "} diff --git a/src/Data/SkillStatMap.lua b/src/Data/SkillStatMap.lua index 3346810c6c..8dfec0801e 100644 --- a/src/Data/SkillStatMap.lua +++ b/src/Data/SkillStatMap.lua @@ -508,12 +508,6 @@ return function(mod, flag, skill) mod("DamageEnergyShieldLeech", "BASE", nil, ModFlag.Spell), div = 100, }, -["maximum_life_leech_amount_per_leech_+%"] = { - mod("MaxLifeLeechRate", "INC", nil) -}, -["maximum_energy_shield_leech_amount_per_leech_+%"] = { - mod("MaxEnergyShieldLeechRate", "INC", nil) -}, ["mana_gain_per_target"] = { mod("ManaOnHit", "BASE", nil) }, diff --git a/src/Export/Scripts/miscdata.lua b/src/Export/Scripts/miscdata.lua index cfa82837ea..7d60c99f41 100644 --- a/src/Export/Scripts/miscdata.lua +++ b/src/Export/Scripts/miscdata.lua @@ -13,6 +13,7 @@ local damage = "" local armour = "" local ailmentThreshold = "" local poiseThreshold = "" +local leechResistance = "" local minionLevel = "" for stats in dat("DefaultMonsterStats"):Rows() do evasion = evasion .. stats.Evasion .. ", " @@ -24,6 +25,7 @@ for stats in dat("DefaultMonsterStats"):Rows() do armour = armour .. stats.Armour .. ", " ailmentThreshold = ailmentThreshold .. stats.AilmentThreshold .. ", " poiseThreshold = poiseThreshold .. stats.PoiseThreshold .. ", " + leechResistance = leechResistance .. stats.LeechResistance .. ", " end -- Table was incorrect is PoE 1 but seems to be correct for PoE 2. Keeping here just in case --for i = 1, 100 do @@ -39,6 +41,7 @@ out:write('data.monsterAllyDamageTable = { '..allyDamage..'}\n') out:write('data.monsterArmourTable = { '..armour..'}\n') out:write('data.monsterAilmentThresholdTable = { '..ailmentThreshold..'}\n') out:write('data.monsterPoiseThresholdTable = { '..poiseThreshold..'}\n') +out:write('data.monsterLeechResistanceTable = { '..leechResistance..'}\n') out:write('\n') out:write('-- From MinionGemLevelScaling.dat\n') diff --git a/src/Modules/CalcBreakdown.lua b/src/Modules/CalcBreakdown.lua index 193db6af9a..ac69b2c59f 100644 --- a/src/Modules/CalcBreakdown.lua +++ b/src/Modules/CalcBreakdown.lua @@ -206,59 +206,73 @@ return function(modDB, output, actor) return out end - function breakdown.leech(instant, instantRate, instances, pool, rate, max, dur, instantLeechProportion, hitRate) + function breakdown.leech(output, resource, hitRate) local out = { } + local prefix = resource.."Leech" + local instant = output[prefix.."Instant"] + local resistance = output.EnemyLeechResistance + local resistMult = 1 - resistance / 100 + local resistText = resistance > 0 and s_format(" ^8(after %.2f%% enemy leech resistance)", resistance) or "" if actor.mainSkill.skillData.showAverage then + local overTime = output[prefix.."PerHit"] - instant + t_insert(out, "Leech per hit:") + if overTime > 0 then + t_insert(out, s_format("%.1f ^8(recovered over %.2fs)", overTime, output[prefix.."Duration"])) + end if instant > 0 then - if instantLeechProportion ~= 1 then - t_insert(out, s_format("Instant Leech: %.1f ^8(%d%% x %.1f)", instant, instantLeechProportion * 100, dur * pool * data.misc.LeechRateBase / (1-instantLeechProportion))) - else - t_insert(out, s_format("Instant Leech: %.1f", instant)) - end + t_insert(out, s_format("%s%.1f ^8(instant)", overTime > 0 and "+ " or "", instant)) end - if instances > 0 then - t_insert(out, "Total leeched per instance:") - t_insert(out, s_format("%d ^8(size of leech destination pool)", pool)) - t_insert(out, s_format("x %.2f ^8(base leech rate is %d%% per second)", data.misc.LeechRateBase, 100 * data.misc.LeechRateBase)) - local rateMod = calcLib.mod(modDB, skillCfg, rate) - if rateMod ~= 1 then - t_insert(out, s_format("x %.2f ^8(leech rate modifier)", rateMod)) + t_insert(out, s_format("= %.1f%s", output[prefix.."PerHit"], resistText)) + return out + end + local instances = output[prefix.."Instances"] + local instanceAmount = output[prefix.."InstanceAmount"] / resistMult + local hasOverTime = instances > 0 and instanceAmount > 0 + if hasOverTime then + t_insert(out, "Overlapping leech instances:") + t_insert(out, s_format("%.2f ^8(hits per second)", hitRate)) + t_insert(out, s_format("x %.2fs ^8(duration)", output[prefix.."Duration"])) + t_insert(out, s_format("= %.2f", instances)) + local critActive = output[prefix.."CritActive"] / 100 + if instances > 1 then + t_insert(out, s_format("Only the strongest of %.2f instances recovers:", instances)) + t_insert(out, s_format("%.1f%% ^8(average roll, %.2f / (%.2f + 1))", output[prefix.."RollAverage"], instances, instances)) + if critActive > 0 and critActive < 1 then + local critShare = 1 - (1 - critActive) ^ (1 / instances) + t_insert(out, s_format("%.1f%% ^8(chance of a critical hit, 1 - (1 - %.1f%%) ^ %.2f)", critActive * 100, critShare * 100, instances)) end - t_insert(out, s_format("x %.2fs ^8(instance duration)", dur)) - t_insert(out, s_format("= %.1f", pool * data.misc.LeechRateBase * rateMod * dur)) end - else - if instantRate > 0 then - if instantLeechProportion ~= 1 then - t_insert(out, s_format("Instant Leech: %.1f ^8(%d%% x %.1f)", instant, instantLeechProportion * 100, dur * pool * data.misc.LeechRateBase / (1-instantLeechProportion))) - else - t_insert(out, s_format("Instant Leech: %.1f", instant)) - end - t_insert(out, s_format("Instant Leech per second: %.1f ^8(%.1f x %.2f)", instantRate, instant, hitRate)) + t_insert(out, instances > 1 and "Leech of the strongest instance:" or "Leech per instance:") + local cap = data.gameConstants["EffectiveMaxDamageForLeech"] + local function insertHit(op, label, hit, amount, chance) + local damage = m_min(hit, cap) + local capped = hit > cap and s_format(" capped from %.0f", hit) or "" + local chanceText = chance < 1 and s_format(" x %.1f%%", chance * 100) or "" + t_insert(out, s_format("%s%.0f x %.2f%%%s ^8(%s hit%s x leech%s)", op, damage, amount / resistMult / damage * 100, chanceText, label, capped, chance < 1 and " x chance" or "")) end - if instances > 0 then - t_insert(out, "Rate per instance:") - t_insert(out, s_format("%d ^8(size of leech destination pool)", pool)) - t_insert(out, s_format("x %.2f ^8(base leech rate is %d%% per second)", data.misc.LeechRateBase, 100 * data.misc.LeechRateBase)) - local rateMod = calcLib.mod(modDB, skillCfg, rate) - if rateMod ~= 1 then - t_insert(out, s_format("x %.2f ^8(leech rate modifier)", rateMod)) - end - t_insert(out, s_format("= %.1f ^8per second", pool * data.misc.LeechRateBase * rateMod)) - t_insert(out, "Maximum leech rate against one target:") - t_insert(out, s_format("%.1f", pool * data.misc.LeechRateBase * rateMod)) - t_insert(out, s_format("x %.2f ^8(average instances)", instances)) - local total = pool * data.misc.LeechRateBase * rateMod * instances - t_insert(out, s_format("= %.1f ^8per second", total)) - if total <= max then - t_insert(out, s_format("Time to reach max: %.1fs", dur)) - end - t_insert(out, s_format("Leech rate cap: %.1f", max)) - if total > max then - t_insert(out, s_format("Time to reach cap: %.1fs", dur / total * max)) - end + if critActive < 1 then + insertHit("", "non-critical", output[prefix.."NonCritHit"], output[prefix.."NonCritInstanceAmount"], 1 - critActive) end + if critActive > 0 then + insertHit(critActive < 1 and "+ " or "", "critical", output[prefix.."CritHit"], output[prefix.."CritInstanceAmount"], critActive) + end + t_insert(out, s_format("= %.1f", instanceAmount)) + end + t_insert(out, "Leech per second:") + if hasOverTime then + t_insert(out, s_format("%.1f ^8(leech of the instance)", instanceAmount)) + if resistance > 0 then + t_insert(out, s_format("x %.4f ^8(%.2f%% enemy leech resistance)", resistMult, resistance)) + end + t_insert(out, s_format("x %.2f ^8(leech speed%s)", output[prefix.."Speed"], instant > 0 and ", the instant part shortens the duration instead" or "")) + if instances < 1 then + t_insert(out, s_format("x %.2f ^8(portion of time leeching)", instances)) + end + end + if instant > 0 then + t_insert(out, s_format("%s%.1f x %.2f ^8(instant leech per hit x hits per second)", hasOverTime and "+ " or "", instant, hitRate)) end + t_insert(out, s_format("= %.1f ^8per second", output[prefix.."Rate"])) return out end diff --git a/src/Modules/CalcDefence.lua b/src/Modules/CalcDefence.lua index de8d8996b5..f4c61c0c15 100644 --- a/src/Modules/CalcDefence.lua +++ b/src/Modules/CalcDefence.lua @@ -1673,41 +1673,6 @@ function calcs.defence(env, actor) output.ManaRecoveryRateMod = calcLib.mod(modDB, nil, "ManaRecoveryRate") output.EnergyShieldRecoveryRateMod = calcLib.mod(modDB, nil, "EnergyShieldRecoveryRate") - -- Leech caps - output.MaxLifeLeechInstance = output.Life * calcLib.val(modDB, "MaxLifeLeechInstance") / 100 - output.MaxLifeLeechRatePercent = calcLib.val(modDB, "MaxLifeLeechRate") - if modDB:Flag(nil, "MaximumLifeLeechIsEqualToParent") then - output.MaxLifeLeechRatePercent = actor.parent.output.MaxLifeLeechRatePercent - elseif modDB:Flag(nil, "MaximumLifeLeechIsEqualToPartyMember") then - output.MaxLifeLeechRatePercent = actor.partyMembers.output.MaxLifeLeechRatePercent - end - output.MaxLifeLeechRate = output.Life * output.MaxLifeLeechRatePercent / 100 - if breakdown then - breakdown.MaxLifeLeechRate = { - s_format("%d ^8(maximum life)", output.Life), - s_format("x %d%% ^8(percentage of life to maximum leech rate)", output.MaxLifeLeechRatePercent), - s_format("= %.1f", output.MaxLifeLeechRate) - } - end - output.MaxEnergyShieldLeechInstance = output.EnergyShield * calcLib.val(modDB, "MaxEnergyShieldLeechInstance") / 100 - output.MaxEnergyShieldLeechRate = output.EnergyShield * calcLib.val(modDB, "MaxEnergyShieldLeechRate") / 100 - if breakdown then - breakdown.MaxEnergyShieldLeechRate = { - s_format("%d ^8(maximum energy shield)", output.EnergyShield), - s_format("x %d%% ^8(percentage of energy shield to maximum leech rate)", calcLib.val(modDB, "MaxEnergyShieldLeechRate")), - s_format("= %.1f", output.MaxEnergyShieldLeechRate) - } - end - output.MaxManaLeechInstance = output.Mana * calcLib.val(modDB, "MaxManaLeechInstance") / 100 - output.MaxManaLeechRate = output.Mana * calcLib.val(modDB, "MaxManaLeechRate") / 100 - if breakdown then - breakdown.MaxManaLeechRate = { - s_format("%d ^8(maximum mana)", output.Mana), - s_format("x %d%% ^8(percentage of mana to maximum leech rate)", calcLib.val(modDB, "MaxManaLeechRate")), - s_format("= %.1f", output.MaxManaLeechRate) - } - end - -- Regeneration local resources = {"Mana", "Life", "Energy Shield", "Rage", "Ward"} for i, resourceName in ipairs(resources) do diff --git a/src/Modules/CalcOffence.lua b/src/Modules/CalcOffence.lua index 960a5e16d4..98e856b08c 100644 --- a/src/Modules/CalcOffence.lua +++ b/src/Modules/CalcOffence.lua @@ -520,6 +520,74 @@ local function getBaseLeech(resource, dmgType, skillModList, cfg, enemyDB) end return leech and leech or 0 end + +local leechResources = { "Life", "EnergyShield", "Mana" } + +-- Leech from a hit rolled rollShift of the way from the average to the maximum hit, with the hit capped for leech purposes +-- Also returns the uncapped hit damage +local function getLeechAmount(pass, resource, rollShift) + if pass.hitAvg <= 0 then + return 0, 0 + end + local hit = pass.hitAvg + m_max(pass.hitMax - pass.hitAvg, 0) * rollShift + return pass[resource] / pass.hitAvg * m_min(hit, data.gameConstants["EffectiveMaxDamageForLeech"]), hit +end + +-- Only the strongest Leech instance of a resource recovers at a time. Like non-stacking ailments, +-- overlapping instances shift the active one towards the top of the damage range and towards crits +-- speed is the multiplier to how fast an instance recovers, 1 meaning its full amount over one +-- second +local function calcLeech(output, resource, critPass, nonCritPass, critChance, hitRate, speed) + local critPortion = critChance / 100 + -- Leech of an average crit / non-crit, and the portion of it that is instant + local critAmount = getLeechAmount(critPass, resource, 0) + local nonCritAmount = getLeechAmount(nonCritPass, resource, 0) + local critInstant = critPass[resource.."Instant"] + local nonCritInstant = nonCritPass[resource.."Instant"] + local perHit = critAmount * critPortion + nonCritAmount * (1 - critPortion) + local instant = critAmount * critInstant * critPortion + nonCritAmount * nonCritInstant * (1 - critPortion) + -- Average number of instances alive at any time (hits per second x duration). Instant Leech + -- shortens the duration, but the rest recovers at the normal rate. Hits that leech nothing or only + -- instantly never create an instance + local duration, critInstances, nonCritInstances = 0, 0, 0 + if speed > 0 then + duration = (critPortion * (1 - critInstant) + (1 - critPortion) * (1 - nonCritInstant)) / speed + if critAmount > 0 then + critInstances = hitRate * critPortion * (1 - critInstant) / speed + end + if nonCritAmount > 0 then + nonCritInstances = hitRate * (1 - critPortion) * (1 - nonCritInstant) / speed + end + end + local instances = critInstances + nonCritInstances + -- With more than one instance alive, the active one is the strongest of them, so its expected + -- roll and chance of being a crit both increase. With one or fewer, it is just an average + -- instance The strongest of n uniform rolls averages n/(n+1) of the damage range, i.e. + -- (n-1)/(n+1) of the way from average to max + local rollShift = instances > 1 and (instances - 1) / (instances + 1) or 0 + -- Chance that at least one of the alive instances came from a crit + local critActive = instances > 0 and 1 - (1 - critInstances / instances) ^ m_max(instances, 1) or 0 + -- Full leech amount of the active instance. Its instant part shortens the duration, so it + -- always recovers at amount x speed + local critInstanceAmount, critHit = getLeechAmount(critPass, resource, rollShift) + local nonCritInstanceAmount, nonCritHit = getLeechAmount(nonCritPass, resource, rollShift) + local instanceAmount = critInstanceAmount * critActive + nonCritInstanceAmount * (1 - critActive) + output[resource.."LeechPerHit"] = perHit + output[resource.."LeechInstant"] = instant + output[resource.."LeechDuration"] = duration + output[resource.."LeechSpeed"] = speed + output[resource.."LeechInstances"] = instances + output[resource.."LeechRollAverage"] = 50 + 50 * rollShift + output[resource.."LeechCritActive"] = critActive * 100 + output[resource.."LeechCritHit"] = critHit + output[resource.."LeechNonCritHit"] = nonCritHit + output[resource.."LeechCritInstanceAmount"] = critInstanceAmount + output[resource.."LeechNonCritInstanceAmount"] = nonCritInstanceAmount + output[resource.."LeechInstanceAmount"] = instanceAmount + -- Instant leech from every hit, plus the active instance for the portion of time one is alive + output[resource.."LeechRate"] = instant * hitRate + instanceAmount * speed * m_min(instances, 1) +end + -- Performs all offensive calculations ---@param env Env ---@param actor Actor @@ -3337,14 +3405,6 @@ function calcs.offence(env, actor, activeSkill) end end - -- Calculate leech - local function getLeechInstances(amount, total, hitRate) - if total == 0 then - return 0, 0 - end - local duration = amount / total / data.misc.LeechRateBase - return duration, duration * hitRate - end -- dynamic way of calculating the Ancestral Boost from a single source without duplicating the code -- uptimeOverride: Ancestral Empowerment -- combinedCalcs: ignore INC AoE as we will run that in calcCombinedAncestralBoost @@ -4193,12 +4253,8 @@ function calcs.offence(env, actor, activeSkill) local totalHitMin, totalHitMax, totalHitAvg = 0, 0, 0 local totalCritMin, totalCritMax, totalCritAvg = 0, 0, 0 local ghostReaver = skillModList:Flag(nil, "GhostReaver") - output.LifeLeech = 0 - output.LifeLeechInstant = 0 - output.EnergyShieldLeech = 0 - output.EnergyShieldLeechInstant = 0 - output.ManaLeech = 0 - output.ManaLeechInstant = 0 + local leechPasses = { } + local leechEffect = 1 - m_min(data.monsterLeechResistanceTable[env.enemyLevel] / 10000, 1) for pass = 1, 2 do -- Pass 1 is critical strike damage, pass 2 is non-critical strike @@ -4207,7 +4263,7 @@ function calcs.offence(env, actor, activeSkill) local energyShieldLeechTotal = 0 local manaLeechTotal = 0 local noLifeLeech = skillModList:Flag(cfg, "CannotLeechLife") or enemyDB:Flag(nil, "CannotLeechLifeFromSelf") or skillModList:Flag(cfg, "CannotGainLife") - local noEnergyShieldLeech = skillModList:Flag(cfg, "CannotLeechEnergyShield") or enemyDB:Flag(nil, "CannotLeechEnergyShieldFromSelf") or skillModList:Flag(cfg, "CannotGainEnergyShield") + local noEnergyShieldLeech = skillModList:Flag(cfg, "CannotGainEnergyShield") local noManaLeech = skillModList:Flag(cfg, "CannotLeechMana") or enemyDB:Flag(nil, "CannotLeechManaFromSelf") or skillModList:Flag(cfg, "CannotGainMana") for _, damageType in ipairs(dmgTypeList) do local damageTypeHitMin, damageTypeHitMax, damageTypeHitAvg, damageTypeLuckyChance, damageTypeHitAvgLucky, damageTypeHitAvgNotLucky = 0, 0, 0, 0, 0 @@ -4455,22 +4511,20 @@ function calcs.offence(env, actor, activeSkill) totalHitMax = totalHitMax + damageTypeHitMax end end - if skillData.lifeLeechPerUse then - lifeLeechTotal = lifeLeechTotal + skillData.lifeLeechPerUse - end - if skillData.manaLeechPerUse then - manaLeechTotal = manaLeechTotal + skillData.manaLeechPerUse + local leechPass = { + hitAvg = pass == 1 and totalCritAvg or totalHitAvg, + hitMax = pass == 1 and totalCritMax or totalHitMax, + Life = lifeLeechTotal * calcLib.mod(skillModList, cfg, "LifeLeechAmount") * leechEffect, + EnergyShield = energyShieldLeechTotal * calcLib.mod(skillModList, cfg, "EnergyShieldLeechAmount") * leechEffect, + Mana = manaLeechTotal * calcLib.mod(skillModList, cfg, "ManaLeechAmount") * leechEffect, + LifeInstant = m_max(m_min(skillModList:Sum("BASE", cfg, "InstantLifeLeech"), 100), 0) / 100, + EnergyShieldInstant = m_max(m_min(skillModList:Sum("BASE", cfg, "InstantEnergyShieldLeech"), 100), 0) / 100, + ManaInstant = m_max(m_min(skillModList:Sum("BASE", cfg, "InstantManaLeech"), 100), 0) / 100, + } + if skillModList:Flag(cfg, "ManaLeechRecoversEnergyShield") then + leechPass.EnergyShieldInstant = m_min(leechPass.EnergyShieldInstant + leechPass.ManaInstant, 1) end - - -- leech caps per instance - lifeLeechTotal = m_min(lifeLeechTotal, globalOutput.MaxLifeLeechInstance) - energyShieldLeechTotal = m_min(energyShieldLeechTotal, globalOutput.MaxEnergyShieldLeechInstance) - manaLeechTotal = m_min(manaLeechTotal, globalOutput.MaxManaLeechInstance) - - local portion = (pass == 1) and (output.CritChance / 100) or (1 - output.CritChance / 100) - output.LifeLeech = output.LifeLeech + lifeLeechTotal * portion - output.EnergyShieldLeech = output.EnergyShieldLeech + energyShieldLeechTotal * portion - output.ManaLeech = output.ManaLeech + manaLeechTotal * portion + leechPasses[pass] = leechPass end output.TotalMin = totalHitMin output.TotalMax = totalHitMax @@ -4501,35 +4555,11 @@ function calcs.offence(env, actor, activeSkill) skillModList:NewMod("Condition:"..highestType.."IsHighestDamageType", "FLAG", true, "Config") end - - - --Instant Leech - output.LifeLeechInstantProportion = m_max(m_min(skillModList:Sum("BASE", cfg, "InstantLifeLeech") or 0, 100), 0) / 100 - if output.LifeLeechInstantProportion > 0 then - output.LifeLeechInstant = output.LifeLeech * output.LifeLeechInstantProportion - output.LifeLeech = output.LifeLeech * (1 - output.LifeLeechInstantProportion) - end - output.ManaLeechInstantProportion = m_max(m_min(skillModList:Sum("BASE", cfg, "InstantManaLeech") or 0, 100), 0) / 100 - if output.ManaLeechInstantProportion > 0 then - output.ManaLeechInstant = output.ManaLeech * output.ManaLeechInstantProportion - output.ManaLeech = output.ManaLeech * (1 - output.ManaLeechInstantProportion) - end - output.EnergyShieldLeechInstantProportion = m_max(m_min(skillModList:Sum("BASE", cfg, "InstantEnergyShieldLeech") or 0, 100), 0) / 100 - if skillModList:Flag(cfg, "ManaLeechRecoversEnergyShield") then - output.EnergyShieldLeechInstantProportion = output.EnergyShieldLeechInstantProportion + output.ManaLeechInstantProportion - end - if output.EnergyShieldLeechInstantProportion > 0 then - output.EnergyShieldLeechInstant = output.EnergyShieldLeech * output.EnergyShieldLeechInstantProportion - output.EnergyShieldLeech = output.EnergyShieldLeech * (1 - output.EnergyShieldLeechInstantProportion) + for _, resource in ipairs(leechResources) do + local speed = calcLib.mod(skillModList, cfg, resource.."LeechRate") * globalOutput[resource.."RecoveryRateMod"] + calcLeech(output, resource, leechPasses[1], leechPasses[2], output.CritChance, hitRate, speed) end - output.LifeLeechDuration, output.LifeLeechInstances = getLeechInstances(output.LifeLeech, globalOutput.Life, hitRate) - output.LifeLeechInstantRate = output.LifeLeechInstant * hitRate - output.EnergyShieldLeechDuration, output.EnergyShieldLeechInstances = getLeechInstances(output.EnergyShieldLeech, globalOutput.EnergyShield, hitRate) - output.EnergyShieldLeechInstantRate = output.EnergyShieldLeechInstant * hitRate - output.ManaLeechDuration, output.ManaLeechInstances = getLeechInstances(output.ManaLeech, globalOutput.Mana, hitRate) - output.ManaLeechInstantRate = output.ManaLeechInstant * hitRate - -- Calculate gain on hit if skillFlags.mine or skillFlags.trap or skillFlags.totem then output.LifeOnHit = 0 @@ -4730,21 +4760,14 @@ function calcs.offence(env, actor, activeSkill) combineStat("DpsMultiplier", "DPS") combineStat("TotalDPS", "DPS") combineStat("PvpTotalDPS", "DPS") - combineStat("LifeLeechDuration", "DPS") - combineStat("LifeLeechInstances", "DPS") - combineStat("LifeLeechInstant", "DPS") - combineStat("LifeLeechInstantRate", "DPS") - combineStat("LifeLeechInstantProportion", "DPS") - combineStat("EnergyShieldLeechDuration", "DPS") - combineStat("EnergyShieldLeechInstances", "DPS") - combineStat("EnergyShieldLeechInstant", "DPS") - combineStat("EnergyShieldLeechInstantRate", "DPS") - combineStat("EnergyShieldLeechInstantProportion", "DPS") - combineStat("ManaLeechDuration", "DPS") - combineStat("ManaLeechInstances", "DPS") - combineStat("ManaLeechInstant", "DPS") - combineStat("ManaLeechInstantRate", "DPS") - combineStat("ManaLeechInstantProportion", "DPS") + for _, resource in ipairs(leechResources) do + for _, stat in ipairs({ "PerHit", "Rate", "Instances", "Instant", "InstanceAmount", "CritInstanceAmount", "NonCritInstanceAmount", "CritHit", "NonCritHit" }) do + combineStat(resource.."Leech"..stat, "DPS") + end + for _, stat in ipairs({ "Duration", "Speed", "RollAverage", "CritActive" }) do + combineStat(resource.."Leech"..stat, "AVERAGE") + end + end combineStat("LifeOnHit", "DPS") combineStat("LifeOnHitRate", "DPS") combineStat("LifeOnKill", "DPS") @@ -4904,16 +4927,6 @@ function calcs.offence(env, actor, activeSkill) skillData.summonSpeed = output.SummonedMinionsPerCast * (output.HitSpeed or output.Speed) * output.DpsMultiplier end - -- Calculate leech rates - output.LifeLeechInstanceRate = output.Life * data.misc.LeechRateBase * calcLib.mod(skillModList, skillCfg, "LifeLeechRate") - output.LifeLeechRate = output.LifeLeechInstances * output.LifeLeechInstanceRate - output.LifeLeechPerHit = output.LifeLeechInstanceRate - output.EnergyShieldLeechInstanceRate = output.EnergyShield * data.misc.LeechRateBase * calcLib.mod(skillModList, skillCfg, "EnergyShieldLeechRate") - output.EnergyShieldLeechRate = output.EnergyShieldLeechInstances * output.EnergyShieldLeechInstanceRate - output.EnergyShieldLeechPerHit = output.EnergyShieldLeechInstanceRate - output.ManaLeechInstanceRate = output.Mana * data.misc.LeechRateBase * calcLib.mod(skillModList, skillCfg, "ManaLeechRate") - output.ManaLeechRate = output.ManaLeechInstances * output.ManaLeechInstanceRate - output.ManaLeechPerHit = output.ManaLeechInstanceRate -- On full life, Immortal Ambition treats life leech as energy shield leech if skillModList:Flag(nil, "ImmortalAmbition") then output.EnergyShieldLeechRate = output.EnergyShieldLeechRate + output.LifeLeechRate @@ -4922,18 +4935,6 @@ function calcs.offence(env, actor, activeSkill) output.LifeLeechRate = 0 output.LifeLeechPerHit = 0 end - -- Disable non-instant life leech - if skillModList:Flag(nil, "UnaffectedByNonInstantLifeLeech") then - output.LifeLeechRate = 0 - output.LifeLeechPerHit = 0 - output.LifeLeechInstances = 0 - end - output.LifeLeechRate = output.LifeLeechInstantRate + m_min(output.LifeLeechRate, output.MaxLifeLeechRate) * output.LifeRecoveryRateMod - output.LifeLeechPerHit = output.LifeLeechInstant + m_min(output.LifeLeechPerHit, output.MaxLifeLeechRate) * output.LifeLeechDuration * output.LifeRecoveryRateMod - output.EnergyShieldLeechRate = output.EnergyShieldLeechInstantRate + m_min(output.EnergyShieldLeechRate, output.MaxEnergyShieldLeechRate) * output.EnergyShieldRecoveryRateMod - output.EnergyShieldLeechPerHit = output.EnergyShieldLeechInstant + m_min(output.EnergyShieldLeechPerHit, output.MaxEnergyShieldLeechRate) * output.EnergyShieldLeechDuration * output.EnergyShieldRecoveryRateMod - output.ManaLeechRate = output.ManaLeechInstantRate + m_min(output.ManaLeechRate, output.MaxManaLeechRate) * output.ManaRecoveryRateMod - output.ManaLeechPerHit = output.ManaLeechInstant + m_min(output.ManaLeechPerHit, output.MaxManaLeechRate) * output.ManaLeechDuration * output.ManaRecoveryRateMod skillFlags.leechLife = output.LifeLeechRate > 0 skillFlags.leechES = output.EnergyShieldLeechRate > 0 skillFlags.leechMana = output.ManaLeechRate > 0 @@ -4947,15 +4948,16 @@ function calcs.offence(env, actor, activeSkill) output.ManaLeechGainRate = output.ManaLeechRate + output.ManaOnHitRate end if breakdown then + output.EnemyLeechResistance = data.monsterLeechResistanceTable[env.enemyLevel] / 100 local hitRate = output.HitChance / 100 * (globalOutput.HitSpeed or globalOutput.Speed) * output.DpsMultiplier if skillFlags.leechLife then - breakdown.LifeLeech = breakdown.leech(output.LifeLeechInstant, output.LifeLeechInstantRate, output.LifeLeechInstances, output.Life, "LifeLeechRate", output.MaxLifeLeechRate, output.LifeLeechDuration, output.LifeLeechInstantProportion, hitRate) + breakdown.LifeLeech = breakdown.leech(output, "Life", hitRate) end if skillFlags.leechES then - breakdown.EnergyShieldLeech = breakdown.leech(output.EnergyShieldLeechInstant, output.EnergyShieldLeechInstantRate, output.EnergyShieldLeechInstances, output.EnergyShield, "EnergyShieldLeechRate", output.MaxEnergyShieldLeechRate, output.EnergyShieldLeechDuration, output.EnergyShieldLeechInstantProportion, hitRate) + breakdown.EnergyShieldLeech = breakdown.leech(output, "EnergyShield", hitRate) end if skillFlags.leechMana then - breakdown.ManaLeech = breakdown.leech(output.ManaLeechInstant, output.ManaLeechInstantRate, output.ManaLeechInstances, output.Mana, "ManaLeechRate", output.MaxManaLeechRate, output.ManaLeechDuration, output.ManaLeechInstantProportion, hitRate) + breakdown.ManaLeech = breakdown.leech(output, "Mana", hitRate) end end diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index b0fe494a77..59d2534784 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -3632,8 +3632,6 @@ function calcs.perform(env, skipEHP) buffExports.PlayerMods["BlockChanceMax="..tostring(output["BlockChanceMax"])] = true elseif mod.name == "BlockAttackChanceIsEqualToParent" then buffExports.PlayerMods["BlockChance="..tostring(output["BlockChance"])] = true - elseif mod.name == "MaximumLifeLeechIsEqualToPartyMember" then - buffExports.PlayerMods["MaxLifeLeechRatePercent="..tostring(output["MaxLifeLeechRatePercent"])] = true elseif mod.name == "TakenFromParentESBeforeYou" then buffExports.PlayerMods["EnergyShieldRecoveryCap="..tostring(output["EnergyShieldRecoveryCap"])] = true elseif mod.name == "MainHandCritIsEqualToParent" then diff --git a/src/Modules/CalcSections.lua b/src/Modules/CalcSections.lua index 787ffca96b..07f50473f1 100644 --- a/src/Modules/CalcSections.lua +++ b/src/Modules/CalcSections.lua @@ -1220,10 +1220,6 @@ return { } } } }, { 1, "LeechGain", 1, colorCodes.OFFENCE, {{ defaultCollapsed = false, label = "Leech & Gain on Hit", data = { - { label = "Life Leech Cap", flag = "leechLife", { format = "{1:output:MaxLifeLeechRate}", - { breakdown = "MaxLifeLeechRate" }, - { modName = "MaxLifeLeechRate" }, - }, }, { label = "Life Leech Rate", flag = "leechLife", notFlag = "showAverage", { format = "{1:output:LifeLeechRate}", { breakdown = "LifeLeech" }, { label = "Player modifiers", notFlagList = { "totem", "attack" }, modName = { "DamageLeech", "DamageLifeLeech", "PhysicalDamageLifeLeech", "LightningDamageLifeLeech", "ColdDamageLifeLeech", "FireDamageLifeLeech", "ChaosDamageLifeLeech", "ElementalDamageLifeLeech" }, modType = "BASE", cfg = "skill" }, @@ -1232,6 +1228,8 @@ return { { label = "Totem modifiers", flag = "totem", modName = { "DamageLifeLeechToPlayer" }, modType = "BASE", cfg = "skill" }, { label = "Enemy modifiers", modName = { "SelfDamageLifeLeech" }, modType = "BASE", enemy = true }, { label = "Leech Conversion", modName = { "LifeLeechBasedOnPhysicalDamage", "LifeLeechBasedOnColdDamage", "LifeLeechBasedOnFireDamage", "LifeLeechBasedOnLightningDamage", "LifeLeechBasedOnElementalDamage", "LifeLeechBasedOnChaosDamage", "Condition:NoLifeLeechFromPhysicalDamage", "Condition:NoLifeLeechFromColdDamage", "Condition:NoLifeLeechFromFireDamage", "Condition:NoLifeLeechFromLightningDamage", "Condition:NoLifeLeechFromElementalDamage", "Condition:NoLifeLeechFromChaosDamage" }, cfg = "skill" }, + { label = "Leech Amount", modName = "LifeLeechAmount", cfg = "skill" }, + { label = "Leech Speed", modName = { "LifeLeechRate", "LifeRecoveryRate" }, cfg = "skill" }, }, }, { label = "Life Leech per Hit", flagList = { "leechLife", "showAverage" }, { format = "{1:output:LifeLeechPerHit}", { breakdown = "LifeLeech" }, @@ -1241,6 +1239,8 @@ return { { label = "Totem modifiers", flag = "totem", modName = { "DamageLifeLeechToPlayer" }, modType = "BASE", cfg = "skill" }, { label = "Enemy modifiers", modName = { "SelfDamageLifeLeech" }, modType = "BASE", enemy = true }, { label = "Leech Conversion", modName = { "LifeLeechBasedOnPhysicalDamage", "LifeLeechBasedOnColdDamage", "LifeLeechBasedOnFireDamage", "LifeLeechBasedOnLightningDamage", "LifeLeechBasedOnElementalDamage", "LifeLeechBasedOnChaosDamage", "Condition:NoLifeLeechFromPhysicalDamage", "Condition:NoLifeLeechFromColdDamage", "Condition:NoLifeLeechFromFireDamage", "Condition:NoLifeLeechFromLightningDamage", "Condition:NoLifeLeechFromElementalDamage", "Condition:NoLifeLeechFromChaosDamage" }, cfg = "skill" }, + { label = "Leech Amount", modName = "LifeLeechAmount", cfg = "skill" }, + { label = "Leech Speed", modName = { "LifeLeechRate", "LifeRecoveryRate" }, cfg = "skill" }, }, }, { label = "Life Gain Rate", notFlag = "showAverage", haveOutput = "LifeOnHitRate", { format = "{1:output:LifeOnHitRate}", { label = "Player modifiers", notFlag = "attack", modName = "LifeOnHit", modType = "BASE", cfg = "skill" }, @@ -1257,10 +1257,6 @@ return { { label = "Life Gain on Kill", haveOutput = "LifeOnKill", { format = "{1:output:LifeOnKill}", {modName = "LifeOnKill"}, }, }, - { label = "ES Leech Cap", flag = "leechES", { format = "{1:output:MaxEnergyShieldLeechRate}", - { breakdown = "MaxEnergyShieldLeechRate" }, - { modName = "MaxEnergyShieldLeechRate" }, - }, }, { label = "ES Leech Rate", flag = "leechES", notFlag = "showAverage", { format = "{1:output:EnergyShieldLeechRate}", { breakdown = "EnergyShieldLeech" }, { label = "Player modifiers", notFlagList = { "totem", "attack" }, modName = { "DamageEnergyShieldLeech", "PhysicalDamageEnergyShieldLeech", "LightningDamageEnergyShieldLeech", "ColdDamageEnergyShieldLeech", "FireDamageEnergyShieldLeech", "ChaosDamageEnergyShieldLeech", "ElementalDamageEnergyShieldLeech" }, modType = "BASE", cfg = "skill" }, @@ -1269,6 +1265,8 @@ return { { label = "Totem modifiers", flag = "totem", modName = { "DamageEnergyShieldLeechToPlayer" }, modType = "BASE", cfg = "skill" }, { label = "Enemy modifiers", modName = { "SelfDamageEnergyShieldLeech" }, modType = "BASE", enemy = true }, { label = "Leech Conversion", modName = { "EnergyShieldLeechBasedOnPhysicalDamage", "EnergyShieldLeechBasedOnColdDamage", "EnergyShieldLeechBasedOnFireDamage", "EnergyShieldLeechBasedOnLightningDamage", "EnergyShieldLeechBasedOnElementalDamage", "EnergyShieldLeechBasedOnChaosDamage", "Condition:NoEnergyShieldLeechFromPhysicalDamage", "Condition:NoEnergyShieldLeechFromColdDamage", "Condition:NoEnergyShieldLeechFromFireDamage", "Condition:NoEnergyShieldLeechFromLightningDamage", "Condition:NoEnergyShieldLeechFromElementalDamage", "Condition:NoEnergyShieldLeechFromChaosDamage" }, cfg = "skill" }, + { label = "Leech Amount", modName = "EnergyShieldLeechAmount", cfg = "skill" }, + { label = "Leech Speed", modName = { "EnergyShieldLeechRate", "EnergyShieldRecoveryRate" }, cfg = "skill" }, }, }, { label = "ES Leech per Hit", flagList = { "leechES", "showAverage" }, { format = "{1:output:EnergyShieldLeechPerHit}", { breakdown = "EnergyShieldLeech" }, @@ -1278,6 +1276,8 @@ return { { label = "Totem modifiers", flag = "totem", modName = { "DamageEnergyShieldLeechToPlayer" }, modType = "BASE", cfg = "skill" }, { label = "Enemy modifiers", modName = { "SelfDamageEnergyShieldLeech" }, modType = "BASE", enemy = true }, { label = "Leech Conversion", modName = { "EnergyShieldLeechBasedOnPhysicalDamage", "EnergyShieldLeechBasedOnColdDamage", "EnergyShieldLeechBasedOnFireDamage", "EnergyShieldLeechBasedOnLightningDamage", "EnergyShieldLeechBasedOnElementalDamage", "EnergyShieldLeechBasedOnChaosDamage", "Condition:NoEnergyShieldLeechFromPhysicalDamage", "Condition:NoEnergyShieldLeechFromColdDamage", "Condition:NoEnergyShieldLeechFromFireDamage", "Condition:NoEnergyShieldLeechFromLightningDamage", "Condition:NoEnergyShieldLeechFromElementalDamage", "Condition:NoEnergyShieldLeechFromChaosDamage" }, cfg = "skill" }, + { label = "Leech Amount", modName = "EnergyShieldLeechAmount", cfg = "skill" }, + { label = "Leech Speed", modName = { "EnergyShieldLeechRate", "EnergyShieldRecoveryRate" }, cfg = "skill" }, }, }, { label = "ES Gain Rate", notFlag = "showAverage", haveOutput = "EnergyShieldOnHitRate", { format = "{1:output:EnergyShieldOnHitRate}", { label = "Player modifiers", notFlag = "attack", modName = "EnergyShieldOnHit", modType = "BASE", cfg = "skill" }, @@ -1294,10 +1294,6 @@ return { { label = "ES Gain on Kill", haveOutput = "EnergyShieldOnKill", { format = "{1:output:EnergyShieldOnKill}", {modName = "EnergyShieldOnKill"}, }, }, - { label = "Mana Leech Cap", flag = "leechMana", { format = "{1:output:MaxManaLeechRate}", - { breakdown = "MaxManaLeechRate" }, - { modName = "MaxManaLeechRate" }, - }, }, { label = "Mana Leech Rate", flag = "leechMana", notFlag = "showAverage", { format = "{1:output:ManaLeechRate}", { breakdown = "ManaLeech" }, { label = "Player modifiers", notFlag = "attack", modName = { "DamageLeech", "DamageManaLeech", "PhysicalDamageManaLeech", "LightningDamageManaLeech", "ColdDamageManaLeech", "FireDamageManaLeech", "ChaosDamageManaLeech", "ElementalDamageManaLeech" }, modType = "BASE", cfg = "skill" }, @@ -1305,6 +1301,8 @@ return { { label = "Off Hand", flag = "weapon2Attack", modName = { "DamageLeech", "DamageManaLeech", "PhysicalDamageManaLeech", "LightningDamageManaLeech", "ColdDamageManaLeech", "FireDamageManaLeech", "ChaosDamageManaLeech", "ElementalDamageManaLeech" }, modType = "BASE", cfg = "weapon2" }, { label = "Enemy modifiers", modName = { "SelfDamageManaLeech" }, modType = "BASE", cfg = "skill", enemy = true }, { label = "Leech Conversion", modName = { "ManaLeechBasedOnPhysicalDamage", "ManaLeechBasedOnColdDamage", "ManaLeechBasedOnFireDamage", "ManaLeechBasedOnLightningDamage", "ManaLeechBasedOnElementalDamage", "ManaLeechBasedOnChaosDamage", "Condition:NoManaLeechFromPhysicalDamage", "Condition:NoManaLeechFromColdDamage", "Condition:NoManaLeechFromFireDamage", "Condition:NoManaLeechFromLightningDamage", "Condition:NoManaLeechFromElementalDamage", "Condition:NoManaLeechFromChaosDamage" }, cfg = "skill" }, + { label = "Leech Amount", modName = "ManaLeechAmount", cfg = "skill" }, + { label = "Leech Speed", modName = { "ManaLeechRate", "ManaRecoveryRate" }, cfg = "skill" }, }, }, { label = "Mana Leech per Hit", flagList = { "leechMana", "showAverage" }, { format = "{1:output:ManaLeechPerHit}", { breakdown = "ManaLeech" }, @@ -1313,6 +1311,8 @@ return { { label = "Off Hand", flag = "weapon2Attack", modName = { "DamageLeech", "DamageManaLeech", "PhysicalDamageManaLeech", "LightningDamageManaLeech", "ColdDamageManaLeech", "FireDamageManaLeech", "ChaosDamageManaLeech", "ElementalDamageManaLeech" }, modType = "BASE", cfg = "weapon2" }, { label = "Enemy modifiers", modName = { "SelfDamageManaLeech" }, modType = "BASE", enemy = true }, { label = "Leech Conversion", modName = { "ManaLeechBasedOnPhysicalDamage", "ManaLeechBasedOnColdDamage", "ManaLeechBasedOnFireDamage", "ManaLeechBasedOnLightningDamage", "ManaLeechBasedOnElementalDamage", "ManaLeechBasedOnChaosDamage", "Condition:NoManaLeechFromPhysicalDamage", "Condition:NoManaLeechFromColdDamage", "Condition:NoManaLeechFromFireDamage", "Condition:NoManaLeechFromLightningDamage", "Condition:NoManaLeechFromElementalDamage", "Condition:NoManaLeechFromChaosDamage" }, cfg = "skill" }, + { label = "Leech Amount", modName = "ManaLeechAmount", cfg = "skill" }, + { label = "Leech Speed", modName = { "ManaLeechRate", "ManaRecoveryRate" }, cfg = "skill" }, }, }, { label = "Mana Gain Rate", notFlag = "showAverage", haveOutput = "ManaOnHitRate", { format = "{1:output:ManaOnHitRate}", { label = "Player modifiers", notFlag = "attack", modName = "ManaOnHit", modType = "BASE", cfg = "skill" }, diff --git a/src/Modules/CalcSetup.lua b/src/Modules/CalcSetup.lua index 95b78f6bc9..58ddc4a695 100644 --- a/src/Modules/CalcSetup.lua +++ b/src/Modules/CalcSetup.lua @@ -49,16 +49,10 @@ function calcs.initModDB(env, modDB) modDB:NewMod("AbsorptionChargesMax", "BASE", 0, "Base") modDB:NewMod("AfflictionChargesMax", "BASE", 0, "Base") modDB:NewMod("BloodChargesMax", "BASE", 5, "Base") - modDB:NewMod("MaxLifeLeechRate", "BASE", 20, "Base") - modDB:NewMod("MaxManaLeechRate", "BASE", 20, "Base") modDB:NewMod("ImpaleStacksMax", "BASE", 5, "Base") modDB:NewMod("IgniteStacksMax", "BASE", 1, "Base") modDB:NewMod("BleedStacksMax", "BASE", 1, "Base") modDB:NewMod("PoisonStacksMax", "BASE", 1, "Base") - modDB:NewMod("MaxEnergyShieldLeechRate", "BASE", 10, "Base") - modDB:NewMod("MaxLifeLeechInstance", "BASE", 10, "Base") - modDB:NewMod("MaxManaLeechInstance", "BASE", 10, "Base") - modDB:NewMod("MaxEnergyShieldLeechInstance", "BASE", 10, "Base") modDB:NewMod("TrapThrowingTime", "BASE", 0.6, "Base") modDB:NewMod("MineLayingTime", "BASE", 0.3, "Base") modDB:NewMod("WarcryCastTime", "BASE", 0.8, "Base") diff --git a/src/Modules/Data.lua b/src/Modules/Data.lua index d94d05a320..e260ab2ed3 100644 --- a/src/Modules/Data.lua +++ b/src/Modules/Data.lua @@ -265,7 +265,6 @@ data.misc = { -- magic numbers EnergyShieldRechargeDelay = 4, Transfiguration = 0.3, EnemyMaxResist = data.monsterConstants["base_maximum_all_resistances_%"], - LeechRateBase = 0.02, DotDpsCap = 35791394, -- (2 ^ 31 - 1) / 60 (int max / 60 seconds) BleedPercentBase = data.gameConstants["BleedingHitDamagePercentPerMinute"] / 60 / 100, BleedDurationBase = data.gameConstants["BaseBleedingDuration"], diff --git a/src/Modules/ModParser.lua b/src/Modules/ModParser.lua index ff8a00f8fa..33097a980b 100644 --- a/src/Modules/ModParser.lua +++ b/src/Modules/ModParser.lua @@ -567,30 +567,11 @@ local modNameList = { ["life and mana gained for each enemy hit"] = { "LifeOnHit", "ManaOnHit", flags = ModFlag.Hit }, ["life and mana for each enemy hit"] = { "LifeOnHit", "ManaOnHit", flags = ModFlag.Hit }, ["damage as life"] = "DamageLifeLeech", - ["life leeched per second"] = "LifeLeechRate", - ["mana leeched per second"] = "ManaLeechRate", - ["total recovery per second from life leech"] = "LifeLeechRate", - ["recovery per second from life leech"] = "LifeLeechRate", - ["total recovery per second from energy shield leech"] = "EnergyShieldLeechRate", - ["recovery per second from energy shield leech"] = "EnergyShieldLeechRate", - ["total recovery per second from mana leech"] = "ManaLeechRate", - ["recovery per second from mana leech"] = "ManaLeechRate", - ["total recovery per second from life, mana, or energy shield leech"] = { "LifeLeechRate", "ManaLeechRate", "EnergyShieldLeechRate" }, - ["maximum recovery per life leech"] = "MaxLifeLeechInstance", - ["maximum recovery per energy shield leech"] = "MaxEnergyShieldLeechInstance", - ["maximum recovery per mana leech"] = "MaxManaLeechInstance", - ["maximum total recovery per second from life leech"] = "MaxLifeLeechRate", - ["maximum total life recovery per second from leech"] = "MaxLifeLeechRate", - ["maximum total recovery per second from energy shield leech"] = "MaxEnergyShieldLeechRate", - ["maximum total energy shield recovery per second from leech"] = "MaxEnergyShieldLeechRate", - ["maximum total recovery per second from mana leech"] = "MaxManaLeechRate", - ["maximum total mana recovery per second from leech"] = "MaxManaLeechRate", - ["maximum total life, mana and energy shield recovery per second from leech"] = { "MaxLifeLeechRate", "MaxManaLeechRate", "MaxEnergyShieldLeechRate" }, ["life and mana leech is instant"] = { "InstantManaLeech", "InstantLifeLeech" }, ["life leech is instant"] = "InstantLifeLeech", ["mana leech is instant"] = "InstantManaLeech", - ["amount of mana leeched"] = "MaxManaLeechRate", - ["amount of life leeched"] = "MaxLifeLeechRate", + ["amount of mana leeched"] = "ManaLeechAmount", + ["amount of life leeched"] = "LifeLeechAmount", ["energy shield leech is instant"] = { "InstantEnergyShieldLeech" }, ["leech is instant"] = { "InstantEnergyShieldLeech", "InstantManaLeech", "InstantLifeLeech" }, ["to impale enemies on hit"] = "ImpaleChance", @@ -2364,13 +2345,6 @@ local specialModList = { flag("Condition:CanGainRage"), } end, ["(%w+) recovery from regeneration is not applied"] = function(_, type) return { flag("UnaffectedBy" .. firstToUpper(type) .. "Regen") } end, - ["(%d+)%% less damage taken for every (%d+)%% life recovery per second from leech"] = function(num, _, div) - return { mod("DamageTaken", "MORE", -num, { type = "PerStat", stat = "MaxLifeLeechRatePercent", div = tonumber(div) }) } - end, - ["(%w+) recovery from non%-instant leech is not applied"] = function(_, type) return { flag("UnaffectedByNonInstant" .. firstToUpper(type) .. "Leech") } end, - ["(%d+)%% additional physical damage reduction for every (%d+)%% life recovery per second from leech"] = function(num, _, div) - return { mod("PhysicalDamageReduction", "BASE", num, { type = "PerStat", stat = "MaxLifeLeechRatePercent", div = tonumber(div) }, { type = "Condition", var = "Leeching"}) } - end, ["modifiers to chance to suppress spell damage instead apply to chance to dodge spell hits at 50%% of their value"] = { flag("ConvertSpellSuppressionToSpellDodge"), mod("SpellSuppressionChance", "OVERRIDE", 0, "Acrobatics"), @@ -2416,6 +2390,9 @@ local specialModList = { }, ["leech life (%d+)%% slower"] = function(num) return {mod("LifeLeechRate", "INC", -num)} end, ["leech life (%d+)%% faster"] = function(num) return {mod("LifeLeechRate", "INC", num)} end, + ["leech life (%d+)%% less quickly"] = function(num) return {mod("LifeLeechRate", "MORE", -num)} end, + ["leech mana (%d+)%% faster"] = function(num) return {mod("ManaLeechRate", "INC", num)} end, + ["leech (%d+)%% faster"] = function(num) return {mod("LifeLeechRate", "INC", num), mod("ManaLeechRate", "INC", num), mod("EnergyShieldLeechRate", "INC", num)} end, ["life regeneration is applied to energy shield instead"] = { flag("ZealotsOath") }, ["mana recovery from regeneration is also applied to runic ward"] = { flag("ManaRegenerationRecoversWard") }, ["excess life recovery from regeneration is applied to energy shield"] = { flag("ZealotsOath", { type = "Condition", var = "FullLife" }) },