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

Tincture effect fixes #8151

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
168 changes: 127 additions & 41 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,18 @@ local m_floor = math.floor
local dmgTypeList = {"Physical", "Lightning", "Cold", "Fire", "Chaos"}
local catalystList = {"Abrasive", "Accelerating", "Fertile", "Imbued", "Intrinsic", "Noxious", "Prismatic", "Tempering", "Turbulent", "Unstable"}
local catalystTags = {
{ "attack" },
{ "speed" },
{ "life", "mana", "resource" },
{ "caster" },
{ "jewellery_attribute", "attribute" },
{ "physical_damage", "chaos_damage" },
{ "jewellery_resistance", "resistance" },
{ "jewellery_defense", "defences" },
{ "jewellery_elemental" ,"elemental_damage" },
{ "critical" },
{ attack = true },
{ speed = true },
{ life = true, mana = true, resource = true },
{ caster = true },
{ jewellery_attribute = true, attribute = true },
{ physical_damage = true, chaos_damage = true },
{ jewellery_resistance = true, resistance = true },
{ jewellery_defense = true, defences = true },
{ jewellery_elemental = true ,elemental_damage = true },
{ critical = true },
}

local function getCatalystScalar(catalystId, tags, quality)
if not catalystId or type(catalystId) ~= "number" or not catalystTags[catalystId] or not tags or type(tags) ~= "table" or #tags == 0 then
return 1
end
if not quality then
quality = 20
end

-- Create a fast lookup table for all provided tags
local tagLookup = {}
for _, curTag in ipairs(tags) do
tagLookup[curTag] = true;
end

-- Find if any of the catalyst's tags match the provided tags
for _, catalystTag in ipairs(catalystTags[catalystId]) do
if tagLookup[catalystTag] then
return (100 + quality) / 100
end
end
return 1
end

local influenceInfo = itemLib.influenceInfo

local ItemClass = newClass("Item", function(self, raw, rarity, highQuality)
Expand Down Expand Up @@ -342,6 +319,13 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
l = l + 1
end
end
-- preprocess looking for modifier effect multipliers
local modLineMultipliers = {}
for _, line in ipairs(self.rawLines) do
if line:find("effect") then
modLineMultipliers["localEffect"] = (modLineMultipliers["localEffect"] or 0) + (line:match("^(%d+)%% increased effect") or 0) - (line:match("^(%d+)%% reduced effect") or 0)
end
end
self.checkSection = false
self.sockets = { }
self.classRequirementModLines = { }
Expand Down Expand Up @@ -721,14 +705,41 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
foundImplicit = true
gameModeStage = "IMPLICIT"
end
local catalystScalar = getCatalystScalar(self.catalyst, modLine.modTags, self.catalystQuality)
local rangedLine = itemLib.applyRange(line, 1, catalystScalar)
local rangeScalar = 1
if self.catalyst and catalystTags[self.catalyst] then
for _, curTag in ipairs(modLine.modTags) do
if catalystTags[self.catalyst][curTag] then
rangeScalar = (100 + self.catalystQuality) / 100
break
end
end
elseif self.base.tincture then
for _, curTag in ipairs(modLine.modTags) do
if curTag == "tincture" then
rangeScalar = (100 + (modLineMultipliers["localEffect"] or 0)) / 100 * (100 + (self.quality or 20)) / 100
break
end
end
end
if not self.base.tincture then
for searchTag, mult in pairs(modLineMultipliers) do
if searchTag ~= "localEffect" then
for _, curTag in ipairs(modLine.modTags) do
if curTag == searchTag then
rangeScalar = rangeScalar * mult
break
end
end
end
end
end
local rangedLine = itemLib.applyRange(line, 1, rangeScalar)
local modList, extra = modLib.parseMod(rangedLine)
if (not modList or extra) and self.rawLines[l+1] then
-- Try to combine it with the next line
local nextLine = self.rawLines[l+1]:gsub("%b{}", ""):gsub(" ?%(%l+%)","")
local combLine = line.." "..nextLine
rangedLine = itemLib.applyRange(combLine, 1, catalystScalar)
rangedLine = itemLib.applyRange(combLine, 1, rangeScalar)
modList, extra = modLib.parseMod(rangedLine, true)
if modList and not extra then
line = line.."\n"..nextLine
Expand Down Expand Up @@ -778,7 +789,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
if modList then
modLine.modList = modList
modLine.extra = extra
modLine.valueScalar = catalystScalar
modLine.valueScalar = rangeScalar
modLine.range = modLine.range or main.defaultItemAffixQuality
t_insert(modLines, modLine)
if mode == "GAME" then
Expand Down Expand Up @@ -1163,6 +1174,23 @@ function ItemClass:Craft()
self.nameSuffix = ""
self.requirements.level = self.base.req.level
local statOrder = { }
-- preprocess looking for modifier effect multipliers
local modLineMultipliers = {}
if self.base.tincture then
for _, list in ipairs({self.prefixes,self.suffixes}) do
for _, affix in ipairs(list) do
local mod = self.affixes[affix.modId]
if mod then
for _, line in ipairs(mod) do
if line:find("effect") then
line = itemLib.applyRange(line, affix.range or 0.5, nil)
modLineMultipliers["localEffect"] = (modLineMultipliers["localEffect"] or 0) + (line:match("^(%d+)%% increased effect") or 0) - (line:match("^(%d+)%% reduced effect") or 0)
end
end
end
end
end
end
for _, list in ipairs({self.prefixes,self.suffixes}) do
for i = 1, self.affixLimit / 2 do
local affix = list[i]
Expand All @@ -1176,8 +1204,32 @@ function ItemClass:Craft()
elseif mod.type == "Suffix" then
self.nameSuffix = " " .. mod.affix
end
self.requirements.level = m_max(self.requirements.level or 0, m_floor(mod.level * 0.8))
local rangeScalar = getCatalystScalar(self.catalyst, mod.modTags, self.catalystQuality)
self.requirements.level = m_max(self.requirements.level or 0, m_floor(mod.level * 0.8))
local rangeScalar = 1
if self.catalyst and catalystTags[self.catalyst] then
for _, curTag in ipairs(mod.modTags) do
if catalystTags[self.catalyst][curTag] then
rangeScalar = (100 + self.catalystQuality) / 100
break
end
end
elseif self.base.tincture and mod.type == "Suffix" then
rangeScalar = (100 + (modLineMultipliers["localEffect"] or 0)) / 100 * (100 + (self.quality or 20)) / 100
end
if not self.base.tincture then
for searchTag, mult in pairs(modLineMultipliers) do
if searchTag == mod.type then
rangeScalar = rangeScalar * mult
else
for _, curTag in ipairs(modLine.modTags) do
if curTag == searchTag then
rangeScalar = rangeScalar * mult
break
end
end
end
end
end
for i, line in ipairs(mod) do
line = itemLib.applyRange(line, affix.range or 0.5, rangeScalar)
local order = mod.statOrder[i]
Expand Down Expand Up @@ -1569,6 +1621,15 @@ function ItemClass:BuildModList()
end
end
end
-- preprocess looking for modifier effect multipliers
local modLineMultipliers = {}
if self.base.tincture then
for _, modLine in ipairs(self.explicitModLines) do
if modLine.line:find("effect") then
modLineMultipliers["localEffect"] = (modLineMultipliers["localEffect"] or 0) + (modLine.line:match("^(%d+)%% increased effect") or 0) - (modLine.line:match("^(%d+)%% reduced effect") or 0)
end
end
end
local function processModLine(modLine)
if self:CheckModLineVariant(modLine) then
-- special section for variant over-ride of pre-modifier item parameters
Expand All @@ -1581,9 +1642,34 @@ function ItemClass:BuildModList()
-- Check if line actually has a range
if modLine.line:find("%((%-?%d+%.?%d*)%-(%-?%d+%.?%d*)%)") then
local strippedModeLine = modLine.line:gsub("\n"," ")
local catalystScalar = getCatalystScalar(self.catalyst, modLine.modTags, self.catalystQuality)
local rangeScalar = 1
if self.catalyst and catalystTags[self.catalyst] then
for _, curTag in ipairs(modLine.modTags) do
if catalystTags[self.catalyst][curTag] then
rangeScalar = (100 + self.catalystQuality) / 100
break
end
end
elseif self.base.tincture then
for _, curTag in ipairs(modLine.modTags) do
if curTag == "tincture" then
rangeScalar = (100 + (modLineMultipliers["localEffect"] or 0)) / 100 * (100 + (self.quality or 20)) / 100
break
end
end
end
if not self.base.tincture then
for searchTag, mult in pairs(modLineMultipliers) do
for _, curTag in ipairs(modLine.modTags) do
if curTag == searchTag then
rangeScalar = rangeScalar * mult
break
end
end
end
end
-- Put the modified value into the string
local line = itemLib.applyRange(strippedModeLine, modLine.range, catalystScalar)
local line = itemLib.applyRange(strippedModeLine, modLine.range, rangeScalar)
-- Check if we can parse it before adding the mods
local list, extra = modLib.parseMod(line)
if list and not extra then
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3649,7 +3649,7 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
if item.rarity == "MAGIC" then
effectInc = effectInc + modDB:Sum("INC", { actor = "player" }, "MagicTinctureEffect")
end
local effectMod = (1 + (tinctureData.effectInc + effectInc) / 100) * (1 + (item.quality or 0) / 100)
local effectMod = (1 + (effectInc) / 100)
if effectMod ~= 1 then
t_insert(stats, s_format("^8Tincture effect modifier: ^7%+d%%", effectMod * 100 - 100))
end
Expand Down
18 changes: 9 additions & 9 deletions src/Data/Bases/tincture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ itemBases["Prismatic Tincture"] = {
type = "Tincture",
tags = { tincture = true, default = true, },
implicit = "(70-100)% increased Elemental Damage with Melee Weapons",
implicitModTypes = { { "elemental_damage", "damage", "elemental", "attack" }, },
implicitModTypes = { { "elemental_damage", "damage", "elemental", "attack", "tincture" }, },
tincture = { manaBurn = 0.7, cooldown = 8 },
req = { },
}
Expand All @@ -22,63 +22,63 @@ itemBases["Ironwood Tincture"] = {
type = "Tincture",
tags = { tincture = true, default = true, },
implicit = "40% reduced Enemy Stun Threshold with Melee Weapons\n(15-25)% increased Stun Duration with Melee Weapons",
implicitModTypes = { { "attack" }, { "attack" }, },
implicitModTypes = { { "attack", "tincture" }, { "attack", "tincture" }, },
tincture = { manaBurn = 0.9, cooldown = 10 },
req = { },
}
itemBases["Ashbark Tincture"] = {
type = "Tincture",
tags = { tincture = true, default = true, },
implicit = "25% chance to Ignite with Melee Weapons\n(60-90)% increased Damage with Ignite from Melee Weapons",
implicitModTypes = { { "elemental_damage", "damage", "elemental", "fire", "attack", "ailment" }, { "elemental_damage", "damage", "elemental", "fire", "attack", "ailment" }, },
implicitModTypes = { { "elemental_damage", "damage", "elemental", "fire", "attack", "ailment", "tincture" }, { "elemental_damage", "damage", "elemental", "fire", "attack", "ailment", "tincture" }, },
tincture = { manaBurn = 0.6, cooldown = 7 },
req = { },
}
itemBases["Borealwood Tincture"] = {
type = "Tincture",
tags = { tincture = true, default = true, },
implicit = "25% chance to Freeze with Melee Weapons\n(25-35)% increased Effect of Chill from Melee Weapons",
implicitModTypes = { { "elemental_damage", "damage", "elemental", "cold", "attack", "ailment" }, { "elemental_damage", "damage", "elemental", "cold", "attack", "ailment" }, },
implicitModTypes = { { "elemental_damage", "damage", "elemental", "cold", "attack", "ailment", "tincture" }, { "elemental_damage", "damage", "elemental", "cold", "attack", "ailment", "tincture" }, },
tincture = { manaBurn = 0.6, cooldown = 7 },
req = { },
}
itemBases["Fulgurite Tincture"] = {
type = "Tincture",
tags = { tincture = true, default = true, },
implicit = "25% chance to Shock with Melee Weapons\n(25-35)% increased Effect of Shock from Melee Weapons",
implicitModTypes = { { "elemental_damage", "damage", "elemental", "lightning", "attack", "ailment" }, { "elemental_damage", "damage", "elemental", "lightning", "attack", "ailment" }, },
implicitModTypes = { { "elemental_damage", "damage", "elemental", "lightning", "attack", "ailment", "tincture" }, { "elemental_damage", "damage", "elemental", "lightning", "attack", "ailment", "tincture" }, },
tincture = { manaBurn = 0.6, cooldown = 7 },
req = { },
}
itemBases["Poisonberry Tincture"] = {
type = "Tincture",
tags = { tincture = true, default = true, },
implicit = "20% chance to Poison with Melee Weapons\n(60-90)% increased Damage with Poison from Melee Weapons",
implicitModTypes = { { "chaos_damage", "poison", "damage", "chaos", "attack", "ailment" }, { "chaos_damage", "poison", "damage", "chaos", "attack", "ailment" }, },
implicitModTypes = { { "chaos_damage", "poison", "damage", "chaos", "attack", "ailment", "tincture" }, { "chaos_damage", "poison", "damage", "chaos", "attack", "ailment", "tincture" }, },
tincture = { manaBurn = 0.7, cooldown = 6 },
req = { },
}
itemBases["Blood Sap Tincture"] = {
type = "Tincture",
tags = { tincture = true, default = true, },
implicit = "20% chance to cause Bleeding with Melee Weapons\n(60-90)% increased Damage with Bleeding from Melee Weapons",
implicitModTypes = { { "physical_damage", "bleed", "damage", "physical", "attack", "ailment" }, { "physical_damage", "bleed", "damage", "physical", "attack", "ailment" }, },
implicitModTypes = { { "physical_damage", "bleed", "damage", "physical", "attack", "ailment", "tincture" }, { "physical_damage", "bleed", "damage", "physical", "attack", "ailment", "tincture" }, },
tincture = { manaBurn = 0.7, cooldown = 6 },
req = { },
}
itemBases["Oakbranch Tincture"] = {
type = "Tincture",
tags = { tincture = true, default = true, },
implicit = "Gain 3 Rage on Melee Weapon Hit",
implicitModTypes = { { "attack" }, },
implicitModTypes = { { "attack", "tincture" }, },
tincture = { manaBurn = 0.5, cooldown = 8 },
req = { },
}
itemBases["Sporebloom Tincture"] = {
type = "Tincture",
tags = { tincture = true, default = true, },
implicit = "25% chance to Blind Enemies on Hit with Melee Weapons\n(25-35)% increased Effect of Blind from Melee Weapons",
implicitModTypes = { { "attack" }, { "attack" }, },
implicitModTypes = { { "attack", "tincture" }, { "attack", "tincture" }, },
tincture = { manaBurn = 0.9, cooldown = 8 },
req = { },
}
32 changes: 16 additions & 16 deletions src/Data/Uniques/Special/New.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,39 +113,39 @@ Sporebloom Tincture
League: Settlers of Kalguur
Requires Level 52
Implicits: 2
25% chance to Blind Enemies on Hit with Melee Weapons
(25-35)% increased Effect of Blind from Melee Weapons
Melee Weapon Hits Inflict (2-3) Withered Debuffs for 2 seconds
(20-30)% chance to inflict a Grasping Vine on Melee Weapon Hit
{tags:tincture}25% chance to Blind Enemies on Hit with Melee Weapons
{tags:tincture}(25-35)% increased Effect of Blind from Melee Weapons
{tags:tincture}Melee Weapon Hits Inflict (2-3) Withered Debuffs for 2 seconds
{tags:tincture}(20-30)% chance to inflict a Grasping Vine on Melee Weapon Hit
]],[[
Wildfire Phloem
Ashbark Tincture
League: Settlers of Kalguur
Requires Level 32
Implicits: 2
25% chance to Ignite with Melee Weapons
(60-90)% increased Damage with Ignite from Melee Weapons
-1 Fire Damage taken from Hits per Mana Burn
(15-25)% chance to refresh Ignite Duration on Melee Weapon Hit
Cover Full Life Enemies in Ash for (4-10) seconds on Melee Weapon hit
{tags:tincture}25% chance to Ignite with Melee Weapons
{tags:tincture}(60-90)% increased Damage with Ignite from Melee Weapons
{tags:tincture}-1 Fire Damage taken from Hits per Mana Burn
{tags:tincture}(15-25)% chance to refresh Ignite Duration on Melee Weapon Hit
{tags:tincture}Cover Full Life Enemies in Ash for (4-10) seconds on Melee Weapon hit
]],[[
Mightblood Ire
Ironwood Tincture
League: Settlers of Kalguur
Requires Level 18
Implicits: 2
40% reduced Enemy Stun Threshold with Melee Weapons
(15-25)% increased Stun Duration with Melee Weapons
Melee Strike Skills deal Splash Damage to surrounding targets
{tags:tincture}40% reduced Enemy Stun Threshold with Melee Weapons
{tags:tincture}(15-25)% increased Stun Duration with Melee Weapons
{tags:tincture}Melee Strike Skills deal Splash Damage to surrounding targets
(25-15)% reduced Mana Burn rate
]],[[
Sap of the Seasons
Prismatic Tincture
League: Settlers of Kalguur
Requires Level 18
Implicits: 1
(70-100)% increased Elemental Damage with Melee Weapons
Melee Weapon Damage Penetrates 1% Elemental Resistance per Mana Burn, up to a maximum of 200%
{tags:tincture}(70-100)% increased Elemental Damage with Melee Weapons
{tags:tincture}Melee Weapon Damage Penetrates 1% Elemental Resistance per Mana Burn, up to a maximum of 200%
(20-40)% increased Cooldown Recovery Rate
(35--35)% increased Mana Burn rate
]],[[
Expand All @@ -154,10 +154,10 @@ Oakbranch Tincture
League: Settlers of Kalguur
Requires Level 18
Implicits: 1
Gain 3 Rage on Melee Weapon Hit
{tags:tincture}Gain 3 Rage on Melee Weapon Hit
Does not inflict Mana Burn over time
Inflicts Mana Burn on you when you Hit an Enemy with a Melee Weapon
(1-5)% increased Rarity of Items found per Mana Burn, up to a maximum of 100%
{tags:tincture}(1-5)% increased Rarity of Items found per Mana Burn, up to a maximum of 100%
Melee Weapon Attacks have Culling Strike
]],[[
Admiral's Arrogance
Expand Down
Loading
Loading