Skip to content

Commit

Permalink
Fix Restoration Druid 4-Set not seen as Incarnation: Tree of Life
Browse files Browse the repository at this point in the history
  • Loading branch information
Snakybo committed Apr 2, 2022
1 parent 9f23e4a commit 4e1b861
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The format of this changelog is based on [Keep a Changelog](https://keepachangel

### Fixed

- Fix Restoration Druid 4-Set not being detected as Incarnation: Tree of Life ([Squishes](https://github.com/Squishes))
- Fix covenant load condition not always being triggered immediately after switching covenants

## [1.6.8] - 2022-02-22
Expand Down
28 changes: 27 additions & 1 deletion Clicked/Core/Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,12 @@ function Addon:GetAvailableShapeshiftForms(binding)

-- Incarnation: Tree of Life does not show up as a shapeshift form,
-- but it will always be NUM_SHAPESHIFT_FORMS + 1 (See: #9)
if IsSpellKnown(33891) then

-- 9.2: Restoration Druid 4-set bonus gives them Incarnation: Tree of Life without having it talented
local items = { 188847, 188848, 188849, 188851, 188853 }
local is92RestoSetActive = specId == 105 and Addon:IsSetBonusActive(items, 4)

if IsSpellKnown(33891) or is92RestoSetActive then
table.insert(result, GetNumShapeshiftForms() + 1)
end
else
Expand Down Expand Up @@ -809,6 +814,27 @@ function Addon:IterateShapeshiftForms(specId)
end
end

--- Check if an item set bonus is active.
---
--- @param setItemIds integer[]
--- @param numSetPieces integer
--- @return boolean
function Addon:IsSetBonusActive(setItemIds, numSetPieces)
local count = 0

for _, itemId in ipairs(setItemIds) do
if IsEquippedItem(itemId) then
count = count + 1

if count >= numSetPieces then
return true
end
end
end

return false
end

--- Check if the specified keybind is "restricted", a restricted keybind
--- is not allowed to do various actions as it is required for core game
--- input (such as left and right mouse buttons).
Expand Down

0 comments on commit 4e1b861

Please sign in to comment.