Skip to content
Snippets Groups Projects
Commit 4068b5d3 authored by dg's avatar dg
Browse files

Stealth now takes no turns to use

Stealth now also teaches a new talent "automatic stealth", as long as it is active the player will auto-enter stealth when conditions are good


git-svn-id: http://svn.net-core.org/repos/t-engine4@2377 51575b47-30f0-44d4-a5cc-537603b46e54
parent 25c89d9c
No related branches found
No related tags found
No related merge requests found
......@@ -296,6 +296,13 @@ function _M:act()
end
end
-- Auto stealth?
if self:isTalentActive(self.T_AUTOMATIC_STEALTH) and not self:isTalentActive(self.T_STEALTH) then
local t = self:getTalentFromId(self.T_STEALTH)
if self:preUseTalent(t, true, true) and not self:isTalentCoolingDown(t) then
self:useTalent(self.T_STEALTH)
end
end
if self:attr("stunned") then
self.stunned_counter = (self.stunned_counter or 0) + (self:attr("stun_immune") or 0) * 100
......@@ -1583,6 +1590,7 @@ function _M:postUseTalent(ab, ret)
self:antimagicBackslash(4 + self:getTalentLevelRaw(ab))
end
self.changed = true
if not ab.no_energy then
if ab.is_spell then
self:useEnergy(game.energy_to_act * self:combatSpellSpeed())
......
......@@ -18,6 +18,7 @@
-- darkgod@te4.org
-- Cunning talents
newTalentType{ allow_random=true, type="cunning/stealth-base", name = "stealth", description = "Allows the user to enter stealth." }
newTalentType{ allow_random=true, type="cunning/stealth", name = "stealth", description = "Allows the user to enter stealth." }
newTalentType{ allow_random=true, type="cunning/trapping", name = "trapping", description = "The knowledge of trap laying and assorted trickeries." }
newTalentType{ allow_random=true, type="cunning/traps", name = "traps", description = "Collection of known traps." }
......
......@@ -17,6 +17,23 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
newTalent{
name = "Automatic Stealth",
type = {"cunning/stealth-base", 1},
mode = "sustained", no_sustain_autoreset = true,
points = 1,
cooldown = 0,
activate = function(self, t)
return {}
end,
deactivate = function(self, t, p)
return true
end,
info = function(self, t)
return [[When active, automatically try to enter stealth when possible.]]
end,
}
newTalent{
name = "Stealth",
type = {"cunning/stealth", 1},
......@@ -24,25 +41,40 @@ newTalent{
mode = "sustained", no_sustain_autoreset = true,
points = 5,
cooldown = 10,
no_energy = true,
getStealthPower = function(self, t) return 4 + self:getCun(10) * self:getTalentLevel(t) end,
getRadius = function(self, t) return math.floor(10 - self:getTalentLevel(t) * 1.1) end,
activate = function(self, t)
on_learn = function(self, t)
if self:getTalentLevelRaw(t) == 1 then
self:learnTalent(self.T_AUTOMATIC_STEALTH, true, 1)
end
end,
on_unlearn = function(self, t)
if self:getTalentLevelRaw(t) == 0 then
self:unlearnTalent(self.T_AUTOMATIC_STEALTH)
end
end,
on_pre_use = function(self, t, silent)
if self:isTalentActive(t.id) then return true end
local armor = self:getInven("BODY")[1]
if armor and (armor.subtype == "heavy" or armor.subtype == "massive") then
game.logPlayer(self, "You cannot Stealth with such heavy armour!")
if not silent then game.logPlayer(self, "You cannot Stealth with such heavy armour!") end
return nil
end
-- Check nearby actors
if not self.x or not self.y or not game.level then return end
local grids = core.fov.circle_grids(self.x, self.y, t.getRadius(self, t), true)
for x, yy in pairs(grids) do for y in pairs(yy) do
local actor = game.level.map(x, y, game.level.map.ACTOR)
if actor and actor ~= self and actor:reactionToward(self) < 0 and not rng.percent(self.hide_chance or 0) then
game.logPlayer(self, "You cannot Stealth with nearby foes watching!")
if not silent then game.logPlayer(self, "You cannot Stealth with nearby foes watching!") end
return nil
end
end end
return true
end,
activate = function(self, t)
local res = {
stealth = self:addTemporaryValue("stealth", t.getStealthPower(self, t)),
lite = self:addTemporaryValue("lite", -1000),
......
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