Skip to content

Commit

Permalink
improve curses to give breakdown on calcs page and generate proper list
Browse files Browse the repository at this point in the history
  • Loading branch information
Regisle committed Aug 22, 2024
1 parent cb7e3e9 commit 6525f5a
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 26 deletions.
3 changes: 2 additions & 1 deletion src/Classes/CalcsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ Effective DPS: Curses and enemy properties (such as resistances and status condi
}, },
{ label = "Aura and Buff Skills", flag = "buffs", textSize = 12, { format = "{output:BuffList}", { breakdown = "SkillBuffs" } }, },
{ label = "Combat Buffs", flag = "combat", textSize = 12, { format = "{output:CombatList}" }, },
{ label = "Curses and Debuffs", flag = "effective", textSize = 12, { format = "{output:CurseList}", { breakdown = "SkillDebuffs" } }, },
{ label = "Curses and Debuffs", flag = "effective", textSize = 12, { format = "{output:SkillDebuffsList}", { breakdown = "SkillDebuffs" } }, },
{ label = "Debuffs on You", flag = "effective", textSize = 12, haveOutput = "DebuffsOnYouList", { format = "{output:DebuffsOnYouList}", { breakdown = "DebuffsOnYou" } }, },
}}}, function(section)
self.build:RefreshSkillSelectControls(section.controls, self.input.skill_number, "Calcs")
section.controls.showMinion.state = self.input.showMinion
Expand Down
26 changes: 26 additions & 0 deletions src/Data/Skills/other.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2556,6 +2556,32 @@ skills["TriggeredShockedGround"] = {
[10] = { storedUses = 1, levelRequirement = 1, cooldown = 5, },
},
}
skills["Silence"] = {
name = "",
hidden = true,
color = 4,
skillTypes = { [SkillType.Spell] = true, [SkillType.Area] = true, [SkillType.Duration] = true, [SkillType.Trappable] = true, [SkillType.Totemable] = true, [SkillType.Mineable] = true, [SkillType.Multicastable] = true, [SkillType.Triggerable] = true, [SkillType.AppliesCurse] = true, [SkillType.AreaSpell] = true, [SkillType.Hex] = true, },
statDescriptionScope = "skill_stat_descriptions",
castTime = 1,
baseFlags = {
spell = true,
curse = true,
area = true,
duration = true,
},
baseMods = {
flag("DisableSkill", { type = "SkillType", skillType = SkillType.Aura, neg = true }, { type = "SkillType", skillType = SkillType.Spell }, { type = "GlobalEffect", effectType = "Curse" }),
skill("debuff", true),
},
constantStats = {
{ "base_skill_effect_duration", 3000 },
},
stats = {
},
levels = {
[1] = { levelRequirement = 0, },
},
}
skills["SpectralSpirits"] = {
name = "Spectral Spirits",
hidden = true,
Expand Down
6 changes: 6 additions & 0 deletions src/Export/Skills/other.txt
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,12 @@ local skills, mod, flag, skill = ...
#baseMod mod("ShockedGroundEffect", "BASE", 15)
#mods

#skill Silence
#flags spell curse area duration
#baseMod flag("DisableSkill", { type = "SkillType", skillType = SkillType.Aura, neg = true }, { type = "SkillType", skillType = SkillType.Spell }, { type = "GlobalEffect", effectType = "Curse" })
#baseMod skill("debuff", true)
#mods

#skill SpectralSpirits
#flags spell minion
fromItem = true,
Expand Down
24 changes: 19 additions & 5 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2625,6 +2625,8 @@ function calcs.perform(env, skipEHP)
end
end

local curseOnYouSlots = { }
env.curseOnYouSlots = curseOnYouSlots
-- Check for extra curses
for dest, modDB in pairs({[curses] = modDB, [minionCurses] = env.minion and env.minion.modDB}) do
for _, value in ipairs(modDB:List(nil, "ExtraCurse")) do
Expand All @@ -2646,15 +2648,14 @@ function calcs.perform(env, skipEHP)
end
end
if value.applyToPlayer then
-- Sources for curses on the player don't usually respect any kind of limit, so there's little point bothering with slots
-- Sources for curses on the player don't usually respect any kind of limit, so there's little point bothering with slots, just always insert it
if modDB:Sum("BASE", nil, "AvoidCurse") < 100 then
modDB.conditions["Cursed"] = true
modDB.multipliers["CurseOnSelf"] = (modDB.multipliers["CurseOnSelf"] or 0) + 1
modDB.conditions["AffectedBy"..grantedEffect.name:gsub(" ","")] = true
local cfg = { skillName = grantedEffect.name }
local inc = (value.incEffect or 0) + modDB:Sum("INC", cfg, "CurseEffectOnSelf") + gemModList:Sum("INC", nil, "CurseEffectAgainstPlayer")
local more = modDB:More(cfg, "CurseEffectOnSelf") * gemModList:More(nil, "CurseEffectAgainstPlayer")
modDB:ScaleAddList(curseModList, (1 + inc / 100) * more)
local newModList = new("ModList")
newModList:ScaleAddList(curseModList, (1 + inc / 100) * more)
t_insert(curseOnYouSlots, { name = grantedEffect.name, modList = newModList})
end
elseif not enemyDB:Flag(nil, "Hexproof") or modDB:Flag(nil, "CursesIgnoreHexproof") then
local curse = {
Expand Down Expand Up @@ -2842,6 +2843,19 @@ function calcs.perform(env, skipEHP)
for _, modList in pairs(debuffs) do
enemyDB:AddList(modList)
end
if #curseOnYouSlots > 1 then
modDB.multipliers["CurseOnSelf"] = #curseOnYouSlots
for _, slot in ipairs(curseOnYouSlots) do
modDB.conditions["Cursed"] = true
modDB.conditions["AffectedBy"..slot.name:gsub(" ","")] = true
if slot.isMark then
modDB.conditions["Marked"] = true
end
if slot.modList then
modDB:AddList(slot.modList)
end
end
end
modDB.multipliers["CurseOnEnemy"] = #curseSlots
for _, slot in ipairs(curseSlots) do
enemyDB.conditions["Cursed"] = true
Expand Down
23 changes: 21 additions & 2 deletions src/Modules/Calcs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ function calcs.buildOutput(build, mode)
local buffList = { }
local combatList = { }
local curseList = { }
local curseOnYouList = { }
if output.PowerCharges > 0 then
t_insert(combatList, s_format("%d Power Charges", output.PowerCharges))
end
Expand Down Expand Up @@ -764,9 +765,27 @@ function calcs.buildOutput(build, mode)
end
end
end
env.player.breakdown.DebuffsOnYou = { modList = { } }
for _, slot in ipairs(env.curseOnYouSlots) do
t_insert(curseOnYouList, slot.name)
if slot.modList then
for _, mod in ipairs(slot.modList) do
local value = env.modDB:EvalMod(mod)
if value and value ~= 0 then
t_insert(env.player.breakdown.DebuffsOnYou.modList, {
mod = mod,
value = value,
})
end
end
end
end
output.BuffList = table.concat(buffList, ", ")
output.CombatList = table.concat(combatList, ", ")
output.CurseList = table.concat(curseList, ", ")
output.SkillDebuffsList = table.concat(curseList, ", ")
if #curseOnYouList > 0 then
output.DebuffsOnYouList = table.concat(curseOnYouList, ", ")
end
if env.minion then
local buffList = { }
local combatList = { }
Expand Down Expand Up @@ -819,7 +838,7 @@ function calcs.buildOutput(build, mode)
env.minion.breakdown.SkillDebuffs = env.player.breakdown.SkillDebuffs
output.Minion.BuffList = table.concat(buffList, ", ")
output.Minion.CombatList = table.concat(combatList, ", ")
output.Minion.CurseList = output.CurseList
output.Minion.SkillDebuffsList = output.SkillDebuffsList
end

-- infoDump(env)
Expand Down
6 changes: 4 additions & 2 deletions src/Modules/ConfigOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,11 @@ Huge sets the radius to 11.
ConPrintTable({"Curse:_", val, extraData})
if val == "ALL" then
for _, curse in ipairs(data.playerCursedWithXList) do
modList:NewMod("ExtraCurse", "LIST", { skillId = curse.val, level = extraData[1] or 1, applyToPlayer = true })
if curse.val ~= "NONE" and curse.val ~= "ALL" then
modList:NewMod("ExtraCurse", "LIST", { skillId = curse.val, level = extraData[1] or 1, applyToPlayer = true })
end
end
elseif val ~= "None" then
elseif val ~= "NONE" then
modList:NewMod("ExtraCurse", "LIST", { skillId = val, level = extraData[1] or 1, applyToPlayer = true })
end
end },
Expand Down
24 changes: 8 additions & 16 deletions src/Modules/Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -255,22 +255,6 @@ data.cursePriority = {
["CurseFromEquipment"] = 10000,
["CurseFromAura"] = 20000,
}
-- this list should be auto generated and include things like silence etc
data.playerCursedWithXList = {
{ val = "AssassinsMark", label = "Assassin's Mark:" },
{ val = "Conductivity", label = "Conductivity:" },
{ val = "Despair", label = "Despair:" },
{ val = "ElementalWeakness", label = "Elemental Weakness:" },
{ val = "Enfeeble", label = "Enfeeble:" },
{ val = "Flammability", label = "Flammability:" },
{ val = "Frostbite", label = "Frostbite:" },
{ val = "PoachersMark", label = "Poacher's Mark:" },
{ val = "ProjectileWeakness", label = "Projectile Weakness:" },
{ val = "Punishment", label = "Punishment:" },
{ val = "TemporalChains", label = "Temporal Chains:" },
{ val = "Vulnerability", label = "Vulnerability:" },
{ val = "WarlordsMark", label = "Warlord's Mark:" },
}

---@type string[] @List of all keystones not exclusive to timeless jewels.
data.keystones = {
Expand Down Expand Up @@ -861,6 +845,8 @@ data.skillStatMapMeta = {
for _, type in pairs(skillTypes) do
LoadModule("Data/Skills/"..type, data.skills, makeSkillMod, makeFlagMod, makeSkillDataMod)
end
-- This list is used for curse on player config
data.playerCursedWithXList = { }
for skillId, grantedEffect in pairs(data.skills) do
grantedEffect.name = sanitiseText(grantedEffect.name)
grantedEffect.id = skillId
Expand Down Expand Up @@ -893,7 +879,13 @@ for skillId, grantedEffect in pairs(data.skills) do
end
end
end
-- Filter out curses which typicaly get applied to the player, many curses have multiple sources like from monsters

Check warning on line 882 in src/Modules/Data.lua

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (typicaly)
-- This does mean it misses Projectile weakness which is only from monsters but I dont think those even exist anymore tbh
if grantedEffect.skillTypes and grantedEffect.skillTypes[SkillType.AppliesCurse] and skillId == grantedEffect.name:gsub(" ",""):gsub("'","") then
t_insert(data.playerCursedWithXList, { val = skillId, label = grantedEffect.name} )
end
end
table.sort(data.playerCursedWithXList, function(a, b) return a.val < b.val end)

-- Load gems
data.gems = LoadModule("Data/Gems")
Expand Down

0 comments on commit 6525f5a

Please sign in to comment.