Skip to content
Snippets Groups Projects
Commit 6b7c0449 authored by Tawny Harte's avatar Tawny Harte
Browse files

fears targeting behaviour

parent 6114d03a
No related branches found
No related tags found
1 merge request!558Afflicted+predator
......@@ -58,19 +58,19 @@ newTalent{
return false
end,
applyEffect = function(self, t, target, no_fearRes)
--tyrant mindpower bonus
local tTyrant = nil
if self:knowTalent(self.T_TYRANT) then tTyrant = self:getTalentFromId(self.T_TYRANT) end
local mindpowerChange = 0
--mindpower check
local mindpower = self:combatMindpower()
if not target:checkHit(mindpower, target:combatMentalResist()) then
game.logSeen(target, "%s resists the fear!", target.name:capitalize())
return nil
end
--apply heighten fear
local tHeightenFear = nil
if self:knowTalent(self.T_HEIGHTEN_FEAR) then tHeightenFear = self:getTalentFromId(self.T_HEIGHTEN_FEAR) end
......@@ -80,24 +80,24 @@ newTalent{
local damage = tHeightenFear.getDamage(self, t)
target:setEffect(target.EFF_HEIGHTEN_FEAR, dur, {src=self, range=self:getTalentRange(tHeightenFear), turns=turnsUntilTrigger, turns_left=turnsUntilTrigger, damage=damage })
end
--fear res check & heighten fear bypass
if not no_fearRes and not target:canBe("fear") then
game.logSeen(target, "#F53CBE#%s resists the fear!", target.name:capitalize())
return true
end
--build table of possible fears
local effects = {}
if not target:hasEffect(target.EFF_PARANOID) then table.insert(effects, target.EFF_PARANOID) end
if not target:hasEffect(target.EFF_DISPAIR) then table.insert(effects, target.EFF_DISPAIR) end
if not target:hasEffect(target.EFF_TERRIFIED) then table.insert(effects, target.EFF_TERRIFIED) end
if not target:hasEffect(target.EFF_HAUNTED) then table.insert(effects, target.EFF_HAUNTED) end
--choose fear
if #effects == 0 then return nil end
local effectId = rng.table(effects)
--data for fear effects
local duration = t.getDuration(self, t)
local eff = {src=self, duration=duration }
......@@ -115,7 +115,7 @@ newTalent{
else
print("* fears: failed to get effect", effectId)
end
--tyrant stuff
if tTyrant then
--tyrant buff data
......@@ -143,10 +143,10 @@ newTalent{
F.dur = math.max(F.dur, math.min(8, F.dur + extendFear))
end
end
--set fear
target:setEffect(effectId, duration, eff)
return effectId
end,
endEffect = function(self, t)
......@@ -164,8 +164,8 @@ newTalent{
action = function(self, t)
local tg = self:getTalentTarget(t)
local x, y, target = self:getTarget(tg)
if not x or not y or core.fov.distance(self.x, self.y, x, y) > self:getTalentRange(t) then return nil end
if not x or not y then return nil end
local _ _, x, y = self:canProject(tg, x, y)
self:project(
tg, x, y,
function(px, py)
......@@ -228,7 +228,7 @@ newTalent{
local turnsUntilTrigger = t.getTurnsUntilTrigger(self, t)
local duration = tInstillFear.getDuration(self, tInstillFear)
local damage = t.getDamage(self, t)
return ([[Heighten the fears of those near to you. Any foe you attempt to inflict a fear upon and who remains in a radius of %d and in sight of you for %d (non-consecutive) turns, will take %0.2f mind and %0.2f darkness damage and gain a new fear that lasts for %d turns.
return ([[Heighten the fears of those near to you. Any foe you attempt to inflict a fear upon and who remains in a radius of %d and in sight of you for %d (non-consecutive) turns, will take %0.2f mind and %0.2f darkness damage and gain a new fear that lasts for %d turns.
This effect completely ignores fear resistance, but can be saved against.]]):
format(range, turnsUntilTrigger, damDesc(self, DamageType.MIND, t.getDamage(self, t) / 2), damDesc(self, DamageType.DARKNESS, t.getDamage(self, t) / 2 ), duration)
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