Skip to content

Add initial implementation of thorns #785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
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
12 changes: 12 additions & 0 deletions src/Classes/SkillsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ which comes from the following sources:]]
label = label .. "\n\t" .. colorCodes[source.rarity or "NORMAL"] .. (source.name or source.dn or "???")
end
label = label .. "^7\nYou cannot delete this group, but it will disappear if you lose the above sources."
elseif self.displayGroup.thornsSources then
label = [[^7This is a special group created for thorns effect, which comes from the following sources:]]
for _, source in ipairs(self.displayGroup.thornsSources) do
label = label .. "\n\t" .. colorCodes[source.rarity or "NORMAL"] .. (source.name or source.dn or "???")
end
label = label .. "^7\nYou cannot delete this group, but it will disappear if you lose the above sources."
else
local activeGem = self.displayGroup.gemList[1]
local sourceName
Expand Down Expand Up @@ -1122,6 +1128,12 @@ function SkillsTabClass:AddSocketGroupTooltip(tooltip, socketGroup)
end
return
end
if socketGroup.thornsSources then
for _, source in ipairs(socketGroup.thornsSources) do
tooltip:AddLine(18, "^7Source: " .. colorCodes[source.rarity or "NORMAL"] .. (source.name or source.dn or "???"))
end
return
end
if socketGroup.enabled and not socketGroup.slotEnabled then
tooltip:AddLine(16, "^7Note: this group is disabled because it is socketed in the inactive weapon set.")
end
Expand Down
17 changes: 9 additions & 8 deletions src/Data/Global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,17 @@ KeywordFlag.Spell = 0x00020000
KeywordFlag.Hit = 0x00040000
KeywordFlag.Ailment = 0x00080000
KeywordFlag.Brand = 0x00100000
KeywordFlag.Thorns = 0x00200000
-- Other effects
KeywordFlag.Poison = 0x00200000
KeywordFlag.Bleed = 0x00400000
KeywordFlag.Ignite = 0x00800000
KeywordFlag.Poison = 0x00400000
KeywordFlag.Bleed = 0x00800000
KeywordFlag.Ignite = 0x01000000
-- Damage over Time types
KeywordFlag.PhysicalDot=0x01000000
KeywordFlag.LightningDot=0x02000000
KeywordFlag.ColdDot = 0x04000000
KeywordFlag.FireDot = 0x08000000
KeywordFlag.ChaosDot = 0x10000000
KeywordFlag.PhysicalDot=0x02000000
KeywordFlag.LightningDot=0x04000000
KeywordFlag.ColdDot = 0x08000000
KeywordFlag.FireDot = 0x10000000
KeywordFlag.ChaosDot = 0x20000000
---The default behavior for KeywordFlags is to match *any* of the specified flags.
---Including the "MatchAll" flag when creating a mod will cause *all* flags to be matched rather than any.
KeywordFlag.MatchAll = 0x40000000
Expand Down
83 changes: 42 additions & 41 deletions src/Data/ModCache.lua

Large diffs are not rendered by default.

34 changes: 33 additions & 1 deletion src/Data/Skills/other.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3701,4 +3701,36 @@ skills["UniqueBreachLightningBoltPlayer"] = {
},
},
}
}
}
skills["ThornsPlayer"] = {
name = "Thorns",
hidden = true,
fromItem = true,
skillTypes = { [SkillType.Damage] = true },
qualityStats = {
},
levels = {
[1] = { levelRequirement = 0, },
},
statSets = {
[1] = {
label = "Thorns",
incrementalEffectiveness = 0,
statDescriptionScope = "skill_stat_descriptions",
baseFlags = {
thorns = true,
},
baseMods = {
flag("CannotBleed"),
flag("CannotPoison"),
},
constantStats = {
},
stats = {
},
levels = {
[1] = { },
},
},
}
}
35 changes: 34 additions & 1 deletion src/Export/Skills/other.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,37 @@ statMap = {
#set UniqueBreachLightningBoltPlayer
#flags spell area
#mods
#skillEnd
#skillEnd

skills["ThornsPlayer"] = {
name = "Thorns",
hidden = true,
fromItem = true,
skillTypes = { [SkillType.Damage] = true },
qualityStats = {
},
levels = {
[1] = { levelRequirement = 0, },
},
statSets = {
[1] = {
label = "Thorns",
incrementalEffectiveness = 0,
statDescriptionScope = "skill_stat_descriptions",
baseFlags = {
thorns = true,
},
baseMods = {
flag("CannotBleed"),
flag("CannotPoison"),
},
constantStats = {
},
stats = {
},
levels = {
[1] = { },
},
},
}
}
3 changes: 3 additions & 0 deletions src/Modules/CalcActiveSkill.lua
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,9 @@ function calcs.buildActiveSkillModList(env, activeSkill)
if skillTypes[SkillType.Spell] and not skillFlags.cast then
skillKeywordFlags = bor(skillKeywordFlags, KeywordFlag.Spell)
end
if skillFlags.thorns then
skillKeywordFlags = bor(skillKeywordFlags, KeywordFlag.Thorns)
end

-- Get skill totem ID for totem skills
-- This is used to calculate totem life
Expand Down
37 changes: 37 additions & 0 deletions src/Modules/CalcSetup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ function calcs.buildModListForNode(env, node, incSmallPassiveSkill)
if modList:Flag(nil, "CanExplode") then
t_insert(env.explodeSources, node)
end

if modList:Flag(nil, "GrantsThorns") then
t_insert(env.thornsSources, node)
end

for i, mod in ipairs(modList) do
local added = false
Expand Down Expand Up @@ -496,6 +500,7 @@ function calcs.initEnv(build, mode, override, specEnv)
env.grantedSkillsNodes = { }
env.grantedSkillsItems = { }
env.explodeSources = { }
env.thornsSources = { }
env.itemWarnings = { }
env.flasks = { }
env.charms = { }
Expand Down Expand Up @@ -740,6 +745,9 @@ function calcs.initEnv(build, mode, override, specEnv)
if item and item.baseModList and item.baseModList:Flag(nil, "CanExplode") then
t_insert(env.explodeSources, item)
end
if item and item.baseModList and item.baseModList:Flag(nil, "GrantsThorns") then
t_insert(env.thornsSources, item)
end
if slot.weaponSet and slot.weaponSet ~= (build.itemsTab.activeItemSet.useSecondWeaponSet and 2 or 1) then
goto continue
end
Expand Down Expand Up @@ -1329,6 +1337,35 @@ function calcs.initEnv(build, mode, override, specEnv)
build.skillsTab:ProcessSocketGroup(group)
end

if #env.thornsSources ~= 0 then
-- Check if a matching group already exists
local group
for _, socketGroup in pairs(build.skillsTab.socketGroupList) do
if socketGroup.source == "Thorns" then
group = socketGroup
break
end
end
if not group then
-- Create a new group for this skill
group = { label = "Thorns", enabled = true, gemList = { }, source = "Thorns", noSupports = true }
t_insert(build.skillsTab.socketGroupList, group)
end
-- Update the group
group.thornsSources = env.thornsSources
wipeTable(group.gemList)
local activeGemInstance = {
skillId = "ThornsPlayer",
quality = 0,
enabled = true,
level = 1,
triggered = true,
}
t_insert(group.gemList, activeGemInstance)
markList[group] = true
build.skillsTab:ProcessSocketGroup(group)
end

-- Remove any socket groups that no longer have a matching item
local i = 1
while build.skillsTab.socketGroupList[i] do
Expand Down
10 changes: 9 additions & 1 deletion src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -662,11 +662,14 @@ local modNameList = {
["cold damage over time multiplier"] = "ColdDotMultiplier",
["chaos damage over time multiplier"] = "ChaosDotMultiplier",
["damage over time multiplier"] = "DotMultiplier",
["thorns damage"] = { "Damage", keywordFlags = KeywordFlag.Thorns },
-- Crit/accuracy/speed modifiers
["critical hit chance"] = "CritChance",
["attack critical hit chance"] = { "CritChance", flags = ModFlag.Attack },
["thorns critical hit chance"] = { "CritChance", keywordFlags = KeywordFlag.Thorns },
["critical damage bonus"] = "CritMultiplier",
["attack critical damage bonus"] = { "CritMultiplier", flags = ModFlag.Attack },
["thorns critical damage bonus"] = { "CritMultiplier", keywordFlags = KeywordFlag.Thorns },
["critical spell damage bonus"] = { "CritMultiplier", flags = ModFlag.Spell },
["accuracy"] = "Accuracy",
["accuracy rating"] = "Accuracy",
Expand Down Expand Up @@ -5319,7 +5322,12 @@ local specialModList = {
["nearby allies have (%d+)%% chance to block attack damage per (%d+) strength you have"] = function(block, _, str) return {
mod("ExtraAura", "LIST", { onlyAllies = true, mod = mod("BlockChance", "BASE", block) }, { type = "PerStat", stat = "Str", div = tonumber(str) }),
} end,
["physical damage reduction from armour is based on your combined armour and evasion rating"] = { mod("EvasionAddsToPdr", "FLAG", true) }
["physical damage reduction from armour is based on your combined armour and evasion rating"] = { mod("EvasionAddsToPdr", "FLAG", true) },
["(%d+) to (%d+) (%a+) thorns damage"] = function(_, min, max, damageType) return {
mod(damageType:gsub("^%l", string.upper).."Min", "BASE", min, nil, 0, KeywordFlag.Thorns),
mod(damageType:gsub("^%l", string.upper).."Max", "BASE", max, nil, 0, KeywordFlag.Thorns),
flag("GrantsThorns")
} end,
}
for _, name in pairs(data.keystones) do
specialModList[name:lower()] = { mod("Keystone", "LIST", name) }
Expand Down