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

NPCs can not get angry at their own faction

git-svn-id: http://svn.net-core.org/repos/t-engine4@2175 51575b47-30f0-44d4-a5cc-537603b46e54
parent 0de727c1
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,10 @@ end
-- @param value the value to add/substract
function _M:checkAngered(src, set, value)
if not src.resolveSource then return end
if not src.faction then return end
-- Cant anger at our own faction unless it's the silly player
if self.faction == src.faction and not src.player then return end
local rsrc = src:resolveSource()
local rid = rsrc.unique or rsrc.name
......@@ -109,7 +113,7 @@ function _M:onTakeHit(value, src)
end
-- Get angry if attacked by a friend
if src ~= self and src.resolveSource and src.faction and self:reactionToward(src) >= 0 then
if src and src ~= self and src.resolveSource and src.faction and self:reactionToward(src) >= 0 then
self:checkAngered(src, false, -50)
-- Call for help if we become hostile
......@@ -130,7 +134,7 @@ function _M:die(src)
end
-- Get angry if attacked by a friend
if src ~= self and src.resolveSource and src.faction then
if src and src ~= self and src.resolveSource and src.faction then
local rsrc = src:resolveSource()
local rid = rsrc.unique or rsrc.name
......
......@@ -514,7 +514,15 @@ newInscription{
action = function(self, t)
local data = self:getInscriptionData(t.short_name)
self:incMana((data.mana + data.inc_stat) / 20)
self:setEffect(self.EFF_MANASURGE, data.dur, {power=self.mana_regen * (data.mana + data.inc_stat) / 100})
if self.mana_regen <= 0 then
self:setEffect(self.EFF_MANASURGE, data.dur, {power=self.mana_regen * (data.mana + data.inc_stat) / 100})
else
if self.mana_regen < 0 then
game.logPlayer(self, "Your negative mana regeneration rate is unaffected by the rune.")
else
game.logPlayer(self, "Your inexistant mana regeneration rate is unaffected by the rune.")
end
end
return true
end,
info = function(self, t)
......
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