Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions spec/System/TestAftershock_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
describe("TestAftershock", function()
before_each(function()
newBuild()
build.itemsTab:CreateDisplayItemFromRaw("New Item\nMarauding Mace")
build.itemsTab:AddDisplayItem()
end)

teardown(function()
-- newBuild() takes care of resetting everything in setup()
end)

local function dpsWith(group, customMods)
build.skillsTab:PasteSocketGroup(group)
build.configTab.input.customMods = customMods or ""
build.configTab:BuildModList()
runCallback("OnFrame")
local hand = build.calcsTab.mainOutput.MainHand or build.calcsTab.mainOutput
return build.calcsTab.mainOutput.TotalDPS, hand.AftershockChance
end

it("counts the Aftershock support in Slam DPS", function()
local base = dpsWith("Leap Slam 1/0 1")
newBuild()
build.itemsTab:CreateDisplayItemFromRaw("New Item\nMarauding Mace")
build.itemsTab:AddDisplayItem()
local supported, chance = dpsWith("Leap Slam 1/0 1\nAftershock I 1/0 1")
assert.are.equals(25, chance)
assert.is_true(math.abs(supported - base * 1.25) < 0.01)
end)

it("parses aftershock chance lines on Slams, including Mace Slams", function()
local base = dpsWith("Leap Slam 1/0 1")
local dps, chance = dpsWith("Leap Slam 1/0 1", "20% chance for Mace Slam Skills you use yourself to cause an additional Aftershock\n5% chance for Slam Skills to cause an additional Aftershock")
assert.are.equals(25, chance)
assert.is_true(math.abs(dps - base * 1.25) < 0.01)
end)

it("limits Mace and Shapeshift aftershock lines to those Slams", function()
local function tagsOf(line)
local mods = modLib.parseMod(line)
local tags = { }
for _, tag in ipairs(mods[1]) do
tags[#tags + 1] = tag.var or tag.skillType
end
return tags
end
assert.are.same({ SkillType.Slam, "UsingMace" }, tagsOf("20% chance for Mace Slam Skills you use yourself to cause an additional Aftershock"))
assert.are.same({ SkillType.Slam, SkillType.Shapeshift }, tagsOf("10% chance for Shapeshift Slam Skills you use yourself to cause an additional Aftershock"))
assert.are.same({ SkillType.Slam }, tagsOf("5% chance for Slam Skills to cause an additional Aftershock"))
end)

it("caps aftershock chance at 100%", function()
local base = dpsWith("Leap Slam 1/0 1")
local dps, chance = dpsWith("Leap Slam 1/0 1", "Slam Skills you use yourself cause an additional Aftershock\n25% chance for Slam Skills you use yourself to cause an additional Aftershock")
assert.are.equals(100, chance)
assert.is_true(math.abs(dps - base * 2) < 0.01)
end)

it("does not apply aftershocks to non-Slam skills", function()
local base = dpsWith("Boneshatter 1/0 1")
local dps, chance = dpsWith("Boneshatter 1/0 1", "Slam Skills you use yourself cause an additional Aftershock")
assert.is_nil(chance)
assert.are.equals(base, dps)
end)
end)
27 changes: 13 additions & 14 deletions src/Data/ModCache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1458,9 +1458,8 @@ c["10% chance for Attack Hits to apply ten Incision"]={{[1]={flags=0,keywordFlag
c["10% chance for Enemies you Kill to Explode, dealing 100%"]={{}," for Enemies you Kill to Explode, dealing 100% "}
c["10% chance for Enemies you Kill to Explode, dealing 100% of their maximum Life as Physical Damage"]={{[1]={flags=0,keywordFlags=0,name="ExplodeMod",type="LIST",value={amount=100,keyOfScaledMod="value",type="Physical",value=10}},[2]={flags=0,keywordFlags=0,name="CanExplode",type="FLAG",value=true}},nil}
c["10% chance for Flasks you use to not consume Charges"]={{[1]={flags=0,keywordFlags=0,name="FlaskChanceNotConsumeCharges",type="BASE",value=10}},nil}
c["10% chance for Mace Slam Skills you use yourself to cause an additional Aftershock"]={{}," for Mace Slam Skills you use yourself to cause an additional Aftershock "}
c["10% chance for Mace Slam Skills you use yourself to cause an additional Aftershock Strike Skills you use yourself with Maces have 10% chance to deal Splash Damage"]={{[1]={flags=1048580,keywordFlags=0,name="Damage",type="BASE",value=10}}," for Mace Slam Skills you use yourself to cause an additional Aftershock Strike Skills you use yourself have 10% chance to deal Splash "}
c["10% chance for Shapeshift Slam Skills you use yourself to cause an additional Aftershock"]={{}," for Shapeshift Slam Skills you use yourself to cause an additional Aftershock "}
c["10% chance for Mace Slam Skills you use yourself to cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},[2]={type="Condition",var="UsingMace"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=10}},nil}
c["10% chance for Shapeshift Slam Skills you use yourself to cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},[2]={skillType=157,type="SkillType"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=10}},nil}
c["10% chance to Aggravate Bleeding on targets you Hit with Attacks"]={{}," to Aggravate Bleeding on targets you Hit "}
c["10% chance to Aggravate Bleeding on targets you Hit with Attacks 8% increased Attack Speed while a Rare or Unique Enemy is in your Presence"]={{[1]={[1]={actor="enemy",type="ActorCondition",varList={[1]="NearbyRareOrUniqueEnemy",[2]="RareOrUnique"}},flags=1,keywordFlags=65536,name="Speed",type="BASE",value=10}}," to Aggravate Bleeding on targets you Hit 8% increased "}
c["10% chance to Avoid Elemental Ailments"]={{[1]={flags=0,keywordFlags=0,name="AvoidElementalAilments",type="BASE",value=10}},nil}
Expand Down Expand Up @@ -2076,7 +2075,7 @@ c["125% increased amount of Mana Leeched if you've dealt a Critical Hit Recently
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}
c["13% chance for Mace Slam Skills you use yourself to cause an additional Aftershock"]={{}," for Mace Slam Skills you use yourself to cause an additional Aftershock "}
c["13% chance for Mace Slam Skills you use yourself to cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},[2]={type="Condition",var="UsingMace"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=13}},nil}
c["13% chance for Spell Skills to fire 2 additional Projectiles"]={{[1]={flags=2,keywordFlags=0,name="TwoAdditionalProjectilesChance",type="BASE",value=13}},nil}
c["13% chance to Gain Arcane Surge when you deal a Critical Hit"]={{[1]={[1]={type="Condition",var="CritRecently"},flags=0,keywordFlags=0,name="Condition:ArcaneSurge",type="FLAG",value=true}},nil}
c["13% chance to Maim on Hit"]={{}," to Maim "}
Expand Down Expand Up @@ -2196,7 +2195,7 @@ c["15 to 25 Physical Thorns damage"]={{[1]={flags=32,keywordFlags=0,name="Physic
c["15% Surpassing Chance to gain a Puppet Master stack whenever you use a Command Skill"]={{},"% Surpassing Chance to gain a Puppet Master stack whenever you use a Command Skill "}
c["15% additional Physical Damage Reduction"]={{[1]={flags=0,keywordFlags=0,name="PhysicalDamageReduction",type="BASE",value=15}},nil}
c["15% chance for Remnants you create to grant their effects twice"]={{[1]={flags=0,keywordFlags=0,name="LocalEffect",type="BASE",value=15}}," for Remnants you create to grant their s twice "}
c["15% chance for Shapeshift Slam Skills you use yourself to cause an additional Aftershock"]={{}," for Shapeshift Slam Skills you use yourself to cause an additional Aftershock "}
c["15% chance for Shapeshift Slam Skills you use yourself to cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},[2]={skillType=157,type="SkillType"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=15}},nil}
c["15% chance that if you would gain Endurance Charges, you instead gain up to maximum Endurance Charges"]={{[1]={flags=0,keywordFlags=0,name="FlaskCharges",type="BASE",value=15}}," that if you would gain Endurance , you instead gain up to maximum Endurance Charges "}
c["15% chance that if you would gain Frenzy Charges, you instead gain up to your maximum number of Frenzy Charges"]={{[1]={flags=0,keywordFlags=0,name="FlaskCharges",type="BASE",value=15}}," that if you would gain Frenzy , you instead gain up to your maximum number of Frenzy Charges "}
c["15% chance that if you would gain Power Charges, you instead gain up to your maximum number of Power Charges"]={{[1]={flags=0,keywordFlags=0,name="FlaskCharges",type="BASE",value=15}}," that if you would gain Power , you instead gain up to your maximum number of Power Charges "}
Expand Down Expand Up @@ -2746,7 +2745,7 @@ c["20% chance for Energy Shield Recharge to start when you Kill an Enemy"]={{[1]
c["20% chance for Flasks you use to not consume Charges"]={{[1]={flags=0,keywordFlags=0,name="FlaskChanceNotConsumeCharges",type="BASE",value=20}},nil}
c["20% chance for Lightning Damage with Hits to be Lucky"]={{[1]={flags=0,keywordFlags=0,name="LightningLuckyHitsChance",type="BASE",value=20}},nil}
c["20% chance for Lightning Skills to Chain an additional time"]={{[1]={flags=0,keywordFlags=128,name="ChainChance",type="BASE",value=20}},nil}
c["20% chance for Mace Slam Skills you use yourself to cause an additional Aftershock"]={{}," for Mace Slam Skills you use yourself to cause an additional Aftershock "}
c["20% chance for Mace Slam Skills you use yourself to cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},[2]={type="Condition",var="UsingMace"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=20}},nil}
c["20% chance to Aggravate Bleeding on targets you Critically Hit with Attacks"]={{}," to Aggravate Bleeding on targets you Critically Hit "}
c["20% chance to Aggravate Bleeding on targets you Hit with Empowered Attacks"]={{}," to Aggravate Bleeding on targets you Hit with Empowered Attacks "}
c["20% chance to Aggravate Bleeding on targets you Hit with Empowered Attacks Empowered Attacks deal 30% increased Damage"]={{[1]={flags=0,keywordFlags=0,name="Damage",type="BASE",value=20}}," to Aggravate Bleeding on targets you Hit with Empowered Attacks Empowered Attacks deal 30% increased "}
Expand Down Expand Up @@ -3183,7 +3182,7 @@ c["25% chance for Attacks to Maim on Hit against Poisoned Enemies 25% increased
c["25% chance for Lightning Damage with Hits to be Lucky"]={{[1]={flags=0,keywordFlags=0,name="LightningLuckyHitsChance",type="BASE",value=25}},nil}
c["25% chance for Projectiles to Pierce Enemies within 3m distance of you"]={{[1]={flags=0,keywordFlags=0,name="ProjectileCount",type="BASE",value=25}}," for to Pierce Enemies within 3m distance of you "}
c["25% chance for Skills to retain 40% of Glory on use"]={{}," for Skills to retain 40% of Glory on use "}
c["25% chance for Slam Skills you use yourself to cause an additional Aftershock"]={{}," for Slam Skills you use yourself to cause an additional Aftershock "}
c["25% chance for Slam Skills you use yourself to cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=25}},nil}
c["25% chance for Trigger skills to refund half of Energy Spent"]={{}," for Trigger skills to refund half of Energy Spent "}
c["25% chance on Consuming a Shock on an Enemy to reapply it"]={{}," on Consuming a Shock on an Enemy to reapply it "}
c["25% chance on Shocking Enemies to created Shocked Ground"]={{[1]={[1]={actor="enemy",type="ActorCondition",var="OnShockedGround"},flags=0,keywordFlags=0,name="ShockBase",type="BASE",value=20}},nil}
Expand Down Expand Up @@ -4343,8 +4342,8 @@ c["5 to 10 Physical Thorns damage"]={{[1]={flags=32,keywordFlags=0,name="Physica
c["5 to 9 Physical Thorns damage"]={{[1]={flags=32,keywordFlags=0,name="PhysicalMin",type="BASE",value=5},[2]={flags=32,keywordFlags=0,name="PhysicalMax",type="BASE",value=9}},nil}
c["5% Chance to build an additional Combo on Hit"]={{}," to build an additional Combo "}
c["5% additional Physical Damage Reduction while you have at least 150 Devotion"]={{[1]={[1]={stat="Devotion",threshold=150,type="StatThreshold"},flags=0,keywordFlags=0,name="PhysicalDamageReduction",type="BASE",value=5}},nil}
c["5% chance for Slam Skills to cause an additional Aftershock"]={{}," for Slam Skills to cause an additional Aftershock "}
c["5% chance for Slam Skills you use yourself to cause an additional Aftershock"]={{}," for Slam Skills you use yourself to cause an additional Aftershock "}
c["5% chance for Slam Skills to cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=5}},nil}
c["5% chance for Slam Skills you use yourself to cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=5}},nil}
c["5% chance to Blind Enemies on Hit"]={{[1]={flags=0,keywordFlags=0,name="BlindChance",type="BASE",value=5}},nil}
c["5% chance to Blind Enemies on Hit with Attacks"]={{[1]={flags=0,keywordFlags=65536,name="BlindChance",type="BASE",value=5}},nil}
c["5% chance to Daze on Hit"]={{[1]={flags=4,keywordFlags=0,name="DazeChance",type="BASE",value=5}},nil}
Expand Down Expand Up @@ -5001,8 +5000,8 @@ c["75% increased Evasion Rating"]={{[1]={flags=0,keywordFlags=0,name="Evasion",t
c["75% increased Mana Regeneration Rate"]={{[1]={flags=0,keywordFlags=0,name="ManaRegen",type="INC",value=75}},nil}
c["75% increased Melee Damage with Spears while Surrounded"]={{[1]={[1]={type="Condition",var="Surrounded"},flags=268435716,keywordFlags=0,name="Damage",type="INC",value=75}},nil}
c["75% increased Physical Damage"]={{[1]={flags=0,keywordFlags=0,name="PhysicalDamage",type="INC",value=75}},nil}
end)();(function()
c["75% increased Spell Damage"]={{[1]={flags=2,keywordFlags=0,name="Damage",type="INC",value=75}},nil}
end)();(function()
c["75% increased Spirit"]={{[1]={flags=0,keywordFlags=0,name="Spirit",type="INC",value=75}},nil}
c["75% increased Thorns damage if you've Blocked Recently"]={{[1]={[1]={type="Condition",var="BlockedRecently"},flags=32,keywordFlags=0,name="Damage",type="INC",value=75}},nil}
c["75% increased chance to Shock"]={{[1]={flags=0,keywordFlags=0,name="EnemyShockChance",type="INC",value=75}},nil}
Expand All @@ -5020,8 +5019,8 @@ c["8 Life Regeneration per second"]={{[1]={flags=0,keywordFlags=0,name="LifeRege
c["8 to 14 Fire Damage per Endurance Charge"]={{[1]={[1]={type="Multiplier",var="EnduranceCharge"},flags=0,keywordFlags=0,name="FireMin",type="BASE",value=8},[2]={[1]={type="Multiplier",var="EnduranceCharge"},flags=0,keywordFlags=0,name="FireMax",type="BASE",value=14}},nil}
c["8% Global chance to Blind Enemies on Hit"]={{[1]={[1]={type="Global"},flags=0,keywordFlags=0,name="BlindChance",type="BASE",value=8}},"% chance "}
c["8% additional Physical Damage Reduction"]={{[1]={flags=0,keywordFlags=0,name="PhysicalDamageReduction",type="BASE",value=8}},nil}
c["8% chance for Mace Slam Skills you use yourself to cause an additional Aftershock"]={{}," for Mace Slam Skills you use yourself to cause an additional Aftershock "}
c["8% chance for Slam Skills you use yourself to cause an additional Aftershock"]={{}," for Slam Skills you use yourself to cause an additional Aftershock "}
c["8% chance for Mace Slam Skills you use yourself to cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},[2]={type="Condition",var="UsingMace"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=8}},nil}
c["8% chance for Slam Skills you use yourself to cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=8}},nil}
c["8% chance for Spell Skills to fire 2 additional Projectiles"]={{[1]={flags=2,keywordFlags=0,name="TwoAdditionalProjectilesChance",type="BASE",value=8}},nil}
c["8% chance for Spell Skills to fire 8 additional Projectiles in a circle"]={{[1]={flags=2,keywordFlags=0,name="ProjectileCount",type="BASE",value=8}}," to fire 8 additional in a circle "}
c["8% chance to Aggravate Bleeding on targets you Hit with Attacks"]={{}," to Aggravate Bleeding on targets you Hit "}
Expand Down Expand Up @@ -9415,7 +9414,7 @@ c["Skills which require Glory generate 4 Glory every 2 seconds"]={nil,"Skills wh
c["Skills which require Glory generate 5 Glory every 2 seconds"]={nil,"Skills which require Glory generate 5 Glory every 2 seconds "}
c["Skills which require Glory generate 5 Glory every 2 seconds Enemies in your Presence have Exposure"]={nil,"Skills which require Glory generate 5 Glory every 2 seconds Enemies in your Presence have Exposure "}
c["Slam Skills have 8% increased Area of Effect"]={{[1]={[1]={skillType=93,type="SkillType"},flags=0,keywordFlags=0,name="AreaOfEffect",type="INC",value=8}},nil}
c["Slam Skills you use yourself cause an additional Aftershock"]={nil,"Slam Skills you use yourself cause an additional Aftershock "}
c["Slam Skills you use yourself cause an additional Aftershock"]={{[1]={[1]={skillType=93,type="SkillType"},flags=0,keywordFlags=0,name="AftershockChance",type="BASE",value=100}},nil}
c["Slam Skills you use yourself have 30% increased Aftershock Area of Effect"]={nil,"Slam Skills you use yourself have 30% increased Aftershock Area of Effect "}
c["Socketed Curse Gems have 30% increased Reservation Efficiency"]={{[1]={[1]={keyword="curse",slotName="{SlotName}",type="SocketedIn"},flags=0,keywordFlags=0,name="ExtraSkillMod",type="LIST",value={mod={flags=0,keywordFlags=0,name="ReservationEfficiency",type="INC",value=30}}}},nil}
c["Socketed Curse Gems have 80% increased Reservation Efficiency"]={{[1]={[1]={keyword="curse",slotName="{SlotName}",type="SocketedIn"},flags=0,keywordFlags=0,name="ExtraSkillMod",type="LIST",value={mod={flags=0,keywordFlags=0,name="ReservationEfficiency",type="INC",value=80}}}},nil}
Expand Down Expand Up @@ -10003,8 +10002,8 @@ 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}
end)();(function()
c["Zealot's Oath during Effect"]={{[1]={[1]={type="Condition",var="UsingFlask"},flags=0,keywordFlags=0,name="ZealotsOath",type="FLAG",value=true}},nil}
c["additional Elemental Infusion of the same type"]={nil,"additional Elemental Infusion of the same type "}
c["additional Rune-only sockets:"]={{},nil}
Expand Down
8 changes: 8 additions & 0 deletions src/Modules/CalcOffence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4063,6 +4063,14 @@ function calcs.offence(env, actor, activeSkill)
output.ScaledDamageEffect = output.ScaledDamageEffect * (1 + output.DoubleDamageEffect + output.TripleDamageEffect)

output.DpsMultiplier = ( skillData.dpsMultiplier or 1 ) * calcLib.mod(skillModList, skillCfg, "DPS")
-- Aftershocks repeat the area of Slams you use yourself: on average one more hit per use at 100% chance
if activeSkill.skillTypes[SkillType.Slam] and not activeSkill.skillTypes[SkillType.Triggered] then
local aftershockChance = m_min(skillModList:Sum("BASE", skillCfg, "AftershockChance"), 100)
if aftershockChance > 0 then
output.AftershockChance = aftershockChance
output.DpsMultiplier = output.DpsMultiplier * (1 + aftershockChance / 100)
end
end

local hitRate = output.HitChance / 100 * (globalOutput.HitSpeed or globalOutput.Speed) * output.DpsMultiplier

Expand Down
Loading