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

more spells (temporal)

git-svn-id: http://svn.net-core.org/repos/t-engine4@256 51575b47-30f0-44d4-a5cc-537603b46e54
parent 1b236d5b
No related branches found
No related tags found
No related merge requests found
......@@ -138,6 +138,10 @@ end
--- Called before taking a hit, it's the chance to check for shields
function _M:onTakeHit(value, src)
if self:attr("invulnerable") then
return 0
end
if self:attr("mana_shield") then
local mana = self:getMana()
local mana_val = value * self:attr("mana_shield")
......
......@@ -230,3 +230,37 @@ newDamageType{
end
end,
}
-- Slowness
newDamageType{
name = "slow", type = "SLOW",
projector = function(src, x, y, type, dam)
local target = game.level.map(x, y, Map.ACTOR)
if target then
-- Freeze it, if we pass the test
local sx, sy = game.level.map:getTileToScreen(x, y)
if target:checkHit(src:combatSpellpower(), target:combatSpellResist(), 0, 95, 20) then
target:setEffect(target.EFF_SLOW, 7, {power=dam})
else
game.logSeen(target, "%s resists!", target.name:capitalize())
end
end
end,
}
-- Time prison, invulnerability and stun
newDamageType{
name = "time prison", type = "TIME_PRISON",
projector = function(src, x, y, type, dam)
local target = game.level.map(x, y, Map.ACTOR)
if target then
-- Freeze it, if we pass the test
local sx, sy = game.level.map:getTileToScreen(x, y)
if target:checkHit(src:combatSpellpower(), target:combatSpellResist(), 0, 95, 20) then
target:setEffect(target.EFF_TIME_PRISON, dam, {})
else
game.logSeen(target, "%s resists!", target.name:capitalize())
end
end
end,
}
......@@ -74,7 +74,7 @@ newTalent{
DEFEND = 10,
},
activate = function(self, t)
local power = 3 - (self:combatSpellpower(1) * self:getTalentLevel(t)) / 280
local power = math.max(0.8, 3 - (self:combatSpellpower(1) * self:getTalentLevel(t)) / 280)
return {
shield = self:addTemporaryValue("mana_shield", power),
}
......@@ -85,6 +85,6 @@ newTalent{
end,
info = function(self, t)
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)
The damage to mana ratio increases with the Magic stat]]):format(math.max(0.8, 3 - (self:combatSpellpower(1) * self:getTalentLevel(t)) / 280))
end,
}
newTalent{
name = "Time Prison",
type = {"spell/temporal", 1},
require = spells_req1,
points = 5,
mana = 30,
cooldown = 30,
tactical = {
DEFENSE = 10,
},
range = 20,
action = function(self, t)
local tg = {type="hit", range=self:getTalentRange(t)}
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.TIME_PRISON, 4 + self:combatSpellpower(0.03) * self:getTalentLevel(t), {type="manathrust"})
return true
end,
info = function(self, t)
return ([[Removes the target from the flow of time for %d turns. In this state the target cannot act nor be harmed.
The duration will increase with the Magic stat]]):format(4 + self:combatSpellpower(0.03) * self:getTalentLevel(t))
end,
}
newTalent{
name = "Congeal Time",
type = {"spell/temporal",2},
require = spells_req2,
points = 5,
mana = 20,
cooldown = 30,
tactical = {
BUFF = 10,
},
action = function(self, t)
local tg = {type="hit", range=self:getTalentRange(t)}
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, DamageType.SLOW, util.bound((self:combatSpellpower(25) * self:getTalentLevel(t)) / 100, 0.1, 0.4), {type="manathrust"})
return true
end,
info = function(self, t)
return ([[Decreases the target global speed by %.2f for 7 turns.
The speed decreases with the Magic stat]]):format(util.bound((self:combatSpellpower(25) * self:getTalentLevel(t)) / 100, 0.1, 0.4))
end,
}
newTalent{
name = "Essence of Speed",
type = {"spell/temporal",4},
require = spells_req4,
points = 5,
mode = "sustained",
sustain_mana = 450,
cooldown = 30,
tactical = {
BUFF = 10,
},
activate = function(self, t)
local power = util.bound((self:combatSpellpower(50) * self:getTalentLevel(t)) / 100, 0.1, 2)
return {
speed = self:addTemporaryValue("energy", {mod=power}),
}
end,
deactivate = function(self, t, p)
self:removeTemporaryValue("energy", p.speed)
return true
end,
info = function(self, t)
return ([[Increases the caster global speed by %.2f.
The speed increases with the Magic stat]]):format(util.bound((self:combatSpellpower(50) * self:getTalentLevel(t)) / 100, 0.1, 2))
end,
}
......@@ -135,6 +135,22 @@ newEffect{
end,
}
newEffect{
name = "SLOW",
desc = "Slow",
type = "magical",
status = "detrimental",
parameters = { power=0.1 },
on_gain = function(self, err) return "#Target# slows down.", "+Slow" end,
on_lose = function(self, err) return "#Target# speeds up.", "-Slow" end,
activate = function(self, eff)
eff.tmpid = self:addTemporaryValue("energy", {mod=-eff.power})
end,
deactivate = function(self, eff)
self:removeTemporaryValue("energy", eff.tmpid)
end,
}
newEffect{
name = "INVISIBILITY",
desc = "Invisibility",
......@@ -222,3 +238,23 @@ newEffect{
self:removeTemporaryValue("combat_spellcrit", eff.sid)
end,
}
newEffect{
name = "TIME_PRISON",
desc = "Time Prison",
type = "other",
status = "detrimental",
parameters = {},
on_gain = function(self, err) return "#Target# is removed from time!", "+Out of Time" end,
on_lose = function(self, err) return "#Target# is into normal time.", "-Out of Time" end,
activate = function(self, eff)
eff.iid = self:addTemporaryValue("invulnerable", 1)
self.energy.value = 0
end,
on_timeout = function(self, eff)
self.energy.value = 0
end,
deactivate = function(self, eff)
self:removeTemporaryValue("invulnerable", eff.iid)
end,
}
No preview for this file type
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