diff --git a/game/engines/default/engine/Level.lua b/game/engines/default/engine/Level.lua index 7eacac250833245632e2b2fe23389218118258f3..86d3791a22c9b70b1b014a2e26f645b0b83f39ea 100644 --- a/game/engines/default/engine/Level.lua +++ b/game/engines/default/engine/Level.lua @@ -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 diff --git a/game/engines/default/engine/Savefile.lua b/game/engines/default/engine/Savefile.lua index 458ad1b7ae8a1233f59c9a8e003591598441db46..fafa3706386b8d3458e7f1ca95b59003c6d52eff 100644 --- a/game/engines/default/engine/Savefile.lua +++ b/game/engines/default/engine/Savefile.lua @@ -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 diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 35d1914bec6fbbb6305344653aa2e47b83731810..88136dff51a922f10048419ee41a32f33a626080 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -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 diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index 812d199e8e2fddfb680280f39916027c0f4a3db0..1134511d38eae22a56b7b34cdc54ac9b622cb2df 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -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 diff --git a/game/modules/tome/data/talents/celestial/twilight.lua b/game/modules/tome/data/talents/celestial/twilight.lua index 206543a7bbc3e7a70c566f01d29aa2aff9ca379a..66382763aa2604dd50519bd570e2d616e05f6d0c 100644 --- a/game/modules/tome/data/talents/celestial/twilight.lua +++ b/game/modules/tome/data/talents/celestial/twilight.lua @@ -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 diff --git a/game/modules/tome/data/talents/cunning/ambush.lua b/game/modules/tome/data/talents/cunning/ambush.lua index d6d1c97acfee0fe876dc5fe626fe09c9563bb959..885b2675377ac7681a2d2c4abdc9ceb7be98d642 100644 --- a/game/modules/tome/data/talents/cunning/ambush.lua +++ b/game/modules/tome/data/talents/cunning/ambush.lua @@ -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 diff --git a/game/modules/tome/data/talents/spells/shades.lua b/game/modules/tome/data/talents/spells/shades.lua index 8436407817b800dd223990e7537fcb850f23cd04..c99f3bcc23e320269d6faa50b216078fb8014b7a 100644 --- a/game/modules/tome/data/talents/spells/shades.lua +++ b/game/modules/tome/data/talents/spells/shades.lua @@ -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 diff --git a/game/modules/tome/dialogs/LevelupDialog.lua b/game/modules/tome/dialogs/LevelupDialog.lua index d5cf1a08288bcfa61e9ff5faecc883c61e1cae03..0bea6dacd00fcf93d1fd03ab0380e7263aca13ce 100644 --- a/game/modules/tome/dialogs/LevelupDialog.lua +++ b/game/modules/tome/dialogs/LevelupDialog.lua @@ -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()