Skip to content

Commit 68013a3

Browse files
committed
simplify conditional
1 parent ad1882e commit 68013a3

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

src/Modules/CalcActiveSkill.lua

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,34 @@ local function getWeaponFlags(env, weaponData, weaponTypes, skillTypeDualWieldOn
194194
if not info then
195195
return
196196
end
197+
198+
local function matchesWeaponType(weaponData, types, skillTypeDualWieldOnly)
199+
-- Wings of Entropy
200+
if weaponData.countsAsDualWielding then
201+
if skillTypeDualWieldOnly then
202+
return true
203+
end
204+
return (types[weaponData.type] or types["One Handed "..info.flag]) and types["One Handed "..info.flag]
205+
end
206+
-- Varunastra
207+
if weaponData.countsAsAll1H then
208+
return types["Claw"]
209+
or types["Dagger"]
210+
or types["One Handed Axe"]
211+
or types["One Handed Mace"]
212+
or types["One Handed Sword"]
213+
end
214+
-- Normal weapon matching
215+
if types[weaponData.type] then
216+
return true
217+
end
218+
219+
return false
220+
end
221+
197222
if weaponTypes then
198223
for _, types in ipairs(weaponTypes) do
199-
if weaponData.countsAsDualWielding and ((not skillTypeDualWieldOnly and (not types[weaponData.type] or not types["One Handed "..info.flag])) and (not types["One Handed "..info.flag])) -- Wings of Entropy
200-
or (not weaponData.countsAsDualWielding and 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"])))
201-
then
224+
if not matchesWeaponType(weaponData, types, skillTypeDualWieldOnly) then
202225
return nil, info
203226
end
204227
end

0 commit comments

Comments
 (0)