-
Notifications
You must be signed in to change notification settings - Fork 428
Expand file tree
/
Copy pathTestIdolatry_spec.lua
More file actions
182 lines (161 loc) · 6.48 KB
/
Copy pathTestIdolatry_spec.lua
File metadata and controls
182 lines (161 loc) · 6.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
describe("TestIdolatry", function()
before_each(function()
newBuild()
end)
-- The Spirit Walker "Idolatry" notable grants three mods that scale with the
-- number of Idols / non-Idol augments (Runes + Soul Cores) socketed across equipped items.
-- Counting: CalcSetup tallies socketed augments by type into the IdolsInEquipment and
-- NonIdolAugmentsInEquipment multipliers, which the three Idolatry mods scale against.
it("counts Idols and non-Idol augments across equipped items", function()
-- Gloves with 2 Idols socketed
build.itemsTab:CreateDisplayItemFromRaw([[
Rarity: MAGIC
Idolatry Test Gloves
Vaal Gloves
Sockets: S S
Rune: Idol of Sirrius
Rune: Idol of Sirrius
Implicits: 0
]])
build.itemsTab:AddDisplayItem()
-- Quarterstaff with 3 Soul Cores socketed (non-Idol augments)
build.itemsTab:CreateDisplayItemFromRaw([[
Rarity: MAGIC
Idolatry Test Staff
Aegis Quarterstaff
Sockets: S S S
Rune: Soul Core of Cholotl
Rune: Soul Core of Zantipi
Rune: Soul Core of Atmohua
Implicits: 0
]])
build.itemsTab:AddDisplayItem()
runCallback("OnFrame")
local modDB = build.calcsTab.mainEnv.modDB
assert.are.equals(2, modDB.multipliers.IdolsInEquipment)
assert.are.equals(3, modDB.multipliers.NonIdolAugmentsInEquipment)
end)
-- Empty sockets (itemSocketCount populated while item.runes has no entry for the slot, e.g. a
-- freshly created base item) must not be counted as augments.
it("does not count empty sockets as augments", function()
build.itemsTab:CreateDisplayItemFromRaw([[
Rarity: MAGIC
Empty Socket Test Gloves
Vaal Gloves
Sockets: S S
Implicits: 0
]])
build.itemsTab:AddDisplayItem()
runCallback("OnFrame")
local modDB = build.calcsTab.mainEnv.modDB
assert.is_nil(modDB.multipliers.IdolsInEquipment)
assert.is_nil(modDB.multipliers.NonIdolAugmentsInEquipment)
end)
-- Parsing: the three stat lines must resolve to mods that scale against those multipliers.
it("parses Idolatry and bonded-idol stat lines", function()
local parseMod = LoadModule("Modules/ModParser")
-- Helper to find the Multiplier tag on a mod (tags are stored as array entries)
local function multiplierTag(mod)
for _, tag in ipairs(mod) do
if tag.type == "Multiplier" then return tag end
end
end
-- 1) Companion damage scales by the player's Idol count (read via actor = "player"
-- since the mod is evaluated in the companion's own modDB).
local companion = parseMod("Companions deal 10% increased damage per Idol in your Equipment")
assert.are.equals(1, #companion)
assert.are.equals("MinionModifier", companion[1].name)
local inner = companion[1].value.mod
assert.are.equals("Damage", inner.name)
assert.are.equals("INC", inner.type)
assert.are.equals(10, inner.value)
local companionTag = multiplierTag(inner)
assert.is_not_nil(companionTag)
assert.are.equals("IdolsInEquipment", companionTag.var)
assert.are.equals("player", companionTag.actor)
-- 2) Reservation Efficiency scales by the Idol count (player context).
local reservation = parseMod("2% increased Reservation Efficiency of Skills per Idol in your Equipment")
assert.are.equals(1, #reservation)
assert.are.equals("ReservationEfficiency", reservation[1].name)
assert.are.equals("INC", reservation[1].type)
assert.are.equals(2, reservation[1].value)
assert.are.equals("IdolsInEquipment", multiplierTag(reservation[1]).var)
-- 3) Elemental Resistance penalty scales by the non-Idol augment count (player context).
local resist = parseMod("-4% to all Elemental Resistances per non-Idol Augment in your Equipment")
assert.are.equals(1, #resist)
assert.are.equals("ElementalResist", resist[1].name)
assert.are.equals("BASE", resist[1].type)
assert.are.equals(-4, resist[1].value)
assert.are.equals("NonIdolAugmentsInEquipment", multiplierTag(resist[1]).var)
-- 4) Fox Idol's unlock is an item-local flag, not a global condition.
local localUnlock = parseMod("Idols socketed in this item gain the benefits of their Bonded modifiers")
assert.are.equals(1, #localUnlock)
assert.are.equals("SocketedIdolsUseBondedModifiers", localUnlock[1].name)
assert.are.equals("FLAG", localUnlock[1].type)
-- 5) The ascendancy unlock is a flag consumed by calc setup, not a condition on each bonded mod.
local globalUnlock = parseMod("Gain the benefits of Bonded modifiers on Runes and Idols")
assert.are.equals(1, #globalUnlock)
assert.are.equals("CanUseBonded", globalUnlock[1].name)
assert.are.equals("FLAG", globalUnlock[1].type)
end)
it("enables only Idol Bonded modifiers from Fox Idol locally", function()
local item = new("Item", [[
Test Body
Rusted Cuirass
]])
item.itemSocketCount = 2
item.runes = { "Fox Idol", "Lesser Body Rune" }
item:UpdateRunes()
item:BuildAndParseRaw()
assert.is_true(item.socketedIdolsUseBondedModifiers)
local foxBondedLine
local bodyRuneBondedLife
for _, modLine in ipairs(item.runeModLines) do
if modLine.line == "Bonded: +5% to Quality of all Skills" then
foxBondedLine = modLine
end
if modLine.line == "Bonded: +20 to maximum Life" then
bodyRuneBondedLife = modLine
end
end
assert.is_not_nil(foxBondedLine)
assert.are.equals(0, #foxBondedLine.modList)
assert.is_not_nil(bodyRuneBondedLife)
assert.are.equals(0, #bodyRuneBondedLife.modList)
build.itemsTab:AddItem(item)
build.buildFlag = true
runCallback("OnFrame")
local modDB = build.calcsTab.mainEnv.itemModDB
local foxBondedQuality
for _, mod in ipairs(modDB.mods.GemProperty or { }) do
if mod.value.value == 5 and mod.source == item.modSource then
foxBondedQuality = mod
break
end
end
assert.is_not_nil(foxBondedQuality)
assert.is_not_nil(foxBondedLine.bondedModList)
assert.is_nil(bodyRuneBondedLife.bondedModList)
for _, mod in ipairs(modDB.mods.Life or { }) do
assert.is_false(mod.type == "BASE" and mod.value == 20 and mod.source == item.modSource)
end
end)
it("enables and scales Bonded modifiers from the ascendancy flag", function()
build.spec.allocNodes[42253] = build.spec.nodes[42253] -- Wisdom of the Maji
local item = new("Item", [[
Test Body
Rusted Cuirass
200% increased effect of Socketed Runes
]])
item.itemSocketCount = 1
item.runes = { "Lesser Body Rune" }
item:UpdateRunes()
item:BuildAndParseRaw()
build.itemsTab:AddItem(item)
build.buildFlag = true
runCallback("OnFrame")
local modDB = build.calcsTab.mainEnv.itemModDB
assert.are.equals(150, modDB:Sum("BASE", nil, "Life"))
assert.are.equals(60, modDB:Sum("BASE", nil, "Mana"))
end)
end)