Skip to content
Snippets Groups Projects
Commit b8d2917f authored by Chris Davidson's avatar Chris Davidson
Browse files

- Add a unique_ego flag that indicates if an ego can only be applied to an item once

parent 7296b461
No related branches found
No related tags found
No related merge requests found
......@@ -1655,11 +1655,13 @@ function _M:egoFilter(zone, level, type, etype, e, ego_filter, egos_list, picked
local arcane_check = false
local nature_check = false
local am_check = false
local unique_check = false
for i = 1, #egos_list do
local e = egos_list[i]
if e.power_source and e.power_source.arcane then arcane_check = true end
if e.power_source and e.power_source.nature then nature_check = true end
if e.power_source and e.power_source.antimagic then am_check = true end
if e.unique_ego then unique_check = true end
end
local fcts = {}
......@@ -1675,6 +1677,19 @@ function _M:egoFilter(zone, level, type, etype, e, ego_filter, egos_list, picked
fcts[#fcts+1] = function(ego) return not ego.power_source or not ego.power_source.arcane end
end
if unique_check then
fcts[#fcts+1] = function(ego)
local check = false
-- Use keywords as a proxy for name, a bit simpler than going through Object.ego_list
for k,v in pairs(ego.keywords) do
if e.keywords and e.keywords[k] then
check = true
end
end
return not check
end
end
if #fcts > 0 then
local old = ego_filter.special
ego_filter.special = function(ego)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment