Skip to content
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

Limit application of unique item configs. #6572

Merged
Merged
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
30 changes: 10 additions & 20 deletions src/Modules/CalcTriggers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ local function slotMatch(env, skill)
return (match1 or match2)
end

local function isTriggered(skill)
return skill.skillData.triggeredByUnique or skill.skillData.triggered or skill.skillTypes[SkillType.InbuiltTrigger] or skill.skillTypes[SkillType.Triggered] or skill.activeEffect.grantedEffect.triggered
end

local function processAddedCastTime(skill, breakdown)
if skill.skillModList:Flag(skill.skillCfg, "SpellCastTimeAddedToCooldownIfTriggered") then
local baseCastTime = skill.skillData.castTimeOverride or skill.activeEffect.grantedEffect.castTime or 1
Expand Down Expand Up @@ -323,10 +327,9 @@ local function CWCHandler(env)
local output = env.player.output
local breakdown = env.player.breakdown
for _, skill in ipairs(env.player.activeSkillList) do
local triggered = skill.skillData.triggeredByUnique or skill.skillData.triggered or skill.skillTypes[SkillType.InbuiltTrigger] or skill.skillTypes[SkillType.Triggered]
local match1 = env.player.mainSkill.activeEffect.grantedEffect.fromItem and skill.socketGroup and skill.socketGroup.slot == env.player.mainSkill.socketGroup.slot
local match2 = (not env.player.mainSkill.activeEffect.grantedEffect.fromItem) and skill.socketGroup == env.player.mainSkill.socketGroup
if skill.skillTypes[SkillType.Channel] and skill ~= env.player.mainSkill and (match1 or match2) and not triggered then
if skill.skillTypes[SkillType.Channel] and skill ~= env.player.mainSkill and (match1 or match2) and not isTriggered(skill) then
source, trigRate = findTriggerSkill(env, skill, source, trigRate)
end
if skill.skillData.triggeredWhileChannelling and (match1 or match2) then
Expand Down Expand Up @@ -548,9 +551,8 @@ local function tawhoaChosenHandler(env)
local calcMode = env.mode == "CALCS" and "CALCS" or "MAIN"

for _, triggerSkill in ipairs(env.player.activeSkillList) do
local triggered = triggerSkill.skillData.triggeredByUnique or triggerSkill.skillData.triggered or triggerSkill.skillTypes[SkillType.InbuiltTrigger] or triggerSkill.skillTypes[SkillType.Triggered]
local isDisabled = triggerSkill.skillFlags and triggerSkill.skillFlags.disable
if triggerSkill ~= env.player.mainSkill and (triggerSkill.skillTypes[SkillType.Slam] or triggerSkill.skillTypes[SkillType.Melee]) and triggerSkill.skillTypes[SkillType.Attack] and not triggerSkill.skillTypes[SkillType.Vaal] and not triggered and not isDisabled and not triggerSkill.skillTypes[SkillType.Totem] and not triggerSkill.skillTypes[SkillType.SummonsTotem] then
if triggerSkill ~= env.player.mainSkill and (triggerSkill.skillTypes[SkillType.Slam] or triggerSkill.skillTypes[SkillType.Melee]) and triggerSkill.skillTypes[SkillType.Attack] and not triggerSkill.skillTypes[SkillType.Vaal] and not isTriggered(triggerSkill) and not isDisabled and not triggerSkill.skillTypes[SkillType.Totem] and not triggerSkill.skillTypes[SkillType.SummonsTotem] then
-- Grab a fully-processed by calcs.perform() version of the skill that Tawhoa's Chosen will use
local uuid = cacheSkillUUID(triggerSkill, env)
if not GlobalCache.cachedData[calcMode][uuid] then
Expand Down Expand Up @@ -723,8 +725,7 @@ local function defaultTriggerHandler(env, config)
-- Find trigger skill and triggered skills
if config.triggeredSkillCond or config.triggerSkillCond then
for _, skill in ipairs(env.player.activeSkillList) do
local triggered = skill.skillData.triggeredByUnique or skill.skillData.triggered or skill.skillTypes[SkillType.InbuiltTrigger] or skill.skillTypes[SkillType.Triggered]
if config.triggerSkillCond and config.triggerSkillCond(env, skill) and (not triggered or actor.mainSkill.skillFlags.globalTrigger or config.allowTriggered) and skill ~= actor.mainSkill then
if config.triggerSkillCond and config.triggerSkillCond(env, skill) and (not isTriggered(skill) or actor.mainSkill.skillFlags.globalTrigger or config.allowTriggered) and skill ~= actor.mainSkill then
source, trigRate, uuid = findTriggerSkill(env, skill, source, trigRate, config.comparer)
end
if config.triggeredSkillCond and config.triggeredSkillCond(env,skill) then
Expand Down Expand Up @@ -1334,8 +1335,7 @@ local configTable = {
local trigRate, source, uuid, useCastRate, triggeredSkills
triggeredSkills = {}
for _, skill in ipairs(env.player.activeSkillList) do
local triggered = skill.skillData.triggeredByUnique or skill.skillData.triggered or skill.skillTypes[SkillType.InbuiltTrigger] or skill.skillTypes[SkillType.Triggered]
if (skill.skillTypes[SkillType.Damage] or skill.skillTypes[SkillType.Attack] or skill.skillTypes[SkillType.Spell]) and not skill.skillFlags.aura and skill ~= env.player.mainSkill and not skill.skillData.triggeredByCraft and not skill.activeEffect.grantedEffect.fromItem and not triggered then
if (skill.skillTypes[SkillType.Damage] or skill.skillTypes[SkillType.Attack] or skill.skillTypes[SkillType.Spell]) and not skill.skillFlags.aura and skill ~= env.player.mainSkill and not skill.skillData.triggeredByCraft and not skill.activeEffect.grantedEffect.fromItem and not isTriggered(skill) then
source, trigRate, uuid = findTriggerSkill(env, skill, source, trigRate)
if skill.skillFlags and (skill.skillFlags.totem or skill.skillFlags.golem or skill.skillFlags.banner or skill.skillFlags.ballista) and skill.activeEffect.grantedEffect.castTime then
if skill.activeEffect.grantedEffect.levels ~= nil then
Expand Down Expand Up @@ -1627,18 +1627,11 @@ local function getUniqueItemTriggerName(skill)
end
end

local function logNoHandler(skillName, triggerName, uniqueName)
local message = s_format("WARNING: no handler for: %s, %s, %s ", skillName, triggerName, uniqueName)
return function()
ConPrintf(message)
end
end

function calcs.triggers(env)
if not env.player.mainSkill.skillFlags.disable and not env.player.mainSkill.skillData.limitedProcessing and not (env.player.mainSkill.activeEffect.srcInstance and env.player.mainSkill.activeEffect.srcInstance.noSupports) then
if not env.player.mainSkill.skillFlags.disable and not env.player.mainSkill.skillData.limitedProcessing then
local skillName = env.minion and env.minion.mainSkill.activeEffect.grantedEffect.name or env.player.mainSkill.activeEffect.grantedEffect.name
local triggerName = env.player.mainSkill.triggeredBy and env.player.mainSkill.triggeredBy.grantedEffect.name
local uniqueName = env.player.mainSkill.skillTypes[SkillType.Triggerable] and getUniqueItemTriggerName(env.player.mainSkill)
local uniqueName = isTriggered(env.player.mainSkill) and getUniqueItemTriggerName(env.player.mainSkill)
local skillNameLower = skillName and skillName:lower()
local triggerNameLower = triggerName and triggerName:lower()
local awakenedTriggerNameLower = triggerNameLower and triggerNameLower:gsub("^awakened ", "")
Expand All @@ -1647,9 +1640,6 @@ function calcs.triggers(env)
config = config or triggerNameLower and configTable[triggerNameLower] and configTable[triggerNameLower](env)
config = config or awakenedTriggerNameLower and configTable[awakenedTriggerNameLower] and configTable[awakenedTriggerNameLower](env)
config = config or uniqueNameLower and configTable[uniqueNameLower] and configTable[uniqueNameLower](env)
if not (triggerNameLower and configTable[triggerNameLower]) and not (awakenedTriggerNameLower and configTable[awakenedTriggerNameLower]) and not (uniqueNameLower and configTable[uniqueNameLower]) then
logNoHandler(skillName, triggerName, uniqueName)(env)
end
if config then
config.actor = config.actor or env.player
config.triggerName = config.triggerName or triggerName or uniqueName or skillName
Expand Down