From b3ecc76e2c2b071c1df8d161820600dc5354ca4b Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Sat, 15 Jan 2011 23:04:06 +0000 Subject: [PATCH] anomalies git-svn-id: http://svn.net-core.org/repos/t-engine4@2386 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/modules/tome/class/Actor.lua | 10 ++++++++++ .../data/talents/chronomancy/spacetime-weaving.lua | 10 +++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index e3f4eaa7a2..cf4f272bf6 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -1542,6 +1542,16 @@ function _M:preUseTalent(ab, silent, fake) self:incParadox(pa / 2) self:useEnergy() return false + elseif rng.percent(math.pow((self:getParadox()/400), 4)) then + -- Random anomaly + local ts = {} + for id, t in pairs(self.talents_def) do + if t.type[1] == "chronomancy/anomalies" then ts[#ts+1] = id end + end + if not silent then game.logPlayer(self, "You lose control and unleash an anomaly!") end + self:forceUseTalent(rng.table(ts), {ignore_energy=true}) + self:useEnergy() + return false end end diff --git a/game/modules/tome/data/talents/chronomancy/spacetime-weaving.lua b/game/modules/tome/data/talents/chronomancy/spacetime-weaving.lua index 236c8f763a..e1140ac58f 100644 --- a/game/modules/tome/data/talents/chronomancy/spacetime-weaving.lua +++ b/game/modules/tome/data/talents/chronomancy/spacetime-weaving.lua @@ -181,13 +181,13 @@ newTalent{ display = '&', color_r=255, color_g=255, color_b=255, back_color=colors.STEEL_BLUE, message = "@Target@ moves through the wormhole.", triggered = function(self, x, y, who) - local tx, ty = util.findFreeGrid(self.dest.x, self.dest.y, 5, true, {[engine.Map.ACTOR]=true}) + local tx, ty = util.findFreeGrid(self.dest.x, self.dest.y, 5, true, {[engine.Map.ACTOR]=true}) if not tx or not who:canBe("teleport") or game.level.map.attrs(tx, ty, "no_teleport") then game.logPlayer(who, "You try to enter the wormhole but a violent force pushes you back.") - return true - else - who:move(tx, ty, true) - end + return true + else + who:move(tx, ty, true) + end return true end, disarm = function(self, x, y, who) return false end, -- GitLab