Skip to content

Commit 819a42d

Browse files
authored
update GetModSpawnWeight with excludeTags (#6099)
1 parent 7a535f9 commit 819a42d

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/Classes/Item.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ function ItemClass:NormaliseQuality()
881881
end
882882
end
883883

884-
function ItemClass:GetModSpawnWeight(mod, extraTags)
884+
function ItemClass:GetModSpawnWeight(mod, includeTags, excludeTags)
885885
local weight = 0
886886
if self.base then
887887
local function HasInfluenceTag(key)
@@ -904,13 +904,13 @@ function ItemClass:GetModSpawnWeight(mod, extraTags)
904904
end
905905

906906
for i, key in ipairs(mod.weightKey) do
907-
if self.base.tags[key] or (extraTags and extraTags[key]) or HasInfluenceTag(key) then
907+
if (self.base.tags[key] or (includeTags and includeTags[key]) or HasInfluenceTag(key)) and not (excludeTags and excludeTags[key]) then
908908
weight = (HasInfluenceTag(key) and HasMavenInfluence(mod.affix)) and 1000 or mod.weightVal[i]
909909
break
910910
end
911911
end
912912
for i, key in ipairs(mod.weightMultiplierKey) do
913-
if self.base.tags[key] or (extraTags and extraTags[key]) or HasInfluenceTag(key) then
913+
if (self.base.tags[key] or (includeTags and includeTags[key]) or HasInfluenceTag(key)) and not (excludeTags and excludeTags[key]) then
914914
weight = weight * mod.weightMultiplierVal[i] / 100
915915
break
916916
end

src/Classes/ItemsTab.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,12 +2616,10 @@ function ItemsTabClass:AddCrucibleModifierToDisplayItem()
26162616
end
26172617
if self.displayItem.canHaveOnlySupportSkillsCrucibleTree then
26182618
return keyMap["crucible_unique_staff"] and mod.weightVal[keyMap["crucible_unique_staff"]] ~= 0
2619-
end
2620-
if self.displayItem.canHaveShieldCrucibleTree then
2619+
elseif self.displayItem.canHaveShieldCrucibleTree then
26212620
return self.displayItem:GetModSpawnWeight(mod, { ["crucible_unique_helmet"] = true, ["shield"] = true }) > 0
26222621
elseif self.displayItem.canHaveTwoHandedSwordCrucibleTree then
2623-
self.displayItem.base.tags["one_hand_weapon"] = nil
2624-
return self.displayItem:GetModSpawnWeight(mod, { ["two_hand_weapon"] = true }) > 0
2622+
return self.displayItem:GetModSpawnWeight(mod, { ["two_hand_weapon"] = true }, { ["one_hand_weapon"] = true }) > 0
26252623
end
26262624
return self.displayItem:GetModSpawnWeight(mod) > 0
26272625
end

0 commit comments

Comments
 (0)