diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index cec12a691919295f77957d045c07e878f2ad4f1d..087d91943ae2070bbb55d615d07e684142e34bc1 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -2330,7 +2330,6 @@ end -- Overwrite incStamina to set up Adrenaline Surge local previous_incStamina = _M.incStamina - function _M:incStamina(stamina) if stamina < 0 and self:hasEffect(self.EFF_ADRENALINE_SURGE) then local stamina_cost = math.abs(stamina) @@ -2346,6 +2345,23 @@ function _M:incStamina(stamina) end end +-- Overwrite incVim to set up Bloodcasting +local previous_incVim = _M.incVim +function _M:incVim(v) + if v < 0 and self:attr("bloodcasting") then + local cost = math.abs(v) + if self.vim - cost < 0 then + local damage = cost - (self.vim or 0) + self:incVim(-self.vim or 0) + self.life = self.life - damage + else + return previous_incVim(self, v) + end + else + return previous_incVim(self, v) + end +end + --- Called before a talent is used -- Check the actor can cast it -- @param ab the talent (not the id, the table) @@ -2419,7 +2435,7 @@ function _M:preUseTalent(ab, silent, fake) if not silent then game.logPlayer(self, "You do not have enough stamina to use %s.", ab.name) end return false end - if ab.vim and self:getVim() < ab.vim then + if ab.vim and self:getVim() < ab.vim and (not self:attr("bloodcasting") or self.life < ab.vim) then if not silent then game.logPlayer(self, "You do not have enough vim to use %s.", ab.name) end return false end diff --git a/game/modules/tome/data/gfx/talents/blood_sacrifice.png b/game/modules/tome/data/gfx/talents/bloodcasting.png similarity index 100% rename from game/modules/tome/data/gfx/talents/blood_sacrifice.png rename to game/modules/tome/data/gfx/talents/bloodcasting.png diff --git a/game/modules/tome/data/talents/corruptions/sanguisuge.lua b/game/modules/tome/data/talents/corruptions/sanguisuge.lua index a1f5a6d35f761367edec3ed516b48ee24faf4add..1306823ae7d262796651689cbd31c8d3f062e37a 100644 --- a/game/modules/tome/data/talents/corruptions/sanguisuge.lua +++ b/game/modules/tome/data/talents/corruptions/sanguisuge.lua @@ -45,6 +45,7 @@ newTalent{ end, } +--[[ newTalent{ name = "Blood Sacrifice", type = {"corruption/sanguisuge", 2}, @@ -80,12 +81,33 @@ newTalent{ return true end, info = function(self, t) - return ([[Sacrifices 50%% of your current life to restore %d vim. + return ([=[Sacrifices 50%% of your current life to restore %d vim. This only works if there is at least one foe in sight. - The effect will increase with your Magic stat.]]): + The effect will increase with your Magic stat.]=]): format(30 + self:combatTalentSpellDamage(t, 5, 150)) end, } +]] +newTalent{ + name = "Bloodcasting", + type = {"corruption/sanguisuge", 2}, + require = corrs_req2, + points = 5, + vim = 0, + cooldown = 18, + no_energy = true, + range = 10, + no_npc_use = true, + action = function(self, t) + self:setEffect(self.EFF_BLOODCASTING, 2 + math.floor(self:getTalentLevel(t)), {}) + game:playSoundNear(self, "talents/spell_generic2") + return true + end, + info = function(self, t) + return ([[For %d turns your corruption spells will consume health instead of vim if their cost is higher than your vim.]]): + format(2 + math.floor(self:getTalentLevel(t))) + end, +} newTalent{ name = "Absorb Life", diff --git a/game/modules/tome/data/timed_effects/magical.lua b/game/modules/tome/data/timed_effects/magical.lua index e13a0b0e6d3173d9abf72c837a7006dce7981e64..e69e3a1bee70e11225e6c79b5d8433a28cc4c8ce 100644 --- a/game/modules/tome/data/timed_effects/magical.lua +++ b/game/modules/tome/data/timed_effects/magical.lua @@ -1578,3 +1578,19 @@ newEffect{ end end, } + +newEffect{ + name = "BLOODCASTING", image = "talents/bloodcasting.png", + desc = "Bloodcasting", + long_desc = function(self, eff) return ("Corruptions consume health instead of vim.") end, + type = "magical", + subtype = {corruption=true}, + status = "beneficial", + parameters = {}, + activate = function(self, eff) + eff.tmpid = self:addTemporaryValue("bloodcasting", 1) + end, + deactivate = function(self, eff) + self:removeTemporaryValue("bloodcasting", eff.tmpid) + end, +}