Skip to content
Snippets Groups Projects
Commit c6cd84db authored by dg's avatar dg
Browse files

Fixed a duplicate actor bug on talent change

git-svn-id: http://svn.net-core.org/repos/t-engine4@5231 51575b47-30f0-44d4-a5cc-537603b46e54
parent 8d6acd4a
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,10 @@ function _M:init(level, map)
self.data = {}
end
function _M:onSaving()
self.last_iteration = nil
end
--- Adds a sublevel
function _M:addSublevel(name, level)
if self.sublevels[name] then error("Sublevel already exists: "..name) end
......
......@@ -103,6 +103,7 @@ function _M:saveObject(obj, zip)
while #self.process > 0 do
local tbl = table.remove(self.process)
self.tables[tbl] = self:getFileName(tbl)
if tbl.onSaving then tbl:onSaving() end
tbl:save()
savefile_pipe.current_nb = savefile_pipe.current_nb + 1
processed = processed + 1
......
......@@ -2716,7 +2716,7 @@ end
--- Actor forgets a talent
-- @param t_id the id of the talent to learn
-- @return true if the talent was unlearnt, nil and an error message otherwise
function _M:unlearnTalent(t_id, nb)
function _M:unlearnTalent(t_id, nb, no_unsustain)
if not engine.interface.ActorTalents.unlearnTalent(self, t_id, nb) then return false end
local t = _M.talents_def[t_id]
......@@ -2736,7 +2736,7 @@ function _M:unlearnTalent(t_id, nb)
end
-- Unsustain ?
if not self:knowTalent(t_id) and t.mode == "sustained" and self:isTalentActive(t_id) then self:forceUseTalent(t_id, {ignore_energy=true}) end
if not no_unsustain and not self:knowTalent(t_id) and t.mode == "sustained" and self:isTalentActive(t_id) then self:forceUseTalent(t_id, {ignore_energy=true}) end
return true
end
......
......@@ -279,6 +279,14 @@ function _M:act()
end
end
function _M:tooltip(x, y, seen_by)
local str = mod.class.Actor.tooltip(self, x, y, seen_by)
if not str then return end
if config.settings.cheat then str:add(true, "UID: "..self.uid, true, self.image) end
return str
end
--- Funky shader stuff
function _M:updateMainShader()
if game.fbo_shader then
......
......@@ -240,6 +240,7 @@ newTalent{
m.on_acquire_target = nil
m.seen_by = nil
m.can_talk = nil
m.exp_worth = 0
m.clone_on_hit = nil
if m.talents.T_SUMMON then m.talents.T_SUMMON = nil end
if m.talents.T_MULTIPLY then m.talents.T_MULTIPLY = nil end
......
......@@ -148,6 +148,7 @@ newTalent{
m.on_takehit = nil
m.can_talk = nil
m.clone_on_hit = nil
m.exp_worth = 0
m.no_inventory_access = true
m.stealth = t.getStealthPower(self, t)
for i = 1, 10 do
......
......@@ -205,6 +205,7 @@ newTalent{
m.seen_by = nil
m.can_talk = nil
m.on_takehit = nil
m.exp_worth = 0
m.no_inventory_access = true
m.clone_on_hit = nil
m.talents.T_CREATE_MINIONS = nil
......
......@@ -63,6 +63,7 @@ function _M:init(actor, on_finish, on_birth)
self.actor.__increased_talent_types = self.actor.__increased_talent_types or {}
self.actor_dup = actor:clone()
self.actor_dup.uid = actor.uid -- Yes ...
for _, v in pairs(game.engine.Birther.birth_descriptor_def) do
if v.type == "subclass" and v.name == actor.descriptor.subclass then self.desc_def = v break end
......@@ -369,7 +370,9 @@ function _M:cancel()
self.actor.last_learnt_talents = self.actor_dup.last_learnt_talents
]]
local ax, ay = self.actor.x, self.actor.y
self.actor_dup.replacedWith = false
self.actor:replaceWith(self.actor_dup)
self.actor.replacedWith = nil
self.actor.x, self.actor.y = ax, ay
self.actor.changed = true
self.actor:removeAllMOs()
......@@ -470,7 +473,7 @@ function _M:finish()
for tid, act in pairs(self.actor.sustain_talents) do
if act then
local t = self.actor:getTalentFromId(tid)
if t.no_sustain_autoreset then
if t.no_sustain_autoreset and self.actor:knowTalent(tid) then
talents = talents.."#GOLD# - "..t.name.."#LAST#\n"
else
reset[#reset+1] = tid
......@@ -715,7 +718,7 @@ function _M:learnTalent(t_id, v)
self:simplePopup("Impossible", "You cannot unlearn talents!")
return
end
self.actor:unlearnTalent(t_id)
self.actor:unlearnTalent(t_id, nil, true)
self.talents_changed[t_id] = true
local _, reason = self.actor:canLearnTalent(t, 0)
local ok, dep_miss, stats_ok = self:checkDeps()
......@@ -757,7 +760,7 @@ function _M:learnTalent(t_id, v)
self:simplePopup("Impossible", "You cannot unlearn talents!")
return
end
self.actor:unlearnTalent(t_id)
self.actor:unlearnTalent(t_id, nil, true)
self.talents_changed[t_id] = true
local _, reason = self.actor:canLearnTalent(t, 0)
local ok, dep_miss, stats_ok = self:checkDeps()
......
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