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

New "callbackOnResurrect"

parent 82660b96
No related branches found
No related tags found
No related merge requests found
......@@ -3138,6 +3138,7 @@ function _M:die(src, death_note)
self:move(self.x, self.y, true)
self:check("on_resurrect", "basic_resurrect")
self:triggerHook{"Actor:resurrect", reason="basic_resurrect"}
self:fireTalentCheck("callbackOnResurrect", "basic_resurrect")
if self:attr("self_resurrect_chat") then
local chat = Chat.new(self.self_resurrect_chat, self, game.player)
......@@ -5984,6 +5985,7 @@ local sustainCallbackCheck = {
callbackOnDeath = "talents_on_death",
callbackOnDeathbox = "talents_on_deathbox",
callbackOnSummonDeath = "talents_on_summon_death",
callbackOnResurrect = "talents_on_resurrect",
callbackOnDie = "talents_on_die",
callbackOnKill = "talents_on_kill",
callbackOnSummonKill = "talents_on_summon_kill",
......
......@@ -35,7 +35,7 @@ newTalent{
self.lich_first_rez = true
_G.a=dialog
dialog:cleanActor(self)
dialog:resurrectBasic(self)
dialog:resurrectBasic(self, "lich_rebirth")
dialog:restoreResources(self)
self:callTalent(self.T_LICH, "becomeLich")
......@@ -48,7 +48,7 @@ newTalent{
elseif not self:hasEffect(self.EFF_LICH_HUNGER) and not self.lich_no_more_regen then
list[#list+1] = {name=("Lich Regeneration (%d turns)"):tformat(t.getTurns(self, t)), action=function()
dialog:cleanActor(self)
dialog:resurrectBasic(self)
dialog:resurrectBasic(self, "lich_regen")
dialog:restoreResources(self)
game.level.map:particleEmitter(self.x, self.y, 1, "demon_teleport")
......
......@@ -128,7 +128,7 @@ function _M:restoreResources(actor)
end
--- Basic resurrection
function _M:resurrectBasic(actor)
function _M:resurrectBasic(actor, reason)
actor.dead = false
actor.died = (actor.died or 0) + 1
......@@ -160,6 +160,8 @@ function _M:resurrectBasic(actor)
game.paused = true
actor:checkTwoHandedPenalty()
actor:fireTalentCheck("callbackOnResurrect", reason or "unknown")
end
--- Send the party to the Eidolon Plane
......@@ -177,7 +179,7 @@ function _M:eidolonPlane()
local is_exploration = game.permadeath == game.PERMADEATH_INFINITE
self:cleanActor(self.actor)
self:resurrectBasic(self.actor)
self:resurrectBasic(self.actor, "eidolon_plane")
for e, _ in pairs(game.party.members) do
self:cleanActor(e)
end
......@@ -222,7 +224,7 @@ function _M:use(item)
game.logPlayer(self.actor, "#LIGHT_BLUE#You resurrect! CHEATER!")
self:cleanActor(self.actor)
self:resurrectBasic(self.actor)
self:resurrectBasic(self.actor, "cheat")
self:restoreResources(self.actor)
self.actor:check("on_resurrect", "cheat")
self.actor:triggerHook{"Actor:resurrect", reason="cheat"}
......@@ -231,7 +233,7 @@ function _M:use(item)
game.logPlayer(self.actor, "#LIGHT_RED#The Blood of Life rushes through your dead body. You come back to life!")
self:cleanActor(self.actor)
self:resurrectBasic(self.actor)
self:resurrectBasic(self.actor, "blood_life")
self:restoreResources(self.actor)
world:gainAchievement("UNSTOPPABLE", actor)
self.actor:check("on_resurrect", "blood_life")
......@@ -251,7 +253,7 @@ function _M:use(item)
game.logPlayer(self.actor, "#YELLOW#Your bones magically knit back together. You are once more able to dish out pain to your foes!")
self:cleanActor(self.actor)
self:resurrectBasic(self.actor)
self:resurrectBasic(self.actor, "skeleton")
self:restoreResources(self.actor)
world:gainAchievement("UNSTOPPABLE", actor)
self.actor:check("on_resurrect", "skeleton")
......@@ -263,7 +265,7 @@ function _M:use(item)
game.logPlayer(self.actor, "#YELLOW#Your %s is consumed and disappears! You come back to life!", o:getName{do_colour=true})
self:cleanActor(self.actor)
self:resurrectBasic(self.actor)
self:resurrectBasic(self.actor, "consume", o)
self:restoreResources(self.actor)
world:gainAchievement("UNSTOPPABLE", actor)
self.actor:check("on_resurrect", "consume", o)
......
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