|
| 1 | +-- Tests for Facebreaker-style gloves: empty-handed gloves that grant their own base |
| 2 | +-- weapon damage and let you attack as though using a One Hand Mace. |
| 3 | +describe("TestFacebreaker", function() |
| 4 | + before_each(function() |
| 5 | + newBuild() |
| 6 | + end) |
| 7 | + |
| 8 | + teardown(function() |
| 9 | + -- newBuild() takes care of resetting everything in setup() |
| 10 | + end) |
| 11 | + |
| 12 | + -- Physical variant (Facebreaker) |
| 13 | + local function equipFacebreaker() |
| 14 | + build.itemsTab:CreateDisplayItemFromRaw([[ |
| 15 | + New Item |
| 16 | + Stocky Mitts |
| 17 | + Has 8 to 12 Physical damage, +3 to +4 per Boss's Face Broken |
| 18 | + Can Attack as though using a One Handed Mace while both of your hand slots are empty |
| 19 | + Unarmed Attacks that would use an Equipped One Hand Mace's damage use this Item's damage |
| 20 | + ]]) |
| 21 | + build.itemsTab:AddDisplayItem() |
| 22 | + runCallback("OnFrame") |
| 23 | + end |
| 24 | + |
| 25 | + it("grants its base Physical damage to Unarmed attacks", function() |
| 26 | + equipFacebreaker() |
| 27 | + local weaponData1 = build.calcsTab.mainEnv.player.weaponData1 |
| 28 | + assert.are.equals(8, weaponData1.FacebreakerPhysicalMin) |
| 29 | + assert.are.equals(12, weaponData1.FacebreakerPhysicalMax) |
| 30 | + end) |
| 31 | + |
| 32 | + it("lets you attack as though using a One Hand Mace while unarmed", function() |
| 33 | + equipFacebreaker() |
| 34 | + local weaponData1 = build.calcsTab.mainEnv.player.weaponData1 |
| 35 | + assert.is_true(weaponData1.asThoughUsing ~= nil and weaponData1.asThoughUsing["One Hand Mace"] == true) |
| 36 | + end) |
| 37 | + |
| 38 | + it("scales its base damage per Boss's Face Broken", function() |
| 39 | + equipFacebreaker() |
| 40 | + build.configTab.input.configBossFaceBroken = 10 |
| 41 | + build.configTab:BuildModList() |
| 42 | + runCallback("OnFrame") |
| 43 | + local weaponData1 = build.calcsTab.mainEnv.player.weaponData1 |
| 44 | + -- 8 base + 3 per face broken * 10, 12 base + 4 per face broken * 10 |
| 45 | + assert.are.equals(8 + 3 * 10, weaponData1.FacebreakerPhysicalMin) |
| 46 | + assert.are.equals(12 + 4 * 10, weaponData1.FacebreakerPhysicalMax) |
| 47 | + end) |
| 48 | + |
| 49 | + it("matches the in-game resolved damage at 60 Boss's Faces Broken (188-252)", function() |
| 50 | + -- Real in-game Facebreaker shows "Physical Damage: 188-252" at 60 Boss's Faces Broken |
| 51 | + equipFacebreaker() |
| 52 | + build.configTab.input.configBossFaceBroken = 60 |
| 53 | + build.configTab:BuildModList() |
| 54 | + runCallback("OnFrame") |
| 55 | + build.skillsTab:PasteSocketGroup("Boneshatter 1/0 1") |
| 56 | + runCallback("OnFrame") |
| 57 | + build.calcsTab:BuildOutput() |
| 58 | + runCallback("OnFrame") |
| 59 | + local mainHand = build.calcsTab.mainOutput.MainHand |
| 60 | + assert.are.equals(188, mainHand.PhysicalMinBase) |
| 61 | + assert.are.equals(252, mainHand.PhysicalMaxBase) |
| 62 | + end) |
| 63 | + |
| 64 | + it("makes One Hand Mace skills usable unarmed and applies 'more Unarmed Damage per Strength' to them", function() |
| 65 | + build.itemsTab:CreateDisplayItemFromRaw([[ |
| 66 | + New Item |
| 67 | + Stocky Mitts |
| 68 | + Has 8 to 12 Physical damage, +3 to +4 per Boss's Face Broken |
| 69 | + 1% more Unarmed Damage per 5 Strength |
| 70 | + Can Attack as though using a One Handed Mace while both of your hand slots are empty |
| 71 | + Unarmed Attacks that would use an Equipped One Hand Mace's damage use this Item's damage |
| 72 | + ]]) |
| 73 | + build.itemsTab:AddDisplayItem() |
| 74 | + -- strip enemy Armour so the small base damage still resolves to a positive hit |
| 75 | + build.configTab.input.customMods = "Nearby Enemies have 100% less Armour" |
| 76 | + build.configTab:BuildModList() |
| 77 | + runCallback("OnFrame") |
| 78 | + -- Boneshatter requires a One/Two Hand Mace (no "None"): only usable unarmed thanks to Facebreaker |
| 79 | + build.skillsTab:PasteSocketGroup("Boneshatter 1/0 1") |
| 80 | + runCallback("OnFrame") |
| 81 | + build.calcsTab:BuildOutput() |
| 82 | + runCallback("OnFrame") |
| 83 | + local mainSkill = build.calcsTab.mainEnv.player.mainSkill |
| 84 | + assert.is_truthy(mainSkill) |
| 85 | + -- the Mace-only skill resolves to a real (unarmed) attack producing a positive hit |
| 86 | + assert.are.equals("Boneshatter", mainSkill.activeEffect.grantedEffect.name) |
| 87 | + assert.is_truthy(build.calcsTab.mainOutput.MainHand) |
| 88 | + assert.is_true(build.calcsTab.mainOutput.MainHand.AverageHit > 0) |
| 89 | + local modDB = build.calcsTab.mainEnv.player.modDB |
| 90 | + -- 'more Unarmed Damage per 5 Strength' applies to unarmed Hits (which is what Facebreaker mace attacks are)... |
| 91 | + assert.is_true(modDB:Sum("MORE", { flags = ModFlag.Unarmed + ModFlag.Hit }, "Damage") > 0) |
| 92 | + -- ...but not to actual weapon (e.g. Sword) Hits |
| 93 | + assert.are.equals(0, modDB:Sum("MORE", { flags = ModFlag.Sword + ModFlag.Hit }, "Damage")) |
| 94 | + end) |
| 95 | + |
| 96 | + it("auto-imports the Boss's Faces Broken count from character quest stats", function() |
| 97 | + build.importTab:ImportQuestRewardConfig({ "57 [BrokenFace|Broken Boss Faces]" }) |
| 98 | + assert.is_nil(build.configTab.input.configBossFaceBroken) |
| 99 | + assert.are.equals(57, build.configTab.placeholder.configBossFaceBroken) |
| 100 | + end) |
| 101 | + |
| 102 | + it("supports the Fire damage variant", function() |
| 103 | + build.itemsTab:CreateDisplayItemFromRaw([[ |
| 104 | + New Item |
| 105 | + Stocky Mitts |
| 106 | + Has 9 to 14 Fire damage, +3 to +5 per Boss's Face Broken |
| 107 | + Can Attack as though using a One Handed Mace while both of your hand slots are empty |
| 108 | + Unarmed Attacks that would use an Equipped One Hand Mace's damage use this Item's damage |
| 109 | + ]]) |
| 110 | + build.itemsTab:AddDisplayItem() |
| 111 | + runCallback("OnFrame") |
| 112 | + local weaponData1 = build.calcsTab.mainEnv.player.weaponData1 |
| 113 | + assert.are.equals(9, weaponData1.FacebreakerFireMin) |
| 114 | + assert.are.equals(14, weaponData1.FacebreakerFireMax) |
| 115 | + end) |
| 116 | + |
| 117 | + it("uses Facebreaker item damage instead of Hollow Palm added Physical damage for mace-compatible staff skills", function() |
| 118 | + equipFacebreaker() |
| 119 | + build.configTab.input.customMods = "Hollow Palm Technique" |
| 120 | + build.configTab:BuildModList() |
| 121 | + runCallback("OnFrame") |
| 122 | + build.skillsTab:PasteSocketGroup("Rain of Blades 1/0 1") |
| 123 | + runCallback("OnFrame") |
| 124 | + local skillModList = build.calcsTab.mainEnv.player.mainSkill.skillModList |
| 125 | + assert.are.equals(0, skillModList:Sum("BASE", { flags = ModFlag.Attack }, "PhysicalMin")) |
| 126 | + assert.are.equals(0, skillModList:Sum("BASE", { flags = ModFlag.Attack }, "PhysicalMax")) |
| 127 | + end) |
| 128 | + |
| 129 | + it("keeps Hollow Palm added Physical damage for quarterstaff-only skills", function() |
| 130 | + equipFacebreaker() |
| 131 | + build.configTab.input.customMods = "Hollow Palm Technique" |
| 132 | + build.configTab:BuildModList() |
| 133 | + runCallback("OnFrame") |
| 134 | + build.skillsTab:PasteSocketGroup("Quarterstaff Strike 1/0 1") |
| 135 | + runCallback("OnFrame") |
| 136 | + local skillModList = build.calcsTab.mainEnv.player.mainSkill.skillModList |
| 137 | + assert.is_true(skillModList:Sum("BASE", { flags = ModFlag.Attack }, "PhysicalMin") > 0) |
| 138 | + assert.is_true(skillModList:Sum("BASE", { flags = ModFlag.Attack }, "PhysicalMax") > 0) |
| 139 | + end) |
| 140 | +end) |
0 commit comments