Skip to content
Open
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
20 changes: 20 additions & 0 deletions spec/System/TestItemParse_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@ describe("TestItemParse", function()
assert.are.equals(12, item.quality)
end)

it("parses '<element> 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)
Expand Down
4 changes: 4 additions & 0 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
Loading