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

divination spells

git-svn-id: http://svn.net-core.org/repos/t-engine4@261 51575b47-30f0-44d4-a5cc-537603b46e54
parent e18a66fb
No related branches found
No related tags found
No related merge requests found
......@@ -83,9 +83,9 @@ function _M:setEffect(eff_id, dur, p, silent)
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
if _M.tempeffect_def[eff_id].activate then _M.tempeffect_def[eff_id].activate(self, p) end
self.changed = true
end
--- Check timed effect
......
......@@ -208,6 +208,26 @@ function _M:display()
self.level.map:fovESP(self.player.x, self.player.y, self.player.esp.range or 10)
self.level.map:fov(self.player.x, self.player.y, 20)
if self.player.lite > 0 then self.level.map:fovLite(self.player.x, self.player.y, self.player.lite) end
--
-- Handle Sense spell
--
if self.player:attr("detect_range") then
core.fov.calc_circle(self.player.x, self.player.y, self.player:attr("detect_range"), function(map, lx, ly)
if game.level.map:checkEntity(lx, ly, engine.Map.TERRAIN, "block_sense") then return true end
end, function(map, lx, ly)
local ok = false
print(game.player:attr("detect_actor"), game.level.map(lx, ly, game.level.map.ACTOR), "::", lx, ly)
if game.player:attr("detect_actor") and game.level.map(lx, ly, game.level.map.ACTOR) then ok = true end
if game.player:attr("detect_object") and game.level.map(lx, ly, game.level.map.OBJECT) then ok = true end
-- if game.player:attr("detect_trap") and game.level.map(lx, ly, game.level.map.ACTOR) then ok = true end
if ok then
game.level.map.seens(lx, ly, true)
end
end, self)
game.level.map:redisplay()
end
end
self.level.map:display()
......
newTalent{
name = "Sense",
type = {"spell/divination", 1},
require = spells_req1,
points = 5,
mana = 10,
cooldown = 10,
tactical = {
ATTACK = 10,
},
action = function(self, t)
local rad = 10 + self:combatSpellpower(0.1) * self:getTalentLevel(t)
self:setEffect(self.EFF_SENSE, 2, {
range = rad,
actor = 1,
object = (self:getTalentLevel(t) >= 2) and 1 or 0,
trap = (self:getTalentLevel(t) >= 5) and 1 or 0,
})
return true
end,
info = function(self, t)
return ([[Sense foes around you in a radius of %d.
At level 2 it detects objects.
At level 5 it detects traps.
The radius will increase with the Magic stat]]):format(10 + self:combatSpellpower(0.1) * self:getTalentLevel(t))
end,
}
newTalent{
name = "Indentify",
type = {"spell/divination", 2},
require = spells_req2,
points = 3,
mana = 20,
cooldown = 20,
action = function(self, t)
local rad = math.floor(0 + (self:getTalentLevel(t) - 4))
return true
end,
info = function(self, t)
return ([[Identify the powers and nature of an object.
At level 3 it identifies all the objects in your possession.
At level 4 it identifies all the objects on the floor in a radius of %d.]]):format(math.floor(0 + (self:getTalentLevel(t) - 4)))
end,
}
newTalent{
name = "Vision",
type = {"spell/divination", 3},
require = spells_req3,
points = 5,
mana = 20,
cooldown = 20,
action = function(self, t)
self:magicMap(10 + self:combatSpellpower(0.1) * self:getTalentLevel(t))
return true
end,
info = function(self, t)
return ([[Form a map of your surroundings in your mind in a radius of %d.]]):format(10 + self:combatSpellpower(0.1) * self:getTalentLevel(t))
end,
}
newTalent{
name = "Telepathy",
type = {"spell/divination", 4},
mode = "sustained",
require = spells_req4,
points = 5,
sustain_mana = 200,
cooldown = 30,
activate = function(self, t)
-- There is an implicit +10, as it is the default radius
local rad = self:combatSpellpower(0.1) * self:getTalentLevel(t)
return {
esp = self:addTemporaryValue("esp", {range=rad, all=1}),
}
end,
deactivate = function(self, t, p)
self:removeTemporaryValue("esp", p.esp)
return true
end,
info = function(self, t)
return ([[Allows to sense the presence of foes in your mind, in a radius of %d.
The bonus will increase with the Magic stat]]):format(10 + self:combatSpellpower(0.1) * self:getTalentLevel(t))
end,
}
......@@ -63,15 +63,17 @@ newTalent{
local power = 4 + self:combatSpellpower(0.1) * self:getTalentLevel(t)
return {
invisible = self:addTemporaryValue("invisible", power),
drain = self:addTemporaryValue("mana_regen", 5),
}
end,
deactivate = function(self, t, p)
self:removeTemporaryValue("invisible", p.invisible)
self:removeTemporaryValue("mana_regen", p.drain)
return true
end,
info = function(self, t)
return ([[The caster fades from sight, granting %d bonus to invisibility.
This powerful spell constantly drains your mana while active.
The bonus will increase with the Magic stat]]):format(4 + self:combatSpellpower(0.1) * self:getTalentLevel(t))
end,
}
......@@ -258,3 +258,24 @@ newEffect{
self:removeTemporaryValue("invulnerable", eff.iid)
end,
}
newEffect{
name = "SENSE",
desc = "Sensing",
type = "magical",
status = "beneficial",
parameters = { range=10, actor=1, object=0, trap=0 },
activate = function(self, eff)
eff.rid = self:addTemporaryValue("detect_range", eff.range)
eff.aid = self:addTemporaryValue("detect_actor", eff.actor)
eff.oid = self:addTemporaryValue("detect_object", eff.object)
eff.tid = self:addTemporaryValue("detect_trap", eff.trap)
game.level.map.changed = true
end,
deactivate = function(self, eff)
self:removeTemporaryValue("detect_range", eff.rid)
self:removeTemporaryValue("detect_actor", eff.aid)
self:removeTemporaryValue("detect_object", eff.oid)
self:removeTemporaryValue("detect_trap", eff.tid)
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