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

disruption shield

git-svn-id: http://svn.net-core.org/repos/t-engine4@196 51575b47-30f0-44d4-a5cc-537603b46e54
parent 2a9f5819
No related branches found
No related tags found
No related merge requests found
......@@ -39,8 +39,8 @@ end
-- 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
function _M:takeHit(value, src)
if self.onTakeHit then value = self:onTakeHit(value, src) end
self.life = self.life - value
if self.onTakeHit then self:onTakeHit(value, src) end
if self.life <= 0 then
game.logSeen(self, "%s killed %s!", src.name:capitalize(), self.name)
game.level:removeEntity(self)
......
......@@ -122,6 +122,21 @@ function _M:tooltip()
return ("%s\n#00ffff#Level: %d\nExp: %d/%d\n#ff0000#HP: %d"):format(self.name, self.level, self.exp, self:getExpChart(self.level+1) or "---", self.life)
end
--- Called before taking a hit, it's the chance to check for shields
function _M:onTakeHit(value, src)
if self:attr("mana_shield") then
local mana = self:getMana()
local mana_val = value * self:attr("mana_shield")
-- We have enough to absord the full hit
if mana_val <= mana then
self:incMana(-mana_val)
return 0
-- Or we dont! and we do nothing
end
end
return value
end
function _M:die(src)
-- Gives the killer some exp for the kill
if src then
......
......@@ -22,10 +22,11 @@ end
--- Called by ActorLife interface
-- We use it to pass aggression values to the AIs
function _M:onTakeHit(value, src)
print("took hit from", src.name, "::", self.ai_target.actor)
if not self.ai_target.actor then
self.ai_target.actor = src
end
return mod.class.Actor.onTakeHit(self, value, src)
end
function _M:tooltip()
......
......@@ -23,7 +23,7 @@ newTalent{
type = {"physical/combat-training", 1},
mode = "passive",
points = 5,
require = { stat = { con=14 }, },
require = { stat = { con=function(level) return 14 + level * 5 end }, },
on_learn = function(self, t)
self.max_life = self.max_life + 40
end,
......
......@@ -13,7 +13,6 @@ newTalent{
if self:getTalentLevel(t) >= 3 then tg.type = "beam" end
local x, y = self:getTarget(tg)
if not x or not y then return nil end
print("lvel", self:getTalentLevel(t))
self:project(tg, x, y, DamageType.ARCANE, self:spellCrit(10 + self:combatSpellpower(0.5) * self:getTalentLevel(t)))
return true
end,
......@@ -54,13 +53,13 @@ newTalent{
points = 5,
require = { stat = { mag=28 }, },
on_learn = function(self, t)
self.combat_spellpower = self.combat_spellpower + 3
self.combat_spellpower = self.combat_spellpower + 5
end,
on_unlearn = function(self, t)
self.combat_spellpower = self.combat_spellpower - 3
self.combat_spellpower = self.combat_spellpower - 5
end,
info = function(self, t)
return [[Your mastery of magic allows your to permanently increase your spellpower by 3.]]
return [[Your mastery of magic allows your to permanently increase your spellpower by 5.]]
end,
}
......@@ -74,12 +73,18 @@ newTalent{
DEFEND = 10,
},
activate = function(self, t)
game.log("IMPLEMENT ME!")
local power = 3 - (self:combatSpellpower(1) * self:getTalentLevel(t)) / 280
return {
shield = self:addTemporaryValue("mana_shield", power),
}
end,
deactivate = function(self, t, p)
self:removeTemporaryValue("mana_shield", p.shield)
return true
end,
require = { stat = { mag=60 }, level=40 },
require = { stat = { mag=40 }, level=20 },
info = function(self, t)
return ([[Uses mana instead of life to take damage
The damage to mana ratio increases with the Magic stat]]):format(10 + self:combatSpellpower())
return ([[Uses mana instead of life to take damage. Uses %0.2f mana per damage taken.
The damage to mana ratio increases with the Magic stat]]):format(3 - (self:combatSpellpower(1) * self:getTalentLevel(t)) / 280)
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