Skip to content

Commit 897f007

Browse files
authored
Restore on-kill explosions support (#1259)
1 parent 26fe13d commit 897f007

File tree

5 files changed

+278
-12
lines changed

5 files changed

+278
-12
lines changed

src/Data/ModCache.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4082,7 +4082,7 @@ c["Breaks Armour equal to 40% of damage from Hits with this weapon"]={nil,"Break
40824082
c["Breaks Armour equal to 40% of damage from Hits with this weapon Fully Armour Broken enemies you kill with Hits Shatter"]={nil,"Breaks Armour equal to 40% of damage from Hits with this weapon Fully Armour Broken enemies you kill with Hits Shatter "}
40834083
c["Buffs on you expire 10% slower"]={{[1]={[1]={skillType=5,type="SkillType"},flags=0,keywordFlags=0,name="Duration",type="INC",value=10}},nil}
40844084
c["Burning Enemies you kill have a 5% chance to Explode, dealing a"]={nil,"Burning Enemies you kill have a 5% chance to Explode, dealing a "}
4085-
c["Burning Enemies you kill have a 5% chance to Explode, dealing a tenth of their maximum Life as Fire Damage"]={{[1]={[1]={actor="enemy",type="ActorCondition",var="Burning"},flags=0,keywordFlags=0,name="ExplodeMod",type="LIST",value={amount=5,chance=1,keyOfScaledMod="chance",type="Tenth"}},[2]={flags=0,keywordFlags=0,name="CanExplode",type="FLAG",value=true}},nil}
4085+
c["Burning Enemies you kill have a 5% chance to Explode, dealing a tenth of their maximum Life as Fire Damage"]={{[1]={[1]={actor="enemy",type="ActorCondition",var="Burning"},flags=0,keywordFlags=0,name="ExplodeMod",type="LIST",value={amount=10,chance=0.05,keyOfScaledMod="chance",type="Fire"}},[2]={flags=0,keywordFlags=0,name="CanExplode",type="FLAG",value=true}},nil}
40864086
c["Can Attack as though using a Quarterstaff while both of your hand slots are empty"]={nil,"Can Attack as though using a Quarterstaff while both of your hand slots are empty "}
40874087
c["Can Attack as though using a Quarterstaff while both of your hand slots are empty Unarmed Attacks that would use your Quarterstaff's damage gain:"]={nil,"Can Attack as though using a Quarterstaff while both of your hand slots are empty Unarmed Attacks that would use your Quarterstaff's damage gain: "}
40884088
c["Can Attack as though using a Quarterstaff while both of your hand slots are empty Unarmed Attacks that would use your Quarterstaff's damage gain: Physical damage based on their Skill Level"]={nil,"Can Attack as though using a Quarterstaff while both of your hand slots are empty Unarmed Attacks that would use your Quarterstaff's damage gain: Physical damage based on their Skill Level "}
@@ -4136,10 +4136,7 @@ c["Causes 50% increased Stun Buildup Always deals Critical Hits against Heavy St
41364136
c["Causes Bleeding on Hit"]={{[1]={[1]={type="Condition",var="{Hand}Attack"},flags=0,keywordFlags=0,name="BleedChance",type="BASE",value=100}},nil}
41374137
c["Causes Daze buildup equal to 100% of Damage dealt"]={nil,"Causes Daze buildup equal to 100% of Damage dealt "}
41384138
c["Causes Double Stun Buildup"]={{}," Stun Buildup "}
4139-
c["Causes Enemies to Explode on Critical kill, for 10% of their Life as Physical Damage"]={nil,"Causes Enemies to Explode on Critical kill, for 10% of their Life as Physical Damage "}
4140-
c["Causes Enemies to Explode on Critical kill, for 10% of their Life as Physical Damage 120% increased Physical Damage"]={nil,"Causes Enemies to Explode on Critical kill, for 10% of their Life as Physical Damage 120% increased Physical Damage "}
4141-
c["Causes Enemies to Explode on Critical kill, for 10% of their Life as Physical Damage 172% increased Physical Damage"]={nil,"Causes Enemies to Explode on Critical kill, for 10% of their Life as Physical Damage 172% increased Physical Damage "}
4142-
c["Causes Enemies to Explode on Critical kill, for 10% of their Life as Physical Damage Adds 62 to 94 Fire Damage"]={{[1]={flags=0,keywordFlags=0,name="FireMin",type="BASE",value=62},[2]={flags=0,keywordFlags=0,name="FireMax",type="BASE",value=94}},"Causes Enemies to Explode on Critical kill, for 10% of their as Physical Damage "}
4139+
c["Causes Enemies to Explode on Critical kill, for 10% of their Life as Physical Damage"]={{[1]={flags=0,keywordFlags=0,name="ExplodeMod",type="LIST",value={amount=10,chance=1,keyOfScaledMod="chance",type="Physical"}},[2]={flags=0,keywordFlags=0,name="CanExplode",type="FLAG",value=true}},nil}
41434140
c["Chance is doubled against Undead and Demons"]={{},"Chance against Undead and Demons "}
41444141
c["Chance to Deflect is Lucky"]={nil,"Chance to Deflect is Lucky "}
41454142
c["Chance to Evade is Unlucky"]={nil,"Chance to Evade is Unlucky "}

src/Data/Skills/other.lua

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6684,4 +6684,136 @@ skills["VoidIllusionSpawnPlayer"] = {
66846684
},
66856685
},
66866686
}
6687+
}
6688+
skills["EnemyExplode"] = {
6689+
name = "On Kill Monster Explosion",
6690+
hidden = true,
6691+
color = 4,
6692+
skillTypes = { [SkillType.Damage] = true, [SkillType.Area] = true, },
6693+
castTime = 0,
6694+
levels = {
6695+
[1] = { damageEffectiveness = 0, baseMultiplier = 1, levelRequirement = 1, }
6696+
},
6697+
preDamageFunc = function(activeSkill, output)
6698+
output.ExplodeChance = 0
6699+
local statSet = activeSkill.activeEffect.statSet or activeSkill.activeEffect.statSetCalcs
6700+
if statSet.index ~= 3 then
6701+
local allExplodeMods = activeSkill.skillModList:Tabulate("LIST", activeSkill.skillCfg, "ExplodeMod")
6702+
for _, explodeMod in ipairs(allExplodeMods) do
6703+
local activeEffectSource = activeSkill.activeEffect.srcInstance.explodeSource.modSource or "Tree:"..activeSkill.activeEffect.srcInstance.explodeSource.id
6704+
if explodeMod.mod.source == activeEffectSource then
6705+
local explodeMod = explodeMod.value
6706+
if explodeMod.type == "RandomElement" then
6707+
activeSkill.skillData["FireEffectiveExplodePercentage"] = explodeMod.amount / 3
6708+
activeSkill.skillData["ColdEffectiveExplodePercentage"] = explodeMod.amount / 3
6709+
activeSkill.skillData["LightningEffectiveExplodePercentage"] = explodeMod.amount / 3
6710+
else
6711+
activeSkill.skillData[explodeMod.type.."EffectiveExplodePercentage"] = explodeMod.amount
6712+
end
6713+
output.ExplodeChance = statSet.index == 2 and 1 or explodeMod.chance
6714+
end
6715+
end
6716+
else
6717+
local typeAmountChances = { }
6718+
local explodeModList = activeSkill.skillModList:List(activeSkill.skillCfg, "ExplodeMod")
6719+
for _, explodeMod in ipairs(explodeModList) do
6720+
local amountChance = typeAmountChances[explodeMod.type] or { }
6721+
amountChance[explodeMod.amount] = (amountChance[explodeMod.amount] or 0) + explodeMod.chance
6722+
typeAmountChances[explodeMod.type] = amountChance
6723+
end
6724+
for type, amountChance in pairs(typeAmountChances) do
6725+
local physExplodeChance = 0
6726+
for amount, chance in pairs(amountChance) do
6727+
local amountXChance = amount * chance
6728+
if type == "RandomElement" then
6729+
activeSkill.skillData["FireEffectiveExplodePercentage"] = (activeSkill.skillData["FireEffectiveExplodePercentage"] or 0) + amountXChance / 3
6730+
activeSkill.skillData["ColdEffectiveExplodePercentage"] = (activeSkill.skillData["ColdEffectiveExplodePercentage"] or 0) + amountXChance / 3
6731+
activeSkill.skillData["LightningEffectiveExplodePercentage"] = (activeSkill.skillData["LightningEffectiveExplodePercentage"] or 0) + amountXChance / 3
6732+
else
6733+
activeSkill.skillData[type.."EffectiveExplodePercentage"] = (activeSkill.skillData[type.."EffectiveExplodePercentage"] or 0) + amountXChance
6734+
end
6735+
if type == "Physical" then
6736+
physExplodeChance = 1 - ((1 - physExplodeChance) * (1 - chance))
6737+
end
6738+
output.ExplodeChance = 1 - ((1 - output.ExplodeChance) * (1 - chance))
6739+
end
6740+
if type == "Physical" and physExplodeChance ~= 0 then
6741+
activeSkill.skillModList:NewMod("CalcArmourAsThoughDealing", "MORE", 100 / math.min(physExplodeChance, 1) - 100)
6742+
end
6743+
end
6744+
end
6745+
output.ExplodeChance = math.min(output.ExplodeChance * 100, 100)
6746+
end,
6747+
statSets = {
6748+
[1] = {
6749+
label = "This Source Only",
6750+
baseFlags = {
6751+
area = true,
6752+
monsterExplode = true,
6753+
},
6754+
baseMods = {
6755+
skill("radius", 22),
6756+
skill("showAverage", true),
6757+
skill("corpseExplosionLifeMultiplier", 0),
6758+
skill("explodeCorpse", true),
6759+
skill("hitChanceIsExplodeChance", true),
6760+
},
6761+
stats = {
6762+
"is_area_damage",
6763+
"base_skill_show_average_damage_instead_of_dps",
6764+
"display_skill_deals_secondary_damage",
6765+
"damage_cannot_be_reflected",
6766+
"skill_can_add_multiple_charges_per_action",
6767+
},
6768+
levels = {
6769+
[1] = { },
6770+
},
6771+
},
6772+
[2] = {
6773+
label = "This Source Only, Ignoring Chance",
6774+
baseFlags = {
6775+
area = true,
6776+
monsterExplode = true,
6777+
},
6778+
baseMods = {
6779+
skill("radius", 22),
6780+
skill("showAverage", true),
6781+
skill("corpseExplosionLifeMultiplier", 0),
6782+
skill("explodeCorpse", true),
6783+
},
6784+
stats = {
6785+
"is_area_damage",
6786+
"base_skill_show_average_damage_instead_of_dps",
6787+
"display_skill_deals_secondary_damage",
6788+
"damage_cannot_be_reflected",
6789+
"skill_can_add_multiple_charges_per_action",
6790+
},
6791+
levels = {
6792+
[1] = { },
6793+
},
6794+
},
6795+
[3] = {
6796+
label = "Average of All Sources",
6797+
baseFlags = {
6798+
area = true,
6799+
monsterExplode = true,
6800+
},
6801+
baseMods = {
6802+
skill("radius", 22),
6803+
skill("showAverage", true),
6804+
skill("corpseExplosionLifeMultiplier", 0),
6805+
skill("explodeCorpse", true),
6806+
},
6807+
stats = {
6808+
"is_area_damage",
6809+
"base_skill_show_average_damage_instead_of_dps",
6810+
"display_skill_deals_secondary_damage",
6811+
"damage_cannot_be_reflected",
6812+
"skill_can_add_multiple_charges_per_action",
6813+
},
6814+
levels = {
6815+
[1] = { },
6816+
},
6817+
},
6818+
}
66876819
}

src/Export/Skills/other.txt

Lines changed: 134 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,4 +478,137 @@ statMap = {
478478
#set VoidIllusionSpawnPlayer
479479
#flags attack
480480
#mods
481-
#skillEnd
481+
#skillEnd
482+
483+
skills["EnemyExplode"] = {
484+
name = "On Kill Monster Explosion",
485+
hidden = true,
486+
color = 4,
487+
skillTypes = { [SkillType.Damage] = true, [SkillType.Area] = true, },
488+
castTime = 0,
489+
levels = {
490+
[1] = { damageEffectiveness = 0, baseMultiplier = 1, levelRequirement = 1, }
491+
},
492+
preDamageFunc = function(activeSkill, output)
493+
output.ExplodeChance = 0
494+
local statSet = activeSkill.activeEffect.statSet or activeSkill.activeEffect.statSetCalcs
495+
if statSet.index ~= 3 then
496+
local allExplodeMods = activeSkill.skillModList:Tabulate("LIST", activeSkill.skillCfg, "ExplodeMod")
497+
for _, explodeMod in ipairs(allExplodeMods) do
498+
local activeEffectSource = activeSkill.activeEffect.srcInstance.explodeSource.modSource or "Tree:"..activeSkill.activeEffect.srcInstance.explodeSource.id
499+
if explodeMod.mod.source == activeEffectSource then
500+
local explodeMod = explodeMod.value
501+
if explodeMod.type == "RandomElement" then
502+
activeSkill.skillData["FireEffectiveExplodePercentage"] = explodeMod.amount / 3
503+
activeSkill.skillData["ColdEffectiveExplodePercentage"] = explodeMod.amount / 3
504+
activeSkill.skillData["LightningEffectiveExplodePercentage"] = explodeMod.amount / 3
505+
else
506+
activeSkill.skillData[explodeMod.type.."EffectiveExplodePercentage"] = explodeMod.amount
507+
end
508+
output.ExplodeChance = statSet.index == 2 and 1 or explodeMod.chance
509+
end
510+
end
511+
else
512+
local typeAmountChances = { }
513+
local explodeModList = activeSkill.skillModList:List(activeSkill.skillCfg, "ExplodeMod")
514+
for _, explodeMod in ipairs(explodeModList) do
515+
local amountChance = typeAmountChances[explodeMod.type] or { }
516+
amountChance[explodeMod.amount] = (amountChance[explodeMod.amount] or 0) + explodeMod.chance
517+
typeAmountChances[explodeMod.type] = amountChance
518+
end
519+
for type, amountChance in pairs(typeAmountChances) do
520+
local physExplodeChance = 0
521+
for amount, chance in pairs(amountChance) do
522+
local amountXChance = amount * chance
523+
if type == "RandomElement" then
524+
activeSkill.skillData["FireEffectiveExplodePercentage"] = (activeSkill.skillData["FireEffectiveExplodePercentage"] or 0) + amountXChance / 3
525+
activeSkill.skillData["ColdEffectiveExplodePercentage"] = (activeSkill.skillData["ColdEffectiveExplodePercentage"] or 0) + amountXChance / 3
526+
activeSkill.skillData["LightningEffectiveExplodePercentage"] = (activeSkill.skillData["LightningEffectiveExplodePercentage"] or 0) + amountXChance / 3
527+
else
528+
activeSkill.skillData[type.."EffectiveExplodePercentage"] = (activeSkill.skillData[type.."EffectiveExplodePercentage"] or 0) + amountXChance
529+
end
530+
if type == "Physical" then
531+
physExplodeChance = 1 - ((1 - physExplodeChance) * (1 - chance))
532+
end
533+
output.ExplodeChance = 1 - ((1 - output.ExplodeChance) * (1 - chance))
534+
end
535+
if type == "Physical" and physExplodeChance ~= 0 then
536+
activeSkill.skillModList:NewMod("CalcArmourAsThoughDealing", "MORE", 100 / math.min(physExplodeChance, 1) - 100)
537+
end
538+
end
539+
end
540+
output.ExplodeChance = math.min(output.ExplodeChance * 100, 100)
541+
end,
542+
statSets = {
543+
[1] = {
544+
label = "This Source Only",
545+
baseFlags = {
546+
area = true,
547+
monsterExplode = true,
548+
},
549+
baseMods = {
550+
skill("radius", 22),
551+
skill("showAverage", true),
552+
skill("corpseExplosionLifeMultiplier", 0),
553+
skill("explodeCorpse", true),
554+
skill("hitChanceIsExplodeChance", true),
555+
},
556+
stats = {
557+
"is_area_damage",
558+
"base_skill_show_average_damage_instead_of_dps",
559+
"display_skill_deals_secondary_damage",
560+
"damage_cannot_be_reflected",
561+
"skill_can_add_multiple_charges_per_action",
562+
},
563+
levels = {
564+
[1] = { },
565+
},
566+
},
567+
[2] = {
568+
label = "This Source Only, Ignoring Chance",
569+
baseFlags = {
570+
area = true,
571+
monsterExplode = true,
572+
},
573+
baseMods = {
574+
skill("radius", 22),
575+
skill("showAverage", true),
576+
skill("corpseExplosionLifeMultiplier", 0),
577+
skill("explodeCorpse", true),
578+
},
579+
stats = {
580+
"is_area_damage",
581+
"base_skill_show_average_damage_instead_of_dps",
582+
"display_skill_deals_secondary_damage",
583+
"damage_cannot_be_reflected",
584+
"skill_can_add_multiple_charges_per_action",
585+
},
586+
levels = {
587+
[1] = { },
588+
},
589+
},
590+
[3] = {
591+
label = "Average of All Sources",
592+
baseFlags = {
593+
area = true,
594+
monsterExplode = true,
595+
},
596+
baseMods = {
597+
skill("radius", 22),
598+
skill("showAverage", true),
599+
skill("corpseExplosionLifeMultiplier", 0),
600+
skill("explodeCorpse", true),
601+
},
602+
stats = {
603+
"is_area_damage",
604+
"base_skill_show_average_damage_instead_of_dps",
605+
"display_skill_deals_secondary_damage",
606+
"damage_cannot_be_reflected",
607+
"skill_can_add_multiple_charges_per_action",
608+
},
609+
levels = {
610+
[1] = { },
611+
},
612+
},
613+
}
614+
}

src/Modules/CalcSetup.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,16 +1347,21 @@ function calcs.initEnv(build, mode, override, specEnv)
13471347
group = { label = "On Kill Monster Explosion", enabled = true, gemList = { }, source = "Explode", noSupports = true }
13481348
t_insert(build.skillsTab.socketGroupList, group)
13491349
end
1350+
-- Hack to remove duplicates
1351+
local explodeBySource = { }
1352+
for _, explodeSource in ipairs(env.explodeSources) do
1353+
explodeBySource[explodeSource.modSource or explodeSource.id] = explodeSource
1354+
end
13501355
-- Update the group
1351-
group.explodeSources = env.explodeSources
1356+
group.explodeSources = explodeBySource
13521357
local gemsBySource = { }
13531358
for _, gem in ipairs(group.gemList) do
13541359
if gem.explodeSource then
13551360
gemsBySource[gem.explodeSource.modSource or gem.explodeSource.id] = gem
13561361
end
13571362
end
13581363
wipeTable(group.gemList)
1359-
for _, explodeSource in ipairs(env.explodeSources) do
1364+
for _, explodeSource in pairs(explodeBySource) do
13601365
local activeGemInstance
13611366
if gemsBySource[explodeSource.modSource or explodeSource.id] then
13621367
activeGemInstance = gemsBySource[explodeSource.modSource or explodeSource.id]

src/Modules/ModParser.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,6 @@ local specialModList = {
20622062
["enemies you kill while affected by glorious madness have a (%d+)%% chance to explode, dealing a (.+) of their life as (.+) damage"] = function(chance, _, amount, type) -- Beacon of Madness
20632063
return explodeFunc(chance, amount, type, { type = "Condition", var = "AffectedByGloriousMadness" })
20642064
end,
2065-
["enemies killed with attack hits have a (%d+)%% chance to explode, dealing a (.+) of their life as (.+) damage"] = explodeFunc, -- Devastator (attack clusters)
20662065
["enemies killed with wand hits have a (%d+)%% chance to explode, dealing a (.+) of their life as (.+) damage"] = function(chance, _, amount, type) -- Explosive Force (wand clusters)
20672066
return explodeFunc(chance, amount, type, { type = "Condition", var = "UsingWand" })
20682067
end,
@@ -2075,7 +2074,7 @@ local specialModList = {
20752074
["enemies you kill explode, dealing (%d+)%% of their life as (.+) damage"] = function(amount, _, type) -- legacy synth, legacy crusader
20762075
return explodeFunc(100, amount, type)
20772076
end,
2078-
["enemies killed explode dealing (%d+)%% of their life as (.+) damage"] = function(amount, _, type) -- Quecholli
2077+
["causes enemies to explode on critical kill, for (%d+)%% of their life as (.+) damage"] = function(amount, _, type) -- Crumbling Maul implicit
20792078
return explodeFunc(100, amount, type)
20802079
end,
20812080
["enemies on fungal ground you kill explode, dealing (%d+)%% of their life as (.+) damage"] = function(amount, _, type) -- Sporeguard
@@ -2090,8 +2089,8 @@ local specialModList = {
20902089
["bleeding enemies you kill explode, dealing (%d+)%% of their maximum life as (.+) damage"] = function(amount, _, type) -- Haemophilia
20912090
return explodeFunc(100, amount, type, { type = "ActorCondition", actor = "enemy", var = "Bleeding" })
20922091
end,
2093-
["burning enemies you kill have a (%d+)%% chance to explode, dealing a (.+) of their maximum life as (.+) damage"] = function(amount, _, type) -- Haemophilia
2094-
return explodeFunc(100, amount, type, { type = "ActorCondition", actor = "enemy", var = "Burning" })
2092+
["burning enemies you kill have a (%d+)%% chance to explode, dealing a (.+) of their maximum life as (.+) damage"] = function(chance, _, amount, type) -- Explosive Impact
2093+
return explodeFunc(chance, amount, type, { type = "ActorCondition", actor = "enemy", var = "Burning" })
20952094
end,
20962095
["non-aura curses you inflict are not removed from dying enemies"] = {},
20972096
["enemies near corpses affected by your curses are blinded"] = { mod("EnemyModifier", "LIST", { mod = flag("Condition:Blinded") }, { type = "MultiplierThreshold", var = "NearbyCorpse", threshold = 1 }, { type = "ActorCondition", actor = "enemy", var = "Cursed" }) },

0 commit comments

Comments
 (0)