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

fear

git-svn-id: http://svn.net-core.org/repos/t-engine4@387 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3986aac6
No related branches found
No related tags found
No related merge requests found
......@@ -407,6 +407,11 @@ end
-- @param ab the talent (not the id, the table)
-- @return true to continue, false to stop
function _M:preUseTalent(ab, silent)
if self:attr("feared") then
game.logSeen(self, "%s is too afraid to use %s.", self.name:capitalize(), ab.name)
return false
end
if not self:enoughEnergy() then print("fail energy") return false end
if ab.mode == "sustained" then
......@@ -655,6 +660,7 @@ function _M:canBe(what)
if what == "cut" and rng.percent(100 * (self:attr("cut_immune") or 0)) then return false end
if what == "blind" and rng.percent(100 * (self:attr("blind_immune") or 0)) then return false end
if what == "stun" and rng.percent(100 * (self:attr("stun_immune") or 0)) then return false end
if what == "fear" and rng.percent(100 * (self:attr("fear_immune") or 0)) then return false end
if what == "knockback" and rng.percent(100 * (self:attr("knockback_immune") or 0)) then return false end
if what == "instakill" and rng.percent(100 * (self:attr("instakill_immune") or 0)) then return false end
return true
......
......@@ -42,6 +42,15 @@ The ToME combat system has the following attributes:
function _M:attackTarget(target, damtype, mult, noenergy)
local speed, hit = nil, false
if self:attr("feared") then
if not noenergy then
self:useEnergy(game.energy_to_act * speed)
self.did_energy = true
end
game.logSeen(self, "%s is too afraid to attack.", self.name:capitalize())
return false
end
-- Cancel stealth early if we are noticed
if self:isTalentActive(self.T_STEALTH) and target:canSee(self) then
self:useTalent(self.T_STEALTH)
......
......@@ -12,6 +12,7 @@ newEntity{
energy = { mod=0.5 },
combat_armor = 1, combat_def = 1,
never_move = 1,
fear_immune = 1,
}
newEntity{ base = "BASE_NPC_MOLD",
......
......@@ -18,6 +18,7 @@ newEntity{
resolvers.drops{chance=60, nb=1, {type="money"} },
resists = { [DamageType.LIGHT] = -50 },
fear_immune = 1,
}
newEntity{ base = "BASE_NPC_OOZE",
......
......@@ -14,6 +14,7 @@ newEntity{
energy = { mod=1 },
combat_armor = 1, combat_def = 1,
never_move = 1,
fear_immune = 1,
}
newEntity{ base = "BASE_NPC_PLANT",
......
......@@ -20,6 +20,7 @@ newEntity{
tmasteries = resolvers.tmasteries{ ["technique/other"]=0.3, ["technique/2hweapon-offense"]=0.3, ["technique/2hweapon-cripple"]=0.3 },
blind_immune = 1,
fear_immune = 1,
see_invisible = 2,
undead = 1,
}
......
......@@ -23,6 +23,7 @@ newEntity{
tmasteries = resolvers.tmasteries{ ["technique/other"]=0.3 },
resists = { [DamageType.FIRE] = -50 },
fear_immune = 1,
}
newEntity{ base = "BASE_NPC_TROLL",
......
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