diff --git a/spec/System/TestItemParse_spec.lua b/spec/System/TestItemParse_spec.lua index fe48536c59..8654ce88d4 100644 --- a/spec/System/TestItemParse_spec.lua +++ b/spec/System/TestItemParse_spec.lua @@ -73,6 +73,26 @@ describe("TestItemParse", function() assert.are.equals(12, item.quality) end) + it("parses ' spell' as a composable Spell + element tag (issue #2226)", function() + local item = new("Item", [[ + Rarity: Rare + Xoph's Test Band + Amethyst Ring + Implicits: 0 + +5% to Fire Spell Critical Hit Chance + +30% to Fire Spell Critical Damage Bonus + +7% to Cold Spell Critical Hit Chance + ]]) + -- the "fire spell" tag composes with any crit stat (chance and damage bonus) + assert.are.equals(5, item.baseModList:Sum("BASE", { flags = ModFlag.Spell, keywordFlags = KeywordFlag.Fire }, "CritChance")) + assert.are.equals(30, item.baseModList:Sum("BASE", { flags = ModFlag.Spell, keywordFlags = KeywordFlag.Fire }, "CritMultiplier")) + -- ...and works per element + assert.are.equals(7, item.baseModList:Sum("BASE", { flags = ModFlag.Spell, keywordFlags = KeywordFlag.Cold }, "CritChance")) + -- still correctly scoped: not attacks, and not the wrong element + assert.are.equals(0, item.baseModList:Sum("BASE", { flags = ModFlag.Attack, keywordFlags = KeywordFlag.Fire }, "CritChance")) + assert.are.equals(0, item.baseModList:Sum("BASE", { flags = ModFlag.Spell, keywordFlags = KeywordFlag.Cold }, "CritMultiplier")) + end) + --TODO: impl sockets for POB2 --it("Sockets", function() --end) diff --git a/src/Modules/ModParser.lua b/src/Modules/ModParser.lua index 3dd2c16b06..01f20600cd 100644 --- a/src/Modules/ModParser.lua +++ b/src/Modules/ModParser.lua @@ -1037,6 +1037,10 @@ local modFlagList = { ["with ranged weapons"] = { flags = bor(ModFlag.WeaponRanged, ModFlag.Hit) }, -- Skill types ["spell"] = { flags = ModFlag.Spell }, + ["fire spell"] = { flags = ModFlag.Spell, keywordFlags = KeywordFlag.Fire }, + ["cold spell"] = { flags = ModFlag.Spell, keywordFlags = KeywordFlag.Cold }, + ["lightning spell"] = { flags = ModFlag.Spell, keywordFlags = KeywordFlag.Lightning }, + ["chaos spell"] = { flags = ModFlag.Spell, keywordFlags = KeywordFlag.Chaos }, ["for spells"] = { flags = ModFlag.Spell }, ["for spell skills"] = { flags = ModFlag.Spell }, ["for spell damage"] = { flags = ModFlag.Spell },