Skip to content
Snippets Groups Projects
Commit ce9210d8 authored by Hachem_Muche's avatar Hachem_Muche
Browse files

Update some Trap functions for backwards compatibility with older traps.

Coup de Grace will correctly trigger stealth only if it's on cooldown.
parent 6beb9d42
No related branches found
No related tags found
1 merge request!360Trap/RogueFixes
This commit is part of merge request !360. Comments created here will be created in the context of that merge request.
......@@ -100,7 +100,7 @@ function _M:setKnown(actor, v, x, y)
self.known_by[actor] = v
if x and y and v and actor.player and game.level.map(x, y, engine.Map.TRAP) == self then
game.level.map(x, y, engine.Map.TERRAIN).always_remember = true
if core.fov.distance(self.x, self.y, actor.x, actor.y) <= 1 then
if core.fov.distance(x, y, actor.x, actor.y) <= 1 then
if actor:checkHitOld(actor:callTalent(actor.T_TRAP_MASTERY, "getPower") + 5, self.disarm_power) then
self:identify(true)
end
......@@ -180,7 +180,7 @@ end
function _M:disarm(x, y, who)
-- don't disarm "friendly" traps
if self.faction and who.reactionToward and who:reactionToward(self) >= 0 then return false end
if core.fov.distance(self.x, self.y, x, y) <= 1 then self:setKnown(who, true, x, y) end
if core.fov.distance(x, y, who.x, who.y) <= 1 then self:setKnown(who, true, x, y) end
return engine.Trap.disarm(self, x, y, who)
end
......
......@@ -66,14 +66,11 @@ newTalent{
end
end
if target.dead then
if target.dead and self:knowTalent(self.T_STEALTH) and not self:isTalentActive(self.T_STEALTH) and not self:isTalentCoolingDown(self.T_STEALTH) then
game:onTickEnd(function()
if self:knowTalent(self.T_STEALTH) and not self:isTalentActive(self.T_STEALTH) then
self.hide_chance = 1000
self.talents_cd[self.T_STEALTH] = 0
self:forceUseTalent(self.T_STEALTH, {ignore_energy=true, silent = true})
self.hide_chance = nil
end
self.hide_chance = 1000
self:forceUseTalent(self.T_STEALTH, {ignore_energy=true, silent = true})
self.hide_chance = nil
end)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment