Skip to content
Snippets Groups Projects
Commit 7a4ca35c authored by DarkGod's avatar DarkGod
Browse files

Fix a bug where sometimes the world explodes when necrotic minions are healed. Boom.

parent 7b3d9151
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -88,6 +88,7 @@ function _M:select(item)
end
function _M:use(item, a)
if item.answer == -1 then game:unregisterDialog(self) return end
a = a or self.chat:get(self.cur_id).answers[item.answer]
if not a then return end
......@@ -142,7 +143,7 @@ function _M:generateList()
-- Makes up the list
local list = { chars={} }
local nb = 1
for i, a in ipairs(self.chat:get(self.cur_id).answers) do
for i, a in ipairs(self.chat:get(self.cur_id).answers or {}) do
if not a.fallback and (not a.cond or a.cond(self.npc, self.player)) then
list[#list+1] = { name=string.char(string.byte('a')+nb-1)..") "..self.chat:replace(a[1]), answer=i, color=a.color}
list.chars[string.char(string.byte('a')+nb-1)] = #list
......@@ -150,7 +151,7 @@ function _M:generateList()
end
end
if #list == 0 then
for i, a in ipairs(self.chat:get(self.cur_id).answers) do
for i, a in ipairs(self.chat:get(self.cur_id).answers or {}) do
if a.fallback and (not a.cond or a.cond(self.npc, self.player)) then
list[#list+1] = { name=string.char(string.byte('a')+nb-1)..") "..self.chat:replace(a[1]), answer=i, color=a.color}
list.chars[string.char(string.byte('a')+nb-1)] = #list
......@@ -158,6 +159,14 @@ function _M:generateList()
end
end
end
-- Anti bug
if #list == 0 then
list[#list+1] = { name=string.char(string.byte('a')+nb-1)..") [error - exit - please report the bug]", answer=-1}
list.chars[string.char(string.byte('a')+nb-1)] = #list
nb = nb + 1
end
self.list = list
self.text = self.chat:replace(self.chat:get(self.cur_id).text)
......
......@@ -207,7 +207,7 @@ function necroSetupSummon(self, def, x, y, level, turns, no_control)
if not src or src == self or src.necrotic_minion then return mod.class.NPC.heal(self, amt, src) end
if
(src.getCurrentTalent and src:getCurrentTalent() and src:getTalentFromId(src:getCurrentTalent()) and not src:getTalentFromId(src:getCurrentTalent()).is_nature) or
src:attr("can_heal_necrotic_minions")
(src.attr and src:attr("can_heal_necrotic_minions"))
then
return mod.class.NPC.heal(self, amt, src)
end
......
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