diff --git a/game/engine/interface/ActorTemporaryEffects.lua b/game/engine/interface/ActorTemporaryEffects.lua index 5b1ad29a67cda559c2db9ada70d7e0fefa437255..1a8bd9bfa5e3863d964f7466f3c329e1b8928057 100644 --- a/game/engine/interface/ActorTemporaryEffects.lua +++ b/game/engine/interface/ActorTemporaryEffects.lua @@ -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 diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 9caeba4055b93cb56cbb9c5a328c181e39191a7f..d2fd92178aa19b4e51707be9139ae890efc035d3 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -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() diff --git a/game/modules/tome/data/talents/spells/divination.lua b/game/modules/tome/data/talents/spells/divination.lua index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..ca0fd6559aaa3913d541252ae77cf376de02036e 100644 --- a/game/modules/tome/data/talents/spells/divination.lua +++ b/game/modules/tome/data/talents/spells/divination.lua @@ -0,0 +1,86 @@ +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, +} diff --git a/game/modules/tome/data/talents/spells/phantasm.lua b/game/modules/tome/data/talents/spells/phantasm.lua index 7ffe4ddc37c1977580faf1a2799c370a9a1fee60..83e2e755eb684d27abd6897acb936fc9ffc45faf 100644 --- a/game/modules/tome/data/talents/spells/phantasm.lua +++ b/game/modules/tome/data/talents/spells/phantasm.lua @@ -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, } - diff --git a/game/modules/tome/data/timed_effects.lua b/game/modules/tome/data/timed_effects.lua index 28f7429c851a8efffaef071da7a1bc5b1988a12d..aedc3e8f7cbcfb058c3aa200cba43c9043481860 100644 --- a/game/modules/tome/data/timed_effects.lua +++ b/game/modules/tome/data/timed_effects.lua @@ -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, +} diff --git a/ideas/spells.ods b/ideas/spells.ods index acfd34e1a2a8420d8aae10f6f2309c05199b2628..089b68acf359356577742b9661584516879e9727 100644 Binary files a/ideas/spells.ods and b/ideas/spells.ods differ