Merge pull request #12842 from abc013/Allies06SubFix

Allies 06a: Make the AI only build submarines if the player has a shipyard
This commit is contained in:
Paul Chote
2017-03-15 20:12:18 +00:00
committed by GitHub
2 changed files with 18 additions and 3 deletions

View File

@@ -107,6 +107,13 @@ ProduceVehicles = function()
end end
ProduceNaval = function() ProduceNaval = function()
if not shouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == player and self.Type == "syrd" end) < 1 then
Trigger.AfterDelay(DateTime.Minutes(1), ProduceNaval)
return
end
shouldProduce = true
if SubPen.IsDead or SubPen.Owner ~= ussr then if SubPen.IsDead or SubPen.Owner ~= ussr then
return return
end end

View File

@@ -110,7 +110,6 @@ CaptureRadarDome = function()
end) end)
end end
infiltrated = false
InfiltrateTechCenter = function() InfiltrateTechCenter = function()
Utils.Do(SovietTechLabs, function(a) Utils.Do(SovietTechLabs, function(a)
Trigger.OnInfiltrated(a, function() Trigger.OnInfiltrated(a, function()
@@ -127,9 +126,15 @@ InfiltrateTechCenter = function()
end) end)
Proxy.Destroy() Proxy.Destroy()
end) end)
Trigger.OnCapture(a, function()
if not infiltrated then
Media.DisplayMessage("Do not capture the tech centers! Infiltrate one with a spy.")
end
end)
end) end)
Trigger.OnAllKilled(SovietTechLabs, function() Trigger.OnAllKilledOrCaptured(SovietTechLabs, function()
if not player.IsObjectiveCompleted(InfiltrateTechCenterObj) then if not player.IsObjectiveCompleted(InfiltrateTechCenterObj) then
player.MarkFailedObjective(InfiltrateTechCenterObj) player.MarkFailedObjective(InfiltrateTechCenterObj)
end end
@@ -140,6 +145,9 @@ InfiltrateRef = function()
Trigger.OnInfiltrated(Refinery, function() Trigger.OnInfiltrated(Refinery, function()
player.MarkCompletedObjective(InfiltrateRefObj) player.MarkCompletedObjective(InfiltrateRefObj)
end) end)
Trigger.OnCapture(Refinery, function()
player.MarkCompletedObjective(InfiltrateRefObj)
end)
Trigger.OnKilled(Refinery, function() Trigger.OnKilled(Refinery, function()
if not player.IsObjectiveCompleted(InfiltrateRefObj) then if not player.IsObjectiveCompleted(InfiltrateRefObj) then
player.MarkFailedObjective(InfiltrateRefObj) player.MarkFailedObjective(InfiltrateRefObj)
@@ -180,7 +188,7 @@ WorldLoaded = function()
Media.PlaySpeechNotification(player, "MissionAccomplished") Media.PlaySpeechNotification(player, "MissionAccomplished")
end) end)
InfiltrateTechCenterObj = player.AddPrimaryObjective("Infiltrate one of the Soviet tech centers.") InfiltrateTechCenterObj = player.AddPrimaryObjective("Infiltrate one of the Soviet tech centers with a spy.")
CaptureRadarDomeObj = player.AddSecondaryObjective("Capture the Radar Dome at the shore.") CaptureRadarDomeObj = player.AddSecondaryObjective("Capture the Radar Dome at the shore.")
InfiltrateRefObj = player.AddSecondaryObjective("Infiltrate the Refinery for money.") InfiltrateRefObj = player.AddSecondaryObjective("Infiltrate the Refinery for money.")