Advertisement
Guest User

Mithy

a guest
Nov 28th, 2010
668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1.     # Trebuchets - match, prioritize vs catapults+, take into account fort totals
  2.     CUpgradeStructure01 = {
  3.         PriorityFunction = function(unit)
  4.             local priority = 0
  5.             local ourForts = unit:GetAIBrain():GetTeamArmy():GetListOfUnits(categories.FORT, false)
  6.             if ourForts < 2 then
  7.                 return 0
  8.             end
  9.  
  10.             local enemyForts = GetEnemyTeamBrain(unit):GetListOfUnits(categories.FORT, false)
  11.             if EnemyHasUpgrade(unit, 'CTroopNumber04') and not TeamHasUpgrade(unit, 'CTroopNumber04') then
  12.                 priority = 15
  13.             elseif EnemyHasUpgrade(unit, 'CUpgradeStructure02') then
  14.                 priority = 2 * enemyForts
  15.             end
  16.  
  17.             return priority * ourForts * GoldThreshold(unit, UpgradeCost('CUpgradeStructure02'))
  18.         end,
  19.     },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement