From fd4463a396c93b2e2d05b5b370827c03d82cc4c8 Mon Sep 17 00:00:00 2001 From: Paliak <91493239+Paliak@users.noreply.github.com> Date: Sat, 31 Aug 2024 03:56:44 +0200 Subject: [PATCH] FEAT: implement settlers trigger enchant (#8240) --- spec/System/TestTriggers_spec.lua | 20 ++++++++++++++++++++ src/Data/Skills/other.lua | 23 +++++++++++++++++++++++ src/Export/Skills/other.txt | 9 +++++++++ src/Modules/CalcTriggers.lua | 9 +++++++++ src/Modules/ModParser.lua | 1 + 5 files changed, 62 insertions(+) diff --git a/spec/System/TestTriggers_spec.lua b/spec/System/TestTriggers_spec.lua index c04b05e93d..649fd67ff2 100644 --- a/spec/System/TestTriggers_spec.lua +++ b/spec/System/TestTriggers_spec.lua @@ -1339,4 +1339,24 @@ describe("TestTriggers", function() assert.True(build.calcsTab.mainOutput.SkillTriggerRate ~= nil) end) + + it("Trigger settlers enchant", function() + build.itemsTab:CreateDisplayItemFromRaw([[Physical 1H Axe + Runic Hatchet + Quality: 0 + Sockets: R-R-R + LevelReq: 71 + Implicits: 0 + Trigger a Socketed Fire Spell on Hit, with a 0.25 second Cooldown]]) + build.itemsTab:AddDisplayItem() + runCallback("OnFrame") + + build.skillsTab:PasteSocketGroup("Slot: Weapon 1\nFireball 20/0 Default 1\n") + runCallback("OnFrame") + + build.skillsTab:PasteSocketGroup("Smite 20/0 Default 1\n") + runCallback("OnFrame") + + assert.True(build.calcsTab.mainOutput.SkillTriggerRate ~= nil) + end) end) diff --git a/src/Data/Skills/other.lua b/src/Data/Skills/other.lua index 7a44f899be..9ae995e4fa 100644 --- a/src/Data/Skills/other.lua +++ b/src/Data/Skills/other.lua @@ -3856,6 +3856,29 @@ skills["SupportUniqueCastCurseOnCurse"] = { [1] = { storedUses = 1, levelRequirement = 0, cooldown = 0.25, }, }, } +skills["SupportTriggerFireSpellOnHit"] = { + name = "SupportTriggerFireSpellOnHit", + hidden = true, + color = 4, + support = true, + requireSkillTypes = { SkillType.Spell, SkillType.Triggerable, SkillType.AND, SkillType.Fire, SkillType.AND, }, + addSkillTypes = { SkillType.Triggered, SkillType.Cooldown, }, + excludeSkillTypes = { SkillType.Trapped, SkillType.RemoteMined, SkillType.SummonsTotem, SkillType.Aura, SkillType.InbuiltTrigger, }, + isTrigger = true, + statDescriptionScope = "gem_stat_descriptions", + fromItem = true, + statMap = { + ["spell_is_triggered_on_hit"] = { + skill("triggeredBySettlersEnchantTrigger", true) + } + }, + stats = { + "spell_is_triggered_on_hit", + }, + levels = { + [1] = { storedUses = 1, levelRequirement = 1, cooldown = 0.25, }, + }, +} skills["EnemyExplode"] = { name = "On Kill Monster Explosion", hidden = true, diff --git a/src/Export/Skills/other.txt b/src/Export/Skills/other.txt index ce71a86798..8f4d05c5e2 100644 --- a/src/Export/Skills/other.txt +++ b/src/Export/Skills/other.txt @@ -1044,6 +1044,15 @@ local skills, mod, flag, skill = ... fromItem = true, #mods +#skill SupportTriggerFireSpellOnHit + fromItem = true, + statMap = { + ["spell_is_triggered_on_hit"] = { + skill("triggeredBySettlersEnchantTrigger", true) + } + }, +#mods + skills["EnemyExplode"] = { name = "On Kill Monster Explosion", hidden = true, diff --git a/src/Modules/CalcTriggers.lua b/src/Modules/CalcTriggers.lua index 4bcfd86730..f1c9607fc1 100644 --- a/src/Modules/CalcTriggers.lua +++ b/src/Modules/CalcTriggers.lua @@ -1399,6 +1399,15 @@ local configTable = { return slotMatch(env, skill) and skill.triggeredBy and calcLib.canGrantedEffectSupportActiveSkill(skill.triggeredBy.grantedEffect, skill) end} end, + ["supporttriggerfirespellonhit"] = function(env) + return {triggerSkillCond = function(env, skill) + -- Skill is triggered only when the weapon with the enchant on it hits + return skill.skillTypes[SkillType.Melee] + end, + triggeredSkillCond = function(env, skill) + return skill.skillData.triggeredBySettlersEnchantTrigger and slotMatch(env, skill) + end} + end, } -- Find unique item trigger name diff --git a/src/Modules/ModParser.lua b/src/Modules/ModParser.lua index 182b8556a3..d08c974299 100644 --- a/src/Modules/ModParser.lua +++ b/src/Modules/ModParser.lua @@ -2783,6 +2783,7 @@ local specialModList = { mod("KitavaRequiredManaCost", "BASE", tonumber(amount), "Kitava's Thirst"), mod("ExtraSupport", "LIST", { skillId = "SupportCastOnManaSpent", level = 1 }, { type = "SocketedIn", slotName = "{SlotName}" }), } end, + ["trigger a socketed fire spell on hit, with a ([%d%.]+) second cooldown"] = { mod("ExtraSupport", "LIST", { skillId = "SupportTriggerFireSpellOnHit", level = 1 }, { type = "SocketedIn", slotName = "{SlotName}" }) }, -- Socketed gem modifiers ["([%+%-]%d+) to level of socketed gems"] = function(num) return { mod("GemProperty", "LIST", { keyword = "all", key = "level", value = num }, { type = "SocketedIn", slotName = "{SlotName}" }) } end, ["([%+%-]%d+)%%? to (%a+) of socketed ?([%a%- ]*) gems"] = function(num, _, property, type)