diff --git a/spec/System/TestItemMods_spec.lua b/spec/System/TestItemMods_spec.lua index 3c185d98ac..9cded26365 100644 --- a/spec/System/TestItemMods_spec.lua +++ b/spec/System/TestItemMods_spec.lua @@ -1,4 +1,4 @@ -describe("TetsItemMods", function() +describe("TestItemMods", function() before_each(function() newBuild() end) @@ -612,4 +612,58 @@ describe("TetsItemMods", function() assert.are.equals(baseFrenzyChargesMax + 1, build.calcsTab.calcsOutput.FrenzyChargesMax) assert.are.equals(baseEnduranceChargesMax + 1, build.calcsTab.calcsOutput.EnduranceChargesMax) end) + + it("Test Wings of Entropy skill disabled", function() + build.itemsTab:CreateDisplayItemFromRaw([[ + Wings of Entropy + {variant:1,2,3,4}Sundering Axe + {variant:5}Ezomyte Axe + Variant: Pre 1.3.0 + Variant: Pre 2.0.0 + Variant: Pre 3.4.0 + Variant: Pre 3.11.0 + Variant: Pre 3.26.0 + Variant: Current + Implicits: 0 + {variant:1,2,3}7% Chance to Block Spell Damage + {variant:4}(6-7)% Chance to Block Spell Damage + {variant:5,6}(7-10)% Chance to Block Spell Damage + {variant:1}+10% Chance to Block Attack Damage while Dual Wielding + {variant:2,3,4}+8% Chance to Block Attack Damage while Dual Wielding + {variant:5,6}+(8-12)% Chance to Block Attack Damage while Dual Wielding + {variant:1,2}(80-120)% increased Physical Damage + {variant:3,4}(100-120)% increased Physical Damage + {variant:5,6}(60-80)% increased Physical Damage + {variant:1,2,3,4}Adds (55-65) to (100-120) Fire Damage in Main Hand + {variant:5}Adds (75-100) to (165-200) Fire Damage in Main Hand + {variant:6}Adds (150-200) to (330-400) Fire Damage in Main Hand + {variant:1,2,3,4}Adds (55-65) to (100-120) Chaos Damage in Off Hand + {variant:5}Adds (75-100) to (165-200) Chaos Damage in Off Hand + {variant:6}Adds (151-199) to (331-401) Chaos Damage in Off Hand + Counts as Dual Wielding + ]]) + build.itemsTab:AddDisplayItem() + runCallback("OnFrame") + + local function testSkill(skill, index, expected) + build.skillsTab:PasteSocketGroup(skill.." 20/0 1") + runCallback("OnFrame") + + build.mainSocketGroup = index + build.modFlag = true + build.buildFlag = true + runCallback("OnFrame") + + assert.True(build.calcsTab.mainEnv.player.mainSkill.skillFlags.disable == expected) + end + + testSkill("Lacerate of Haemorrhage", 1, nil) + testSkill("Lacerate of Butchering", 2, true) + testSkill("Ice Crash of Cadence", 3, nil) + testSkill("Swordstorm", 4, nil) + testSkill("Ground Slam of Earthshaking", 5, true) + testSkill("Sunder", 6, nil) + testSkill("Chain Hook", 7, nil) + testSkill("Dual Strike of Ambidexterity", 8, true) + end) end) diff --git a/src/Modules/CalcActiveSkill.lua b/src/Modules/CalcActiveSkill.lua index de735dc5a3..3786e0176c 100644 --- a/src/Modules/CalcActiveSkill.lua +++ b/src/Modules/CalcActiveSkill.lua @@ -189,15 +189,32 @@ function calcs.copyActiveSkill(env, mode, skill) end -- Get weapon flags and info for given weapon -local function getWeaponFlags(env, weaponData, weaponTypes) +local function getWeaponFlags(env, weaponData, weaponTypes, skillTypeDualWieldOnly) local info = env.data.weaponTypeInfo[weaponData.type] if not info then return end + + local function matchesWeaponType(types) + -- Wings of Entropy + if weaponData.countsAsDualWielding then + return skillTypeDualWieldOnly or types["One Handed "..info.flag] + end + -- Varunastra + if weaponData.countsAsAll1H then + return types["Claw"] + or types["Dagger"] + or types["One Handed Axe"] + or types["One Handed Mace"] + or types["One Handed Sword"] + end + -- Normal weapon matching + return types[weaponData.type] + end + if weaponTypes then for _, types in ipairs(weaponTypes) do - if not types[weaponData.type] and - (not weaponData.countsAsAll1H or not (types["Claw"] or types["Dagger"] or types["One Handed Axe"] or types["One Handed Mace"] or types["One Handed Sword"])) then + if not matchesWeaponType(types) then return nil, info end end @@ -284,7 +301,7 @@ function calcs.buildActiveSkillModList(env, activeSkill) t_insert(weaponTypes, skillEffect.grantedEffect.weaponTypes) end end - local weapon1Flags, weapon1Info = getWeaponFlags(env, activeSkill.actor.weaponData1, weaponTypes) + local weapon1Flags, weapon1Info = getWeaponFlags(env, activeSkill.actor.weaponData1, weaponTypes, skillTypes[SkillType.DualWieldOnly]) if not weapon1Flags and activeSkill.summonSkill then -- Minion skills seem to ignore weapon types weapon1Flags, weapon1Info = ModFlag[env.data.weaponTypeInfo["None"].flag], env.data.weaponTypeInfo["None"] @@ -305,7 +322,7 @@ function calcs.buildActiveSkillModList(env, activeSkill) activeSkill.disableReason = "Main Hand weapon is not usable with this skill" end if not skillTypes[SkillType.MainHandOnly] and not skillFlags.forceMainHand then - local weapon2Flags, weapon2Info = getWeaponFlags(env, activeSkill.actor.weaponData2, weaponTypes) + local weapon2Flags, weapon2Info = getWeaponFlags(env, activeSkill.actor.weaponData2, weaponTypes, skillTypes[SkillType.DualWieldOnly]) if weapon2Flags then if skillTypes[SkillType.DualWieldRequiresDifferentTypes] and (activeSkill.actor.weaponData1.type == activeSkill.actor.weaponData2.type) and not (activeSkill.actor.weaponData2.countsAsAll1H or activeSkill.actor.weaponData1.countsAsAll1H) then -- Skill requires a different compatible off hand weapon to main hand weapon