From d5fea093dbc4c0427a426199045b80d382154b1e Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Fri, 10 Feb 2012 16:57:42 +0000 Subject: [PATCH] Fixed description of Tormented effect Fixed description of Panicked effect Fixed moving the player in panicked effect Added support for fear resistance to Fears/Panic Reduced damage of Slaughter/Reckless Charge git-svn-id: http://svn.net-core.org/repos/t-engine4@4827 51575b47-30f0-44d4-a5cc-537603b46e54 --- .../tome/data/talents/cursed/fears.lua | 6 ++- .../tome/data/talents/cursed/slaughter.lua | 7 +-- .../tome/data/timed_effects/mental.lua | 44 ++++++++++++------- 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/game/modules/tome/data/talents/cursed/fears.lua b/game/modules/tome/data/talents/cursed/fears.lua index e1a0ab6a7a..a070d559de 100644 --- a/game/modules/tome/data/talents/cursed/fears.lua +++ b/game/modules/tome/data/talents/cursed/fears.lua @@ -232,8 +232,12 @@ newTalent{ function(px, py) local actor = game.level.map(px, py, engine.Map.ACTOR) if actor and self:reactionToward(actor) < 0 and actor ~= self then - if actor:checkHit(self:combatMindpower(), actor:combatMentalResist(), 0, 95) then + if not actor:canBe("fear") then + game.logSeen(actor, "#F53CBE#%s ignores the panic!", actor.name:capitalize()) + elseif actor:checkHit(self:combatMindpower(), actor:combatMentalResist(), 0, 95) then actor:setEffect(actor.EFF_PANICKED, duration, {source=self,range=10,chance=chance}) + else + game.logSeen(actor, "#F53CBE#%s resists the panic!", actor.name:capitalize()) end end end, diff --git a/game/modules/tome/data/talents/cursed/slaughter.lua b/game/modules/tome/data/talents/cursed/slaughter.lua index b433906ec6..9164672790 100644 --- a/game/modules/tome/data/talents/cursed/slaughter.lua +++ b/game/modules/tome/data/talents/cursed/slaughter.lua @@ -133,13 +133,14 @@ newTalent{ require = cursed_str_req3, points = 5, random_ego = "attack", - cooldown = 20, - hate = 8, + cooldown = 15, + hate = 5, range = function(self, t) return 3 + self:getTalentLevelRaw(t) end, tactical = { CLOSEIN = 2 }, requires_target = true, getDamageMultiplier = function(self, t, hate) - return self:combatTalentIntervalDamage(t, "str", 0.8, 1.7, 0.4) * getHateMultiplier(self, 0.5, 1, false, hate) + return 0.7 * getHateMultiplier(self, 0.5, 1, false, hate) + --return self:combatTalentIntervalDamage(t, "str", 0.8, 1.7, 0.4) * getHateMultiplier(self, 0.5, 1, false, hate) end, getMaxAttackCount = function(self, t) return 1 + self:getTalentLevelRaw(t) diff --git a/game/modules/tome/data/timed_effects/mental.lua b/game/modules/tome/data/timed_effects/mental.lua index 5ea47eb2f1..5e71b0d9ab 100644 --- a/game/modules/tome/data/timed_effects/mental.lua +++ b/game/modules/tome/data/timed_effects/mental.lua @@ -1041,7 +1041,7 @@ newEffect{ newEffect{ name = "TORMENTED", image = "effects/tormented.png", desc = "Tormented", - long_desc = function(self, eff) return ("The target's mind is being tormented, causing %d apparitions to manifest and attack the target, inflicting %d mind damage each before disappearing."):format(eff.tormentorCount, eff.tormentorDamage) end, + long_desc = function(self, eff) return ("The target's mind is being tormented, causing %d apparitions to manifest and attack the target, inflicting %d mind damage each before disappearing."):format(eff.count, eff.damage) end, type = "mental", subtype = { fear=true }, status = "detrimental", @@ -1124,9 +1124,9 @@ newEffect{ } newEffect{ - name = "PANICKED", image = "talents/panicked.png", + name = "PANICKED", image = "talents/panic.png", desc = "Panicked", - long_desc = function(self, eff) return ("The target has been panicked by %s, causing them to have a %d%% chance of fleeing in terror instead of acting."):format(eff.chance) end, + long_desc = function(self, eff) return ("The target has been panicked by %s, causing them to have a %d%% chance of fleeing in terror instead of acting."):format(eff.source.name, eff.chance) end, type = "mental", subtype = { fear=true }, status = "detrimental", @@ -1141,26 +1141,40 @@ newEffect{ end, do_act = function(self, eff) if not self:enoughEnergy() then return nil end - if eff.source.dead then return nil end + if eff.source.dead then return true end local distance = core.fov.distance(self.x, self.y, eff.source.x, eff.source.y) if distance <= eff.range then -- in range if not self:attr("never_move") and rng.percent(eff.chance) then - local source = eff.source - local moveX, moveY = self.x + self.x - source.x, self.y + self.y - source.y - - if not self:moveDirection(moveX, moveY, true) then - if old_x ~= self.x or old_y ~= self.y then - if not self.did_energy then - self:useEnergy() + local sourceX, sourceY = eff.source.x, eff.source.y + + local bestX, bestY + local bestDistance = 0 + local start = rng.range(0, 8) + for i = start, start + 8 do + local x = self.x + (i % 3) - 1 + local y = self.y + math.floor((i % 9) / 3) - 1 + + if x ~= self.x or y ~= self.y then + local distance = core.fov.distance(x, y, sourceX, sourceY) + if distance > bestDistance + and game.level.map:isBound(x, y) + and not game.level.map:checkAllEntities(x, y, "block_move", self) + and not game.level.map(x, y, Map.ACTOR) then + bestDistance = distance + bestX = x + bestY = y end end + end + + if bestX then + self:move(bestX, bestY, false) + game.logPlayer(self, "#F53CBE#You panic and flee from %s.", eff.source.name) else - game.logSeen(self, "#F53CBE#%s panics and tries to move away from %s.", self.name:capitalize(), eff.source.name) - if not self.did_energy then - self:useEnergy() - end + game.logSeen(self, "#F53CBE#%s panics and tries to flee from %s.", self.name:capitalize(), eff.source.name) + self:useEnergy(game.energy_to_act * self:combatMovementSpeed(bestX, bestY)) end end end -- GitLab