Resolve Lua language server diagnosed problems.
This commit is contained in:
committed by
abcdefg30
parent
3d0efa1cbe
commit
378f66a1ff
@@ -61,16 +61,16 @@ Messages =
|
||||
|
||||
CachedResources = -1
|
||||
Tick = function()
|
||||
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if player.Resources > SpiceToHarvest - 1 then
|
||||
player.MarkCompletedObjective(GatherSpice)
|
||||
if Atreides.Resources > SpiceToHarvest - 1 then
|
||||
Atreides.MarkCompletedObjective(GatherSpice)
|
||||
end
|
||||
|
||||
-- player has no Wind Trap
|
||||
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if (Atreides.PowerProvided <= 20 or Atreides.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
HasPower = false
|
||||
Media.DisplayMessage(Messages[2], Mentat)
|
||||
else
|
||||
@@ -78,40 +78,40 @@ Tick = function()
|
||||
end
|
||||
|
||||
-- player has no Refinery and no Silos
|
||||
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Atreides.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[3], Mentat)
|
||||
end
|
||||
|
||||
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Atreides.Resources > Atreides.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[4], Mentat)
|
||||
end
|
||||
|
||||
if player.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
|
||||
if Atreides.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest }
|
||||
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
|
||||
UserInterface.SetMissionText(harvestedResources)
|
||||
CachedResources = player.Resources
|
||||
CachedResources = Atreides.Resources
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("Atreides")
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
SpiceToHarvest = ToHarvest[Difficulty]
|
||||
|
||||
InitObjectives(player)
|
||||
KillAtreides = AddPrimaryObjective(harkonnen, "")
|
||||
InitObjectives(Atreides)
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "")
|
||||
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
|
||||
GatherSpice = AddPrimaryObjective(player, harvestSpice)
|
||||
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements")
|
||||
GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
|
||||
KillHarkonnen = AddSecondaryObjective(Atreides, "eliminate-harkonnen-units-reinforcements")
|
||||
|
||||
local checkResourceCapacity = function()
|
||||
Trigger.AfterDelay(0, function()
|
||||
if player.ResourceCapacity < SpiceToHarvest then
|
||||
if Atreides.ResourceCapacity < SpiceToHarvest then
|
||||
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
return true
|
||||
@@ -126,15 +126,15 @@ WorldLoaded = function()
|
||||
return
|
||||
end
|
||||
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end)
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end)
|
||||
if #refs == 0 then
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
else
|
||||
Trigger.OnAllRemovedFromWorld(refs, function()
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end)
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end)
|
||||
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
end
|
||||
@@ -143,8 +143,8 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(Messages[1], Mentat)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(25), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, AtreidesReinforcements, AtreidesEntryPath)
|
||||
Media.PlaySpeechNotification(Atreides, "Reinforce")
|
||||
Reinforcements.Reinforce(Atreides, AtreidesReinforcements, AtreidesEntryPath)
|
||||
end)
|
||||
|
||||
WavesLeft = HarkonnenAttackWaves[Difficulty]
|
||||
@@ -158,7 +158,7 @@ SendReinforcements = function()
|
||||
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
|
||||
|
||||
Trigger.AfterDelay(delay, function()
|
||||
Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
|
||||
Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
|
||||
|
||||
WavesLeft = WavesLeft - 1
|
||||
if WavesLeft == 0 then
|
||||
|
||||
@@ -61,16 +61,16 @@ Messages =
|
||||
|
||||
CachedResources = -1
|
||||
Tick = function()
|
||||
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if player.Resources > SpiceToHarvest - 1 then
|
||||
player.MarkCompletedObjective(GatherSpice)
|
||||
if Atreides.Resources > SpiceToHarvest - 1 then
|
||||
Atreides.MarkCompletedObjective(GatherSpice)
|
||||
end
|
||||
|
||||
-- player has no Wind Trap
|
||||
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if (Atreides.PowerProvided <= 20 or Atreides.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
HasPower = false
|
||||
Media.DisplayMessage(Messages[2], Mentat)
|
||||
else
|
||||
@@ -78,40 +78,40 @@ Tick = function()
|
||||
end
|
||||
|
||||
-- player has no Refinery and no Silos
|
||||
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Atreides.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[3], Mentat)
|
||||
end
|
||||
|
||||
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Atreides.Resources > Atreides.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[4], Mentat)
|
||||
end
|
||||
|
||||
if player.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
|
||||
if Atreides.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest }
|
||||
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
|
||||
UserInterface.SetMissionText(harvestedResources)
|
||||
CachedResources = player.Resources
|
||||
CachedResources = Atreides.Resources
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("Atreides")
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
SpiceToHarvest = ToHarvest[Difficulty]
|
||||
|
||||
InitObjectives(player)
|
||||
KillAtreides = AddPrimaryObjective(harkonnen, "")
|
||||
InitObjectives(Atreides)
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "")
|
||||
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
|
||||
GatherSpice = AddPrimaryObjective(player, harvestSpice)
|
||||
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements")
|
||||
GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
|
||||
KillHarkonnen = AddSecondaryObjective(Atreides, "eliminate-harkonnen-units-reinforcements")
|
||||
|
||||
local checkResourceCapacity = function()
|
||||
Trigger.AfterDelay(0, function()
|
||||
if player.ResourceCapacity < SpiceToHarvest then
|
||||
if Atreides.ResourceCapacity < SpiceToHarvest then
|
||||
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
return true
|
||||
@@ -126,15 +126,15 @@ WorldLoaded = function()
|
||||
return
|
||||
end
|
||||
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end)
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end)
|
||||
if #refs == 0 then
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
else
|
||||
Trigger.OnAllRemovedFromWorld(refs, function()
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end)
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end)
|
||||
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
end
|
||||
@@ -143,8 +143,8 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(Messages[1], Mentat)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(25), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, AtreidesReinforcements, AtreidesEntryPath)
|
||||
Media.PlaySpeechNotification(Atreides, "Reinforce")
|
||||
Reinforcements.Reinforce(Atreides, AtreidesReinforcements, AtreidesEntryPath)
|
||||
end)
|
||||
|
||||
WavesLeft = HarkonnenAttackWaves[Difficulty]
|
||||
@@ -158,7 +158,7 @@ SendReinforcements = function()
|
||||
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
|
||||
|
||||
Trigger.AfterDelay(delay, function()
|
||||
Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
|
||||
Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
|
||||
|
||||
WavesLeft = WavesLeft - 1
|
||||
if WavesLeft == 0 then
|
||||
|
||||
@@ -24,11 +24,11 @@ AttackDelays =
|
||||
HarkonnenInfantryTypes = { "light_inf" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[harkonnen] = { }
|
||||
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
IdlingUnits[Harkonnen] = { }
|
||||
DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local toBuild = function() return HarkonnenInfantryTypes end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -65,31 +65,31 @@ HarkonnenAttackWaves =
|
||||
}
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
if Atreides.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
if Harkonnen.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillHarkonnen) then
|
||||
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
player = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
|
||||
InitObjectives(player)
|
||||
KillAtreides = AddPrimaryObjective(harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces")
|
||||
InitObjectives(Atreides)
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen-forces")
|
||||
|
||||
Camera.Position = AConyard.CenterPosition
|
||||
|
||||
Trigger.OnAllKilled(HarkonnenBase, function()
|
||||
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(HarkonnenAttackPaths) end
|
||||
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
|
||||
SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
end
|
||||
|
||||
@@ -24,11 +24,11 @@ AttackDelays =
|
||||
HarkonnenInfantryTypes = { "light_inf" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[harkonnen] = { }
|
||||
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
IdlingUnits[Harkonnen] = { }
|
||||
DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local toBuild = function() return HarkonnenInfantryTypes end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -65,31 +65,31 @@ HarkonnenAttackWaves =
|
||||
}
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
if Atreides.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
if Harkonnen.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillHarkonnen) then
|
||||
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
player = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
|
||||
InitObjectives(player)
|
||||
KillAtreides = AddPrimaryObjective(harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces")
|
||||
InitObjectives(Atreides)
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen-forces")
|
||||
|
||||
Camera.Position = AConyard.CenterPosition
|
||||
|
||||
Trigger.OnAllKilled(HarkonnenBase, function()
|
||||
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(HarkonnenAttackPaths) end
|
||||
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
|
||||
SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
end
|
||||
|
||||
@@ -24,16 +24,16 @@ OrdosInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "troope
|
||||
OrdosVehicleTypes = { "raider", "raider", "quad" }
|
||||
|
||||
InitAIUnits = function()
|
||||
IdlingUnits[ordos] = Reinforcements.Reinforce(ordos, InitialOrdosReinforcements, OrdosPaths[2])
|
||||
IdlingUnits[ordos][#IdlingUnits + 1] = OTrooper1
|
||||
IdlingUnits[ordos][#IdlingUnits + 1] = OTrooper2
|
||||
IdlingUnits[ordos][#IdlingUnits + 1] = ORaider
|
||||
IdlingUnits[Ordos] = Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements, OrdosPaths[2])
|
||||
IdlingUnits[Ordos][#IdlingUnits + 1] = OTrooper1
|
||||
IdlingUnits[Ordos][#IdlingUnits + 1] = OTrooper2
|
||||
IdlingUnits[Ordos][#IdlingUnits + 1] = ORaider
|
||||
|
||||
DefendAndRepairBase(ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(Ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty])
|
||||
end
|
||||
|
||||
ActivateAI = function()
|
||||
LastHarvesterEaten[ordos] = true
|
||||
LastHarvesterEaten[Ordos] = true
|
||||
Trigger.AfterDelay(0, InitAIUnits)
|
||||
|
||||
OConyard.Produce(AtreidesUpgrades[1])
|
||||
@@ -46,7 +46,7 @@ ActivateAI = function()
|
||||
|
||||
-- Finish the upgrades first before trying to build something
|
||||
Trigger.AfterDelay(DateTime.Seconds(14), function()
|
||||
ProduceUnits(ordos, OBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos, OLightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Ordos, OBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Ordos, OLightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -78,65 +78,65 @@ AtreidesBaseBuildings = { "barracks", "light_factory" }
|
||||
AtreidesUpgrades = { "upgrade.barracks", "upgrade.light" }
|
||||
|
||||
MessageCheck = function(index)
|
||||
return #player.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not player.HasPrerequisites({ AtreidesUpgrades[index] })
|
||||
return #Atreides.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not Atreides.HasPrerequisites({ AtreidesUpgrades[index] })
|
||||
end
|
||||
|
||||
CachedResources = -1
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
ordos.MarkCompletedObjective(KillAtreides)
|
||||
if Atreides.HasNoRequiredUnits() then
|
||||
Ordos.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if ordos.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then
|
||||
if Ordos.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillOrdos) then
|
||||
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillOrdos)
|
||||
Atreides.MarkCompletedObjective(KillOrdos)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos] then
|
||||
local units = ordos.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Ordos] then
|
||||
local units = Ordos.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos] = false
|
||||
ProtectHarvester(units[1], ordos, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[Ordos] = false
|
||||
ProtectHarvester(units[1], Ordos, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if player.Resources > SpiceToHarvest - 1 then
|
||||
player.MarkCompletedObjective(GatherSpice)
|
||||
if Atreides.Resources > SpiceToHarvest - 1 then
|
||||
Atreides.MarkCompletedObjective(GatherSpice)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(32) == 0 and (MessageCheck(1) or MessageCheck(2)) then
|
||||
Media.DisplayMessage(UserInterface.Translate("upgrade-barracks-light-factory"), Mentat)
|
||||
end
|
||||
|
||||
if player.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
|
||||
if Atreides.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest }
|
||||
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
|
||||
UserInterface.SetMissionText(harvestedResources)
|
||||
CachedResources = player.Resources
|
||||
CachedResources = Atreides.Resources
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
ordos = Player.GetPlayer("Ordos")
|
||||
player = Player.GetPlayer("Atreides")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
|
||||
SpiceToHarvest = ToHarvest[Difficulty]
|
||||
|
||||
InitObjectives(player)
|
||||
KillAtreides = AddPrimaryObjective(ordos, "")
|
||||
InitObjectives(Atreides)
|
||||
KillAtreides = AddPrimaryObjective(Ordos, "")
|
||||
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
|
||||
GatherSpice = AddPrimaryObjective(player, harvestSpice)
|
||||
KillOrdos = AddSecondaryObjective(player, "eliminate-ordos-units-reinforcements")
|
||||
GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
|
||||
KillOrdos = AddSecondaryObjective(Atreides, "eliminate-ordos-units-reinforcements")
|
||||
|
||||
Camera.Position = AConyard.CenterPosition
|
||||
|
||||
local checkResourceCapacity = function()
|
||||
Trigger.AfterDelay(0, function()
|
||||
if player.ResourceCapacity < SpiceToHarvest then
|
||||
if Atreides.ResourceCapacity < SpiceToHarvest then
|
||||
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
ordos.MarkCompletedObjective(KillAtreides)
|
||||
Ordos.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
return true
|
||||
@@ -151,31 +151,31 @@ WorldLoaded = function()
|
||||
return
|
||||
end
|
||||
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end)
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end)
|
||||
if #refs == 0 then
|
||||
ordos.MarkCompletedObjective(KillAtreides)
|
||||
Ordos.MarkCompletedObjective(KillAtreides)
|
||||
else
|
||||
Trigger.OnAllRemovedFromWorld(refs, function()
|
||||
ordos.MarkCompletedObjective(KillAtreides)
|
||||
Ordos.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end)
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end)
|
||||
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
end
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilled(OrdosBase, function()
|
||||
Utils.Do(ordos.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Ordos.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return OrdosPaths[1] end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end
|
||||
SendCarryallReinforcements(ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition)
|
||||
local waveCondition = function() return Atreides.IsObjectiveCompleted(KillOrdos) end
|
||||
SendCarryallReinforcements(Ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition)
|
||||
ActivateAI()
|
||||
|
||||
Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] })
|
||||
Media.PlaySpeechNotification(Atreides, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] })
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -24,12 +24,12 @@ AttackDelays =
|
||||
OrdosInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "trooper" }
|
||||
|
||||
InitAIUnits = function()
|
||||
IdlingUnits[ordos] = Reinforcements.Reinforce(ordos, InitialOrdosReinforcements, OrdosPaths[2])
|
||||
DefendAndRepairBase(ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty])
|
||||
IdlingUnits[Ordos] = Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements, OrdosPaths[2])
|
||||
DefendAndRepairBase(Ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty])
|
||||
end
|
||||
|
||||
ActivateAI = function()
|
||||
LastHarvesterEaten[ordos] = true
|
||||
LastHarvesterEaten[Ordos] = true
|
||||
Trigger.AfterDelay(0, InitAIUnits)
|
||||
|
||||
OConyard.Produce(AtreidesUpgrades[1])
|
||||
@@ -40,6 +40,6 @@ ActivateAI = function()
|
||||
|
||||
-- Finish the upgrades first before trying to build something
|
||||
Trigger.AfterDelay(DateTime.Seconds(14), function()
|
||||
ProduceUnits(ordos, OBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Ordos, OBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -78,65 +78,65 @@ AtreidesBaseBuildings = { "barracks", "light_factory" }
|
||||
AtreidesUpgrades = { "upgrade.barracks", "upgrade.light" }
|
||||
|
||||
MessageCheck = function(index)
|
||||
return #player.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not player.HasPrerequisites({ AtreidesUpgrades[index] })
|
||||
return #Atreides.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not Atreides.HasPrerequisites({ AtreidesUpgrades[index] })
|
||||
end
|
||||
|
||||
CachedResources = -1
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
ordos.MarkCompletedObjective(KillAtreides)
|
||||
if Atreides.HasNoRequiredUnits() then
|
||||
Ordos.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if ordos.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then
|
||||
if Ordos.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillOrdos) then
|
||||
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillOrdos)
|
||||
Atreides.MarkCompletedObjective(KillOrdos)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos] then
|
||||
local units = ordos.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Ordos] then
|
||||
local units = Ordos.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos] = false
|
||||
ProtectHarvester(units[1], ordos, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[Ordos] = false
|
||||
ProtectHarvester(units[1], Ordos, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if player.Resources > SpiceToHarvest - 1 then
|
||||
player.MarkCompletedObjective(GatherSpice)
|
||||
if Atreides.Resources > SpiceToHarvest - 1 then
|
||||
Atreides.MarkCompletedObjective(GatherSpice)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(32) == 0 and (MessageCheck(1) or MessageCheck(2)) then
|
||||
Media.DisplayMessage(UserInterface.Translate("upgrade-barracks-light-factory"), Mentat)
|
||||
end
|
||||
|
||||
if player.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
|
||||
if Atreides.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest }
|
||||
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
|
||||
UserInterface.SetMissionText(harvestedResources)
|
||||
CachedResources = player.Resources
|
||||
CachedResources = Atreides.Resources
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
ordos = Player.GetPlayer("Ordos")
|
||||
player = Player.GetPlayer("Atreides")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
|
||||
SpiceToHarvest = ToHarvest[Difficulty]
|
||||
|
||||
InitObjectives(player)
|
||||
KillAtreides = AddPrimaryObjective(ordos, "")
|
||||
InitObjectives(Atreides)
|
||||
KillAtreides = AddPrimaryObjective(Ordos, "")
|
||||
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
|
||||
GatherSpice = AddPrimaryObjective(player, harvestSpice)
|
||||
KillOrdos = AddSecondaryObjective(player, "eliminate-ordos-units-reinforcements")
|
||||
GatherSpice = AddPrimaryObjective(Atreides, harvestSpice)
|
||||
KillOrdos = AddSecondaryObjective(Atreides, "eliminate-ordos-units-reinforcements")
|
||||
|
||||
Camera.Position = AConyard.CenterPosition
|
||||
|
||||
local checkResourceCapacity = function()
|
||||
Trigger.AfterDelay(0, function()
|
||||
if player.ResourceCapacity < SpiceToHarvest then
|
||||
if Atreides.ResourceCapacity < SpiceToHarvest then
|
||||
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
ordos.MarkCompletedObjective(KillAtreides)
|
||||
Ordos.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
return true
|
||||
@@ -151,31 +151,31 @@ WorldLoaded = function()
|
||||
return
|
||||
end
|
||||
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end)
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end)
|
||||
if #refs == 0 then
|
||||
ordos.MarkCompletedObjective(KillAtreides)
|
||||
Ordos.MarkCompletedObjective(KillAtreides)
|
||||
else
|
||||
Trigger.OnAllRemovedFromWorld(refs, function()
|
||||
ordos.MarkCompletedObjective(KillAtreides)
|
||||
Ordos.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end)
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end)
|
||||
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
end
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilled(OrdosBase, function()
|
||||
Utils.Do(ordos.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Ordos.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return OrdosPaths[1] end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end
|
||||
SendCarryallReinforcements(ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition)
|
||||
local waveCondition = function() return Atreides.IsObjectiveCompleted(KillOrdos) end
|
||||
SendCarryallReinforcements(Ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition)
|
||||
ActivateAI()
|
||||
|
||||
Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] })
|
||||
Media.PlaySpeechNotification(Atreides, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] })
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -46,13 +46,13 @@ SendAttack = function(owner, size)
|
||||
end
|
||||
|
||||
InitAIUnits = function()
|
||||
IdlingUnits[harkonnen] = Reinforcements.Reinforce(harkonnen, InitialHarkonnenReinforcements, HarkonnenPaths[1])
|
||||
IdlingUnits[Harkonnen] = Reinforcements.Reinforce(Harkonnen, InitialHarkonnenReinforcements, HarkonnenPaths[1])
|
||||
|
||||
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
end
|
||||
|
||||
ActivateAI = function()
|
||||
LastHarvesterEaten[harkonnen] = true
|
||||
LastHarvesterEaten[Harkonnen] = true
|
||||
InitAIUnits()
|
||||
FremenProduction()
|
||||
|
||||
@@ -61,6 +61,6 @@ ActivateAI = function()
|
||||
local tanksToBuild = function() return HarkonnenTankType end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(harkonnen, HarkonnenBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(harkonnen, HarkonnenHeavyFact, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Harkonnen, HarkonnenBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Harkonnen, HarkonnenHeavyFact, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -96,30 +96,30 @@ FremenProduction = function()
|
||||
end
|
||||
|
||||
local delay = Utils.RandomInteger(FremenInterval[Difficulty][1], FremenInterval[Difficulty][2] + 1)
|
||||
fremen.Build({ "nsfremen" }, function()
|
||||
Fremen.Build({ "nsfremen" }, function()
|
||||
Trigger.AfterDelay(delay, FremenProduction)
|
||||
end)
|
||||
end
|
||||
|
||||
AttackNotifier = 0
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
if Atreides.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
if Harkonnen.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillHarkonnen) then
|
||||
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
player.MarkCompletedObjective(ProtectFremen)
|
||||
player.MarkCompletedObjective(KeepIntegrity)
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
Atreides.MarkCompletedObjective(ProtectFremen)
|
||||
Atreides.MarkCompletedObjective(KeepIntegrity)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then
|
||||
local units = harkonnen.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then
|
||||
local units = Harkonnen.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[harkonnen] = false
|
||||
ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[Harkonnen] = false
|
||||
ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -127,50 +127,50 @@ Tick = function()
|
||||
AttackNotifier = AttackNotifier - 1
|
||||
local integrity = math.floor((Sietch.Health * 100) / Sietch.MaxHealth)
|
||||
SiegeIntegrity = UserInterface.Translate("sietch-integrity", { ["integrity"] = integrity })
|
||||
UserInterface.SetMissionText(SiegeIntegrity, player.Color)
|
||||
UserInterface.SetMissionText(SiegeIntegrity, Atreides.Color)
|
||||
|
||||
if integrity < IntegrityLevel[Difficulty] then
|
||||
player.MarkFailedObjective(KeepIntegrity)
|
||||
Atreides.MarkFailedObjective(KeepIntegrity)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
fremen = Player.GetPlayer("Fremen")
|
||||
player = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Fremen = Player.GetPlayer("Fremen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
|
||||
InitObjectives(player)
|
||||
KillAtreides = AddPrimaryObjective(harkonnen, "")
|
||||
ProtectFremen = AddPrimaryObjective(player, "protect-fremen-sietch")
|
||||
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen")
|
||||
InitObjectives(Atreides)
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "")
|
||||
ProtectFremen = AddPrimaryObjective(Atreides, "protect-fremen-sietch")
|
||||
KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen")
|
||||
local keepSietchIntact = UserInterface.Translate("keep-sietch-intact", { ["integrity"] = IntegrityLevel[Difficulty] })
|
||||
KeepIntegrity = AddPrimaryObjective(player, keepSietchIntact)
|
||||
KeepIntegrity = AddPrimaryObjective(Atreides, keepSietchIntact)
|
||||
|
||||
Camera.Position = AConyard.CenterPosition
|
||||
HarkonnenAttackLocation = AConyard.Location
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(2), function()
|
||||
Beacon.New(player, Sietch.CenterPosition + WVec.New(0, 1024, 0))
|
||||
Beacon.New(Atreides, Sietch.CenterPosition + WVec.New(0, 1024, 0))
|
||||
Media.DisplayMessage(UserInterface.Translate("fremen-sietch-southeast"), Mentat)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(HarkonnenBase, function()
|
||||
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(Sietch, function()
|
||||
Actor.Create("invisibleBlocker", true, { Owner = fremen, Location = CPos.New(62, 59) })
|
||||
UserInterface.SetMissionText(UserInterface.Translate("sietch-destroyed"), player.Color)
|
||||
player.MarkFailedObjective(ProtectFremen)
|
||||
Actor.Create("invisibleBlocker", true, { Owner = Fremen, Location = CPos.New(62, 59) })
|
||||
UserInterface.SetMissionText(UserInterface.Translate("sietch-destroyed"), Atreides.Color)
|
||||
Atreides.MarkFailedObjective(ProtectFremen)
|
||||
end)
|
||||
Trigger.OnDamaged(Sietch, function()
|
||||
if AttackNotifier <= 0 then
|
||||
AttackNotifier = DateTime.Seconds(10)
|
||||
Beacon.New(player, Sietch.CenterPosition + WVec.New(0, 1024, 0), DateTime.Seconds(7))
|
||||
Beacon.New(Atreides, Sietch.CenterPosition + WVec.New(0, 1024, 0), DateTime.Seconds(7))
|
||||
Media.DisplayMessage(UserInterface.Translate("fremen-sietch-under-attack"), Mentat)
|
||||
|
||||
local defenders = fremen.GetGroundAttackers()
|
||||
local defenders = Fremen.GetGroundAttackers()
|
||||
if #defenders > 0 then
|
||||
Utils.Do(defenders, function(unit)
|
||||
unit.Guard(Sietch)
|
||||
@@ -180,35 +180,35 @@ WorldLoaded = function()
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(HarkonnenPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end
|
||||
local waveCondition = function() return Atreides.IsObjectiveCompleted(KillHarkonnen) end
|
||||
local huntFunction = function(unit)
|
||||
unit.AttackMove(HarkonnenAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end
|
||||
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = harkonnen })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = Harkonnen })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(50), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, AtreidesReinforcements[1], AtreidesPath)
|
||||
Media.PlaySpeechNotification(Atreides, "Reinforce")
|
||||
Reinforcements.Reinforce(Atreides, AtreidesReinforcements[1], AtreidesPath)
|
||||
end)
|
||||
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements[2], AtreidesPath, { AtreidesPath[1] })
|
||||
Media.PlaySpeechNotification(Atreides, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements[2], AtreidesPath, { AtreidesPath[1] })
|
||||
end)
|
||||
|
||||
Trigger.OnEnteredProximityTrigger(HarkonnenRally1.CenterPosition, WDist.New(6 * 1024), function(a, id)
|
||||
if a.Owner == player then
|
||||
if a.Owner == Atreides then
|
||||
Trigger.RemoveProximityTrigger(id)
|
||||
local units = Reinforcements.Reinforce(harkonnen, { "light_inf", "combat_tank_h", "trike" }, HarkonnenPaths[1])
|
||||
local units = Reinforcements.Reinforce(Harkonnen, { "light_inf", "combat_tank_h", "trike" }, HarkonnenPaths[1])
|
||||
Utils.Do(units, IdleHunt)
|
||||
end
|
||||
end)
|
||||
|
||||
Trigger.OnExitedProximityTrigger(Sietch.CenterPosition, WDist.New(10.5 * 1024), function(a, id)
|
||||
if a.Owner == fremen and not a.IsDead then
|
||||
if a.Owner == Fremen and not a.IsDead then
|
||||
a.AttackMove(FremenRally.Location)
|
||||
Trigger.OnIdle(a, function()
|
||||
if a.Location.X < 54 or a.Location.Y < 54 then
|
||||
|
||||
@@ -26,44 +26,44 @@ HarkonnenVehicleTypes = { "trike", "trike", "trike", "quad", "quad" }
|
||||
HarkonnenTankType = { "combat_tank_h" }
|
||||
|
||||
InitAIUnits = function()
|
||||
IdlingUnits[harkonnen] = Reinforcements.ReinforceWithTransport(harkonnen, "carryall.reinforce", InitialHarkonnenReinforcements, HarkonnenPaths[1], { HarkonnenPaths[1][1] })[2]
|
||||
IdlingUnits[Harkonnen] = Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", InitialHarkonnenReinforcements, HarkonnenPaths[1], { HarkonnenPaths[1][1] })[2]
|
||||
|
||||
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendActor(HarkonnenBarracks, harkonnen, AttackGroupSize[Difficulty])
|
||||
RepairBuilding(harkonnen, HarkonnenBarracks, 0.75)
|
||||
DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendActor(HarkonnenBarracks, Harkonnen, AttackGroupSize[Difficulty])
|
||||
RepairBuilding(Harkonnen, HarkonnenBarracks, 0.75)
|
||||
|
||||
Utils.Do(SmugglerBase, function(actor)
|
||||
RepairBuilding(smuggler, actor, 0.75)
|
||||
RepairBuilding(Smuggler, actor, 0.75)
|
||||
end)
|
||||
RepairBuilding(smuggler, Starport, 0.75)
|
||||
RepairBuilding(Smuggler, Starport, 0.75)
|
||||
end
|
||||
|
||||
-- Not using ProduceUnits because of the custom StopInfantryProduction condition
|
||||
ProduceInfantry = function()
|
||||
if StopInfantryProduction or HarkonnenBarracks.IsDead or HarkonnenBarracks.Owner ~= harkonnen then
|
||||
if StopInfantryProduction or HarkonnenBarracks.IsDead or HarkonnenBarracks.Owner ~= Harkonnen then
|
||||
return
|
||||
end
|
||||
|
||||
if HoldProduction[harkonnen] then
|
||||
if HoldProduction[Harkonnen] then
|
||||
Trigger.AfterDelay(DateTime.Seconds(30), ProduceInfantry)
|
||||
return
|
||||
end
|
||||
|
||||
local delay = Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1)
|
||||
local toBuild = { Utils.Random(HarkonnenInfantryTypes) }
|
||||
harkonnen.Build(toBuild, function(unit)
|
||||
IdlingUnits[harkonnen][#IdlingUnits[harkonnen] + 1] = unit[1]
|
||||
Harkonnen.Build(toBuild, function(unit)
|
||||
IdlingUnits[Harkonnen][#IdlingUnits[Harkonnen] + 1] = unit[1]
|
||||
Trigger.AfterDelay(delay, ProduceInfantry)
|
||||
|
||||
if #IdlingUnits[harkonnen] >= (AttackGroupSize[Difficulty] * 2.5) then
|
||||
SendAttack(harkonnen, AttackGroupSize[Difficulty])
|
||||
if #IdlingUnits[Harkonnen] >= (AttackGroupSize[Difficulty] * 2.5) then
|
||||
SendAttack(Harkonnen, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
ActivateAI = function()
|
||||
harkonnen.Cash = 15000
|
||||
LastHarvesterEaten[harkonnen] = true
|
||||
Harkonnen.Cash = 15000
|
||||
LastHarvesterEaten[Harkonnen] = true
|
||||
InitAIUnits()
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
@@ -72,6 +72,6 @@ ActivateAI = function()
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceInfantry()
|
||||
ProduceUnits(harkonnen, HarkonnenLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(harkonnen, HarkonnenHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Harkonnen, HarkonnenLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Harkonnen, HarkonnenHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -148,17 +148,17 @@ ContrabandTimes =
|
||||
hard = DateTime.Minutes(2) + DateTime.Seconds(30)
|
||||
}
|
||||
|
||||
wave = 0
|
||||
Wave = 0
|
||||
SendHarkonnen = function()
|
||||
Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function()
|
||||
if player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
if Atreides.IsObjectiveCompleted(KillHarkonnen) then
|
||||
return
|
||||
end
|
||||
|
||||
wave = wave + 1
|
||||
Wave = Wave + 1
|
||||
|
||||
if InfantryReinforcements and wave % 4 == 0 then
|
||||
local inf = Reinforcements.Reinforce(harkonnen, HarkonnenInfantryReinforcements[Difficulty][wave/4], InfantryPath)
|
||||
if InfantryReinforcements and Wave % 4 == 0 then
|
||||
local inf = Reinforcements.Reinforce(Harkonnen, HarkonnenInfantryReinforcements[Difficulty][Wave/4], InfantryPath)
|
||||
Utils.Do(inf, function(unit)
|
||||
unit.AttackMove(HarkonnenAttackLocation)
|
||||
IdleHunt(unit)
|
||||
@@ -166,13 +166,13 @@ SendHarkonnen = function()
|
||||
end
|
||||
|
||||
local entryPath = Utils.Random(HarkonnenPaths)
|
||||
local units = Reinforcements.ReinforceWithTransport(harkonnen, "carryall.reinforce", HarkonnenReinforcements[Difficulty][wave], entryPath, { entryPath[1] })[2]
|
||||
local units = Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[Difficulty][Wave], entryPath, { entryPath[1] })[2]
|
||||
Utils.Do(units, function(unit)
|
||||
unit.AttackMove(HarkonnenAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end)
|
||||
|
||||
if wave < HarkonnenAttackWaves[Difficulty] then
|
||||
if Wave < HarkonnenAttackWaves[Difficulty] then
|
||||
SendHarkonnen()
|
||||
return
|
||||
end
|
||||
@@ -181,21 +181,21 @@ SendHarkonnen = function()
|
||||
end)
|
||||
end
|
||||
|
||||
mercWave = 0
|
||||
MercWave = 0
|
||||
SendMercenaries = function()
|
||||
Trigger.AfterDelay(MercenaryAttackDelay[Difficulty], function()
|
||||
mercWave = mercWave + 1
|
||||
MercWave = MercWave + 1
|
||||
|
||||
Media.DisplayMessage(UserInterface.Translate("incoming-mercenary-force"), Mentat)
|
||||
|
||||
local units = Reinforcements.Reinforce(mercenary, MercenaryReinforcements[Difficulty][mercWave], MercenarySpawn)
|
||||
local units = Reinforcements.Reinforce(Mercenary, MercenaryReinforcements[Difficulty][MercWave], MercenarySpawn)
|
||||
Utils.Do(units, function(unit)
|
||||
unit.AttackMove(MercenaryAttackLocation1)
|
||||
unit.AttackMove(MercenaryAttackLocation2)
|
||||
IdleHunt(unit)
|
||||
end)
|
||||
|
||||
if mercWave < MercenaryAttackWaves[Difficulty] then
|
||||
if MercWave < MercenaryAttackWaves[Difficulty] then
|
||||
SendMercenaries()
|
||||
return
|
||||
end
|
||||
@@ -206,21 +206,21 @@ end
|
||||
|
||||
SendContraband = function(owner)
|
||||
ContrabandArrived = true
|
||||
UserInterface.SetMissionText(UserInterface.Translate("contraband-has-arrived"), player.Color)
|
||||
UserInterface.SetMissionText(UserInterface.Translate("contraband-has-arrived"), Atreides.Color)
|
||||
|
||||
local units = SmugglerReinforcements
|
||||
if owner == player then
|
||||
if owner == Atreides then
|
||||
units = ContrabandReinforcements
|
||||
end
|
||||
|
||||
Reinforcements.ReinforceWithTransport(owner, "frigate", units, { ContrabandEntry.Location, Starport.Location + CVec.New(1, 1) }, { ContrabandExit.Location })
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
if owner == player then
|
||||
player.MarkCompletedObjective(CaptureStarport)
|
||||
if owner == Atreides then
|
||||
Atreides.MarkCompletedObjective(CaptureStarport)
|
||||
Media.DisplayMessage(UserInterface.Translate("contraband-confiscated"), Mentat)
|
||||
else
|
||||
player.MarkFailedObjective(CaptureStarport)
|
||||
Atreides.MarkFailedObjective(CaptureStarport)
|
||||
Media.DisplayMessage(UserInterface.Translate("contraband-not-confiscated"), Mentat)
|
||||
end
|
||||
end)
|
||||
@@ -232,13 +232,13 @@ end
|
||||
|
||||
SmugglersAttack = function()
|
||||
Utils.Do(SmugglerBase, function(building)
|
||||
if not building.IsDead and building.Owner == smuggler then
|
||||
if not building.IsDead and building.Owner == Smuggler then
|
||||
building.Sell()
|
||||
end
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(1), function()
|
||||
Utils.Do(smuggler.GetGroundAttackers(), function(unit)
|
||||
Utils.Do(Smuggler.GetGroundAttackers(), function(unit)
|
||||
IdleHunt(unit)
|
||||
end)
|
||||
end)
|
||||
@@ -246,26 +246,26 @@ end
|
||||
|
||||
AttackNotifier = 0
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
if Atreides.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if LastHarkonnenArrived and not player.IsObjectiveCompleted(KillHarkonnen) and harkonnen.HasNoRequiredUnits() then
|
||||
if LastHarkonnenArrived and not Atreides.IsObjectiveCompleted(KillHarkonnen) and Harkonnen.HasNoRequiredUnits() then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-05"), Mentat)
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if LastMercenariesArrived and not player.IsObjectiveCompleted(KillSmuggler) and smuggler.HasNoRequiredUnits() and mercenary.HasNoRequiredUnits() then
|
||||
if LastMercenariesArrived and not Atreides.IsObjectiveCompleted(KillSmuggler) and Smuggler.HasNoRequiredUnits() and Mercenary.HasNoRequiredUnits() then
|
||||
Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillSmuggler)
|
||||
Atreides.MarkCompletedObjective(KillSmuggler)
|
||||
end
|
||||
|
||||
if LastHarvesterEaten[harkonnen] and DateTime.GameTime % DateTime.Seconds(10) == 0 then
|
||||
local units = harkonnen.GetActorsByType("harvester")
|
||||
if LastHarvesterEaten[Harkonnen] and DateTime.GameTime % DateTime.Seconds(10) == 0 then
|
||||
local units = Harkonnen.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[harkonnen] = false
|
||||
ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[Harkonnen] = false
|
||||
ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -275,28 +275,28 @@ Tick = function()
|
||||
TimerTicks = TimerTicks - 1
|
||||
if (TimerTicks % DateTime.Seconds(1)) == 0 then
|
||||
local contrabandArrivesIn = UserInterface.Translate("contraband-arrives-in", { ["time"] = Utils.FormatTime(TimerTicks)})
|
||||
UserInterface.SetMissionText(contrabandArrivesIn, player.Color)
|
||||
UserInterface.SetMissionText(contrabandArrivesIn, Atreides.Color)
|
||||
end
|
||||
|
||||
if TimerTicks <= 0 then
|
||||
SendContraband(smuggler)
|
||||
SendContraband(Smuggler)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
smuggler = Player.GetPlayer("Smugglers")
|
||||
mercenary = Player.GetPlayer("Mercenaries")
|
||||
player = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Smuggler = Player.GetPlayer("Smugglers")
|
||||
Mercenary = Player.GetPlayer("Mercenaries")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
|
||||
InfantryReinforcements = Difficulty ~= "easy"
|
||||
|
||||
InitObjectives(player)
|
||||
KillAtreides = AddPrimaryObjective(harkonnen, "")
|
||||
CaptureBarracks = AddPrimaryObjective(player, "capture-barracks-sietch-tabr")
|
||||
KillHarkonnen = AddSecondaryObjective(player, "annihilate-harkonnen-units-reinforcements")
|
||||
CaptureStarport = AddSecondaryObjective(player, "capture-smuggler-starport-confiscate-contraband")
|
||||
InitObjectives(Atreides)
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "")
|
||||
CaptureBarracks = AddPrimaryObjective(Atreides, "capture-barracks-sietch-tabr")
|
||||
KillHarkonnen = AddSecondaryObjective(Atreides, "annihilate-harkonnen-units-reinforcements")
|
||||
CaptureStarport = AddSecondaryObjective(Atreides, "capture-smuggler-starport-confiscate-contraband")
|
||||
|
||||
Camera.Position = ARefinery.CenterPosition
|
||||
HarkonnenAttackLocation = AtreidesRally.Location
|
||||
@@ -311,14 +311,14 @@ WorldLoaded = function()
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(HarkonnenBase, function()
|
||||
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(Starport, function()
|
||||
if not player.IsObjectiveCompleted(CaptureStarport) then
|
||||
if not Atreides.IsObjectiveCompleted(CaptureStarport) then
|
||||
ContrabandArrived = true
|
||||
UserInterface.SetMissionText(UserInterface.Translate("starport-destroyed-no-contraband"), player.Color)
|
||||
player.MarkFailedObjective(CaptureStarport)
|
||||
UserInterface.SetMissionText(UserInterface.Translate("starport-destroyed-no-contraband"), Atreides.Color)
|
||||
Atreides.MarkFailedObjective(CaptureStarport)
|
||||
SmugglersAttack()
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
@@ -327,11 +327,11 @@ WorldLoaded = function()
|
||||
end
|
||||
|
||||
if DefendStarport then
|
||||
player.MarkFailedObjective(DefendStarport)
|
||||
Atreides.MarkFailedObjective(DefendStarport)
|
||||
end
|
||||
end)
|
||||
Trigger.OnDamaged(Starport, function()
|
||||
if Starport.Owner ~= smuggler then
|
||||
if Starport.Owner ~= Smuggler then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -339,7 +339,7 @@ WorldLoaded = function()
|
||||
AttackNotifier = DateTime.Seconds(10)
|
||||
Media.DisplayMessage(UserInterface.Translate("do-not-destroy-starport"), Mentat)
|
||||
|
||||
local defenders = smuggler.GetGroundAttackers()
|
||||
local defenders = Smuggler.GetGroundAttackers()
|
||||
if #defenders > 0 then
|
||||
Utils.Do(defenders, function(unit)
|
||||
unit.Guard(Starport)
|
||||
@@ -348,23 +348,23 @@ WorldLoaded = function()
|
||||
end
|
||||
end)
|
||||
Trigger.OnCapture(Starport, function()
|
||||
DefendStarport = AddSecondaryObjective(player, "defend-captured-starport")
|
||||
DefendStarport = AddSecondaryObjective(Atreides, "defend-captured-starport")
|
||||
|
||||
Trigger.ClearAll(Starport)
|
||||
Trigger.AfterDelay(0, function()
|
||||
Trigger.OnRemovedFromWorld(Starport, function()
|
||||
player.MarkFailedObjective(DefendStarport)
|
||||
Atreides.MarkFailedObjective(DefendStarport)
|
||||
end)
|
||||
end)
|
||||
|
||||
if not ContrabandArrived then
|
||||
SendContraband(player)
|
||||
SendContraband(Atreides)
|
||||
end
|
||||
SmugglersAttack()
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(HarkonnenBarracks, function()
|
||||
player.MarkFailedObjective(CaptureBarracks)
|
||||
Atreides.MarkFailedObjective(CaptureBarracks)
|
||||
end)
|
||||
Trigger.OnDamaged(HarkonnenBarracks, function()
|
||||
if AttackNotifier <= 0 and HarkonnenBarracks.Health < HarkonnenBarracks.MaxHealth * 3/4 then
|
||||
@@ -376,52 +376,52 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(UserInterface.Translate("hostages-released"), Mentat)
|
||||
|
||||
if DefendStarport then
|
||||
player.MarkCompletedObjective(DefendStarport)
|
||||
Atreides.MarkCompletedObjective(DefendStarport)
|
||||
end
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
player.MarkCompletedObjective(CaptureBarracks)
|
||||
Atreides.MarkCompletedObjective(CaptureBarracks)
|
||||
end)
|
||||
end)
|
||||
|
||||
SendHarkonnen()
|
||||
Actor.Create("upgrade.barracks", true, { Owner = harkonnen })
|
||||
Actor.Create("upgrade.light", true, { Owner = harkonnen })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = harkonnen })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = Harkonnen })
|
||||
Actor.Create("upgrade.light", true, { Owner = Harkonnen })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = Harkonnen })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Minutes(1), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] })
|
||||
Media.PlaySpeechNotification(Atreides, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] })
|
||||
end)
|
||||
|
||||
local smugglerWaypoint = SmugglerWaypoint1.Location
|
||||
Trigger.OnEnteredFootprint({ smugglerWaypoint + CVec.New(-2, 0), smugglerWaypoint + CVec.New(-1, 0), smugglerWaypoint, smugglerWaypoint + CVec.New(1, -1), smugglerWaypoint + CVec.New(2, -1), SmugglerWaypoint3.Location }, function(a, id)
|
||||
if not warned and a.Owner == player and a.Type ~= "carryall" then
|
||||
warned = true
|
||||
if not Warned and a.Owner == Atreides and a.Type ~= "carryall" then
|
||||
Warned = true
|
||||
Trigger.RemoveFootprintTrigger(id)
|
||||
Media.DisplayMessage(UserInterface.Translate("stay-away-from-starport"), UserInterface.Translate("smuggler-leader"))
|
||||
end
|
||||
end)
|
||||
|
||||
Trigger.OnEnteredFootprint({ SmugglerWaypoint2.Location }, function(a, id)
|
||||
if not paid and a.Owner == player and a.Type ~= "carryall" then
|
||||
paid = true
|
||||
if not Paid and a.Owner == Atreides and a.Type ~= "carryall" then
|
||||
Paid = true
|
||||
Trigger.RemoveFootprintTrigger(id)
|
||||
Media.DisplayMessage(UserInterface.Translate("were-warned-will-pay"), UserInterface.Translate("smuggler-leader"))
|
||||
Utils.Do(smuggler.GetGroundAttackers(), function(unit)
|
||||
Utils.Do(Smuggler.GetGroundAttackers(), function(unit)
|
||||
unit.AttackMove(SmugglerWaypoint2.Location)
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
KillSmuggler = AddSecondaryObjective(player, "destroy-smugglers-mercenaries")
|
||||
KillSmuggler = AddSecondaryObjective(Atreides, "destroy-smugglers-mercenaries")
|
||||
SendMercenaries()
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
Trigger.OnEnteredProximityTrigger(HarkonnenBarracks.CenterPosition, WDist.New(5 * 1024), function(a, id)
|
||||
if a.Owner == player and a.Type ~= "carryall" then
|
||||
if a.Owner == Atreides and a.Type ~= "carryall" then
|
||||
Trigger.RemoveProximityTrigger(id)
|
||||
Media.DisplayMessage(UserInterface.Translate("capture-harkonnen-barracks-release-hostages"), Mentat)
|
||||
StopInfantryProduction = true
|
||||
|
||||
@@ -61,16 +61,16 @@ Messages =
|
||||
|
||||
CachedResources = -1
|
||||
Tick = function()
|
||||
if AtreidesArrived and atreides.HasNoRequiredUnits() then
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
if AtreidesArrived and Atreides.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if player.Resources > SpiceToHarvest - 1 then
|
||||
player.MarkCompletedObjective(GatherSpice)
|
||||
if Harkonnen.Resources > SpiceToHarvest - 1 then
|
||||
Harkonnen.MarkCompletedObjective(GatherSpice)
|
||||
end
|
||||
|
||||
-- player has no Wind Trap
|
||||
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if (Harkonnen.PowerProvided <= 20 or Harkonnen.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
HasPower = false
|
||||
Media.DisplayMessage(Messages[2], Mentat)
|
||||
else
|
||||
@@ -78,40 +78,40 @@ Tick = function()
|
||||
end
|
||||
|
||||
-- player has no Refinery and no Silos
|
||||
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Harkonnen.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[3], Mentat)
|
||||
end
|
||||
|
||||
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Harkonnen.Resources > Harkonnen.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[4], Mentat)
|
||||
end
|
||||
|
||||
if player.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
|
||||
if Harkonnen.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = Harkonnen.Resources, ["goal"] = SpiceToHarvest }
|
||||
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
|
||||
UserInterface.SetMissionText(harvestedResources)
|
||||
CachedResources = player.Resources
|
||||
CachedResources = Harkonnen.Resources
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
atreides = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
|
||||
SpiceToHarvest = ToHarvest[Difficulty]
|
||||
|
||||
InitObjectives(player)
|
||||
KillHarkonnen = AddPrimaryObjective(atreides, "")
|
||||
InitObjectives(Harkonnen)
|
||||
KillHarkonnen = AddPrimaryObjective(Atreides, "")
|
||||
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
|
||||
GatherSpice = AddPrimaryObjective(player, harvestSpice)
|
||||
KillAtreides = AddSecondaryObjective(player, "eliminate-atreides-units-reinforcements")
|
||||
GatherSpice = AddPrimaryObjective(Harkonnen, harvestSpice)
|
||||
KillAtreides = AddSecondaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
|
||||
|
||||
local checkResourceCapacity = function()
|
||||
Trigger.AfterDelay(0, function()
|
||||
if player.ResourceCapacity < SpiceToHarvest then
|
||||
if Harkonnen.ResourceCapacity < SpiceToHarvest then
|
||||
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
return true
|
||||
@@ -126,16 +126,16 @@ WorldLoaded = function()
|
||||
return
|
||||
end
|
||||
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end)
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Harkonnen end)
|
||||
|
||||
if #refs == 0 then
|
||||
atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
else
|
||||
Trigger.OnAllRemovedFromWorld(refs, function()
|
||||
atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end)
|
||||
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end)
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Harkonnen end)
|
||||
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
end
|
||||
@@ -144,8 +144,8 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(Messages[1], Mentat)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(25), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenEntryPath)
|
||||
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
|
||||
Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenEntryPath)
|
||||
end)
|
||||
|
||||
WavesLeft = AtreidesAttackWaves[Difficulty]
|
||||
@@ -159,7 +159,7 @@ SendReinforcements = function()
|
||||
if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end
|
||||
|
||||
Trigger.AfterDelay(delay, function()
|
||||
Reinforcements.Reinforce(atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt)
|
||||
Reinforcements.Reinforce(Atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt)
|
||||
|
||||
WavesLeft = WavesLeft - 1
|
||||
if WavesLeft == 0 then
|
||||
|
||||
@@ -61,16 +61,16 @@ Messages =
|
||||
|
||||
CachedResources = -1
|
||||
Tick = function()
|
||||
if AtreidesArrived and atreides.HasNoRequiredUnits() then
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
if AtreidesArrived and Atreides.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if player.Resources > SpiceToHarvest - 1 then
|
||||
player.MarkCompletedObjective(GatherSpice)
|
||||
if Harkonnen.Resources > SpiceToHarvest - 1 then
|
||||
Harkonnen.MarkCompletedObjective(GatherSpice)
|
||||
end
|
||||
|
||||
-- player has no Wind Trap
|
||||
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if (Harkonnen.PowerProvided <= 20 or Harkonnen.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
HasPower = false
|
||||
Media.DisplayMessage(Messages[2], Mentat)
|
||||
else
|
||||
@@ -78,40 +78,40 @@ Tick = function()
|
||||
end
|
||||
|
||||
-- player has no Refinery and no Silos
|
||||
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Harkonnen.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[3], Mentat)
|
||||
end
|
||||
|
||||
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Harkonnen.Resources > Harkonnen.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[4], Mentat)
|
||||
end
|
||||
|
||||
if player.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
|
||||
if Harkonnen.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = Harkonnen.Resources, ["goal"] = SpiceToHarvest }
|
||||
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
|
||||
UserInterface.SetMissionText(harvestedResources)
|
||||
CachedResources = player.Resources
|
||||
CachedResources = Harkonnen.Resources
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
atreides = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
|
||||
SpiceToHarvest = ToHarvest[Difficulty]
|
||||
|
||||
InitObjectives(player)
|
||||
KillHarkonnen = AddPrimaryObjective(atreides, "")
|
||||
InitObjectives(Harkonnen)
|
||||
KillHarkonnen = AddPrimaryObjective(Atreides, "")
|
||||
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
|
||||
GatherSpice = AddPrimaryObjective(player, harvestSpice)
|
||||
KillAtreides = AddSecondaryObjective(player, "eliminate-atreides-units-reinforcements")
|
||||
GatherSpice = AddPrimaryObjective(Harkonnen, harvestSpice)
|
||||
KillAtreides = AddSecondaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
|
||||
|
||||
local checkResourceCapacity = function()
|
||||
Trigger.AfterDelay(0, function()
|
||||
if player.ResourceCapacity < SpiceToHarvest then
|
||||
if Harkonnen.ResourceCapacity < SpiceToHarvest then
|
||||
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
return true
|
||||
@@ -126,16 +126,16 @@ WorldLoaded = function()
|
||||
return
|
||||
end
|
||||
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end)
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Harkonnen end)
|
||||
|
||||
if #refs == 0 then
|
||||
atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
else
|
||||
Trigger.OnAllRemovedFromWorld(refs, function()
|
||||
atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end)
|
||||
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end)
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Harkonnen end)
|
||||
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
end
|
||||
@@ -144,8 +144,8 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(Messages[1], Mentat)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(25), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenEntryPath)
|
||||
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
|
||||
Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenEntryPath)
|
||||
end)
|
||||
|
||||
WavesLeft = AtreidesAttackWaves[Difficulty]
|
||||
@@ -159,7 +159,7 @@ SendReinforcements = function()
|
||||
if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end
|
||||
|
||||
Trigger.AfterDelay(delay, function()
|
||||
Reinforcements.Reinforce(atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt)
|
||||
Reinforcements.Reinforce(Atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt)
|
||||
|
||||
WavesLeft = WavesLeft - 1
|
||||
if WavesLeft == 0 then
|
||||
|
||||
@@ -24,11 +24,11 @@ AttackDelays =
|
||||
AtreidesInfantryTypes = { "light_inf" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[atreides] = { }
|
||||
IdlingUnits[Atreides] = { }
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local toBuild = function() return AtreidesInfantryTypes end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
ProduceUnits(atreides, ABarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
ProduceUnits(Atreides, ABarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -65,31 +65,31 @@ AtreidesAttackWaves =
|
||||
}
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then
|
||||
if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides = Player.GetPlayer("Atreides")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
KillHarkonnen = AddPrimaryObjective(atreides, "")
|
||||
KillAtreides = AddSecondaryObjective(player, "destroy-atreides-forces")
|
||||
InitObjectives(Harkonnen)
|
||||
KillHarkonnen = AddPrimaryObjective(Atreides, "")
|
||||
KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides-forces")
|
||||
|
||||
Camera.Position = HConyard.CenterPosition
|
||||
|
||||
Trigger.OnAllKilled(AtreidesBase, function()
|
||||
Utils.Do(atreides.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(AtreidesAttackPaths) end
|
||||
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty])
|
||||
SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty])
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
end
|
||||
|
||||
@@ -25,13 +25,13 @@ AtreidesInfantryTypes = { "light_inf" }
|
||||
AtreidesVehicleTypes = { "trike" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[atreides] = { }
|
||||
IdlingUnits[Atreides] = { }
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuild = function() return AtreidesInfantryTypes end
|
||||
local vehilcesToBuild = function() return AtreidesVehicleTypes end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -65,31 +65,31 @@ AtreidesAttackWaves =
|
||||
}
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then
|
||||
if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides = Player.GetPlayer("Atreides")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
KillHarkonnen = AddPrimaryObjective(atreides, "")
|
||||
KillAtreides = AddSecondaryObjective(player, "destroy-atreides-forces")
|
||||
InitObjectives(Harkonnen)
|
||||
KillHarkonnen = AddPrimaryObjective(Atreides, "")
|
||||
KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides-forces")
|
||||
|
||||
Camera.Position = HConyard.CenterPosition
|
||||
|
||||
Trigger.OnAllKilled(AtreidesBase, function()
|
||||
Utils.Do(atreides.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(AtreidesAttackPaths) end
|
||||
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty])
|
||||
SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty])
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
end
|
||||
|
||||
@@ -25,9 +25,9 @@ AtreidesInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tro
|
||||
AtreidesVehicleTypes = { "trike", "trike", "quad" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[atreides] = { }
|
||||
LastHarvesterEaten[atreides] = true
|
||||
DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
IdlingUnits[Atreides] = { }
|
||||
LastHarvesterEaten[Atreides] = true
|
||||
DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
AConyard.Produce(HarkonnenUpgrades[1])
|
||||
AConyard.Produce(HarkonnenUpgrades[2])
|
||||
@@ -39,7 +39,7 @@ ActivateAI = function()
|
||||
|
||||
-- Finish the upgrades first before trying to build something
|
||||
Trigger.AfterDelay(DateTime.Seconds(14), function()
|
||||
ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -94,25 +94,25 @@ HarkonnenBaseBuildings = { "barracks", "light_factory" }
|
||||
HarkonnenUpgrades = { "upgrade.barracks", "upgrade.light" }
|
||||
|
||||
MessageCheck = function(index)
|
||||
return #player.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not player.HasPrerequisites({ HarkonnenUpgrades[index] })
|
||||
return #Harkonnen.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not Harkonnen.HasPrerequisites({ HarkonnenUpgrades[index] })
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then
|
||||
if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then
|
||||
local units = atreides.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then
|
||||
local units = Atreides.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[atreides] = false
|
||||
ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[Atreides] = false
|
||||
ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -122,31 +122,31 @@ Tick = function()
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides = Player.GetPlayer("Atreides")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
KillHarkonnen = AddPrimaryObjective(atreides, "")
|
||||
KillAtreides = AddPrimaryObjective(player, "eliminate-atreides-units-reinforcements")
|
||||
InitObjectives(Harkonnen)
|
||||
KillHarkonnen = AddPrimaryObjective(Atreides, "")
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
|
||||
|
||||
Camera.Position = HConyard.CenterPosition
|
||||
|
||||
Trigger.OnAllKilled(AtreidesBase, function()
|
||||
Utils.Do(atreides.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(AtreidesPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end
|
||||
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition)
|
||||
local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
|
||||
SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition)
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function()
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
|
||||
Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
|
||||
end)
|
||||
|
||||
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1])
|
||||
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[2], AtreidesHunterPaths[2])
|
||||
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[3], AtreidesHunterPaths[3])
|
||||
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[4], AtreidesHunterPaths[4])
|
||||
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[5], AtreidesHunterPaths[5])
|
||||
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1])
|
||||
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[2], AtreidesHunterPaths[2])
|
||||
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[3], AtreidesHunterPaths[3])
|
||||
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[4], AtreidesHunterPaths[4])
|
||||
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[5], AtreidesHunterPaths[5])
|
||||
end
|
||||
|
||||
@@ -25,13 +25,13 @@ AtreidesInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tro
|
||||
AtreidesVehicleTypes = { "trike", "trike", "quad" }
|
||||
|
||||
InitAIUnits = function()
|
||||
IdlingUnits[atreides] = Reinforcements.Reinforce(atreides, AtreidesInitialReinforcements, AtreidesInitialPath)
|
||||
IdlingUnits[Atreides] = Reinforcements.Reinforce(Atreides, AtreidesInitialReinforcements, AtreidesInitialPath)
|
||||
|
||||
DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
end
|
||||
|
||||
ActivateAI = function()
|
||||
LastHarvesterEaten[atreides] = true
|
||||
LastHarvesterEaten[Atreides] = true
|
||||
Trigger.AfterDelay(0, InitAIUnits)
|
||||
|
||||
AConyard.Produce(HarkonnenUpgrades[1])
|
||||
@@ -44,7 +44,7 @@ ActivateAI = function()
|
||||
|
||||
-- Finish the upgrades first before trying to build something
|
||||
Trigger.AfterDelay(DateTime.Seconds(14), function()
|
||||
ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -96,25 +96,25 @@ HarkonnenBaseBuildings = { "barracks", "light_factory" }
|
||||
HarkonnenUpgrades = { "upgrade.barracks", "upgrade.light" }
|
||||
|
||||
MessageCheck = function(index)
|
||||
return #player.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not player.HasPrerequisites({ HarkonnenUpgrades[index] })
|
||||
return #Harkonnen.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not Harkonnen.HasPrerequisites({ HarkonnenUpgrades[index] })
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then
|
||||
if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then
|
||||
local units = atreides.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then
|
||||
local units = Atreides.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[atreides] = false
|
||||
ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[Atreides] = false
|
||||
ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -124,30 +124,30 @@ Tick = function()
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides = Player.GetPlayer("Atreides")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
KillHarkonnen = AddPrimaryObjective(atreides, "")
|
||||
KillAtreides = AddPrimaryObjective(player, "eliminate-atreides-units-reinforcements")
|
||||
InitObjectives(Harkonnen)
|
||||
KillHarkonnen = AddPrimaryObjective(Atreides, "")
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements")
|
||||
|
||||
Camera.Position = HConyard.CenterPosition
|
||||
|
||||
Trigger.OnAllKilled(AtreidesBase, function()
|
||||
Utils.Do(atreides.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(AtreidesPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end
|
||||
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition)
|
||||
local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
|
||||
SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition)
|
||||
ActivateAI()
|
||||
|
||||
Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function()
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
|
||||
Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
|
||||
end)
|
||||
|
||||
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1])
|
||||
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[2], AtreidesHunterPaths[2])
|
||||
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[3], AtreidesHunterPaths[3])
|
||||
TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[4], AtreidesHunters[4], AtreidesHunterPaths[4])
|
||||
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1])
|
||||
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[2], AtreidesHunterPaths[2])
|
||||
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[3], AtreidesHunterPaths[3])
|
||||
TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[4], AtreidesHunters[4], AtreidesHunterPaths[4])
|
||||
end
|
||||
|
||||
@@ -26,12 +26,12 @@ AtreidesVehicleTypes = { "trike", "trike", "quad" }
|
||||
AtreidesTankType = { "combat_tank_a" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[fremen] = { }
|
||||
IdlingUnits[atreides] = Reinforcements.Reinforce(atreides, InitialAtreidesReinforcements[1], AtreidesPaths[2]), Reinforcements.Reinforce(atreides, InitialAtreidesReinforcements[2], AtreidesPaths[3])
|
||||
IdlingUnits[Fremen] = { }
|
||||
IdlingUnits[Atreides] = Reinforcements.Reinforce(Atreides, InitialAtreidesReinforcements[1], AtreidesPaths[2]), Reinforcements.Reinforce(Atreides, InitialAtreidesReinforcements[2], AtreidesPaths[3])
|
||||
FremenProduction()
|
||||
|
||||
DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(fremen, FremenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(Fremen, FremenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuild = function() return { Utils.Random(AtreidesInfantryTypes) } end
|
||||
@@ -39,7 +39,7 @@ ActivateAI = function()
|
||||
local tanksToBuild = function() return AtreidesTankType end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Atreides, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -122,51 +122,51 @@ FremenProduction = function()
|
||||
end
|
||||
|
||||
local delay = Utils.RandomInteger(FremenInterval[Difficulty][1], FremenInterval[Difficulty][2] + 1)
|
||||
fremen.Build({ "nsfremen" }, function()
|
||||
Fremen.Build({ "nsfremen" }, function()
|
||||
Trigger.AfterDelay(delay, FremenProduction)
|
||||
end)
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
Atreides.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then
|
||||
if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if fremen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillFremen) then
|
||||
if Fremen.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillFremen) then
|
||||
Media.DisplayMessage(UserInterface.Translate("fremen-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillFremen)
|
||||
Harkonnen.MarkCompletedObjective(KillFremen)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then
|
||||
local units = atreides.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then
|
||||
local units = Atreides.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[atreides] = false
|
||||
ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[Atreides] = false
|
||||
ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides = Player.GetPlayer("Atreides")
|
||||
fremen = Player.GetPlayer("Fremen")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
Fremen = Player.GetPlayer("Fremen")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
KillAtreides = AddPrimaryObjective(player, "destroy-atreides")
|
||||
KillFremen = AddPrimaryObjective(player, "destroy-fremen")
|
||||
KillHarkonnen = AddPrimaryObjective(atreides, "")
|
||||
InitObjectives(Harkonnen)
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides")
|
||||
KillFremen = AddPrimaryObjective(Harkonnen, "destroy-fremen")
|
||||
KillHarkonnen = AddPrimaryObjective(Atreides, "")
|
||||
|
||||
Camera.Position = HConyard.CenterPosition
|
||||
FremenAttackLocation = HConyard.Location
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(AtreidesBase, function()
|
||||
Utils.Do(atreides.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Atreides.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilled(Sietches, function()
|
||||
@@ -174,31 +174,31 @@ WorldLoaded = function()
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(FremenPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillFremen) end
|
||||
local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillFremen) end
|
||||
local huntFunction = function(unit)
|
||||
unit.AttackMove(FremenAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end
|
||||
SendCarryallReinforcements(fremen, 0, FremenAttackWaves[Difficulty], FremenAttackDelay[Difficulty], path, FremenReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
SendCarryallReinforcements(Fremen, 0, FremenAttackWaves[Difficulty], FremenAttackDelay[Difficulty], path, FremenReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides })
|
||||
Actor.Create("upgrade.light", true, { Owner = atreides })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = Atreides })
|
||||
Actor.Create("upgrade.light", true, { Owner = Atreides })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(15), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenPath)
|
||||
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
|
||||
Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenPath)
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
Media.DisplayMessage(UserInterface.Translate("fremen-spotted-north-southeast"), Mentat)
|
||||
end)
|
||||
|
||||
local atreidesCondition = function() return player.IsObjectiveCompleted(KillAtreides) end
|
||||
TriggerCarryallReinforcements(player, atreides, BaseAreaTriggers[1], AtreidesHunters, AtreidesPaths[1], atreidesCondition)
|
||||
local atreidesCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
|
||||
TriggerCarryallReinforcements(Harkonnen, Atreides, BaseAreaTriggers[1], AtreidesHunters, AtreidesPaths[1], atreidesCondition)
|
||||
|
||||
local fremenCondition = function() return player.IsObjectiveCompleted(KillFremen) end
|
||||
TriggerCarryallReinforcements(player, fremen, BaseAreaTriggers[1], FremenHunters[1], FremenHunterPaths[3], fremenCondition)
|
||||
TriggerCarryallReinforcements(player, fremen, BaseAreaTriggers[2], FremenHunters[2], FremenHunterPaths[2], fremenCondition)
|
||||
TriggerCarryallReinforcements(player, fremen, BaseAreaTriggers[3], FremenHunters[3], FremenHunterPaths[1], fremenCondition)
|
||||
local fremenCondition = function() return Harkonnen.IsObjectiveCompleted(KillFremen) end
|
||||
TriggerCarryallReinforcements(Harkonnen, Fremen, BaseAreaTriggers[1], FremenHunters[1], FremenHunterPaths[3], fremenCondition)
|
||||
TriggerCarryallReinforcements(Harkonnen, Fremen, BaseAreaTriggers[2], FremenHunters[2], FremenHunterPaths[2], fremenCondition)
|
||||
TriggerCarryallReinforcements(Harkonnen, Fremen, BaseAreaTriggers[3], FremenHunters[3], FremenHunterPaths[1], fremenCondition)
|
||||
end
|
||||
|
||||
@@ -26,13 +26,13 @@ OrdosVehicleTypes = { "raider", "raider", "quad" }
|
||||
OrdosTankType = { "combat_tank_o" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
|
||||
IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
|
||||
IdlingUnits[corrino] = { CSaraukar1, CSaraukar2, CSaraukar3, CSaraukar4, CSaraukar5 }
|
||||
IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
|
||||
IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
|
||||
IdlingUnits[Corrino] = { CSaraukar1, CSaraukar2, CSaraukar3, CSaraukar4, CSaraukar5 }
|
||||
|
||||
DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(OrdosMain, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(OrdosSmall, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(Corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end
|
||||
@@ -40,10 +40,10 @@ ActivateAI = function()
|
||||
local tanksToBuild = function() return OrdosTankType end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_main, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(ordos_small, OBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosSmall, OBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -131,11 +131,11 @@ HarkonnenPaths =
|
||||
|
||||
SendStarportReinforcements = function()
|
||||
Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function()
|
||||
if CStarport.IsDead or CStarport.Owner ~= corrino then
|
||||
if CStarport.IsDead or CStarport.Owner ~= Corrino then
|
||||
return
|
||||
end
|
||||
|
||||
local units = Reinforcements.ReinforceWithTransport(corrino, "frigate", CorrinoStarportReinforcements[Difficulty], { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2]
|
||||
local units = Reinforcements.ReinforceWithTransport(Corrino, "frigate", CorrinoStarportReinforcements[Difficulty], { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2]
|
||||
Utils.Do(units, function(unit)
|
||||
unit.AttackMove(OrdosAttackLocation)
|
||||
IdleHunt(unit)
|
||||
@@ -143,7 +143,7 @@ SendStarportReinforcements = function()
|
||||
|
||||
SendStarportReinforcements()
|
||||
|
||||
if player.IsObjectiveFailed(GuardOutpost) then
|
||||
if Harkonnen.IsObjectiveFailed(GuardOutpost) then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -153,16 +153,16 @@ end
|
||||
|
||||
SendHarkonnenReinforcements = function(delay, number)
|
||||
Trigger.AfterDelay(delay, function()
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] })
|
||||
Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] })
|
||||
Trigger.AfterDelay(DateTime.Seconds(5), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
OrdosReinforcementNotification = function(currentWave, totalWaves)
|
||||
Trigger.AfterDelay(OrdosAttackDelay[Difficulty], function()
|
||||
if player.IsObjectiveFailed(GuardOutpost) or player.IsObjectiveCompleted(KillOrdos) then
|
||||
if Harkonnen.IsObjectiveFailed(GuardOutpost) or Harkonnen.IsObjectiveCompleted(KillOrdos) then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -179,62 +179,62 @@ end
|
||||
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
ordos_main.MarkCompletedObjective(KillHarkonnen1)
|
||||
ordos_small.MarkCompletedObjective(KillHarkonnen2)
|
||||
corrino.MarkCompletedObjective(KillHarkonnen3)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
OrdosMain.MarkCompletedObjective(KillHarkonnen1)
|
||||
OrdosSmall.MarkCompletedObjective(KillHarkonnen2)
|
||||
Corrino.MarkCompletedObjective(KillHarkonnen3)
|
||||
end
|
||||
|
||||
if ordos_main.HasNoRequiredUnits() and ordos_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then
|
||||
if OrdosMain.HasNoRequiredUnits() and OrdosSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillOrdos) then
|
||||
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillOrdos)
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
end
|
||||
|
||||
if corrino.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then
|
||||
if Corrino.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then
|
||||
Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillCorrino)
|
||||
Harkonnen.MarkCompletedObjective(KillCorrino)
|
||||
end
|
||||
|
||||
if player.IsObjectiveCompleted(KillOrdos) and player.IsObjectiveCompleted(KillCorrino) and not player.IsObjectiveCompleted(GuardOutpost) then
|
||||
player.MarkCompletedObjective(GuardOutpost)
|
||||
if Harkonnen.IsObjectiveCompleted(KillOrdos) and Harkonnen.IsObjectiveCompleted(KillCorrino) and not Harkonnen.IsObjectiveCompleted(GuardOutpost) then
|
||||
Harkonnen.MarkCompletedObjective(GuardOutpost)
|
||||
end
|
||||
|
||||
if (HOutpost.IsDead or HOutpost.Owner ~= player) and not player.IsObjectiveFailed(GuardOutpost) then
|
||||
player.MarkFailedObjective(GuardOutpost)
|
||||
if (HOutpost.IsDead or HOutpost.Owner ~= Harkonnen) and not Harkonnen.IsObjectiveFailed(GuardOutpost) then
|
||||
Harkonnen.MarkFailedObjective(GuardOutpost)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then
|
||||
local units = ordos_main.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then
|
||||
local units = OrdosMain.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos_main] = false
|
||||
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[OrdosMain] = false
|
||||
ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then
|
||||
local units = ordos_small.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then
|
||||
local units = OrdosSmall.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos_small] = false
|
||||
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[OrdosSmall] = false
|
||||
ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
ordos_main = Player.GetPlayer("Ordos Main Base")
|
||||
ordos_small = Player.GetPlayer("Ordos Small Base")
|
||||
corrino = Player.GetPlayer("Corrino")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
OrdosMain = Player.GetPlayer("Ordos Main Base")
|
||||
OrdosSmall = Player.GetPlayer("Ordos Small Base")
|
||||
Corrino = Player.GetPlayer("Corrino")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
KillOrdos = AddPrimaryObjective(player, "destroy-ordos")
|
||||
KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces")
|
||||
GuardOutpost = AddSecondaryObjective(player, "keep-modified-outpost-intact")
|
||||
KillHarkonnen1 = AddPrimaryObjective(ordos_main, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(ordos_small, "")
|
||||
KillHarkonnen3 = AddPrimaryObjective(corrino, "")
|
||||
InitObjectives(Harkonnen)
|
||||
KillOrdos = AddPrimaryObjective(Harkonnen, "destroy-ordos")
|
||||
KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces")
|
||||
GuardOutpost = AddSecondaryObjective(Harkonnen, "keep-modified-outpost-intact")
|
||||
KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "")
|
||||
KillHarkonnen3 = AddPrimaryObjective(Corrino, "")
|
||||
|
||||
HOutpost.GrantCondition("modified")
|
||||
|
||||
@@ -242,15 +242,15 @@ WorldLoaded = function()
|
||||
OrdosAttackLocation = HConYard.Location
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(OrdosMainBase, function()
|
||||
Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function()
|
||||
Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(CorrinoBase, function()
|
||||
Utils.Do(corrino.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Corrino.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(5), function()
|
||||
@@ -258,28 +258,28 @@ WorldLoaded = function()
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(OrdosPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end
|
||||
local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillOrdos) end
|
||||
local huntFunction = function(unit)
|
||||
unit.AttackMove(OrdosAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end
|
||||
SendCarryallReinforcements(ordos_main, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
SendCarryallReinforcements(OrdosMain, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
OrdosReinforcementNotification(0, OrdosAttackWaves[Difficulty])
|
||||
|
||||
SendStarportReinforcements()
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = ordos_main })
|
||||
Actor.Create("upgrade.light", true, { Owner = ordos_main })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = ordos_main })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = ordos_small })
|
||||
Actor.Create("upgrade.light", true, { Owner = ordos_small })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = OrdosMain })
|
||||
Actor.Create("upgrade.light", true, { Owner = OrdosMain })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = OrdosMain })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall })
|
||||
Actor.Create("upgrade.light", true, { Owner = OrdosSmall })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
SendHarkonnenReinforcements(DateTime.Seconds(15), 1)
|
||||
SendHarkonnenReinforcements(DateTime.Seconds(30), 1)
|
||||
SendHarkonnenReinforcements(DateTime.Seconds(35), 2)
|
||||
|
||||
local ordosCondition = function() return player.IsObjectiveCompleted(KillOrdos) end
|
||||
TriggerCarryallReinforcements(player, ordos_main, BaseAreaTriggers[1], OrdosHunters[1], OrdosHunterPaths[2], ordosCondition)
|
||||
TriggerCarryallReinforcements(player, ordos_main, BaseAreaTriggers[2], OrdosHunters[2], OrdosHunterPaths[1], ordosCondition)
|
||||
local ordosCondition = function() return Harkonnen.IsObjectiveCompleted(KillOrdos) end
|
||||
TriggerCarryallReinforcements(Harkonnen, OrdosMain, BaseAreaTriggers[1], OrdosHunters[1], OrdosHunterPaths[2], ordosCondition)
|
||||
TriggerCarryallReinforcements(Harkonnen, OrdosMain, BaseAreaTriggers[2], OrdosHunters[2], OrdosHunterPaths[1], ordosCondition)
|
||||
end
|
||||
|
||||
@@ -27,11 +27,11 @@ OrdosTankTypes = { "combat_tank_o", "combat_tank_o", "siege_tank" }
|
||||
OrdosStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_o.starport", "combat_tank_o.starport", "siege_tank.starport", "missile_tank.starport" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
|
||||
IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
|
||||
IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
|
||||
IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
|
||||
|
||||
DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(OrdosMain, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(OrdosSmall, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end
|
||||
@@ -40,11 +40,11 @@ ActivateAI = function()
|
||||
local unitsToBuy = function() return { Utils.Random(OrdosStarportTypes) } end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_main, OHeavyFactory1, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_main, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OHeavyFactory1, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(ordos_small, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosSmall, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -115,11 +115,11 @@ HarkonnenPaths =
|
||||
|
||||
SendStarportReinforcements = function()
|
||||
Trigger.AfterDelay(OrdosStarportDelay[Difficulty], function()
|
||||
if OStarport.IsDead or OStarport.Owner ~= ordos_main then
|
||||
if OStarport.IsDead or OStarport.Owner ~= OrdosMain then
|
||||
return
|
||||
end
|
||||
|
||||
local units = Reinforcements.ReinforceWithTransport(ordos_main, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2]
|
||||
local units = Reinforcements.ReinforceWithTransport(OrdosMain, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2]
|
||||
Utils.Do(units, function(unit)
|
||||
unit.AttackMove(OrdosAttackLocation)
|
||||
IdleHunt(unit)
|
||||
@@ -133,9 +133,9 @@ end
|
||||
|
||||
SendHarkonnenReinforcements = function(delay, number)
|
||||
Trigger.AfterDelay(delay, function()
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] })
|
||||
Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] })
|
||||
Trigger.AfterDelay(DateTime.Seconds(5), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
|
||||
end)
|
||||
end)
|
||||
end
|
||||
@@ -152,45 +152,45 @@ end
|
||||
CheckSmugglerEnemies = function()
|
||||
Utils.Do(SmugglerUnits, function(unit)
|
||||
Trigger.OnDamaged(unit, function(self, attacker)
|
||||
if unit.Owner == smuggler_neutral and attacker.Owner == player then
|
||||
ChangeOwner(smuggler_neutral, smuggler_harkonnen)
|
||||
if unit.Owner == SmugglerNeutral and attacker.Owner == Harkonnen then
|
||||
ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
|
||||
|
||||
-- Ensure that harvesters that was on a carryall switched sides.
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
ChangeOwner(smuggler_neutral, smuggler_harkonnen)
|
||||
ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
|
||||
end)
|
||||
end
|
||||
|
||||
if unit.Owner == smuggler_ordos and attacker.Owner == player then
|
||||
ChangeOwner(smuggler_ordos, smuggler_both)
|
||||
if unit.Owner == SmugglerOrdos and attacker.Owner == Harkonnen then
|
||||
ChangeOwner(SmugglerOrdos, SmugglerBoth)
|
||||
|
||||
-- Ensure that harvesters that was on a carryall switched sides.
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
ChangeOwner(smuggler_ordos, smuggler_both)
|
||||
ChangeOwner(SmugglerOrdos, SmugglerBoth)
|
||||
end)
|
||||
end
|
||||
|
||||
if unit.Owner == smuggler_neutral and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then
|
||||
ChangeOwner(smuggler_neutral, smuggler_ordos)
|
||||
if unit.Owner == SmugglerNeutral and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then
|
||||
ChangeOwner(SmugglerNeutral, SmugglerOrdos)
|
||||
|
||||
-- Ensure that harvesters that was on a carryall switched sides.
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
ChangeOwner(smuggler_neutral, smuggler_ordos)
|
||||
ChangeOwner(SmugglerNeutral, SmugglerOrdos)
|
||||
end)
|
||||
end
|
||||
|
||||
if unit.Owner == smuggler_harkonnen and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then
|
||||
ChangeOwner(smuggler_harkonnen, smuggler_both)
|
||||
if unit.Owner == SmugglerHarkonnen and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then
|
||||
ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
|
||||
|
||||
-- Ensure that harvesters that was on a carryall switched sides.
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
ChangeOwner(smuggler_harkonnen, smuggler_both)
|
||||
ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
|
||||
end)
|
||||
end
|
||||
|
||||
if attacker.Owner == player and not message_check then
|
||||
if attacker.Owner == Harkonnen and not MessageCheck then
|
||||
|
||||
message_check = true
|
||||
MessageCheck = true
|
||||
Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat)
|
||||
end
|
||||
end)
|
||||
@@ -198,61 +198,61 @@ CheckSmugglerEnemies = function()
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
ordos_main.MarkCompletedObjective(KillHarkonnen1)
|
||||
ordos_small.MarkCompletedObjective(KillHarkonnen2)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
OrdosMain.MarkCompletedObjective(KillHarkonnen1)
|
||||
OrdosSmall.MarkCompletedObjective(KillHarkonnen2)
|
||||
end
|
||||
|
||||
if ordos_main.HasNoRequiredUnits() and ordos_small.HasNoRequiredUnits() and not OrdosKilled then
|
||||
if OrdosMain.HasNoRequiredUnits() and OrdosSmall.HasNoRequiredUnits() and not OrdosKilled then
|
||||
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
|
||||
OrdosKilled = true
|
||||
end
|
||||
|
||||
if smuggler_neutral.HasNoRequiredUnits() and smuggler_harkonnen.HasNoRequiredUnits() and smuggler_ordos.HasNoRequiredUnits() and smuggler_both.HasNoRequiredUnits() and not SmugglersKilled then
|
||||
if SmugglerNeutral.HasNoRequiredUnits() and SmugglerHarkonnen.HasNoRequiredUnits() and SmugglerOrdos.HasNoRequiredUnits() and SmugglerBoth.HasNoRequiredUnits() and not SmugglersKilled then
|
||||
Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat)
|
||||
SmugglersKilled = true
|
||||
end
|
||||
|
||||
if (OStarport.IsDead or OStarport.Owner == player) and not player.IsObjectiveCompleted(DestroyStarport) then
|
||||
player.MarkCompletedObjective(DestroyStarport)
|
||||
if (OStarport.IsDead or OStarport.Owner == Harkonnen) and not Harkonnen.IsObjectiveCompleted(DestroyStarport) then
|
||||
Harkonnen.MarkCompletedObjective(DestroyStarport)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then
|
||||
local units = ordos_main.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then
|
||||
local units = OrdosMain.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos_main] = false
|
||||
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[OrdosMain] = false
|
||||
ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then
|
||||
local units = ordos_small.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then
|
||||
local units = OrdosSmall.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos_small] = false
|
||||
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[OrdosSmall] = false
|
||||
ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
ordos_main = Player.GetPlayer("Ordos Main Base")
|
||||
ordos_small = Player.GetPlayer("Ordos Small Base")
|
||||
smuggler_neutral = Player.GetPlayer("Smugglers - Neutral")
|
||||
smuggler_harkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
|
||||
smuggler_ordos = Player.GetPlayer("Smugglers - Enemy to Ordos")
|
||||
smuggler_both = Player.GetPlayer("Smugglers - Enemy to Both")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
OrdosMain = Player.GetPlayer("Ordos Main Base")
|
||||
OrdosSmall = Player.GetPlayer("Ordos Small Base")
|
||||
SmugglerNeutral = Player.GetPlayer("Smugglers - Neutral")
|
||||
SmugglerHarkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
|
||||
SmugglerOrdos = Player.GetPlayer("Smugglers - Enemy to Ordos")
|
||||
SmugglerBoth = Player.GetPlayer("Smugglers - Enemy to Both")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
DestroyStarport = AddPrimaryObjective(player, "capture-destroy-ordos-starport")
|
||||
KillHarkonnen1 = AddPrimaryObjective(ordos_main, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(ordos_small, "")
|
||||
InitObjectives(Harkonnen)
|
||||
DestroyStarport = AddPrimaryObjective(Harkonnen, "capture-destroy-ordos-starport")
|
||||
KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "")
|
||||
|
||||
-- Wait for carryall drop
|
||||
Trigger.AfterDelay(DateTime.Seconds(10), function()
|
||||
SmugglerUnits = smuggler_neutral.GetActors()
|
||||
SmugglerUnits = SmugglerNeutral.GetActors()
|
||||
CheckSmugglerEnemies()
|
||||
end)
|
||||
|
||||
@@ -260,11 +260,11 @@ WorldLoaded = function()
|
||||
OrdosAttackLocation = HMCV.Location
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(OrdosMainBase, function()
|
||||
Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function()
|
||||
Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(OrdosPaths) end
|
||||
@@ -273,15 +273,15 @@ WorldLoaded = function()
|
||||
unit.AttackMove(OrdosAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end
|
||||
SendCarryallReinforcements(ordos_main, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
SendCarryallReinforcements(OrdosMain, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
|
||||
SendStarportReinforcements()
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = ordos_main })
|
||||
Actor.Create("upgrade.light", true, { Owner = ordos_main })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = ordos_main })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = ordos_small })
|
||||
Actor.Create("upgrade.light", true, { Owner = ordos_small })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = OrdosMain })
|
||||
Actor.Create("upgrade.light", true, { Owner = OrdosMain })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = OrdosMain })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall })
|
||||
Actor.Create("upgrade.light", true, { Owner = OrdosSmall })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
SendHarkonnenReinforcements(DateTime.Minutes(2) + DateTime.Seconds(15), 2)
|
||||
|
||||
@@ -27,11 +27,11 @@ OrdosTankTypes = { "combat_tank_o", "combat_tank_o", "siege_tank" }
|
||||
OrdosStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_o.starport", "combat_tank_o.starport", "siege_tank.starport", "missile_tank.starport" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
|
||||
IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
|
||||
IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
|
||||
IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3])
|
||||
|
||||
DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(OrdosMain, OrdosMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(OrdosSmall, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end
|
||||
@@ -40,11 +40,11 @@ ActivateAI = function()
|
||||
local unitsToBuy = function() return { Utils.Random(OrdosStarportTypes) } end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_main, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_main, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosMain, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(ordos_small, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosSmall, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -102,11 +102,11 @@ InitialOrdosPaths =
|
||||
|
||||
SendStarportReinforcements = function()
|
||||
Trigger.AfterDelay(OrdosStarportDelay[Difficulty], function()
|
||||
if OStarport.IsDead or OStarport.Owner ~= ordos_main then
|
||||
if OStarport.IsDead or OStarport.Owner ~= OrdosMain then
|
||||
return
|
||||
end
|
||||
|
||||
local units = Reinforcements.ReinforceWithTransport(ordos_main, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2]
|
||||
local units = Reinforcements.ReinforceWithTransport(OrdosMain, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2]
|
||||
Utils.Do(units, function(unit)
|
||||
unit.AttackMove(OrdosAttackLocation)
|
||||
IdleHunt(unit)
|
||||
@@ -130,25 +130,25 @@ end
|
||||
CheckSmugglerEnemies = function()
|
||||
Utils.Do(SmugglerUnits, function(unit)
|
||||
Trigger.OnDamaged(unit, function(self, attacker)
|
||||
if unit.Owner == smuggler_neutral and attacker.Owner == player then
|
||||
ChangeOwner(smuggler_neutral, smuggler_harkonnen)
|
||||
if unit.Owner == SmugglerNeutral and attacker.Owner == Harkonnen then
|
||||
ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
|
||||
end
|
||||
|
||||
if unit.Owner == smuggler_ordos and attacker.Owner == player then
|
||||
ChangeOwner(smuggler_ordos, smuggler_both)
|
||||
if unit.Owner == SmugglerOrdos and attacker.Owner == Harkonnen then
|
||||
ChangeOwner(SmugglerOrdos, SmugglerBoth)
|
||||
end
|
||||
|
||||
if unit.Owner == smuggler_neutral and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then
|
||||
ChangeOwner(smuggler_neutral, smuggler_ordos)
|
||||
if unit.Owner == SmugglerNeutral and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then
|
||||
ChangeOwner(SmugglerNeutral, SmugglerOrdos)
|
||||
end
|
||||
|
||||
if unit.Owner == smuggler_harkonnen and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then
|
||||
ChangeOwner(smuggler_harkonnen, smuggler_both)
|
||||
if unit.Owner == SmugglerHarkonnen and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then
|
||||
ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
|
||||
end
|
||||
|
||||
if attacker.Owner == player and not message_check then
|
||||
if attacker.Owner == Harkonnen and not MessageCheck then
|
||||
|
||||
message_check = true
|
||||
MessageCheck = true
|
||||
Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat)
|
||||
end
|
||||
end)
|
||||
@@ -156,61 +156,61 @@ CheckSmugglerEnemies = function()
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
ordos_main.MarkCompletedObjective(KillHarkonnen1)
|
||||
ordos_small.MarkCompletedObjective(KillHarkonnen2)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
OrdosMain.MarkCompletedObjective(KillHarkonnen1)
|
||||
OrdosSmall.MarkCompletedObjective(KillHarkonnen2)
|
||||
end
|
||||
|
||||
if ordos_main.HasNoRequiredUnits() and ordos_small.HasNoRequiredUnits() and not OrdosKilled then
|
||||
if OrdosMain.HasNoRequiredUnits() and OrdosSmall.HasNoRequiredUnits() and not OrdosKilled then
|
||||
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
|
||||
OrdosKilled = true
|
||||
end
|
||||
|
||||
if smuggler_neutral.HasNoRequiredUnits() and smuggler_harkonnen.HasNoRequiredUnits() and smuggler_ordos.HasNoRequiredUnits() and smuggler_both.HasNoRequiredUnits() and not SmugglersKilled then
|
||||
if SmugglerNeutral.HasNoRequiredUnits() and SmugglerHarkonnen.HasNoRequiredUnits() and SmugglerOrdos.HasNoRequiredUnits() and SmugglerBoth.HasNoRequiredUnits() and not SmugglersKilled then
|
||||
Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat)
|
||||
SmugglersKilled = true
|
||||
end
|
||||
|
||||
if (OStarport.IsDead or OStarport.Owner == player) and not player.IsObjectiveCompleted(DestroyStarport) then
|
||||
player.MarkCompletedObjective(DestroyStarport)
|
||||
if (OStarport.IsDead or OStarport.Owner == Harkonnen) and not Harkonnen.IsObjectiveCompleted(DestroyStarport) then
|
||||
Harkonnen.MarkCompletedObjective(DestroyStarport)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then
|
||||
local units = ordos_main.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then
|
||||
local units = OrdosMain.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos_main] = false
|
||||
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[OrdosMain] = false
|
||||
ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then
|
||||
local units = ordos_small.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then
|
||||
local units = OrdosSmall.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos_small] = false
|
||||
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[OrdosSmall] = false
|
||||
ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
ordos_main = Player.GetPlayer("Ordos Main Base")
|
||||
ordos_small = Player.GetPlayer("Ordos Small Base")
|
||||
smuggler_neutral = Player.GetPlayer("Smugglers - Neutral")
|
||||
smuggler_harkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
|
||||
smuggler_ordos = Player.GetPlayer("Smugglers - Enemy to Ordos")
|
||||
smuggler_both = Player.GetPlayer("Smugglers - Enemy to Both")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
OrdosMain = Player.GetPlayer("Ordos Main Base")
|
||||
OrdosSmall = Player.GetPlayer("Ordos Small Base")
|
||||
SmugglerNeutral = Player.GetPlayer("Smugglers - Neutral")
|
||||
SmugglerHarkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
|
||||
SmugglerOrdos = Player.GetPlayer("Smugglers - Enemy to Ordos")
|
||||
SmugglerBoth = Player.GetPlayer("Smugglers - Enemy to Both")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
DestroyStarport = AddPrimaryObjective(player, "capture-destroy-ordos-starport")
|
||||
KillHarkonnen1 = AddPrimaryObjective(ordos_main, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(ordos_small, "")
|
||||
InitObjectives(Harkonnen)
|
||||
DestroyStarport = AddPrimaryObjective(Harkonnen, "capture-destroy-ordos-starport")
|
||||
KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "")
|
||||
|
||||
-- Wait for carryall drop
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
SmugglerUnits = smuggler_neutral.GetActors()
|
||||
SmugglerUnits = SmugglerNeutral.GetActors()
|
||||
CheckSmugglerEnemies()
|
||||
end)
|
||||
|
||||
@@ -218,11 +218,11 @@ WorldLoaded = function()
|
||||
OrdosAttackLocation = HConYard.Location
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(OrdosMainBase, function()
|
||||
Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function()
|
||||
Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(OrdosPaths) end
|
||||
@@ -231,14 +231,14 @@ WorldLoaded = function()
|
||||
unit.AttackMove(OrdosAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end
|
||||
SendCarryallReinforcements(ordos_main, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
SendCarryallReinforcements(OrdosMain, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
|
||||
SendStarportReinforcements()
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = ordos_main })
|
||||
Actor.Create("upgrade.light", true, { Owner = ordos_main })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = ordos_main })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = ordos_small })
|
||||
Actor.Create("upgrade.light", true, { Owner = ordos_small })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = OrdosMain })
|
||||
Actor.Create("upgrade.light", true, { Owner = OrdosMain })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = OrdosMain })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall })
|
||||
Actor.Create("upgrade.light", true, { Owner = OrdosSmall })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
end
|
||||
|
||||
@@ -37,13 +37,13 @@ AtreidesStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "
|
||||
CorrinoInfantryTypes = { "light_inf", "trooper", "sardaukar" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[atreides_main] = Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[Difficulty][2], InitialAtreidesPaths[2])
|
||||
IdlingUnits[atreides_small] = Reinforcements.Reinforce(atreides_small, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[3])
|
||||
IdlingUnits[corrino] = Reinforcements.Reinforce(corrino, InitialCorrinoReinforcements, InitialCorrinoPath)
|
||||
IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[Difficulty][2], InitialAtreidesPaths[2])
|
||||
IdlingUnits[AtreidesSmall] = Reinforcements.Reinforce(AtreidesSmall, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[3])
|
||||
IdlingUnits[Corrino] = Reinforcements.Reinforce(Corrino, InitialCorrinoReinforcements, InitialCorrinoPath)
|
||||
|
||||
DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(atreides_small, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(AtreidesSmall, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(Corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuildAtreides = function() return { Utils.Random(AtreidesInfantryTypes) } end
|
||||
@@ -55,13 +55,13 @@ ActivateAI = function()
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
Trigger.AfterDelay(InitialProductionDelay[Difficulty], function()
|
||||
ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_main, AStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, AStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(atreides_small, ABarracks, delay, infantryToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_small, AHeavyFactory2, delay, tanksToBuildSmall, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesSmall, ABarracks, delay, infantryToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesSmall, AHeavyFactory2, delay, tanksToBuildSmall, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(corrino, CBarracks, delay, infantryToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Corrino, CBarracks, delay, infantryToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -124,9 +124,9 @@ HarkonnenPaths =
|
||||
}
|
||||
|
||||
SendHarkonnenReinforcements = function(number)
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements[Difficulty][number], HarkonnenPaths[number], { HarkonnenPaths[number][1] })
|
||||
Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[Difficulty][number], HarkonnenPaths[number], { HarkonnenPaths[number][1] })
|
||||
Trigger.AfterDelay(DateTime.Seconds(9), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -152,7 +152,7 @@ SendAirStrike = function()
|
||||
return
|
||||
end
|
||||
|
||||
local targets = Utils.Where(player.GetActors(), function(actor)
|
||||
local targets = Utils.Where(Harkonnen.GetActors(), function(actor)
|
||||
return
|
||||
actor.HasProperty("Sell") and
|
||||
actor.Type ~= "wall" and
|
||||
@@ -170,63 +170,63 @@ SendAirStrike = function()
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
atreides_main.MarkCompletedObjective(KillHarkonnen1)
|
||||
atreides_small.MarkCompletedObjective(KillHarkonnen2)
|
||||
corrino.MarkCompletedObjective(KillHarkonnen3)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
AtreidesMain.MarkCompletedObjective(KillHarkonnen1)
|
||||
AtreidesSmall.MarkCompletedObjective(KillHarkonnen2)
|
||||
Corrino.MarkCompletedObjective(KillHarkonnen3)
|
||||
end
|
||||
|
||||
if atreides_main.HasNoRequiredUnits() and atreides_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then
|
||||
if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if corrino.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then
|
||||
if Corrino.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then
|
||||
Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillCorrino)
|
||||
Harkonnen.MarkCompletedObjective(KillCorrino)
|
||||
end
|
||||
|
||||
if (HEngineer.IsDead or AConYard2.IsDead) and not player.IsObjectiveCompleted(CaptureAtreidesConYard) then
|
||||
player.MarkFailedObjective(CaptureAtreidesConYard)
|
||||
if (HEngineer.IsDead or AConYard2.IsDead) and not Harkonnen.IsObjectiveCompleted(CaptureAtreidesConYard) then
|
||||
Harkonnen.MarkFailedObjective(CaptureAtreidesConYard)
|
||||
end
|
||||
|
||||
if (AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_main) and not HiTechIsDead then
|
||||
if (AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesMain) and not HiTechIsDead then
|
||||
Media.DisplayMessage(UserInterface.Translate("high-tech-factory-neutralized-imperial-reinforcements"), Mentat)
|
||||
HiTechIsDead = true
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then
|
||||
local units = ordos_main.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then
|
||||
local units = OrdosMain.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos_main] = false
|
||||
ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[OrdosMain] = false
|
||||
ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then
|
||||
local units = ordos_small.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then
|
||||
local units = OrdosSmall.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos_small] = false
|
||||
ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[OrdosSmall] = false
|
||||
ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides_main = Player.GetPlayer("Atreides Main Base")
|
||||
atreides_small = Player.GetPlayer("Atreides Small Base")
|
||||
corrino = Player.GetPlayer("Corrino")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
AtreidesMain = Player.GetPlayer("Atreides Main Base")
|
||||
AtreidesSmall = Player.GetPlayer("Atreides Small Base")
|
||||
Corrino = Player.GetPlayer("Corrino")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
CaptureAtreidesConYard = AddPrimaryObjective(player, "capture-atreides-construction-yard-south")
|
||||
KillAtreides = AddPrimaryObjective(player, "destroy-atreides")
|
||||
KillCorrino = AddPrimaryObjective(player, "destroy-corrino")
|
||||
KillHarkonnen1 = AddPrimaryObjective(atreides_main, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(atreides_small, "")
|
||||
KillHarkonnen3 = AddPrimaryObjective(corrino, "")
|
||||
InitObjectives(Harkonnen)
|
||||
CaptureAtreidesConYard = AddPrimaryObjective(Harkonnen, "capture-atreides-construction-yard-south")
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides")
|
||||
KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-corrino")
|
||||
KillHarkonnen1 = AddPrimaryObjective(AtreidesMain, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(AtreidesSmall, "")
|
||||
KillHarkonnen3 = AddPrimaryObjective(Corrino, "")
|
||||
|
||||
Media.DisplayMessage(UserInterface.Translate("destroy-atreides-high-tech-factory-imperial-reinforcements"), Mentat)
|
||||
|
||||
@@ -236,39 +236,39 @@ WorldLoaded = function()
|
||||
Trigger.AfterDelay(DateTime.Minutes(5), SendAirStrike)
|
||||
|
||||
Trigger.OnCapture(AConYard2, function()
|
||||
player.MarkCompletedObjective(CaptureAtreidesConYard)
|
||||
Harkonnen.MarkCompletedObjective(CaptureAtreidesConYard)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function()
|
||||
Utils.Do(atreides_main.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(AtreidesMain.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(AtreidesSmallBase, function()
|
||||
Utils.Do(atreides_small.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(AtreidesSmall.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(CorrinoBase, function()
|
||||
Utils.Do(corrino.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Corrino.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local atreidesWaveCondition = function() return player.IsObjectiveCompleted(KillAtreides) or HiTechIsDead end
|
||||
local corrinoWaveCondition = function() return player.IsObjectiveCompleted(KillCorrino) or HiTechIsDead end
|
||||
local atreidesWaveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) or HiTechIsDead end
|
||||
local corrinoWaveCondition = function() return Harkonnen.IsObjectiveCompleted(KillCorrino) or HiTechIsDead end
|
||||
local huntFunction = function(unit)
|
||||
unit.AttackMove(AtreidesAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end
|
||||
SendEnemyReinforcements(atreides_main, EnemyAttackDelay[Difficulty], AtreidesPath, AtreidesReinforcements[Difficulty], atreidesWaveCondition, huntFunction)
|
||||
SendEnemyReinforcements(AtreidesMain, EnemyAttackDelay[Difficulty], AtreidesPath, AtreidesReinforcements[Difficulty], atreidesWaveCondition, huntFunction)
|
||||
Trigger.AfterDelay(CorrinoInitialAttackDelay[Difficulty], function()
|
||||
SendEnemyReinforcements(corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[1], CorrinoReinforcements[Difficulty][1], corrinoWaveCondition, huntFunction)
|
||||
SendEnemyReinforcements(corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[2], CorrinoReinforcements[Difficulty][2], corrinoWaveCondition, huntFunction)
|
||||
SendEnemyReinforcements(Corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[1], CorrinoReinforcements[Difficulty][1], corrinoWaveCondition, huntFunction)
|
||||
SendEnemyReinforcements(Corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[2], CorrinoReinforcements[Difficulty][2], corrinoWaveCondition, huntFunction)
|
||||
end)
|
||||
|
||||
Actor.Create("upgrade.light", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.hightech", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides_small })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = atreides_small })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = corrino })
|
||||
Actor.Create("upgrade.light", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.hightech", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = AtreidesSmall })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = Corrino })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
SendHarkonnenReinforcements(1)
|
||||
|
||||
@@ -34,15 +34,15 @@ AtreidesStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "
|
||||
MercenaryTankTypes = { "combat_tank_o", "combat_tank_o", "siege_tank" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[ordos] = Reinforcements.Reinforce(ordos, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
|
||||
IdlingUnits[atreides_enemy] = Reinforcements.Reinforce(atreides_enemy, InitialAtreidesReinforcements, InitialAtreidesPath)
|
||||
IdlingUnits[atreides_neutral] = { }
|
||||
IdlingUnits[mercenary_enemy] = Reinforcements.Reinforce(mercenary_enemy, InitialMercenaryReinforcements, InitialMercenaryPath)
|
||||
IdlingUnits[mercenary_ally] = { }
|
||||
IdlingUnits[Ordos] = Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements[2], InitialOrdosPaths[2])
|
||||
IdlingUnits[AtreidesEnemy] = Reinforcements.Reinforce(AtreidesEnemy, InitialAtreidesReinforcements, InitialAtreidesPath)
|
||||
IdlingUnits[AtreidesNeutral] = { }
|
||||
IdlingUnits[MercenaryEnemy] = Reinforcements.Reinforce(MercenaryEnemy, InitialMercenaryReinforcements, InitialMercenaryPath)
|
||||
IdlingUnits[MercenaryAlly] = { }
|
||||
|
||||
DefendAndRepairBase(ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(atreides_enemy, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(mercenary_enemy, MercenaryBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(Ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(AtreidesEnemy, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(MercenaryEnemy, MercenaryBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
|
||||
@@ -55,15 +55,15 @@ ActivateAI = function()
|
||||
local unitsToBuyAtreides = function() return { Utils.Random(AtreidesStarportTypes) } end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(ordos, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos, OLightFactory, delay, vehilcesToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos, OHeavyFactory, delay, tanksToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(ordos, OStarport, delay, unitsToBuyOrdos, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Ordos, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Ordos, OLightFactory, delay, vehilcesToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Ordos, OHeavyFactory, delay, tanksToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Ordos, OStarport, delay, unitsToBuyOrdos, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(atreides_enemy, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_enemy, ALightFactory, delay, vehilcesToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_enemy, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_enemy, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesEnemy, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesEnemy, ALightFactory, delay, vehilcesToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesEnemy, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesEnemy, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(mercenary_enemy, MHeavyFactory, delay, tanksToBuildMercenary, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(MercenaryEnemy, MHeavyFactory, delay, tanksToBuildMercenary, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -105,7 +105,7 @@ SendStarportReinforcements = function(faction)
|
||||
return
|
||||
end
|
||||
|
||||
reinforcements = Utils.Random(MercenaryStarportReinforcements)
|
||||
local reinforcements = Utils.Random(MercenaryStarportReinforcements)
|
||||
|
||||
local units = Reinforcements.ReinforceWithTransport(faction, "frigate", reinforcements, { MercenaryStarportEntry.Location, MStarport.Location + CVec.New(1, 1) }, { MercenaryStarportExit.Location })[2]
|
||||
Utils.Do(units, function(unit)
|
||||
@@ -118,11 +118,11 @@ SendStarportReinforcements = function(faction)
|
||||
end
|
||||
|
||||
SendAirStrike = function()
|
||||
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_enemy then
|
||||
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesEnemy then
|
||||
return
|
||||
end
|
||||
|
||||
local targets = Utils.Where(player.GetActors(), function(actor)
|
||||
local targets = Utils.Where(Harkonnen.GetActors(), function(actor)
|
||||
return
|
||||
actor.HasProperty("Sell") and
|
||||
actor.Type ~= "wall" and
|
||||
@@ -151,13 +151,13 @@ GetSaboteurTargets = function(player)
|
||||
end
|
||||
|
||||
BuildSaboteur = function()
|
||||
if OPalace.IsDead or OPalace.Owner ~= ordos then
|
||||
if OPalace.IsDead or OPalace.Owner ~= Ordos then
|
||||
return
|
||||
end
|
||||
|
||||
local targets = GetSaboteurTargets(player)
|
||||
local targets = GetSaboteurTargets(Harkonnen)
|
||||
if #targets > 0 then
|
||||
local saboteur = Actor.Create("saboteur", true, { Owner = ordos, Location = OPalace.Location + CVec.New(0, 2) })
|
||||
local saboteur = Actor.Create("saboteur", true, { Owner = Ordos, Location = OPalace.Location + CVec.New(0, 2) })
|
||||
saboteur.Move(saboteur.Location + CVec.New(0, 1))
|
||||
saboteur.Wait(DateTime.Seconds(5))
|
||||
|
||||
@@ -173,7 +173,7 @@ BuildSaboteur = function()
|
||||
end
|
||||
|
||||
SendSaboteur = function(saboteur)
|
||||
local targets = GetSaboteurTargets(player)
|
||||
local targets = GetSaboteurTargets(Harkonnen)
|
||||
if #targets < 1 then
|
||||
return
|
||||
end
|
||||
@@ -188,19 +188,19 @@ SendSaboteur = function(saboteur)
|
||||
end
|
||||
|
||||
CheckAttackToAtreides = function()
|
||||
AtreidesUnits = atreides_neutral.GetActors()
|
||||
AtreidesUnits = AtreidesNeutral.GetActors()
|
||||
|
||||
Utils.Do(AtreidesUnits, function(unit)
|
||||
Trigger.OnDamaged(unit, function(self, attacker)
|
||||
if attacker.Owner == player and not check then
|
||||
ChangeOwner(atreides_neutral, atreides_enemy)
|
||||
if attacker.Owner == Harkonnen and not Check then
|
||||
ChangeOwner(AtreidesNeutral, AtreidesEnemy)
|
||||
|
||||
-- Ensure that harvesters that was on a carryall switched sides.
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
ChangeOwner(atreides_neutral, atreides_enemy)
|
||||
ChangeOwner(AtreidesNeutral, AtreidesEnemy)
|
||||
end)
|
||||
|
||||
check = true
|
||||
Check = true
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-hostile"), Mentat)
|
||||
end
|
||||
end)
|
||||
@@ -217,59 +217,59 @@ ChangeOwner = function(old_owner, new_owner)
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
ordos.MarkCompletedObjective(KillHarkonnen1)
|
||||
atreides_enemy.MarkCompletedObjective(KillHarkonnen2)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
Ordos.MarkCompletedObjective(KillHarkonnen1)
|
||||
AtreidesEnemy.MarkCompletedObjective(KillHarkonnen2)
|
||||
end
|
||||
|
||||
if ordos.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then
|
||||
if Ordos.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillOrdos) then
|
||||
Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillOrdos)
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
end
|
||||
|
||||
if atreides_enemy.HasNoRequiredUnits() and atreides_neutral.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then
|
||||
if AtreidesEnemy.HasNoRequiredUnits() and AtreidesNeutral.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if mercenary_enemy.HasNoRequiredUnits() and mercenary_ally.HasNoRequiredUnits() and not MercenariesDestroyed then
|
||||
if MercenaryEnemy.HasNoRequiredUnits() and MercenaryAlly.HasNoRequiredUnits() and not MercenariesDestroyed then
|
||||
Media.DisplayMessage(UserInterface.Translate("mercenaries-annihilated"), Mentat)
|
||||
MercenariesDestroyed = true
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos] then
|
||||
local units = ordos.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Ordos] then
|
||||
local units = Ordos.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[ordos] = false
|
||||
ProtectHarvester(units[1], ordos, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[Ordos] = false
|
||||
ProtectHarvester(units[1], Ordos, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_enemy] then
|
||||
local units = atreides_enemy.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesEnemy] then
|
||||
local units = AtreidesEnemy.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[atreides_enemy] = false
|
||||
ProtectHarvester(units[1], atreides_enemy, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[AtreidesEnemy] = false
|
||||
ProtectHarvester(units[1], AtreidesEnemy, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
ordos = Player.GetPlayer("Ordos")
|
||||
atreides_enemy = Player.GetPlayer("Ordos Aligned Atreides")
|
||||
atreides_neutral = Player.GetPlayer("Neutral Atreides")
|
||||
mercenary_enemy = Player.GetPlayer("Ordos Aligned Mercenaries")
|
||||
mercenary_ally = Player.GetPlayer("Harkonnen Aligned Mercenaries")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
AtreidesEnemy = Player.GetPlayer("Ordos Aligned Atreides")
|
||||
AtreidesNeutral = Player.GetPlayer("Neutral Atreides")
|
||||
MercenaryEnemy = Player.GetPlayer("Ordos Aligned Mercenaries")
|
||||
MercenaryAlly = Player.GetPlayer("Harkonnen Aligned Mercenaries")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
KillOrdos = AddPrimaryObjective(player, "destroy-ordos")
|
||||
KillAtreides = AddSecondaryObjective(player, "destroy-atreides")
|
||||
AllyWithMercenaries = AddSecondaryObjective(player, "ally-mercenaries")
|
||||
KillHarkonnen1 = AddPrimaryObjective(ordos, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(atreides_enemy, "")
|
||||
InitObjectives(Harkonnen)
|
||||
KillOrdos = AddPrimaryObjective(Harkonnen, "destroy-ordos")
|
||||
KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides")
|
||||
AllyWithMercenaries = AddSecondaryObjective(Harkonnen, "ally-mercenaries")
|
||||
KillHarkonnen1 = AddPrimaryObjective(Ordos, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(AtreidesEnemy, "")
|
||||
|
||||
Camera.Position = HMCV.CenterPosition
|
||||
OrdosAttackLocation = HMCV.Location
|
||||
@@ -279,66 +279,66 @@ WorldLoaded = function()
|
||||
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(30), BuildSaboteur)
|
||||
|
||||
Trigger.OnCapture(MHeavyFactory, function()
|
||||
player.MarkCompletedObjective(AllyWithMercenaries)
|
||||
Harkonnen.MarkCompletedObjective(AllyWithMercenaries)
|
||||
Media.DisplayMessage(UserInterface.Translate("mercenary-leader-captured-allied"), Mentat)
|
||||
MercenaryAttackLocation = MercenaryAttackPoint.Location
|
||||
|
||||
ChangeOwner(mercenary_enemy, mercenary_ally)
|
||||
SendStarportReinforcements(mercenary_ally)
|
||||
DefendAndRepairBase(mercenary_ally, MercenaryBase, 0.75, AttackGroupSize[Difficulty])
|
||||
IdlingUnits[mercenary_ally] = IdlingUnits[mercenary_enemy]
|
||||
ChangeOwner(MercenaryEnemy, MercenaryAlly)
|
||||
SendStarportReinforcements(MercenaryAlly)
|
||||
DefendAndRepairBase(MercenaryAlly, MercenaryBase, 0.75, AttackGroupSize[Difficulty])
|
||||
IdlingUnits[MercenaryAlly] = IdlingUnits[MercenaryEnemy]
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(MHeavyFactory, function()
|
||||
if not player.IsObjectiveCompleted(AllyWithMercenaries) then
|
||||
player.MarkFailedObjective(AllyWithMercenaries)
|
||||
if not Harkonnen.IsObjectiveCompleted(AllyWithMercenaries) then
|
||||
Harkonnen.MarkFailedObjective(AllyWithMercenaries)
|
||||
end
|
||||
end)
|
||||
|
||||
Trigger.OnKilledOrCaptured(OPalace, function()
|
||||
Media.DisplayMessage(UserInterface.Translate("can-not-stand-harkonnen-must-become-neutral"), UserInterface.Translate("atreides-commander"))
|
||||
|
||||
ChangeOwner(atreides_enemy, atreides_neutral)
|
||||
DefendAndRepairBase(atreides_neutral, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
IdlingUnits[atreides_neutral] = IdlingUnits[atreides_enemy]
|
||||
ChangeOwner(AtreidesEnemy, AtreidesNeutral)
|
||||
DefendAndRepairBase(AtreidesNeutral, AtreidesBase, 0.75, AttackGroupSize[Difficulty])
|
||||
IdlingUnits[AtreidesNeutral] = IdlingUnits[AtreidesEnemy]
|
||||
|
||||
-- Ensure that harvesters that was on a carryall switched sides.
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
ChangeOwner(atreides_enemy, atreides_neutral)
|
||||
ChangeOwner(AtreidesEnemy, AtreidesNeutral)
|
||||
CheckAttackToAtreides()
|
||||
end)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(OrdosBase, function()
|
||||
Utils.Do(ordos.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Ordos.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(AtreidesBase, function()
|
||||
Utils.Do(atreides_enemy.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(AtreidesEnemy.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(MercenaryBase, function()
|
||||
Utils.Do(mercenary_enemy.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(mercenary_ally.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(MercenaryEnemy.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(MercenaryAlly.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(OrdosPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end
|
||||
local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillOrdos) end
|
||||
local huntFunction = function(unit)
|
||||
unit.AttackMove(OrdosAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end
|
||||
SendCarryallReinforcements(ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
SendCarryallReinforcements(Ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
|
||||
SendStarportReinforcements(mercenary_enemy)
|
||||
SendStarportReinforcements(MercenaryEnemy)
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = ordos })
|
||||
Actor.Create("upgrade.light", true, { Owner = ordos })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = ordos })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides_enemy })
|
||||
Actor.Create("upgrade.light", true, { Owner = atreides_enemy })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = atreides_enemy })
|
||||
Actor.Create("upgrade.hightech", true, { Owner = atreides_enemy })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = mercenary_enemy })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = Ordos })
|
||||
Actor.Create("upgrade.light", true, { Owner = Ordos })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = Ordos })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = AtreidesEnemy })
|
||||
Actor.Create("upgrade.light", true, { Owner = AtreidesEnemy })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = AtreidesEnemy })
|
||||
Actor.Create("upgrade.hightech", true, { Owner = AtreidesEnemy })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = MercenaryEnemy })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
end
|
||||
|
||||
@@ -34,17 +34,17 @@ CorrinoSmallTankTypes = { "combat_tank_h", "combat_tank_h", "siege_tank" }
|
||||
CorrinoStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_h.starport", "combat_tank_h.starport", "siege_tank.starport", "missile_tank.starport" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[atreides_main] = Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3])
|
||||
IdlingUnits[atreides_small_1] = Reinforcements.Reinforce(atreides_small_1, InitialAtreidesReinforcements[4], InitialAtreidesPaths[4]), Reinforcements.Reinforce(atreides_small_1, InitialAtreidesReinforcements[5], InitialAtreidesPaths[5])
|
||||
IdlingUnits[atreides_small_2] = Reinforcements.Reinforce(atreides_small_2, InitialAtreidesReinforcements[6], InitialAtreidesPaths[6])
|
||||
IdlingUnits[corrino_main] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements, InitialCorrinoPaths[1])
|
||||
IdlingUnits[corrino_small] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements, InitialCorrinoPaths[2])
|
||||
IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3])
|
||||
IdlingUnits[AtreidesSmall1] = Reinforcements.Reinforce(AtreidesSmall1, InitialAtreidesReinforcements[4], InitialAtreidesPaths[4]), Reinforcements.Reinforce(AtreidesSmall1, InitialAtreidesReinforcements[5], InitialAtreidesPaths[5])
|
||||
IdlingUnits[AtreidesSmall2] = Reinforcements.Reinforce(AtreidesSmall2, InitialAtreidesReinforcements[6], InitialAtreidesPaths[6])
|
||||
IdlingUnits[CorrinoMain] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements, InitialCorrinoPaths[1])
|
||||
IdlingUnits[CorrinoSmall] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements, InitialCorrinoPaths[2])
|
||||
|
||||
DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(atreides_small_1, AtreidesSmall1Base, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(atreides_small_2, AtreidesSmall2Base, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(corrino_main, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(corrino_small, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(AtreidesSmall1, AtreidesSmall1Base, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(AtreidesSmall2, AtreidesSmall2Base, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(CorrinoMain, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(CorrinoSmall, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
|
||||
@@ -58,23 +58,23 @@ ActivateAI = function()
|
||||
local unitsToBuyCorrino = function() return { Utils.Random(CorrinoStarportTypes) } end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_main, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(atreides_small_1, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_small_1, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_small_1, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesSmall1, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesSmall1, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesSmall1, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(atreides_small_2, ABarracks4, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesSmall2, ABarracks4, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(corrino_main, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(corrino_main, CLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(corrino_main, CHeavyFactory1, delay, tanksToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(corrino_main, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoMain, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoMain, CLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoMain, CHeavyFactory1, delay, tanksToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoMain, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(corrino_small, CBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(corrino_small, CLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(corrino_small, CHeavyFactory2, delay, tanksToBuildCorrinoSmall, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoSmall, CBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoSmall, CLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoSmall, CHeavyFactory2, delay, tanksToBuildCorrinoSmall, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -137,13 +137,13 @@ HarkonnenPath = { HarkonnenEntry.Location, HarkonnenRally.Location }
|
||||
|
||||
SendStarportReinforcements = function()
|
||||
Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function()
|
||||
if CStarport.IsDead or CStarport.Owner ~= corrino_main then
|
||||
if CStarport.IsDead or CStarport.Owner ~= CorrinoMain then
|
||||
return
|
||||
end
|
||||
|
||||
reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty])
|
||||
local reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty])
|
||||
|
||||
local units = Reinforcements.ReinforceWithTransport(corrino_main, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2]
|
||||
local units = Reinforcements.ReinforceWithTransport(CorrinoMain, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2]
|
||||
Utils.Do(units, function(unit)
|
||||
unit.AttackMove(AtreidesAttackLocation)
|
||||
IdleHunt(unit)
|
||||
@@ -155,19 +155,19 @@ end
|
||||
|
||||
SendHarkonnenReinforcements = function(delay)
|
||||
Trigger.AfterDelay(delay, function()
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
|
||||
Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
|
||||
Trigger.AfterDelay(DateTime.Seconds(5), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
SendAirStrike = function()
|
||||
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_main then
|
||||
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesMain then
|
||||
return
|
||||
end
|
||||
|
||||
local targets = Utils.Where(player.GetActors(), function(actor)
|
||||
local targets = Utils.Where(Harkonnen.GetActors(), function(actor)
|
||||
return
|
||||
actor.HasProperty("Sell") and
|
||||
actor.Type ~= "wall" and
|
||||
@@ -185,7 +185,7 @@ SendAirStrike = function()
|
||||
end
|
||||
|
||||
BuildFremen = function()
|
||||
if APalace.IsDead or APalace.Owner ~= atreides_main then
|
||||
if APalace.IsDead or APalace.Owner ~= AtreidesMain then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -193,7 +193,7 @@ BuildFremen = function()
|
||||
APalace.Produce("fremen")
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(5), function()
|
||||
IdleFremen = Utils.Where(atreides_main.GetActorsByType('fremen'), function(actor) return actor.IsIdle end)
|
||||
IdleFremen = Utils.Where(AtreidesMain.GetActorsByType('fremen'), function(actor) return actor.IsIdle end)
|
||||
|
||||
if #IdleFremen >= FremenGroupSize[Difficulty] then
|
||||
SendFremen()
|
||||
@@ -211,77 +211,77 @@ SendFremen = function()
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
atreides_main.MarkCompletedObjective(KillHarkonnen1)
|
||||
atreides_small_1.MarkCompletedObjective(KillHarkonnen2)
|
||||
atreides_small_2.MarkCompletedObjective(KillHarkonnen3)
|
||||
corrino_main.MarkCompletedObjective(KillHarkonnen4)
|
||||
corrino_small.MarkCompletedObjective(KillHarkonnen5)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
AtreidesMain.MarkCompletedObjective(KillHarkonnen1)
|
||||
AtreidesSmall1.MarkCompletedObjective(KillHarkonnen2)
|
||||
AtreidesSmall2.MarkCompletedObjective(KillHarkonnen3)
|
||||
CorrinoMain.MarkCompletedObjective(KillHarkonnen4)
|
||||
CorrinoSmall.MarkCompletedObjective(KillHarkonnen5)
|
||||
end
|
||||
|
||||
if atreides_main.HasNoRequiredUnits() and atreides_small_1.HasNoRequiredUnits() and atreides_small_2.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then
|
||||
if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall1.HasNoRequiredUnits() and AtreidesSmall2.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if corrino_main.HasNoRequiredUnits() and corrino_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then
|
||||
if CorrinoMain.HasNoRequiredUnits() and CorrinoSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then
|
||||
Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillCorrino)
|
||||
Harkonnen.MarkCompletedObjective(KillCorrino)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_main] then
|
||||
local units = atreides_main.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesMain] then
|
||||
local units = AtreidesMain.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[atreides_main] = false
|
||||
ProtectHarvester(units[1], atreides_main, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[AtreidesMain] = false
|
||||
ProtectHarvester(units[1], AtreidesMain, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_small_1] then
|
||||
local units = atreides_small_1.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesSmall1] then
|
||||
local units = AtreidesSmall1.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[atreides_small_1] = false
|
||||
ProtectHarvester(units[1], atreides_small_1, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[AtreidesSmall1] = false
|
||||
ProtectHarvester(units[1], AtreidesSmall1, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_main] then
|
||||
local units = corrino_main.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoMain] then
|
||||
local units = CorrinoMain.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[corrino_main] = false
|
||||
ProtectHarvester(units[1], corrino_main, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[CorrinoMain] = false
|
||||
ProtectHarvester(units[1], CorrinoMain, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_small] then
|
||||
local units = corrino_small.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoSmall] then
|
||||
local units = CorrinoSmall.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[corrino_small] = false
|
||||
ProtectHarvester(units[1], corrino_small, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[CorrinoSmall] = false
|
||||
ProtectHarvester(units[1], CorrinoSmall, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides_main = Player.GetPlayer("Atreides Main Base")
|
||||
atreides_small_1 = Player.GetPlayer("Atreides Small Base 1")
|
||||
atreides_small_2 = Player.GetPlayer("Atreides Small Base 2")
|
||||
corrino_main = Player.GetPlayer("Corrino Main Base")
|
||||
corrino_small = Player.GetPlayer("Corrino Small Base")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
AtreidesMain = Player.GetPlayer("Atreides Main Base")
|
||||
AtreidesSmall1 = Player.GetPlayer("Atreides Small Base 1")
|
||||
AtreidesSmall2 = Player.GetPlayer("Atreides Small Base 2")
|
||||
CorrinoMain = Player.GetPlayer("Corrino Main Base")
|
||||
CorrinoSmall = Player.GetPlayer("Corrino Small Base")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
KillAtreides = AddPrimaryObjective(player, "destroy-atreides")
|
||||
KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces")
|
||||
KillHarkonnen1 = AddPrimaryObjective(atreides_main, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(atreides_small_1, "")
|
||||
KillHarkonnen3 = AddPrimaryObjective(atreides_small_2, "")
|
||||
KillHarkonnen4 = AddPrimaryObjective(corrino_main, "")
|
||||
KillHarkonnen5 = AddPrimaryObjective(corrino_small, "")
|
||||
InitObjectives(Harkonnen)
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides")
|
||||
KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces")
|
||||
KillHarkonnen1 = AddPrimaryObjective(AtreidesMain, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(AtreidesSmall1, "")
|
||||
KillHarkonnen3 = AddPrimaryObjective(AtreidesSmall2, "")
|
||||
KillHarkonnen4 = AddPrimaryObjective(CorrinoMain, "")
|
||||
KillHarkonnen5 = AddPrimaryObjective(CorrinoSmall, "")
|
||||
|
||||
Camera.Position = HMCV.CenterPosition
|
||||
AtreidesAttackLocation = HarkonnenRally.Location
|
||||
@@ -290,49 +290,49 @@ WorldLoaded = function()
|
||||
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds (30), BuildFremen)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function()
|
||||
Utils.Do(atreides_main.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(AtreidesMain.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(AtreidesSmall1Base, function()
|
||||
Utils.Do(atreides_small_1.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(AtreidesSmall1.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(AtreidesSmall2Base, function()
|
||||
Utils.Do(atreides_small_2.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(AtreidesSmall2.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(CorrinoMainBase, function()
|
||||
Utils.Do(corrino_main.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(CorrinoMain.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(CorrinoSmallBase, function()
|
||||
Utils.Do(corrino_small.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(CorrinoSmall.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(AtreidesPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end
|
||||
local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
|
||||
local huntFunction = function(unit)
|
||||
unit.AttackMove(AtreidesAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end
|
||||
SendCarryallReinforcements(atreides_main, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
SendCarryallReinforcements(AtreidesMain, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
|
||||
SendStarportReinforcements()
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.light", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.hightech", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_1 })
|
||||
Actor.Create("upgrade.light", true, { Owner = atreides_small_1 })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = atreides_small_1 })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_2 })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = corrino_main })
|
||||
Actor.Create("upgrade.light", true, { Owner = corrino_main })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = corrino_main })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = corrino_small })
|
||||
Actor.Create("upgrade.light", true, { Owner = corrino_small })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = corrino_small })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.light", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.hightech", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall1 })
|
||||
Actor.Create("upgrade.light", true, { Owner = AtreidesSmall1 })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = AtreidesSmall1 })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall2 })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = CorrinoMain })
|
||||
Actor.Create("upgrade.light", true, { Owner = CorrinoMain })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = CorrinoMain })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = CorrinoSmall })
|
||||
Actor.Create("upgrade.light", true, { Owner = CorrinoSmall })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = CorrinoSmall })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
SendHarkonnenReinforcements(DateTime.Minutes(2) + DateTime.Seconds(30))
|
||||
|
||||
@@ -33,15 +33,15 @@ CorrinoTankTypes = { "combat_tank_h", "combat_tank_h", "siege_tank", "missile_ta
|
||||
CorrinoStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_h.starport", "combat_tank_h.starport", "siege_tank.starport", "missile_tank.starport" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[atreides_main] = Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2])
|
||||
IdlingUnits[atreides_small] = Reinforcements.Reinforce(atreides_small, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3])
|
||||
IdlingUnits[corrino_main] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[1], InitialCorrinoPaths[1]), Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[2], InitialCorrinoPaths[2])
|
||||
IdlingUnits[corrino_small] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[3], InitialCorrinoPaths[3])
|
||||
IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2])
|
||||
IdlingUnits[AtreidesSmall] = Reinforcements.Reinforce(AtreidesSmall, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3])
|
||||
IdlingUnits[CorrinoMain] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[1], InitialCorrinoPaths[1]), Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[2], InitialCorrinoPaths[2])
|
||||
IdlingUnits[CorrinoSmall] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[3], InitialCorrinoPaths[3])
|
||||
|
||||
DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(atreides_small, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(corrino_main, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(corrino_small, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(AtreidesSmall, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(CorrinoMain, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(CorrinoSmall, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty])
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
|
||||
@@ -54,20 +54,20 @@ ActivateAI = function()
|
||||
local unitsToBuyCorrino = function() return { Utils.Random(CorrinoStarportTypes) } end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_main, AStarport1, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesMain, AStarport1, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(atreides_small, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_small, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_small, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(atreides_small, AStarport2, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesSmall, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesSmall, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesSmall, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(AtreidesSmall, AStarport2, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(corrino_main, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(corrino_main, CHeavyFactory, delay, tanksToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoMain, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoMain, CHeavyFactory, delay, tanksToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
|
||||
ProduceUnits(corrino_small, CBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(corrino_small, CLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(corrino_small, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoSmall, CBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoSmall, CLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(CorrinoSmall, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -143,13 +143,13 @@ HarkonnenPath = { HarkonnenEntry.Location, HarkonnenRally.Location }
|
||||
|
||||
SendStarportReinforcements = function()
|
||||
Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function()
|
||||
if CStarport.IsDead or CStarport.Owner ~= corrino_small then
|
||||
if CStarport.IsDead or CStarport.Owner ~= CorrinoSmall then
|
||||
return
|
||||
end
|
||||
|
||||
reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty])
|
||||
local reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty])
|
||||
|
||||
local units = Reinforcements.ReinforceWithTransport(corrino_small, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2]
|
||||
local units = Reinforcements.ReinforceWithTransport(CorrinoSmall, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2]
|
||||
Utils.Do(units, function(unit)
|
||||
unit.AttackMove(AtreidesAttackLocation)
|
||||
IdleHunt(unit)
|
||||
@@ -161,19 +161,19 @@ end
|
||||
|
||||
SendHarkonnenReinforcements = function(delay)
|
||||
Trigger.AfterDelay(delay, function()
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
|
||||
Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] })
|
||||
Trigger.AfterDelay(DateTime.Seconds(5), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Media.PlaySpeechNotification(Harkonnen, "Reinforce")
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
SendAirStrike = function()
|
||||
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_main then
|
||||
if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesMain then
|
||||
return
|
||||
end
|
||||
|
||||
local targets = Utils.Where(player.GetActors(), function(actor)
|
||||
local targets = Utils.Where(Harkonnen.GetActors(), function(actor)
|
||||
return
|
||||
actor.HasProperty("Sell") and
|
||||
actor.Type ~= "wall" and
|
||||
@@ -191,7 +191,7 @@ SendAirStrike = function()
|
||||
end
|
||||
|
||||
BuildFremen = function()
|
||||
if APalace.IsDead or APalace.Owner ~= atreides_main then
|
||||
if APalace.IsDead or APalace.Owner ~= AtreidesMain then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -199,7 +199,7 @@ BuildFremen = function()
|
||||
APalace.Produce("fremen")
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(5), function()
|
||||
IdleFremen = Utils.Where(atreides_main.GetActorsByType('fremen'), function(actor) return actor.IsIdle end)
|
||||
IdleFremen = Utils.Where(AtreidesMain.GetActorsByType('fremen'), function(actor) return actor.IsIdle end)
|
||||
|
||||
if #IdleFremen >= FremenGroupSize[Difficulty] then
|
||||
SendFremen()
|
||||
@@ -228,44 +228,44 @@ end
|
||||
CheckSmugglerEnemies = function()
|
||||
Utils.Do(SmugglerUnits, function(unit)
|
||||
Trigger.OnDamaged(unit, function(self, attacker)
|
||||
if unit.Owner == smuggler_neutral and attacker.Owner == player then
|
||||
ChangeOwner(smuggler_neutral, smuggler_harkonnen)
|
||||
if unit.Owner == SmugglerNeutral and attacker.Owner == Harkonnen then
|
||||
ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
|
||||
|
||||
-- Ensure that harvesters that was on a carryall switched sides.
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
ChangeOwner(smuggler_neutral, smuggler_harkonnen)
|
||||
ChangeOwner(SmugglerNeutral, SmugglerHarkonnen)
|
||||
end)
|
||||
end
|
||||
|
||||
if unit.Owner == smuggler_ai and attacker.Owner == player then
|
||||
ChangeOwner(smuggler_ai, smuggler_both)
|
||||
if unit.Owner == SmugglerAI and attacker.Owner == Harkonnen then
|
||||
ChangeOwner(SmugglerAI, SmugglerBoth)
|
||||
|
||||
-- Ensure that harvesters that was on a carryall switched sides.
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
ChangeOwner(smuggler_ai, smuggler_both)
|
||||
ChangeOwner(SmugglerAI, SmugglerBoth)
|
||||
end)
|
||||
end
|
||||
|
||||
if unit.Owner == smuggler_neutral and (attacker.Owner == atreides_main or attacker.Owner == atreides_small or attacker.Owner == corrino_main or attacker.Owner == corrino_small) then
|
||||
ChangeOwner(smuggler_neutral, smuggler_ai)
|
||||
if unit.Owner == SmugglerNeutral and (attacker.Owner == AtreidesMain or attacker.Owner == AtreidesSmall or attacker.Owner == CorrinoMain or attacker.Owner == CorrinoSmall) then
|
||||
ChangeOwner(SmugglerNeutral, SmugglerAI)
|
||||
|
||||
-- Ensure that harvesters that was on a carryall switched sides.
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
ChangeOwner(smuggler_neutral, smuggler_ai)
|
||||
ChangeOwner(SmugglerNeutral, SmugglerAI)
|
||||
end)
|
||||
end
|
||||
|
||||
if unit.Owner == smuggler_harkonnen and (attacker.Owner == atreides_main or attacker.Owner == atreides_small or attacker.Owner == corrino_main or attacker.Owner == corrino_small) then
|
||||
ChangeOwner(smuggler_harkonnen, smuggler_both)
|
||||
if unit.Owner == SmugglerHarkonnen and (attacker.Owner == AtreidesMain or attacker.Owner == AtreidesSmall or attacker.Owner == CorrinoMain or attacker.Owner == CorrinoSmall) then
|
||||
ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
|
||||
|
||||
-- Ensure that harvesters that was on a carryall switched sides.
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
ChangeOwner(smuggler_harkonnen, smuggler_both)
|
||||
ChangeOwner(SmugglerHarkonnen, SmugglerBoth)
|
||||
end)
|
||||
end
|
||||
|
||||
if attacker.Owner == player and not message_check then
|
||||
message_check = true
|
||||
if attacker.Owner == Harkonnen and not MessageCheck then
|
||||
MessageCheck = true
|
||||
Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat)
|
||||
end
|
||||
end)
|
||||
@@ -273,93 +273,93 @@ CheckSmugglerEnemies = function()
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
atreides_main.MarkCompletedObjective(KillHarkonnen1)
|
||||
atreides_small.MarkCompletedObjective(KillHarkonnen2)
|
||||
corrino_main.MarkCompletedObjective(KillHarkonnen3)
|
||||
corrino_small.MarkCompletedObjective(KillHarkonnen4)
|
||||
if Harkonnen.HasNoRequiredUnits() then
|
||||
AtreidesMain.MarkCompletedObjective(KillHarkonnen1)
|
||||
AtreidesSmall.MarkCompletedObjective(KillHarkonnen2)
|
||||
CorrinoMain.MarkCompletedObjective(KillHarkonnen3)
|
||||
CorrinoSmall.MarkCompletedObjective(KillHarkonnen4)
|
||||
end
|
||||
|
||||
if atreides_main.HasNoRequiredUnits() and atreides_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then
|
||||
if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if corrino_main.HasNoRequiredUnits() and corrino_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then
|
||||
if CorrinoMain.HasNoRequiredUnits() and CorrinoSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then
|
||||
Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillCorrino)
|
||||
Harkonnen.MarkCompletedObjective(KillCorrino)
|
||||
end
|
||||
|
||||
if smuggler_neutral.HasNoRequiredUnits() and smuggler_harkonnen.HasNoRequiredUnits() and smuggler_ai.HasNoRequiredUnits() and smuggler_both.HasNoRequiredUnits() and not SmugglersKilled then
|
||||
if SmugglerNeutral.HasNoRequiredUnits() and SmugglerHarkonnen.HasNoRequiredUnits() and SmugglerAI.HasNoRequiredUnits() and SmugglerBoth.HasNoRequiredUnits() and not SmugglersKilled then
|
||||
Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat)
|
||||
SmugglersKilled = true
|
||||
end
|
||||
|
||||
local playerConYards = player.GetActorsByType("construction_yard")
|
||||
if #playerConYards > 0 and not player.IsObjectiveCompleted(DeployMCV) then
|
||||
player.MarkCompletedObjective(DeployMCV)
|
||||
local playerConYards = Harkonnen.GetActorsByType("construction_yard")
|
||||
if #playerConYards > 0 and not Harkonnen.IsObjectiveCompleted(DeployMCV) then
|
||||
Harkonnen.MarkCompletedObjective(DeployMCV)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_main] then
|
||||
local units = atreides_main.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesMain] then
|
||||
local units = AtreidesMain.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[atreides_main] = false
|
||||
ProtectHarvester(units[1], atreides_main, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[AtreidesMain] = false
|
||||
ProtectHarvester(units[1], AtreidesMain, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_small] then
|
||||
local units = atreides_small.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesSmall] then
|
||||
local units = AtreidesSmall.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[atreides_small] = false
|
||||
ProtectHarvester(units[1], atreides_small, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[AtreidesSmall] = false
|
||||
ProtectHarvester(units[1], AtreidesSmall, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_main] then
|
||||
local units = corrino_main.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoMain] then
|
||||
local units = CorrinoMain.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[corrino_main] = false
|
||||
ProtectHarvester(units[1], corrino_main, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[CorrinoMain] = false
|
||||
ProtectHarvester(units[1], CorrinoMain, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_small] then
|
||||
local units = corrino_small.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoSmall] then
|
||||
local units = CorrinoSmall.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[corrino_small] = false
|
||||
ProtectHarvester(units[1], corrino_small, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[CorrinoSmall] = false
|
||||
ProtectHarvester(units[1], CorrinoSmall, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides_main = Player.GetPlayer("Atreides Main Base")
|
||||
atreides_small = Player.GetPlayer("Atreides Small Base")
|
||||
corrino_main = Player.GetPlayer("Corrino Main Base")
|
||||
corrino_small = Player.GetPlayer("Corrino Small Base")
|
||||
smuggler_neutral = Player.GetPlayer("Smugglers - Neutral")
|
||||
smuggler_harkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
|
||||
smuggler_ai = Player.GetPlayer("Smugglers - Enemy to AI")
|
||||
smuggler_both = Player.GetPlayer("Smugglers - Enemy to Both")
|
||||
player = Player.GetPlayer("Harkonnen")
|
||||
AtreidesMain = Player.GetPlayer("Atreides Main Base")
|
||||
AtreidesSmall = Player.GetPlayer("Atreides Small Base")
|
||||
CorrinoMain = Player.GetPlayer("Corrino Main Base")
|
||||
CorrinoSmall = Player.GetPlayer("Corrino Small Base")
|
||||
SmugglerNeutral = Player.GetPlayer("Smugglers - Neutral")
|
||||
SmugglerHarkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen")
|
||||
SmugglerAI = Player.GetPlayer("Smugglers - Enemy to AI")
|
||||
SmugglerBoth = Player.GetPlayer("Smugglers - Enemy to Both")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
InitObjectives(player)
|
||||
DeployMCV = AddSecondaryObjective(player, "build-deploy-mcv")
|
||||
KillAtreides = AddPrimaryObjective(player, "destroy-atreides")
|
||||
KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces")
|
||||
KillHarkonnen1 = AddPrimaryObjective(atreides_main, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(atreides_small, "")
|
||||
KillHarkonnen3 = AddPrimaryObjective(corrino_main, "")
|
||||
KillHarkonnen4 = AddPrimaryObjective(corrino_small, "")
|
||||
InitObjectives(Harkonnen)
|
||||
DeployMCV = AddSecondaryObjective(Harkonnen, "build-deploy-mcv")
|
||||
KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides")
|
||||
KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces")
|
||||
KillHarkonnen1 = AddPrimaryObjective(AtreidesMain, "")
|
||||
KillHarkonnen2 = AddPrimaryObjective(AtreidesSmall, "")
|
||||
KillHarkonnen3 = AddPrimaryObjective(CorrinoMain, "")
|
||||
KillHarkonnen4 = AddPrimaryObjective(CorrinoSmall, "")
|
||||
|
||||
-- Wait for carryall drop
|
||||
Trigger.AfterDelay(DateTime.Seconds(10), function()
|
||||
SmugglerUnits = smuggler_neutral.GetActors()
|
||||
SmugglerUnits = SmugglerNeutral.GetActors()
|
||||
CheckSmugglerEnemies()
|
||||
end)
|
||||
|
||||
@@ -370,42 +370,42 @@ WorldLoaded = function()
|
||||
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds (30), BuildFremen)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function()
|
||||
Utils.Do(atreides_main.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(AtreidesMain.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(AtreidesSmallBase, function()
|
||||
Utils.Do(atreides_small.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(AtreidesSmall.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(CorrinoMainBase, function()
|
||||
Utils.Do(corrino_main.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(CorrinoMain.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilledOrCaptured(CorrinoSmallBase, function()
|
||||
Utils.Do(corrino_small.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(CorrinoSmall.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(AtreidesPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end
|
||||
local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end
|
||||
local huntFunction = function(unit)
|
||||
unit.AttackMove(AtreidesAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end
|
||||
SendCarryallReinforcements(atreides_main, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
SendCarryallReinforcements(AtreidesMain, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
|
||||
SendStarportReinforcements()
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.light", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.hightech", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides_small })
|
||||
Actor.Create("upgrade.light", true, { Owner = atreides_small })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = atreides_small })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = corrino_main })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = corrino_main })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = corrino_small })
|
||||
Actor.Create("upgrade.light", true, { Owner = corrino_small })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.light", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.hightech", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall })
|
||||
Actor.Create("upgrade.light", true, { Owner = AtreidesSmall })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = AtreidesSmall })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = CorrinoMain })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = CorrinoMain })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = CorrinoSmall })
|
||||
Actor.Create("upgrade.light", true, { Owner = CorrinoSmall })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
SendHarkonnenReinforcements(DateTime.Minutes(2))
|
||||
|
||||
@@ -61,16 +61,16 @@ Messages =
|
||||
|
||||
CachedResources = -1
|
||||
Tick = function()
|
||||
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
|
||||
Ordos.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if player.Resources > SpiceToHarvest - 1 then
|
||||
player.MarkCompletedObjective(GatherSpice)
|
||||
if Ordos.Resources > SpiceToHarvest - 1 then
|
||||
Ordos.MarkCompletedObjective(GatherSpice)
|
||||
end
|
||||
|
||||
-- player has no Wind Trap
|
||||
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if (Ordos.PowerProvided <= 20 or Ordos.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
HasPower = false
|
||||
Media.DisplayMessage(Messages[2], Mentat)
|
||||
else
|
||||
@@ -78,40 +78,40 @@ Tick = function()
|
||||
end
|
||||
|
||||
-- player has no Refinery and no Silos
|
||||
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Ordos.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[3], Mentat)
|
||||
end
|
||||
|
||||
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Ordos.Resources > Ordos.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[4], Mentat)
|
||||
end
|
||||
|
||||
if player.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
|
||||
if Ordos.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest }
|
||||
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
|
||||
UserInterface.SetMissionText(harvestedResources)
|
||||
CachedResources = player.Resources
|
||||
CachedResources = Ordos.Resources
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("Ordos")
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
SpiceToHarvest = ToHarvest[Difficulty]
|
||||
|
||||
InitObjectives(player)
|
||||
KillOrdos = AddPrimaryObjective(harkonnen, "")
|
||||
InitObjectives(Ordos)
|
||||
KillOrdos = AddPrimaryObjective(Harkonnen, "")
|
||||
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
|
||||
GatherSpice = AddPrimaryObjective(player, harvestSpice)
|
||||
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements")
|
||||
GatherSpice = AddPrimaryObjective(Ordos, harvestSpice)
|
||||
KillHarkonnen = AddSecondaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
|
||||
|
||||
local checkResourceCapacity = function()
|
||||
Trigger.AfterDelay(0, function()
|
||||
if player.ResourceCapacity < SpiceToHarvest then
|
||||
if Ordos.ResourceCapacity < SpiceToHarvest then
|
||||
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
Harkonnen.MarkCompletedObjective(KillAtreides)
|
||||
end)
|
||||
|
||||
return true
|
||||
@@ -126,16 +126,16 @@ WorldLoaded = function()
|
||||
return
|
||||
end
|
||||
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end)
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Ordos end)
|
||||
|
||||
if #refs == 0 then
|
||||
harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
else
|
||||
Trigger.OnAllRemovedFromWorld(refs, function()
|
||||
harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
end)
|
||||
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end)
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Ordos end)
|
||||
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
end
|
||||
@@ -144,8 +144,8 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(Messages[1], Mentat)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(25), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, OrdosReinforcements, OrdosEntryPath)
|
||||
Media.PlaySpeechNotification(Ordos, "Reinforce")
|
||||
Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosEntryPath)
|
||||
end)
|
||||
|
||||
WavesLeft = HarkonnenAttackWaves[Difficulty]
|
||||
@@ -159,7 +159,7 @@ SendReinforcements = function()
|
||||
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
|
||||
|
||||
Trigger.AfterDelay(delay, function()
|
||||
Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
|
||||
Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
|
||||
|
||||
WavesLeft = WavesLeft - 1
|
||||
if WavesLeft == 0 then
|
||||
|
||||
@@ -61,16 +61,16 @@ Messages =
|
||||
|
||||
CachedResources = -1
|
||||
Tick = function()
|
||||
if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then
|
||||
Ordos.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if player.Resources > SpiceToHarvest - 1 then
|
||||
player.MarkCompletedObjective(GatherSpice)
|
||||
if Ordos.Resources > SpiceToHarvest - 1 then
|
||||
Ordos.MarkCompletedObjective(GatherSpice)
|
||||
end
|
||||
|
||||
-- player has no Wind Trap
|
||||
if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if (Ordos.PowerProvided <= 20 or Ordos.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
HasPower = false
|
||||
Media.DisplayMessage(Messages[2], Mentat)
|
||||
else
|
||||
@@ -78,40 +78,40 @@ Tick = function()
|
||||
end
|
||||
|
||||
-- player has no Refinery and no Silos
|
||||
if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Ordos.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[3], Mentat)
|
||||
end
|
||||
|
||||
if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
if HasPower and Ordos.Resources > Ordos.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then
|
||||
Media.DisplayMessage(Messages[4], Mentat)
|
||||
end
|
||||
|
||||
if player.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
|
||||
if Ordos.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest }
|
||||
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
|
||||
UserInterface.SetMissionText(harvestedResources)
|
||||
CachedResources = player.Resources
|
||||
CachedResources = Ordos.Resources
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("Ordos")
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
|
||||
SpiceToHarvest = ToHarvest[Difficulty]
|
||||
|
||||
InitObjectives(player)
|
||||
KillOrdos = AddPrimaryObjective(harkonnen, "")
|
||||
InitObjectives(Ordos)
|
||||
KillOrdos = AddPrimaryObjective(Harkonnen, "")
|
||||
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
|
||||
GatherSpice = AddPrimaryObjective(player, harvestSpice)
|
||||
KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements")
|
||||
GatherSpice = AddPrimaryObjective(Ordos, harvestSpice)
|
||||
KillHarkonnen = AddSecondaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
|
||||
|
||||
local checkResourceCapacity = function()
|
||||
Trigger.AfterDelay(0, function()
|
||||
if player.ResourceCapacity < SpiceToHarvest then
|
||||
if Ordos.ResourceCapacity < SpiceToHarvest then
|
||||
Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat)
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
end)
|
||||
|
||||
return true
|
||||
@@ -126,16 +126,16 @@ WorldLoaded = function()
|
||||
return
|
||||
end
|
||||
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end)
|
||||
local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Ordos end)
|
||||
|
||||
if #refs == 0 then
|
||||
harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
else
|
||||
Trigger.OnAllRemovedFromWorld(refs, function()
|
||||
harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
end)
|
||||
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end)
|
||||
local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Ordos end)
|
||||
Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end)
|
||||
end
|
||||
@@ -144,8 +144,8 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(Messages[1], Mentat)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(25), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, OrdosReinforcements, OrdosEntryPath)
|
||||
Media.PlaySpeechNotification(Ordos, "Reinforce")
|
||||
Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosEntryPath)
|
||||
end)
|
||||
|
||||
WavesLeft = HarkonnenAttackWaves[Difficulty]
|
||||
@@ -159,7 +159,7 @@ SendReinforcements = function()
|
||||
if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end
|
||||
|
||||
Trigger.AfterDelay(delay, function()
|
||||
Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
|
||||
Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt)
|
||||
|
||||
WavesLeft = WavesLeft - 1
|
||||
if WavesLeft == 0 then
|
||||
|
||||
@@ -24,11 +24,11 @@ AttackDelays =
|
||||
HarkonnenInfantryTypes = { "light_inf" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[harkonnen] = { }
|
||||
IdlingUnits[Harkonnen] = { }
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local toBuild = function() return HarkonnenInfantryTypes end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -81,39 +81,39 @@ OrdosReinforcements = { "light_inf", "light_inf", "raider" }
|
||||
OrdosEntryPath = { OrdosEntry.Location, OrdosRally.Location }
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
if Ordos.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
end
|
||||
|
||||
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then
|
||||
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
Ordos.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
player = Player.GetPlayer("Ordos")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
|
||||
InitObjectives(player)
|
||||
KillOrdos = AddPrimaryObjective(harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces")
|
||||
InitObjectives(Ordos)
|
||||
KillOrdos = AddPrimaryObjective(Harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen-forces")
|
||||
|
||||
Camera.Position = OConyard.CenterPosition
|
||||
|
||||
Trigger.OnAllKilled(HarkonnenBase, function()
|
||||
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Minutes(1), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", OrdosReinforcements, OrdosEntryPath, { OrdosEntryPath[1] })
|
||||
Media.PlaySpeechNotification(Ordos, "Reinforce")
|
||||
Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", OrdosReinforcements, OrdosEntryPath, { OrdosEntryPath[1] })
|
||||
end)
|
||||
|
||||
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[1], InitialHarkonnenReinforcementsPaths[1])
|
||||
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[2], InitialHarkonnenReinforcementsPaths[2])
|
||||
TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[1], InitialHarkonnenReinforcementsPaths[1])
|
||||
TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[2], InitialHarkonnenReinforcementsPaths[2])
|
||||
|
||||
local path = function() return Utils.Random(HarkonnenAttackPaths) end
|
||||
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
|
||||
SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
end
|
||||
|
||||
@@ -24,11 +24,11 @@ AttackDelays =
|
||||
HarkonnenInfantryTypes = { "light_inf" }
|
||||
|
||||
ActivateAI = function()
|
||||
IdlingUnits[harkonnen] = { }
|
||||
IdlingUnits[Harkonnen] = { }
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local toBuild = function() return HarkonnenInfantryTypes end
|
||||
local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end
|
||||
|
||||
@@ -65,31 +65,31 @@ HarkonnenAttackWaves =
|
||||
}
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
if Ordos.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
end
|
||||
|
||||
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then
|
||||
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
Ordos.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
player = Player.GetPlayer("Ordos")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
|
||||
InitObjectives(player)
|
||||
KillOrdos = AddPrimaryObjective(harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces")
|
||||
InitObjectives(Ordos)
|
||||
KillOrdos = AddPrimaryObjective(Harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen-forces")
|
||||
|
||||
Camera.Position = OConyard.CenterPosition
|
||||
|
||||
Trigger.OnAllKilled(HarkonnenBase, function()
|
||||
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(HarkonnenAttackPaths) end
|
||||
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
|
||||
SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty])
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
end
|
||||
|
||||
@@ -25,13 +25,13 @@ HarkonnenInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tr
|
||||
HarkonnenVehicleTypes = { "trike", "trike", "quad" }
|
||||
|
||||
InitAIUnits = function()
|
||||
IdlingUnits[harkonnen] = Reinforcements.Reinforce(harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath)
|
||||
IdlingUnits[Harkonnen] = Reinforcements.Reinforce(Harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath)
|
||||
|
||||
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
end
|
||||
|
||||
ActivateAI = function()
|
||||
LastHarvesterEaten[harkonnen] = true
|
||||
LastHarvesterEaten[Harkonnen] = true
|
||||
Trigger.AfterDelay(0, InitAIUnits)
|
||||
|
||||
HConyard.Produce(OrdosUpgrades[1])
|
||||
@@ -44,7 +44,7 @@ ActivateAI = function()
|
||||
|
||||
-- Finish the upgrades first before trying to build something
|
||||
Trigger.AfterDelay(DateTime.Seconds(14), function()
|
||||
ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -77,25 +77,25 @@ OrdosBaseBuildings = { "barracks", "light_factory" }
|
||||
OrdosUpgrades = { "upgrade.barracks", "upgrade.light" }
|
||||
|
||||
MessageCheck = function(index)
|
||||
return #player.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not player.HasPrerequisites({ OrdosUpgrades[index] })
|
||||
return #Ordos.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not Ordos.HasPrerequisites({ OrdosUpgrades[index] })
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
if Ordos.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
end
|
||||
|
||||
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then
|
||||
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
Ordos.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then
|
||||
local units = harkonnen.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then
|
||||
local units = Harkonnen.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[harkonnen] = false
|
||||
ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[Harkonnen] = false
|
||||
ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -105,27 +105,27 @@ Tick = function()
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
player = Player.GetPlayer("Ordos")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
|
||||
InitObjectives(player)
|
||||
KillOrdos = AddPrimaryObjective(harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(player, "eliminate-harkonnen-units-reinforcements")
|
||||
InitObjectives(Ordos)
|
||||
KillOrdos = AddPrimaryObjective(Harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
|
||||
|
||||
Camera.Position = OConyard.CenterPosition
|
||||
|
||||
Trigger.OnAllKilled(HarkonnenBase, function()
|
||||
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(HarkonnenPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end
|
||||
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition)
|
||||
local waveCondition = function() return Ordos.IsObjectiveCompleted(KillHarkonnen) end
|
||||
SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition)
|
||||
ActivateAI()
|
||||
|
||||
Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function()
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", OrdosReinforcements, OrdosPath, { OrdosPath[1] })
|
||||
Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", OrdosReinforcements, OrdosPath, { OrdosPath[1] })
|
||||
end)
|
||||
|
||||
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters, HarkonnenHunterPath)
|
||||
TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters, HarkonnenHunterPath)
|
||||
end
|
||||
|
||||
@@ -25,13 +25,13 @@ HarkonnenInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tr
|
||||
HarkonnenVehicleTypes = { "trike", "trike", "quad" }
|
||||
|
||||
InitAIUnits = function()
|
||||
IdlingUnits[harkonnen] = Reinforcements.Reinforce(harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath)
|
||||
IdlingUnits[Harkonnen] = Reinforcements.Reinforce(Harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath)
|
||||
|
||||
DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty])
|
||||
end
|
||||
|
||||
ActivateAI = function()
|
||||
LastHarvesterEaten[harkonnen] = true
|
||||
LastHarvesterEaten[Harkonnen] = true
|
||||
Trigger.AfterDelay(0, InitAIUnits)
|
||||
|
||||
HConyard.Produce(OrdosUpgrades[1])
|
||||
@@ -44,7 +44,7 @@ ActivateAI = function()
|
||||
|
||||
-- Finish the upgrades first before trying to build something
|
||||
Trigger.AfterDelay(DateTime.Seconds(14), function()
|
||||
ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
ProduceUnits(Harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -106,33 +106,33 @@ OrdosBaseBuildings = { "barracks", "light_factory" }
|
||||
OrdosUpgrades = { "upgrade.barracks", "upgrade.light" }
|
||||
|
||||
MessageCheck = function(index)
|
||||
return #player.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not player.HasPrerequisites({ OrdosUpgrades[index] })
|
||||
return #Ordos.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not Ordos.HasPrerequisites({ OrdosUpgrades[index] })
|
||||
end
|
||||
|
||||
SendOrdosReinforcements = function(timer, unit, path)
|
||||
Trigger.AfterDelay(timer, function()
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", unit, path, { path[1] })
|
||||
Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", unit, path, { path[1] })
|
||||
|
||||
SendOrdosReinforcements(timer, unit, path)
|
||||
end)
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
if Ordos.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillOrdos)
|
||||
end
|
||||
|
||||
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then
|
||||
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
Ordos.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then
|
||||
local units = harkonnen.GetActorsByType("harvester")
|
||||
if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then
|
||||
local units = Harkonnen.GetActorsByType("harvester")
|
||||
|
||||
if #units > 0 then
|
||||
LastHarvesterEaten[harkonnen] = false
|
||||
ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty])
|
||||
LastHarvesterEaten[Harkonnen] = false
|
||||
ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -142,32 +142,32 @@ Tick = function()
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
player = Player.GetPlayer("Ordos")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
|
||||
InitObjectives(player)
|
||||
KillOrdos = AddPrimaryObjective(harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(player, "eliminate-harkonnen-units-reinforcements")
|
||||
InitObjectives(Ordos)
|
||||
KillOrdos = AddPrimaryObjective(Harkonnen, "")
|
||||
KillHarkonnen = AddPrimaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements")
|
||||
|
||||
Camera.Position = OConyard.CenterPosition
|
||||
|
||||
Trigger.OnAllKilled(HarkonnenBase, function()
|
||||
Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt)
|
||||
end)
|
||||
|
||||
local path = function() return Utils.Random(HarkonnenPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end
|
||||
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition)
|
||||
local waveCondition = function() return Ordos.IsObjectiveCompleted(KillHarkonnen) end
|
||||
SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition)
|
||||
ActivateAI()
|
||||
|
||||
SendOrdosReinforcements(OrdosReinforcementDelays[1], OrdosReinforcements[1], OrdosPaths[1])
|
||||
SendOrdosReinforcements(OrdosReinforcementDelays[3], OrdosReinforcements[3], OrdosPaths[3])
|
||||
|
||||
Trigger.AfterDelay(OrdosReinforcementDelays[2], function()
|
||||
Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", OrdosReinforcements[2], OrdosPaths[2], { OrdosPaths[2][1] })
|
||||
Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", OrdosReinforcements[2], OrdosPaths[2], { OrdosPaths[2][1] })
|
||||
end)
|
||||
|
||||
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[1], HarkonnenHunterPaths[1])
|
||||
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[2], HarkonnenHunterPaths[2])
|
||||
TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[3], HarkonnenHunterPaths[3])
|
||||
TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[1], HarkonnenHunterPaths[1])
|
||||
TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[2], HarkonnenHunterPaths[2])
|
||||
TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[3], HarkonnenHunterPaths[3])
|
||||
end
|
||||
|
||||
@@ -37,8 +37,8 @@ InitAIUnits = function(house)
|
||||
end
|
||||
|
||||
ActivateAI = function()
|
||||
InitAIUnits(harkonnen)
|
||||
InitAIUnits(smuggler)
|
||||
InitAIUnits(Harkonnen)
|
||||
InitAIUnits(Smuggler)
|
||||
|
||||
local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
|
||||
@@ -48,11 +48,11 @@ ActivateAI = function()
|
||||
local sTanksToBuild = function() return SmugglerTankType end
|
||||
local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(harkonnen, HLightFactory, delay, hVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(harkonnen, HHeavyFactory, delay, hTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Harkonnen, HLightFactory, delay, hVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Harkonnen, HHeavyFactory, delay, hTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
|
||||
ProduceUnits(smuggler, SBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(smuggler, SLightFactory, delay, sVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(smuggler, SHeavyFactory, delay, sTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Smuggler, SBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Smuggler, SLightFactory, delay, sVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Smuggler, SHeavyFactory, delay, sTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
end
|
||||
|
||||
@@ -52,11 +52,11 @@ OrdosPath = { OrdosEntry.Location, OrdosRally.Location }
|
||||
|
||||
SendHarkonnen = function(path)
|
||||
Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function()
|
||||
if player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
if Ordos.IsObjectiveCompleted(KillHarkonnen) then
|
||||
return
|
||||
end
|
||||
|
||||
local units = Reinforcements.ReinforceWithTransport(harkonnen, "carryall.reinforce", HarkonnenLightInfantryRushers[Difficulty], path, { path[1] })[2]
|
||||
local units = Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenLightInfantryRushers[Difficulty], path, { path[1] })[2]
|
||||
Utils.Do(units, function(unit)
|
||||
unit.AttackMove(HarkonnenAttackLocation)
|
||||
IdleHunt(unit)
|
||||
@@ -83,64 +83,64 @@ end
|
||||
|
||||
AttackNotifier = 0
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
harkonnen.MarkCompletedObjective(KillOrdosH)
|
||||
smuggler.MarkCompletedObjective(KillOrdosS)
|
||||
smuggler.MarkCompletedObjective(DefendOutpost)
|
||||
if Ordos.HasNoRequiredUnits() then
|
||||
Harkonnen.MarkCompletedObjective(KillOrdosH)
|
||||
Smuggler.MarkCompletedObjective(KillOrdosS)
|
||||
Smuggler.MarkCompletedObjective(DefendOutpost)
|
||||
end
|
||||
|
||||
if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then
|
||||
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
Ordos.MarkCompletedObjective(KillHarkonnen)
|
||||
end
|
||||
|
||||
CheckHarvester(harkonnen)
|
||||
CheckHarvester(smuggler)
|
||||
CheckHarvester(Harkonnen)
|
||||
CheckHarvester(Smuggler)
|
||||
|
||||
AttackNotifier = AttackNotifier - 1
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
smuggler = Player.GetPlayer("Smugglers")
|
||||
player = Player.GetPlayer("Ordos")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Smuggler = Player.GetPlayer("Smugglers")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
|
||||
InitObjectives(player)
|
||||
KillOrdosH = AddPrimaryObjective(harkonnen, "")
|
||||
KillOrdosS = AddSecondaryObjective(smuggler, "")
|
||||
DefendOutpost = AddPrimaryObjective(smuggler, "outpost-not-captured-destroyed")
|
||||
CaptureOutpost = AddPrimaryObjective(player, "capture-smuggler-outpost")
|
||||
KillHarkonnen = AddSecondaryObjective(player, "destroy-harkonnen")
|
||||
InitObjectives(Ordos)
|
||||
KillOrdosH = AddPrimaryObjective(Harkonnen, "")
|
||||
KillOrdosS = AddSecondaryObjective(Smuggler, "")
|
||||
DefendOutpost = AddPrimaryObjective(Smuggler, "outpost-not-captured-destroyed")
|
||||
CaptureOutpost = AddPrimaryObjective(Ordos, "capture-smuggler-outpost")
|
||||
KillHarkonnen = AddSecondaryObjective(Ordos, "destroy-harkonnen")
|
||||
|
||||
SOutpost.GrantCondition("modified")
|
||||
|
||||
Camera.Position = OConyard.CenterPosition
|
||||
HarkonnenAttackLocation = OConyard.Location
|
||||
|
||||
Hunt(harkonnen)
|
||||
Hunt(smuggler)
|
||||
Hunt(Harkonnen)
|
||||
Hunt(Smuggler)
|
||||
|
||||
SendHarkonnen(LightInfantryRushersPaths[1])
|
||||
SendHarkonnen(LightInfantryRushersPaths[2])
|
||||
SendHarkonnen(LightInfantryRushersPaths[3])
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = harkonnen })
|
||||
Actor.Create("upgrade.light", true, { Owner = harkonnen })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = smuggler })
|
||||
Actor.Create("upgrade.light", true, { Owner = smuggler })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = Harkonnen })
|
||||
Actor.Create("upgrade.light", true, { Owner = Harkonnen })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = Smuggler })
|
||||
Actor.Create("upgrade.light", true, { Owner = Smuggler })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
Trigger.OnKilled(SOutpost, function()
|
||||
player.MarkFailedObjective(CaptureOutpost)
|
||||
Ordos.MarkFailedObjective(CaptureOutpost)
|
||||
end)
|
||||
Trigger.OnCapture(SOutpost, function()
|
||||
Trigger.AfterDelay(DateTime.Seconds(2), function()
|
||||
player.MarkCompletedObjective(CaptureOutpost)
|
||||
smuggler.MarkFailedObjective(DefendOutpost)
|
||||
Ordos.MarkCompletedObjective(CaptureOutpost)
|
||||
Smuggler.MarkFailedObjective(DefendOutpost)
|
||||
end)
|
||||
end)
|
||||
Trigger.OnDamaged(SOutpost, function()
|
||||
if SOutpost.Owner ~= smuggler then
|
||||
if SOutpost.Owner ~= Smuggler then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -151,8 +151,8 @@ WorldLoaded = function()
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty] - DateTime.Seconds(5), function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, OrdosReinforcements, OrdosPath)
|
||||
Media.PlaySpeechNotification(Ordos, "Reinforce")
|
||||
Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosPath)
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function()
|
||||
|
||||
@@ -27,7 +27,7 @@ EnemyTankType = { "combat_tank_a" }
|
||||
|
||||
InitAIUnits = function(house)
|
||||
LastHarvesterEaten[house] = true
|
||||
if house ~= atreides_small_3 then
|
||||
if house ~= AtreidesSmall3 then
|
||||
IdlingUnits[house] = Reinforcements.Reinforce(house, InitialReinforcements[house.InternalName], InitialReinforcementsPaths[house.InternalName])
|
||||
else
|
||||
IdlingUnits[house] = { }
|
||||
@@ -43,20 +43,20 @@ ActivateAIProduction = function()
|
||||
local tanksToBuild = function() return EnemyTankType end
|
||||
local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(atreides_main, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(atreides_main, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(AtreidesMain, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(AtreidesMain, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
|
||||
ProduceUnits(atreides_small_1, ABarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(AtreidesSmall1, ABarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
|
||||
ProduceUnits(atreides_small_2, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(AtreidesSmall2, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
|
||||
AIProductionActivated = true
|
||||
end
|
||||
|
||||
ActivateAI = function()
|
||||
InitAIUnits(atreides_main)
|
||||
InitAIUnits(atreides_small_1)
|
||||
InitAIUnits(atreides_small_2)
|
||||
InitAIUnits(atreides_small_3)
|
||||
InitAIUnits(AtreidesMain)
|
||||
InitAIUnits(AtreidesSmall1)
|
||||
InitAIUnits(AtreidesSmall2)
|
||||
InitAIUnits(AtreidesSmall3)
|
||||
end
|
||||
|
||||
@@ -110,57 +110,57 @@ end
|
||||
|
||||
CachedResources = -1
|
||||
Tick = function()
|
||||
if player.Resources > SpiceToHarvest - 1 then
|
||||
player.MarkCompletedObjective(GatherSpice)
|
||||
if Ordos.Resources > SpiceToHarvest - 1 then
|
||||
Ordos.MarkCompletedObjective(GatherSpice)
|
||||
end
|
||||
|
||||
if player.HasNoRequiredUnits() then
|
||||
atreides_main.MarkCompletedObjective(KillOrdos1)
|
||||
atreides_small_1.MarkCompletedObjective(KillOrdos2)
|
||||
atreides_small_2.MarkCompletedObjective(KillOrdos3)
|
||||
atreides_small_3.MarkCompletedObjective(KillOrdos4)
|
||||
if Ordos.HasNoRequiredUnits() then
|
||||
AtreidesMain.MarkCompletedObjective(KillOrdos1)
|
||||
AtreidesSmall1.MarkCompletedObjective(KillOrdos2)
|
||||
AtreidesSmall2.MarkCompletedObjective(KillOrdos3)
|
||||
AtreidesSmall3.MarkCompletedObjective(KillOrdos4)
|
||||
end
|
||||
|
||||
if atreides_main.HasNoRequiredUnits() and atreides_small_1.HasNoRequiredUnits() and atreides_small_2.HasNoRequiredUnits() and atreides_small_3.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then
|
||||
if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall1.HasNoRequiredUnits() and AtreidesSmall2.HasNoRequiredUnits() and AtreidesSmall3.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillAtreides) then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
Ordos.MarkCompletedObjective(KillAtreides)
|
||||
end
|
||||
|
||||
if #player.GetActorsByType("engineer") == 0 and not player.IsObjectiveCompleted(CaptureStarport) then
|
||||
player.MarkFailedObjective(CaptureStarport)
|
||||
if #Ordos.GetActorsByType("engineer") == 0 and not Ordos.IsObjectiveCompleted(CaptureStarport) then
|
||||
Ordos.MarkFailedObjective(CaptureStarport)
|
||||
end
|
||||
|
||||
if player.IsObjectiveCompleted(CaptureStarport) then
|
||||
if player.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest }
|
||||
if Ordos.IsObjectiveCompleted(CaptureStarport) then
|
||||
if Ordos.Resources ~= CachedResources then
|
||||
local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest }
|
||||
local harvestedResources = UserInterface.Translate("harvested-resources", parameters)
|
||||
UserInterface.SetMissionText(harvestedResources)
|
||||
CachedResources = player.Resources
|
||||
CachedResources = Ordos.Resources
|
||||
end
|
||||
end
|
||||
|
||||
CheckHarvester(atreides_main)
|
||||
CheckHarvester(atreides_small_1)
|
||||
CheckHarvester(AtreidesMain)
|
||||
CheckHarvester(AtreidesSmall1)
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides_main = Player.GetPlayer("AtreidesMainBase")
|
||||
atreides_small_1 = Player.GetPlayer("AtreidesSmallBase1")
|
||||
atreides_small_2 = Player.GetPlayer("AtreidesSmallBase2")
|
||||
atreides_small_3 = Player.GetPlayer("AtreidesSmallBase3")
|
||||
player = Player.GetPlayer("Ordos")
|
||||
AtreidesMain = Player.GetPlayer("AtreidesMainBase")
|
||||
AtreidesSmall1 = Player.GetPlayer("AtreidesSmallBase1")
|
||||
AtreidesSmall2 = Player.GetPlayer("AtreidesSmallBase2")
|
||||
AtreidesSmall3 = Player.GetPlayer("AtreidesSmallBase3")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
|
||||
SpiceToHarvest = ToHarvest[Difficulty]
|
||||
|
||||
InitObjectives(player)
|
||||
KillOrdos1 = AddPrimaryObjective(atreides_main, "")
|
||||
KillOrdos2 = AddPrimaryObjective(atreides_small_1, "")
|
||||
KillOrdos3 = AddPrimaryObjective(atreides_small_2, "")
|
||||
KillOrdos4 = AddPrimaryObjective(atreides_small_3, "")
|
||||
CaptureStarport = AddPrimaryObjective(player, "capture-atreides-starport-establish-base")
|
||||
InitObjectives(Ordos)
|
||||
KillOrdos1 = AddPrimaryObjective(AtreidesMain, "")
|
||||
KillOrdos2 = AddPrimaryObjective(AtreidesSmall1, "")
|
||||
KillOrdos3 = AddPrimaryObjective(AtreidesSmall2, "")
|
||||
KillOrdos4 = AddPrimaryObjective(AtreidesSmall3, "")
|
||||
CaptureStarport = AddPrimaryObjective(Ordos, "capture-atreides-starport-establish-base")
|
||||
local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest })
|
||||
GatherSpice = AddPrimaryObjective(player, harvestSpice)
|
||||
KillAtreides = AddSecondaryObjective(player, "destroy-atreides")
|
||||
GatherSpice = AddPrimaryObjective(Ordos, harvestSpice)
|
||||
KillAtreides = AddSecondaryObjective(Ordos, "destroy-atreides")
|
||||
|
||||
Camera.Position = OEngi1.CenterPosition
|
||||
AtreidesAttackLocation = OEngi1.Location
|
||||
@@ -173,45 +173,45 @@ WorldLoaded = function()
|
||||
OCombat2.Destroy()
|
||||
end
|
||||
|
||||
Hunt(atreides_main)
|
||||
Hunt(atreides_small_1)
|
||||
Hunt(atreides_small_2)
|
||||
Hunt(atreides_small_3)
|
||||
Hunt(AtreidesMain)
|
||||
Hunt(AtreidesSmall1)
|
||||
Hunt(AtreidesSmall2)
|
||||
Hunt(AtreidesSmall3)
|
||||
|
||||
local path = function() return Utils.Random(AtreidesPaths) end
|
||||
local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end
|
||||
local waveCondition = function() return Ordos.IsObjectiveCompleted(KillAtreides) end
|
||||
local huntFunction = function(unit)
|
||||
unit.AttackMove(AtreidesAttackLocation)
|
||||
IdleHunt(unit)
|
||||
end
|
||||
SendCarryallReinforcements(atreides_main, 0, 8, AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
SendCarryallReinforcements(AtreidesMain, 0, 8, AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction)
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.light", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = atreides_main })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_1 })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides_small_2 })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.light", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall1 })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall2 })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
|
||||
Trigger.OnKilled(AStarport, function()
|
||||
if not player.IsObjectiveCompleted(CaptureStarport) then
|
||||
player.MarkFailedObjective(CaptureStarport)
|
||||
if not Ordos.IsObjectiveCompleted(CaptureStarport) then
|
||||
Ordos.MarkFailedObjective(CaptureStarport)
|
||||
end
|
||||
end)
|
||||
|
||||
Trigger.OnCapture(AStarport, function()
|
||||
player.MarkCompletedObjective(CaptureStarport)
|
||||
Ordos.MarkCompletedObjective(CaptureStarport)
|
||||
|
||||
if not AIProductionActivated then
|
||||
ActivateAIProduction()
|
||||
end
|
||||
|
||||
Reinforcements.ReinforceWithTransport(player, "frigate", { "mcv" }, { OrdosStarportEntry.Location, AStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })
|
||||
Reinforcements.ReinforceWithTransport(Ordos, "frigate", { "mcv" }, { OrdosStarportEntry.Location, AStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })
|
||||
|
||||
if APower8.Owner ~= player and not APower8.IsDead then
|
||||
if APower8.Owner ~= Ordos and not APower8.IsDead then
|
||||
APower8.Sell()
|
||||
end
|
||||
if APower9.Owner ~= player and not APower9.IsDead then
|
||||
if APower9.Owner ~= Ordos and not APower9.IsDead then
|
||||
APower9.Sell()
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -35,8 +35,8 @@ InitAIUnits = function(house)
|
||||
end
|
||||
|
||||
ActivateAI = function()
|
||||
InitAIUnits(atreides)
|
||||
InitAIUnits(harkonnen)
|
||||
InitAIUnits(Atreides)
|
||||
InitAIUnits(Harkonnen)
|
||||
|
||||
local delay = function() return Utils.RandomInteger(ProductionDelays[Difficulty][1], ProductionDelays[Difficulty][2] + 1) end
|
||||
local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end
|
||||
@@ -45,10 +45,10 @@ ActivateAI = function()
|
||||
local tanksToBuildHarkonnen = function() return { Utils.Random(HarkonnenTankTypes) } end
|
||||
local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5
|
||||
|
||||
ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(atreides, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(atreides, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Atreides, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Atreides, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
|
||||
ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(harkonnen, HHeavyFactory, delay, tanksToBuildHarkonnen, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
ProduceUnits(Harkonnen, HHeavyFactory, delay, tanksToBuildHarkonnen, AttackGroupSize[Difficulty], attackTresholdSize)
|
||||
end
|
||||
|
||||
@@ -143,10 +143,10 @@ ContrabandTimes =
|
||||
|
||||
IxianReinforcementsHaveArrived = UserInterface.Translate("ixian-reinforcements-arrived")
|
||||
SendContraband = function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Media.PlaySpeechNotification(Ordos, "Reinforce")
|
||||
|
||||
for i = 0, 6 do
|
||||
local c = player.Color
|
||||
local c = Ordos.Color
|
||||
if i % 2 == 0 then
|
||||
c = HSLColor.White
|
||||
end
|
||||
@@ -159,7 +159,7 @@ SendContraband = function()
|
||||
|
||||
local entryPath = { CPos.New(82, OStarport.Location.Y + 1), OStarport.Location + CVec.New(1, 1) }
|
||||
local exitPath = { CPos.New(2, OStarport.Location.Y + 1) }
|
||||
Reinforcements.ReinforceWithTransport(player, "frigate", IxianReinforcements[Difficulty], entryPath, exitPath)
|
||||
Reinforcements.ReinforceWithTransport(Ordos, "frigate", IxianReinforcements[Difficulty], entryPath, exitPath)
|
||||
end
|
||||
|
||||
Hunt = function(house)
|
||||
@@ -180,23 +180,23 @@ CheckHarvester = function(house)
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if not player.IsObjectiveCompleted(KillAtreides) and atreides.HasNoRequiredUnits() then
|
||||
if not Ordos.IsObjectiveCompleted(KillAtreides) and Atreides.HasNoRequiredUnits() then
|
||||
Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillAtreides)
|
||||
DestroyCarryalls(atreides)
|
||||
Ordos.MarkCompletedObjective(KillAtreides)
|
||||
DestroyCarryalls(Atreides)
|
||||
|
||||
if player.IsObjectiveCompleted(KillHarkonnen) then
|
||||
player.MarkCompletedObjective(GuardStarport)
|
||||
if Ordos.IsObjectiveCompleted(KillHarkonnen) then
|
||||
Ordos.MarkCompletedObjective(GuardStarport)
|
||||
end
|
||||
end
|
||||
|
||||
if not player.IsObjectiveCompleted(KillHarkonnen) and harkonnen.HasNoRequiredUnits() then
|
||||
if not Ordos.IsObjectiveCompleted(KillHarkonnen) and Harkonnen.HasNoRequiredUnits() then
|
||||
Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat)
|
||||
player.MarkCompletedObjective(KillHarkonnen)
|
||||
DestroyCarryalls(harkonnen)
|
||||
Ordos.MarkCompletedObjective(KillHarkonnen)
|
||||
DestroyCarryalls(Harkonnen)
|
||||
|
||||
if player.IsObjectiveCompleted(KillAtreides) then
|
||||
player.MarkCompletedObjective(GuardStarport)
|
||||
if Ordos.IsObjectiveCompleted(KillAtreides) then
|
||||
Ordos.MarkCompletedObjective(GuardStarport)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -217,29 +217,29 @@ Tick = function()
|
||||
reinforcementsText = UserInterface.Translate("additional-reinforcements-arrive-in", time)
|
||||
end
|
||||
|
||||
UserInterface.SetMissionText(reinforcementsText, player.Color)
|
||||
UserInterface.SetMissionText(reinforcementsText, Ordos.Color)
|
||||
end
|
||||
end
|
||||
|
||||
CheckHarvester(atreides)
|
||||
CheckHarvester(harkonnen)
|
||||
CheckHarvester(Atreides)
|
||||
CheckHarvester(Harkonnen)
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides = Player.GetPlayer("Atreides")
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
player = Player.GetPlayer("Ordos")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
|
||||
InitObjectives(player)
|
||||
GuardStarport = AddPrimaryObjective(player, "defend-starport")
|
||||
KillAtreides = AddPrimaryObjective(player, "destroy-atreides")
|
||||
KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen")
|
||||
InitObjectives(Ordos)
|
||||
GuardStarport = AddPrimaryObjective(Ordos, "defend-starport")
|
||||
KillAtreides = AddPrimaryObjective(Ordos, "destroy-atreides")
|
||||
KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen")
|
||||
|
||||
Camera.Position = OConyard.CenterPosition
|
||||
EnemyAttackLocations = { OConyard.Location, OStarport.Location }
|
||||
|
||||
Trigger.OnRemovedFromWorld(OStarport, function()
|
||||
player.MarkFailedObjective(GuardStarport)
|
||||
Ordos.MarkFailedObjective(GuardStarport)
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(2), function()
|
||||
@@ -248,13 +248,13 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(UserInterface.Translate("ixian-reinforcements-in", time), Mentat)
|
||||
end)
|
||||
|
||||
Hunt(atreides)
|
||||
Hunt(harkonnen)
|
||||
Hunt(Atreides)
|
||||
Hunt(Harkonnen)
|
||||
|
||||
local atreidesPath = function() return Utils.Random(AtreidesPaths) end
|
||||
local harkonnenPath = function() return Utils.Random(HarkonnenPaths) end
|
||||
local atreidesCondition = function() return player.IsObjectiveCompleted(KillAtreides) end
|
||||
local harkonnenCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end
|
||||
local atreidesCondition = function() return Ordos.IsObjectiveCompleted(KillAtreides) end
|
||||
local harkonnenCondition = function() return Ordos.IsObjectiveCompleted(KillHarkonnen) end
|
||||
local huntFunction = function(unit)
|
||||
unit.AttackMove(Utils.Random(EnemyAttackLocations))
|
||||
IdleHunt(unit)
|
||||
@@ -263,16 +263,16 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(UserInterface.Translate("enemy-reinforcements-arrived"), Mentat)
|
||||
end
|
||||
|
||||
SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], atreidesPath, AtreidesReinforcements[Difficulty], atreidesCondition, huntFunction, announcementFunction)
|
||||
SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], atreidesPath, AtreidesReinforcements[Difficulty], atreidesCondition, huntFunction, announcementFunction)
|
||||
|
||||
Trigger.AfterDelay(Utils.RandomInteger(DateTime.Seconds(45), DateTime.Minutes(1) + DateTime.Seconds(15)), function()
|
||||
SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], harkonnenPath, HarkonnenReinforcements[Difficulty], harkonnenCondition, huntFunction, announcementFunction)
|
||||
SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], harkonnenPath, HarkonnenReinforcements[Difficulty], harkonnenCondition, huntFunction, announcementFunction)
|
||||
end)
|
||||
|
||||
Actor.Create("upgrade.barracks", true, { Owner = atreides })
|
||||
Actor.Create("upgrade.light", true, { Owner = atreides })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = atreides })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = harkonnen })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = harkonnen })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = Atreides })
|
||||
Actor.Create("upgrade.light", true, { Owner = Atreides })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = Atreides })
|
||||
Actor.Create("upgrade.barracks", true, { Owner = Harkonnen })
|
||||
Actor.Create("upgrade.heavy", true, { Owner = Harkonnen })
|
||||
Trigger.AfterDelay(0, ActivateAI)
|
||||
end
|
||||
|
||||
@@ -139,26 +139,26 @@ InitializeHarvester = function(harvester)
|
||||
harvester.FindResources()
|
||||
end
|
||||
|
||||
ticks = 0
|
||||
speed = 5
|
||||
Ticks = 0
|
||||
Speed = 5
|
||||
|
||||
Tick = function()
|
||||
ticks = ticks + 1
|
||||
Ticks = Ticks + 1
|
||||
|
||||
if ticks > 1 or not Map.IsPausedShellmap then
|
||||
local t = (ticks + 45) % (360 * speed) * (math.pi / 180) / speed;
|
||||
Camera.Position = viewportOrigin + WVec.New(19200 * math.sin(t), 28800 * math.cos(t), 0)
|
||||
if Ticks > 1 or not Map.IsPausedShellmap then
|
||||
local t = (Ticks + 45) % (360 * Speed) * (math.pi / 180) / Speed;
|
||||
Camera.Position = ViewportOrigin + WVec.New(19200 * math.sin(t), 28800 * math.cos(t), 0)
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
atreides = Player.GetPlayer("Atreides")
|
||||
harkonnen = Player.GetPlayer("Harkonnen")
|
||||
ordos = Player.GetPlayer("Ordos")
|
||||
corrino = Player.GetPlayer("Corrino")
|
||||
smugglers = Player.GetPlayer("Smugglers")
|
||||
Atreides = Player.GetPlayer("Atreides")
|
||||
Harkonnen = Player.GetPlayer("Harkonnen")
|
||||
Ordos = Player.GetPlayer("Ordos")
|
||||
Corrino = Player.GetPlayer("Corrino")
|
||||
Smugglers = Player.GetPlayer("Smugglers")
|
||||
|
||||
viewportOrigin = Camera.Position
|
||||
ViewportOrigin = Camera.Position
|
||||
|
||||
Utils.Do(Utils.Take(4, Upgrades), function(upgrade)
|
||||
atr_cyard.Produce(upgrade)
|
||||
@@ -169,32 +169,32 @@ WorldLoaded = function()
|
||||
atr_cyard.Produce(Upgrades[5])
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(45), function()
|
||||
SendNewHarv(atreides, AtrCarryHarvWaypoints, 3)
|
||||
SendNewHarv(harkonnen, HarCarryHarvWaypoints, 3)
|
||||
SendNewHarv(ordos, OrdCarryHarvWaypoints, 3)
|
||||
SendNewHarv(corrino, CorCarryHarvWaypoints, 3)
|
||||
SendNewHarv(smugglers, SmgCarryHarvWaypoints, 1)
|
||||
SendNewHarv(Atreides, AtrCarryHarvWaypoints, 3)
|
||||
SendNewHarv(Harkonnen, HarCarryHarvWaypoints, 3)
|
||||
SendNewHarv(Ordos, OrdCarryHarvWaypoints, 3)
|
||||
SendNewHarv(Corrino, CorCarryHarvWaypoints, 3)
|
||||
SendNewHarv(Smugglers, SmgCarryHarvWaypoints, 1)
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(1), function()
|
||||
Produce(atreides, AtreidesInfantryTypes)
|
||||
Produce(atreides, AtreidesVehicleTypes)
|
||||
Produce(atreides, AtreidesTankTypes)
|
||||
Produce(atreides, AtreidesStarportTypes)
|
||||
Produce(Atreides, AtreidesInfantryTypes)
|
||||
Produce(Atreides, AtreidesVehicleTypes)
|
||||
Produce(Atreides, AtreidesTankTypes)
|
||||
Produce(Atreides, AtreidesStarportTypes)
|
||||
|
||||
Produce(harkonnen, HarkonnenInfantryTypes)
|
||||
Produce(harkonnen, HarkonnenVehicleTypes)
|
||||
Produce(harkonnen, HarkonnenTankTypes)
|
||||
Produce(harkonnen, HarkonnenStarportTypes)
|
||||
Produce(Harkonnen, HarkonnenInfantryTypes)
|
||||
Produce(Harkonnen, HarkonnenVehicleTypes)
|
||||
Produce(Harkonnen, HarkonnenTankTypes)
|
||||
Produce(Harkonnen, HarkonnenStarportTypes)
|
||||
|
||||
Produce(ordos, OrdosInfantryTypes)
|
||||
Produce(ordos, OrdosVehicleTypes)
|
||||
Produce(ordos, OrdosTankTypes)
|
||||
Produce(ordos, OrdosStarportTypes)
|
||||
Produce(Ordos, OrdosInfantryTypes)
|
||||
Produce(Ordos, OrdosVehicleTypes)
|
||||
Produce(Ordos, OrdosTankTypes)
|
||||
Produce(Ordos, OrdosStarportTypes)
|
||||
|
||||
Produce(corrino, CorrinoInfantryTypes)
|
||||
Produce(corrino, CorrinoVehicleTypes)
|
||||
Produce(corrino, CorrinoTankTypes)
|
||||
Produce(corrino, CorrinoStarportTypes)
|
||||
Produce(Corrino, CorrinoInfantryTypes)
|
||||
Produce(Corrino, CorrinoVehicleTypes)
|
||||
Produce(Corrino, CorrinoTankTypes)
|
||||
Produce(Corrino, CorrinoStarportTypes)
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user