Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FindCaptureReward = function(self, flag)
- local brainName = self.Brain.Name
- local captureReward = 0
- --Mithy: Default capture reward weights
- local captureWeights = {
- ugbdefense02 = 0.5,
- ugbfort01 = 0.5,
- ugbresource01 = 0.5, # 0.27.04 changed value from 1.75 to 0.5
- ugbportal01 = 0.5, # 0.27.04 changed value from 1.75 to 0.5
- unbidol01 = 0.75, # 0.26.54 dropped to 0.75 from 1.5
- ugbshop05 = 0.75, # 0.27.05 dropped to 0.75 from 1.25
- unbflagcooldown01 = 0.75, # 0.27.05 dropped to 0.75 from 1.5
- unbflagdamageamp01 = 0.75, # 0.27.05 dropped to 0.75 from 1.5
- unbflaghealthregen01 = 0.75,
- unbflagmanaregen01 = 0.75,
- unbflagmaxhealth01 = 1.25, # 0.27.05 increased from 1.0 to 1.25
- unbflagmaxmana01 = 1.25, # 0.27.05 increased from 1.0 to 1.25
- unbflagexperience01 = 1.0, # 0.26.54 dropped to 1.0 from 1.75
- ugbhealthstatue01 = 1.5,
- ugbartillery01 = 0.75,
- }
- --Mithy: Scenario-specific capture weight overrides
- local scenarioWeights = {
- none = {},
- --Mandala
- map04 = {},
- --Cataract
- map05 = {
- ugbresource01 = 0.75,
- unbflagmaxmana01 = 1.0,
- },
- --Zikurat
- map07 = {},
- --Leviathan
- map09 = {},
- --Crucible
- map10 = {},
- --The Brothers
- map11 = {},
- --Exile
- map12 = {},
- --Prison
- map13 = {},
- }
- local scenName = import('/lua/common/commonutils.lua').GetScenarioName() or 'none'
- local scenWeights = scenarioWeights[scenName] or {}
- local currentWeights = table.merged(captureWeights, scenWeights)
- --Debug output - remove/block-comment once this works
- if not ScenarioWeightsDoOnce then
- ScenarioWeightsDoOnce = true
- LOG("\n*AI DEBUG: FindCaptureReward debug--\n Scenario name: "..scenName.."\n Scenario capture weight overrides:")
- for k, v in scenWeights do
- LOG("\t"..k.." = "..v.."\t(default = "..captureWeights[k]..")")
- end
- LOG("\n ")
- end
- if flag then
- local captureUnits = flag:GetCaptureList()
- for k, v in captureUnits do
- --Mithy: Significantly streamlined weight determination
- captureReward = math.max(captureReward, currentWeights[v] or 0)
- end
- if captureReward <= 0 then
- WARN( '*AI ERROR: No good reward found at flag - ' .. flag.UnitName )
- captureReward = 0.5
- end
- LOG('*AI DEBUG: Capture Reward for - ' .. flag.UnitName .. ' = ' .. captureReward)
- end
- self.CaptureReward = captureReward
- end,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement