Skip to content
Snippets Groups Projects
Commit a5217b7e authored by DarkGod's avatar DarkGod
Browse files

Traps have 5% chance to not trigger

parent 8e85c54a
No related branches found
No related tags found
No related merge requests found
......@@ -128,13 +128,15 @@ end
--- Called when triggered
function _M:canTrigger(x, y, who, no_random)
if rng.percent(5) then
if self:knownBy(who) then game.logPlayer(who, "You somehow avoid the trap (%s).", self:getName()) end
return false
end
if who:attr("avoid_traps") then return false end
if self.pressure_trap and who:attr("avoid_pressure_traps") then return false end
if self.faction and who.reactionToward and who:reactionToward(self) >= 0 then return false end
if not no_random and who.trap_avoidance and rng.percent(who.trap_avoidance) then
if self:knownBy(who) then
game.logPlayer(who, "You carefully avoid the trap (%s).", self:getName())
end
if self:knownBy(who) then game.logPlayer(who, "You carefully avoid the trap (%s).", self:getName()) end
return false
end
if who:attr("walk_sun_path") and game.level then
......
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