Commit 5cf87b451275936e18a2e9adc9aad29ad4db3aef

Authored by dg
1 parent c3c3da8a

plop


git-svn-id: http://svn.net-core.org/repos/t-engine4@2427 51575b47-30f0-44d4-a5cc-537603b46e54
@@ -133,11 +133,14 @@ newAI("use_tactical", function(self) @@ -133,11 +133,14 @@ newAI("use_tactical", function(self)
133 res = res[1] 133 res = res[1]
134 if not res then return end 134 if not res then return end
135 avail = avail[res[1]] 135 avail = avail[res[1]]
  136 + table.sort(avail, function(a,b) return a.val > b.val end)
136 137
137 - local tid = avail[rng.range(1, #avail)].tid  
138 - print("Tactical choice:", res[1], tid)  
139 - self:useTalent(tid)  
140 - return true 138 + if avail[1] then
  139 + local tid = avail[1].tid
  140 + print("Tactical choice:", res[1], tid)
  141 + self:useTalent(tid)
  142 + return true
  143 + end
141 end 144 end
142 end) 145 end)
143 146