diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index c34c5cbe61df7e48972d96c524d010c1a043591e..0e0597cec9f3a2f1aa3884a5e52f500a29372495 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -652,8 +652,12 @@ function _M:move(x, y, force) self:attackTarget(self) moved = true -- Should we prob travel through walls ? - elseif not force and self:attr("prob_travel") and game.level.map:checkEntity(x, y, Map.TERRAIN, "block_move", self) then + elseif not force and self:attr("prob_travel") and not self:attr("prob_travel_deny") and game.level.map:checkEntity(x, y, Map.TERRAIN, "block_move", self) then moved = self:probabilityTravel(x, y, self:attr("prob_travel")) + if self:attr("prob_travel_penalty") then + local d = core.fov.distance(ox, oy, self.x, self.y) + self:setEffect(self.EFF_PROB_TRAVEL_UNSTABLE, d * self:attr("prob_travel_penalty"), {}) + end -- Never move but tries to attack ? ok elseif not force and self:attr("never_move") then -- A bit weird, but this simple asks the collision code to detect an attack diff --git a/game/modules/tome/data/talents/spells/conveyance.lua b/game/modules/tome/data/talents/spells/conveyance.lua index e3312f24a10ae16336a2c3db2e0ed386e7e29949..cec9b30419bca761e42a7dded7f01f315d7a7c53 100644 --- a/game/modules/tome/data/talents/spells/conveyance.lua +++ b/game/modules/tome/data/talents/spells/conveyance.lua @@ -222,17 +222,20 @@ newTalent{ game:playSoundNear(self, "talents/teleport") return { prob_travel = self:addTemporaryValue("prob_travel", t.getRange(self, t)), + prob_travel_penalty = self:addTemporaryValue("prob_travel_penalty", 2 + (5 - math.min(self:getTalentLevelRaw(t), 5)) / 2), } end, deactivate = function(self, t, p) self:removeTemporaryValue("prob_travel", p.prob_travel) + self:removeTemporaryValue("prob_travel_penalty", p.prob_travel_penalty) return true end, info = function(self, t) local range = t.getRange(self, t) return ([[When you hit a solid surface this spell tears down the laws of probability to make you instantly appear on the other side. Teleports up to %d grids. + After a successful probability travel you are left unstable, unable to do it again for a number of turns equal to %d%% of the number of tiles you blinked through. Range will improve with your Spellpower.]]): - format(range) + format(range, (2 + (5 - math.min(self:getTalentLevelRaw(t), 5)) / 2) * 100) end, } diff --git a/game/modules/tome/data/timed_effects/other.lua b/game/modules/tome/data/timed_effects/other.lua index 771aa3d3e83009666667898729d210c6242a8966..76880de10a3da85a1ce4f7c6d25b88f8e1521051 100644 --- a/game/modules/tome/data/timed_effects/other.lua +++ b/game/modules/tome/data/timed_effects/other.lua @@ -1331,3 +1331,19 @@ newEffect{ end end, } + +newEffect{ + name = "PROB_TRAVEL_UNSTABLE", image = "talents/probability_travel.png", + desc = "Time Prison", + long_desc = function(self, eff) return "The target has recently blinked through a wall using probability travel." end, + type = "other", + subtype = { time=true, space=true }, + status = "detrimental", + parameters = {}, + activate = function(self, eff) + eff.iid = self:addTemporaryValue("prob_travel_deny", 1) + end, + deactivate = function(self, eff) + self:removeTemporaryValue("prob_travel_deny", eff.iid) + end, +}