Commit fe773c802e651b4cd5f3dca8c776910b128014e9

Authored by DarkGod
2 parents 0ff1935f ac5f07e4

Merge branch 'bugfix_talented_ai_tactic' into 'master'

Bugfix talented ai tactic

fixes a problem with the talented_ai_tactic resolver with glowing chests.
... ... @@ -695,8 +695,10 @@ end
695 695 -- Extra recursive methods not handled yet
696 696 function resolvers.calc.talented_ai_tactic(t, e)
697 697 local old_on_added_to_level = e.on_added_to_level
698   - e.on_added_to_level = function(self, level, x, y)
699   - if old_on_added_to_level then old_on_added_to_level(self, level, x, y) end
  698 + e.__ai_compute = t
  699 + e.on_added_to_level = function(e, level, x, y)
  700 + local t = e.__ai_compute
  701 + if old_on_added_to_level then old_on_added_to_level(e, level, x, y) end
700 702 print(" # talented_ai_tactic resolver function for", e.name, "level=", e.level, e.uid)
701 703 local tactic_total = t[2] or t.tactic_total or 10 --want tactic weights to total 10
702 704 local weight_power = t[3] or t.weight_power or 0.5 --smooth out tactical weights
... ... @@ -811,8 +813,8 @@ function resolvers.calc.talented_ai_tactic(t, e)
811 813 tactic.type = "computed"
812 814 print(" ### ai_tactic table:")
813 815 for tac, wt in pairs(tactic) do print(" ##", tac, wt) end
814   - self.ai_tactic = tactic
815   --- self.on_added_to_level = nil
  816 + e.ai_tactic = tactic
  817 + e.__ai_compute = nil
816 818 return tactic
817 819 end
818 820 end
... ...