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

Target passing between NPCs is now based on rank, the lower the rank the less...

Target passing between NPCs is now based on rank, the lower the rank the less likely to alert. This plus some internal changes should alleviate soem turn lag as this takes a lot of processing it seems
parent 14f45d3a
No related branches found
No related tags found
No related merge requests found
......@@ -1761,6 +1761,19 @@ function _M:incMoney(v)
end
end
function _M:getRankTalkativeAdjust()
if self.rank == 1 then return 1
elseif self.rank == 2 then return 4
elseif self.rank == 3 then return 9
elseif self.rank == 3.2 then return 12
elseif self.rank == 3.5 then return 15
elseif self.rank == 4 then return 25
elseif self.rank == 5 then return 50
elseif self.rank >= 10 then return 100
else return 0
end
end
function _M:getRankStatAdjust()
if self.rank == 1 then return -1
elseif self.rank == 2 then return -0.5
......
......@@ -193,12 +193,15 @@ end
-- @param who = actor acting (updating its FOV info), calling self:seen_by(who)
-- @see ActorFOV:computeFOV, ActorAI:aiSeeTargetPos, NPC:doAI
function _M:seen_by(who)
if self == who then return end
if self:hasEffect(self.EFF_VAULTED) and who and game.party:hasMember(who) then self:removeEffect(self.EFF_VAULTED, true, true) end
-- Check if we can pass target
if self.dont_pass_target then return end -- This means that ghosts can alert other NPC's but not vice versa ;)
local who_target = who.ai_target and who.ai_target.actor
if not (who_target and who_target.x) then return end
if self.ai_target and self.ai_target.actor == who_target then return end
if not rng.percent(who:getRankTalkativeAdjust()) then return end
-- Only receive (usually) hostile targets from allies
if self:reactionToward(who) <= 0 or not who.ai_state._pass_friendly_target and who:reactionToward(who_target) > 0 then return 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