Skip to content

Commit 8823194

Browse files
committed
Implement "as though using ..." weapon type check
"Hollow Palm" introduces the "as though using a Quarterstaff" wording. Current interpretation is that this is different from "count as using" wording and only removes weapon type restrictions. This commit adds support for that kind of behavior. Note: Because "WeaponData" mods are only processed in `Item.lua` and only for actual items. This kind of mod will not work via `ModParser` when modifying "Unarmed" weaponData
1 parent 9f39731 commit 8823194

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/Modules/CalcActiveSkill.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,24 @@ function calcs.copyActiveSkill(env, mode, skill)
197197
return newSkill, newEnv
198198
end
199199

200+
-- Check for "asThoughUsing..." weaponTypes match, which is mechanically different from "countAs..."
201+
---@param weaponData table
202+
---@param weaponTypes table
203+
---@return boolean @whether a match was found
204+
local function checkAsThoughWeaponTypes(weaponData, weaponTypes)
205+
if (not weaponData.asThoughUsing) or (not weaponTypes) then
206+
return false
207+
else
208+
-- check if any 'usingKey' for which 'usingValue = true' is also true in weaponTypes
209+
for usingKey, usingValue in pairs(weaponData.asThoughUsing) do
210+
for _, types in ipairs(weaponTypes) do
211+
if usingValue and types[usingKey] then return true end
212+
end
213+
end
214+
end
215+
return false
216+
end
217+
200218
-- Get weapon flags and info for given weapon
201219
local function getWeaponFlags(env, weaponData, weaponTypes)
202220
local info = env.data.weaponTypeInfo[weaponData.type]
@@ -207,7 +225,7 @@ local function getWeaponFlags(env, weaponData, weaponTypes)
207225
for _, types in ipairs(weaponTypes) do
208226
if not types[weaponData.type] and
209227
(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"]
210-
or types["Spear"])) then
228+
or types["Spear"])) and not (weaponData.asThoughUsing and checkAsThoughWeaponTypes(weaponData, weaponTypes)) then
211229
return nil, info
212230
end
213231
end

0 commit comments

Comments
 (0)