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
68 changes: 68 additions & 0 deletions spec/System/TestCompareTab_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("CompareTab", function()
compareTab.controls.cmpMineCount,
compareTab.controls.cmpMinion,
compareTab.controls.cmpMinionSkill,
compareTab.controls.cmpMercenaryItemSet,
}
for _, control in ipairs(controls) do
control.shown = true
Expand Down Expand Up @@ -95,4 +96,71 @@ describe("CompareTab", function()
entry:Rebuild()
assert.are.equals(0, runReport())
end)
it("keeps mercenary groups apart from player groups with the same gems", function()
newBuild()
build.skillsTab:PasteSocketGroup("Spark 20/0 1\n")
build.skillsTab:PasteSocketGroup("Mercenary: true\nSparkMercenary 20/0 1\n")
runCallback("OnFrame")
local entry = new("CompareEntry"):CompareEntry(build:SaveDB("code"), "Self")
local player, mercenary = entry.skillsTab.socketGroupList[1], entry.skillsTab.socketGroupList[2]
assert.is_true(mercenary.mercenary)

local compareTab = build.compareTab
assert.are_not.equals(compareTab:GetSocketGroupSignature(player), compareTab:GetSocketGroupSignature(mercenary))
assert.are.equals("Spark", compareTab:GetSocketGroupLabel(player))
assert.are.equals("Spark (Mercenary)", compareTab:GetSocketGroupLabel(mercenary))
end)
-- Compares the build with a copy of itself, using a mercenary group with the given skill as the main skill
local function compareMercenary(skillId)
newBuild()
build.skillsTab:PasteSocketGroup("Mercenary: true\n"..skillId.." 20/0 1\n")
-- The skill name would be pasted as a "key: value" line
local gemData = build.data.gems["Metadata/Items/Gems/SkillGemCallMercenary"]
local group = { label = "", enabled = true, gemList = { { gemId = gemData.id, nameSpec = gemData.name, skillId = gemData.grantedEffectId, level = 20, quality = 0, enabled = true, enableGlobal1 = true, count = 1 } } }
build.skillsTab:ProcessSocketGroup(group)
table.insert(build.skillsTab.socketGroupList, group)
build.mainSocketGroup = 1
build.calcsTab.input.skill_number = 1
build.buildFlag = true
runCallback("OnFrame")
local entry = new("CompareEntry"):CompareEntry(build:SaveDB("code"), "Self")
local compareTab = build.compareTab
compareTab.compareEntries = { entry }
compareTab.activeCompareIndex = 1
compareTab.compareViewMode = "CALCS"
compareTab:RefreshCalcsSkillControls(entry)
return compareTab, entry
end
it("shows the stats of the minion of the mercenary's main skill in the calcs view", function()
local compareTab, entry = compareMercenary("GigaRaiseZombieMercenary")

for _, prefix in ipairs({ "primCalcs", "cmpCalcs" }) do
local actorControl = compareTab.controls[prefix.."ShowMinion"]
assert.are.equals(3, #actorControl.list)
assert.are.equals("Mercenary's Raised Zombie", actorControl.list[3].label)
assert.is_true(compareTab.controls[prefix.."MinionSkill"]:IsShown())
actorControl.selFunc(3, actorControl.list[3])
end
local zombie = entry.calcsTab:GetMercenaryMinion(entry.calcsTab.calcsEnv)
assert.are.equals(zombie, entry.calcsTab:GetActor(entry.calcsTab.calcsEnv))
end)
it("sets the stages of the mercenary's main skill", function()
local compareTab, entry = compareMercenary("FlameblastMercenary")
local function stages(env)
local mainSkill = env.minion.mainSkill
return mainSkill.skillModList:Sum("BASE", mainSkill.skillCfg, "Multiplier:FlameblastStage")
end
compareTab:UpdateSetSelectors(entry)
for _, name in ipairs({ "primCalcsStageCount", "cmpCalcsStageCount", "cmpStageCount", "primCalcsMercenaryItemSet", "cmpCalcsMercenaryItemSet", "cmpMercenaryItemSet" }) do
assert.is_true(compareTab.controls[name]:IsShown(), name)
end
compareTab.controls.primCalcsStageCount.changeFunc("2")
compareTab.controls.cmpCalcsStageCount.changeFunc("4")
compareTab.controls.cmpStageCount.changeFunc("3")
runCallback("OnFrame")
entry:Rebuild()
assert.are.equals(2, stages(build.calcsTab.calcsEnv))
assert.are.equals(4, stages(entry.calcsTab.calcsEnv))
assert.are.equals(3, stages(entry.calcsTab.mainEnv))
end)
end)
Loading
Loading