From a64427a3a5409b369edfd0148bba0735952b81cb Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Wed, 28 Mar 2012 22:54:36 +0000 Subject: [PATCH] Probability Travel now applies a debuff when used to pass a wall that will prevent an other wall passing for X turns (based on distance and talent level) git-svn-id: http://svn.net-core.org/repos/t-engine4@5011 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/modules/tome/class/Actor.lua | 6 +++++- .../tome/data/talents/spells/conveyance.lua | 5 ++++- game/modules/tome/data/timed_effects/other.lua | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index c34c5cbe61..0e0597cec9 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 e3312f24a1..cec9b30419 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 771aa3d3e8..76880de10a 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, +} -- GitLab