|
| 1 | +describe("TestIdolatry", function() |
| 2 | + before_each(function() |
| 3 | + newBuild() |
| 4 | + end) |
| 5 | + |
| 6 | + -- The Spirit Walker "Idolatry" notable grants three mods that scale with the |
| 7 | + -- number of Idols / non-Idol augments (Runes + Soul Cores) socketed across equipped items. |
| 8 | + |
| 9 | + -- Counting: CalcSetup tallies socketed augments by type into the IdolsInEquipment and |
| 10 | + -- NonIdolAugmentsInEquipment multipliers, which the three Idolatry mods scale against. |
| 11 | + it("counts Idols and non-Idol augments across equipped items", function() |
| 12 | + -- Gloves with 2 Idols socketed |
| 13 | + build.itemsTab:CreateDisplayItemFromRaw([[ |
| 14 | + Rarity: MAGIC |
| 15 | + Idolatry Test Gloves |
| 16 | + Vaal Gloves |
| 17 | + Sockets: S S |
| 18 | + Rune: Idol of Sirrius |
| 19 | + Rune: Idol of Sirrius |
| 20 | + Implicits: 0 |
| 21 | + ]]) |
| 22 | + build.itemsTab:AddDisplayItem() |
| 23 | + |
| 24 | + -- Quarterstaff with 3 Soul Cores socketed (non-Idol augments) |
| 25 | + build.itemsTab:CreateDisplayItemFromRaw([[ |
| 26 | + Rarity: MAGIC |
| 27 | + Idolatry Test Staff |
| 28 | + Aegis Quarterstaff |
| 29 | + Sockets: S S S |
| 30 | + Rune: Soul Core of Cholotl |
| 31 | + Rune: Soul Core of Zantipi |
| 32 | + Rune: Soul Core of Atmohua |
| 33 | + Implicits: 0 |
| 34 | + ]]) |
| 35 | + build.itemsTab:AddDisplayItem() |
| 36 | + runCallback("OnFrame") |
| 37 | + |
| 38 | + local modDB = build.calcsTab.mainEnv.modDB |
| 39 | + assert.are.equals(2, modDB.multipliers.IdolsInEquipment) |
| 40 | + assert.are.equals(3, modDB.multipliers.NonIdolAugmentsInEquipment) |
| 41 | + end) |
| 42 | + |
| 43 | + -- Empty sockets (itemSocketCount populated while item.runes has no entry for the slot, e.g. a |
| 44 | + -- freshly created base item) must not be counted as augments. |
| 45 | + it("does not count empty sockets as augments", function() |
| 46 | + build.itemsTab:CreateDisplayItemFromRaw([[ |
| 47 | + Rarity: MAGIC |
| 48 | + Empty Socket Test Gloves |
| 49 | + Vaal Gloves |
| 50 | + Sockets: S S |
| 51 | + Implicits: 0 |
| 52 | + ]]) |
| 53 | + build.itemsTab:AddDisplayItem() |
| 54 | + runCallback("OnFrame") |
| 55 | + |
| 56 | + local modDB = build.calcsTab.mainEnv.modDB |
| 57 | + assert.is_nil(modDB.multipliers.IdolsInEquipment) |
| 58 | + assert.is_nil(modDB.multipliers.NonIdolAugmentsInEquipment) |
| 59 | + end) |
| 60 | + |
| 61 | + -- Parsing: the three stat lines must resolve to mods that scale against those multipliers. |
| 62 | + it("parses the three Idolatry stat lines", function() |
| 63 | + local parseMod = LoadModule("Modules/ModParser") |
| 64 | + |
| 65 | + -- Helper to find the Multiplier tag on a mod (tags are stored as array entries) |
| 66 | + local function multiplierTag(mod) |
| 67 | + for _, tag in ipairs(mod) do |
| 68 | + if tag.type == "Multiplier" then return tag end |
| 69 | + end |
| 70 | + end |
| 71 | + |
| 72 | + -- 1) Companion damage scales by the player's Idol count (read via actor = "player" |
| 73 | + -- since the mod is evaluated in the companion's own modDB). |
| 74 | + local companion = parseMod("Companions deal 10% increased damage per Idol in your Equipment") |
| 75 | + assert.are.equals(1, #companion) |
| 76 | + assert.are.equals("MinionModifier", companion[1].name) |
| 77 | + local inner = companion[1].value.mod |
| 78 | + assert.are.equals("Damage", inner.name) |
| 79 | + assert.are.equals("INC", inner.type) |
| 80 | + assert.are.equals(10, inner.value) |
| 81 | + local companionTag = multiplierTag(inner) |
| 82 | + assert.is_not_nil(companionTag) |
| 83 | + assert.are.equals("IdolsInEquipment", companionTag.var) |
| 84 | + assert.are.equals("player", companionTag.actor) |
| 85 | + |
| 86 | + -- 2) Reservation Efficiency scales by the Idol count (player context). |
| 87 | + local reservation = parseMod("2% increased Reservation Efficiency of Skills per Idol in your Equipment") |
| 88 | + assert.are.equals(1, #reservation) |
| 89 | + assert.are.equals("ReservationEfficiency", reservation[1].name) |
| 90 | + assert.are.equals("INC", reservation[1].type) |
| 91 | + assert.are.equals(2, reservation[1].value) |
| 92 | + assert.are.equals("IdolsInEquipment", multiplierTag(reservation[1]).var) |
| 93 | + |
| 94 | + -- 3) Elemental Resistance penalty scales by the non-Idol augment count (player context). |
| 95 | + local resist = parseMod("-4% to all Elemental Resistances per non-Idol Augment in your Equipment") |
| 96 | + assert.are.equals(1, #resist) |
| 97 | + assert.are.equals("ElementalResist", resist[1].name) |
| 98 | + assert.are.equals("BASE", resist[1].type) |
| 99 | + assert.are.equals(-4, resist[1].value) |
| 100 | + assert.are.equals("NonIdolAugmentsInEquipment", multiplierTag(resist[1]).var) |
| 101 | + end) |
| 102 | +end) |
0 commit comments