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

manaflow & heal spells

git-svn-id: http://svn.net-core.org/repos/t-engine4@100 51575b47-30f0-44d4-a5cc-537603b46e54
parent ba6e9d3b
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,11 @@ function _M:regenLife() ...@@ -29,6 +29,11 @@ function _M:regenLife()
end end
end end
--- Heal some
function _M:heal(value, src)
self.life = util.bound(self.life + value, 0, self.max_life)
end
--- Remove some HP from an actor --- Remove some HP from an actor
-- If HP is reduced to 0 then remove from the level and call the die method.<br/> -- If HP is reduced to 0 then remove from the level and call the die method.<br/>
-- When an actor dies its dead property is set to true, to wait until garbage collection deletes it -- When an actor dies its dead property is set to true, to wait until garbage collection deletes it
......
...@@ -46,6 +46,7 @@ function _M:timedEffects() ...@@ -46,6 +46,7 @@ function _M:timedEffects()
p.dur = p.dur - 1 p.dur = p.dur - 1
if p.dur <= 0 then if p.dur <= 0 then
self.tmp[eff] = nil self.tmp[eff] = nil
self.changed = true
if _M.tempeffect_def[eff].on_lose then if _M.tempeffect_def[eff].on_lose then
local ret, fly = _M.tempeffect_def[eff].on_lose(self, p) local ret, fly = _M.tempeffect_def[eff].on_lose(self, p)
if ret then if ret then
...@@ -56,6 +57,7 @@ function _M:timedEffects() ...@@ -56,6 +57,7 @@ function _M:timedEffects()
game.flyers:add(sx, sy, 20, (rng.range(0,2)-1) * 0.5, -3, fly, {255,100,80}) game.flyers:add(sx, sy, 20, (rng.range(0,2)-1) * 0.5, -3, fly, {255,100,80})
end end
end end
if _M.tempeffect_def[eff].deactivate then _M.tempeffect_def[eff].deactivate(self, p) end
else else
if _M.tempeffect_def[eff].on_timeout then if _M.tempeffect_def[eff].on_timeout then
_M.tempeffect_def[eff].on_timeout(self, p) _M.tempeffect_def[eff].on_timeout(self, p)
...@@ -83,6 +85,8 @@ function _M:setEffect(eff_id, dur, p) ...@@ -83,6 +85,8 @@ function _M:setEffect(eff_id, dur, p)
local sx, sy = game.level.map:getTileToScreen(self.x, self.y) local sx, sy = game.level.map:getTileToScreen(self.x, self.y)
game.flyers:add(sx, sy, 20, (rng.range(0,2)-1) * 0.5, -3, fly, {255,100,80}) game.flyers:add(sx, sy, 20, (rng.range(0,2)-1) * 0.5, -3, fly, {255,100,80})
end end
if _M.tempeffect_def[eff_id].activate then _M.tempeffect_def[eff_id].activate(self, p) end
self.changed = true
end end
end end
......
...@@ -61,6 +61,7 @@ newBirthDescriptor{ ...@@ -61,6 +61,7 @@ newBirthDescriptor{
["spell/cold"]=true, ["spell/cold"]=true,
["spell/air"]=true, ["spell/air"]=true,
["spell/conveyance"]=false, ["spell/conveyance"]=false,
["spell/nature"]=false,
}, },
talents = { talents = {
ActorTalents.T_MANATHRUST, ActorTalents.T_MANATHRUST,
......
...@@ -5,6 +5,7 @@ newTalentType{ type="spell/earth", name = "earth", description = "Harness the po ...@@ -5,6 +5,7 @@ newTalentType{ type="spell/earth", name = "earth", description = "Harness the po
newTalentType{ type="spell/cold", name = "cold", description = "Harness the power of winter to shatter your foes." } newTalentType{ type="spell/cold", name = "cold", description = "Harness the power of winter to shatter your foes." }
newTalentType{ type="spell/air", name = "air", description = "Harness the power of the air to fry your foes." } newTalentType{ type="spell/air", name = "air", description = "Harness the power of the air to fry your foes." }
newTalentType{ type="spell/conveyance", name = "conveyance", description = "Conveyance is the school of travel. It allows you to travel faster and to track others." } newTalentType{ type="spell/conveyance", name = "conveyance", description = "Conveyance is the school of travel. It allows you to travel faster and to track others." }
newTalentType{ type="spell/nature", name = "nature", description = "Summons the power of nature to rejuvenate yourself and the world." }
newTalent{ newTalent{
name = "Manathrust", name = "Manathrust",
...@@ -160,3 +161,43 @@ newTalent{ ...@@ -160,3 +161,43 @@ newTalent{
The damage and duration will increase with the Magic stat]]):format(4 + self:getMag(30), 5 + self:getMag(10)) The damage and duration will increase with the Magic stat]]):format(4 + self:getMag(30), 5 + self:getMag(10))
end, end,
} }
newTalent{
name = "Manaflow",
type = {"spell/arcane", 2},
mana = 10,
cooldown = 300,
tactical = {
MANA = 20,
},
action = function(self)
if not self:hasEffect(self.EFF_MANAFLOW) then
self:setEffect(self.EFF_MANAFLOW, 10, {power=5+self:getMag(30)})
end
return true
end,
require = { stat = { mag=10 }, },
info = function(self)
return ([[Engulf yourself into a surge of mana, quickly restoring %d mana every turns for 10 turns.
The mana restored will increase with the Magic stat]]):format(5 + self:getMag(30))
end,
}
newTalent{
name = "Heal",
type = {"spell/nature", 1},
mana = 30,
cooldown = 10,
tactical = {
HEAL = 10,
},
action = function(self)
self:heal(10 + self:getMag(200), self)
return true
end,
require = { stat = { mag=10 }, },
info = function(self)
return ([[Call upon the forces of nature to heal your body for %d life.
The life healed will increase with the Magic stat]]):format(10 + self:getMag(200))
end,
}
...@@ -3,10 +3,26 @@ newEffect{ ...@@ -3,10 +3,26 @@ newEffect{
desc = "Bleeding", desc = "Bleeding",
type = "physical", type = "physical",
status = "detrimental", status = "detrimental",
parameters = { power=0 }, parameters = { power=1 },
on_gain = function(self, err) return "#Target# start to bleed.", "+Bleeds" end, on_gain = function(self, err) return "#Target# starts to bleed.", "+Bleeds" end,
on_lose = function(self, err) return "#Target# stop bleeding.", "-Bleeds" end, on_lose = function(self, err) return "#Target# stops bleeding.", "-Bleeds" end,
on_timeout = function(self, eff) on_timeout = function(self, eff)
self:takeHit(eff.power, self) self:takeHit(eff.power, self)
end, end,
} }
newEffect{
name = "MANAFLOW",
desc = "Surging mana",
type = "magical",
status = "beneficial",
parameters = { power=10 },
on_gain = function(self, err) return "#Target# starts to surge mana.", "+Manaflow" end,
on_lose = function(self, err) return "#Target# stops surging mana.", "-Manaflow" end,
activate = function(self, eff)
self.mana_regen = self.mana_regen + eff.power
end,
deactivate = function(self, eff)
self.mana_regen = self.mana_regen - eff.power
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