Skip to content
Merged
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
30 changes: 26 additions & 4 deletions spec/System/TestSkills_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("TestSkills", function()
teardown(function()
-- newBuild() takes care of resetting everything in setup()
end)


it("uses granted effect minion list when active skill minion list is missing", function()
local srcInstance = { statSet = { }, skillPart = { }, nameSpec = "Spectre: Test" }
Expand Down Expand Up @@ -113,7 +113,7 @@ describe("TestSkills", function()
it("Test cost efficiency with cost modifiers", function()
-- Test interaction between cost efficiency and cost multipliers
build.skillsTab:PasteSocketGroup("Ball Lightning 1/0 1\n")

-- Add cost multiplier and efficiency
build.configTab.input.customMods = "50% increased Mana Cost\n50% increased Mana Cost Efficiency"
build.configTab:BuildModList()
Expand All @@ -123,6 +123,28 @@ describe("TestSkills", function()
assert.True(math.abs(finalCost - 8.67) < 0.1) -- floor(9 * 1.5) / 1.5
end)

it("Test socket group pasting with corruption levels and count", function()
build.skillsTab:PasteSocketGroup("Wave of Frost 20/0 3 C+1\n Culmination I 1/0 1")
assert.are.equals(3, build.skillsTab.socketGroupList[1].gemList[1].count)

runCallback("OnFrame")

assert.are.equals(3, build.skillsTab.socketGroupList[1].gemList[1].count)
assert.are.equals(true, build.skillsTab.socketGroupList[1].gemList[1].corrupted)
assert.are.equals(1, build.skillsTab.socketGroupList[1].gemList[1].corruptLevel)

newBuild()
-- Support gem first this time, with negative corruption value.
build.skillsTab:PasteSocketGroup("Culmination I 1/0 1\nWave of Frost 20/20 2 C-1")
assert.are.equals(2, build.skillsTab.socketGroupList[1].gemList[2].count)

runCallback("OnFrame")

assert.are.equals(2, build.skillsTab.socketGroupList[1].gemList[2].count)
assert.are.equals(true, build.skillsTab.socketGroupList[1].gemList[2].corrupted)
assert.are.equals(-1, build.skillsTab.socketGroupList[1].gemList[2].corruptLevel)
end)

it("Fractional skill count scales Full DPS", function()
build.skillsTab:PasteSocketGroup("Ball Lightning 20/0 1")
build.skillsTab.socketGroupList[1].includeInFullDPS = true
Expand All @@ -145,7 +167,7 @@ describe("TestSkills", function()
it("Test mana cost efficiency with support gems", function()
-- Test interaction between cost efficiency and cost multipliers
build.skillsTab:PasteSocketGroup("Contagion 6/0 1\nMagnified Area I 1/0 1")

-- Add efficiency
build.configTab.input.customMods = "36% increased Mana Cost Efficiency"
build.configTab:BuildModList()
Expand Down Expand Up @@ -575,7 +597,7 @@ describe("TestSkills", function()
-- if one works they all do, surely
assert.True(build.calcsTab.mainOutput.TotalDPS > baseFireball)
end)

it("Test Minion Pact damage requires a minion in your presence", function()
build.itemsTab:CreateDisplayItemFromRaw([[
New Item
Expand Down
20 changes: 12 additions & 8 deletions src/Classes/GemSelectControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ function GemSelectClass:CalcOutputWithThisGem(calcFunc, gemData, useFullDPS)
enableGlobal2 = true,
gemId = gemData.id,
nameSpec = gemData.name,
skillId = gemData.grantedEffectId
skillId = gemData.grantedEffectId,
corrupted = self.skillsTab.defaultCorruptionState,
corruptLevel = self.skillsTab.defaultCorruptionLevel,
}
end

Expand All @@ -82,16 +84,16 @@ function GemSelectClass:CalcOutputWithThisGem(calcFunc, gemData, useFullDPS)
else
gemList[self.index] = nil
end

self.skillsTab.displayGroup.displayGemList = displayGemList

return output, gemInstance
end

function GemSelectClass:PopulateGemList()
wipeTable(self.gems)
local showAll = self.skillsTab.showSupportGemTypes == "ALL"
local showAwakened = self.skillsTab.showSupportGemTypes == "AWAKENED"
local showLineage = self.skillsTab.showSupportGemTypes == "LINEAGE"
local showNormal = self.skillsTab.showSupportGemTypes == "NORMAL"
local matchLevel = self.skillsTab.defaultGemLevel == "characterLevel"
local characterLevel = self.skillsTab.build and self.skillsTab.build.characterLevel or 1
Expand All @@ -110,8 +112,8 @@ function GemSelectClass:FilterSupport(gemId, gemData)
local showSupportTypes = self.skillsTab.showSupportGemTypes
return (not gemData.grantedEffect.support
or showSupportTypes == "ALL"
or (showSupportTypes == "NORMAL" and not gemData.grantedEffect.plusVersionOf)
or (showSupportTypes == "AWAKENED" and gemData.grantedEffect.plusVersionOf))
or (showSupportTypes == "NORMAL" and not gemData.grantedEffect.isLineage)
or (showSupportTypes == "LINEAGE" and gemData.grantedEffect.isLineage))
end

function GemSelectClass:BuildList(buf)
Expand Down Expand Up @@ -465,7 +467,9 @@ function GemSelectClass:Draw(viewPort, noTooltip)
nameSpec = gemData.name,
skillId = gemData.grantedEffectId,
displayEffect = nil,
gemData = gemData
gemData = gemData,
corruptLevel = self.skillsTab.defaultCorruptionLevel,
corrupted = self.skillsTab.defaultCorruptionState == true,
}
self:AddGemTooltip(gemInstance)
self.tooltip:AddSeparator(10)
Expand Down Expand Up @@ -569,7 +573,7 @@ function GemSelectClass:OnFocusLost()
if self.noMatches then
self:SetText("")
end
self:UpdateGem(true,true, true)
self:UpdateGem(true, true, true)
end
end

Expand Down
42 changes: 37 additions & 5 deletions src/Classes/GemTooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,39 @@ local function addGrantedEffectInfo(tooltip, build, gemInstance, grantedEffect,
tooltip:AddLine(fontSizeBig, string.format("^x7F7F7FTier: ^7%d", gemInstance.gemData.Tier), "FONTIN SC")
end
if not levelRange and addReq and not grantedEffect.support then
tooltip:AddLine(fontSizeBig, string.format("^x7F7F7FLevel: ^7%d%s%s",
gemInstance.level,
((displayInstance.level > gemInstance.level) and " (" .. colorCodes.MAGIC .. "+" .. (displayInstance.level - gemInstance.level) .. "^7)") or ((displayInstance.level < gemInstance.level) and " (" .. colorCodes.WARNING .. "-" .. (gemInstance.level - displayInstance.level) .. "^7)") or "",
(gemInstance.level >= gemInstance.gemData.naturalMaxLevel) and " (Max)" or ""
), "FONTIN SC")
local totalGlobalLevels = 0
if displayInstance.gemPropertyInfo then
for i, prop in ipairs(displayInstance.gemPropertyInfo) do
if prop.value and prop.value.key == "level" and prop.value.value then
totalGlobalLevels = totalGlobalLevels + prop.value.value
end
end
end
local totalLevel
local corruptLevel = displayInstance.corruptLevel or 0
totalLevel = m_max(displayInstance.level, (gemInstance.level + corruptLevel)) -- Needed for tooltip comparison for dropdown gems. Otherwise they only show level 20 when corrupted.
if corruptLevel ~= 0 or
totalGlobalLevels > 0 or
(displayInstance.level - gemInstance.level - corruptLevel > 0)
then
tooltip:AddLine(fontSizeBig, string.format("^x7F7F7FLevel: ^7" .. colorCodes.MAGIC .. totalLevel), "FONTIN SC")
tooltip:AddLine(fontSizeBig, "^7" .. gemInstance.level .. " Levels from Gem" .. ((gemInstance.level >= gemInstance.gemData.naturalMaxLevel) and " (Max)" or ""), "FONTIN SC")
else
tooltip:AddLine(fontSizeBig, string.format("^x7F7F7FLevel: ^7" .. totalLevel .. ((gemInstance.level >= gemInstance.gemData.naturalMaxLevel) and " (Max)" or "")), "FONTIN SC")
end
if corruptLevel > 0 then
tooltip:AddLine(fontSizeBig, colorCodes.MAGIC .. "+" .. corruptLevel .. " Level from Corruption", "FONTIN SC")
elseif corruptLevel < 0 then
tooltip:AddLine(fontSizeBig, colorCodes.MAGIC .. corruptLevel .. " Level from Corruption", "FONTIN SC")
end
if totalGlobalLevels > 0 then
tooltip:AddLine(fontSizeBig, colorCodes.MAGIC .. "+" .. totalGlobalLevels .. " Levels from Global Modifiers", "FONTIN SC")
if totalLevel - gemInstance.level - corruptLevel - totalGlobalLevels > 0 then
tooltip:AddLine(fontSizeBig, colorCodes.MAGIC .. "+" .. totalLevel - gemInstance.level - corruptLevel - totalGlobalLevels .. " Levels from Supports", "FONTIN SC")
end
elseif totalLevel - gemInstance.level - corruptLevel > 0 then
tooltip:AddLine(fontSizeBig, colorCodes.MAGIC .. "+" .. totalLevel - gemInstance.level - corruptLevel .. " Levels from Supports", "FONTIN SC")
end
end

if not levelRange and grantedEffect.support then
Expand Down Expand Up @@ -172,6 +200,10 @@ local function addGrantedEffectInfo(tooltip, build, gemInstance, grantedEffect,
tooltip:AddLine(fontSizeBig, colorCodes.GEMDESCRIPTION .. line, "FONTIN ITALIC")
end
end
if displayInstance.corrupted == true then
tooltip:AddSeparator(10)
tooltip:AddLine(fontSizeBig, colorCodes.NEGATIVE .. "Corrupted", "FONTIN SC")
end
end

local function addStatSetInfo(tooltip, build, gemInstance, grantedEffect, statSet, noLabel, index, levelRange)
Expand Down
7 changes: 5 additions & 2 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ function ImportTabClass:ImportItemsAndSkills(charData)
if gemId then
local gemInstance = { level = 20, quality = 0, enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, gemId = gemId }
gemInstance.support = skillData.support
gemInstance.corrupted = skillData.corrupted

local spectreList = data.spectres
if typeLine:sub(1, 8) == "Spectre:" then
Expand Down Expand Up @@ -918,8 +919,10 @@ function ImportTabClass:ImportItemsAndSkills(charData)
else
gemInstance.level = tonumber(property.values[1][1]:match("%d+"))
end
if skillData.properties[_ + 2] and skillData.properties[_ + 2].values[1][1]:match("(%d+) Level[s]? from Corruption") then
gemInstance.level = gemInstance.level + tonumber(skillData.properties[_ + 2].values[1][1]:match("(%d+) Level[s]? from Corruption"))
if skillData.properties[_ + 2] and skillData.properties[_ + 2].values[1][1]:match("(-?%d+) Level[s]? from Corruption") then
gemInstance.corruptLevel = tonumber(skillData.properties[_ + 2].values[1][1]:match("(-?%d+) Level[s]? from Corruption"))
else
gemInstance.corruptLevel = 0
end
elseif escapeGGGString(property.name) == "Quality" then
gemInstance.quality = tonumber(property.values[1][1]:match("%d+"))
Expand Down
Loading
Loading