Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust difficulty, add speeches to allies-06a #21401

Open
wants to merge 1 commit into
base: bleed
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions mods/ra/languages/lua/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ destroy-soviet-buildings-units = Destroy all Soviet buildings and units in the a
dont-capture-tech-centers = Do not capture the tech centers! Infiltrate one with a spy.
infiltrate-tech-center-spy = Infiltrate one of the Soviet tech centers with a spy.
capture-radar-shore = Capture the Radar Dome at the shore.
build-naval-yard-redeploy-mcv = Secure a foothold and build a Naval Yard.
If needed, the MCV can be redeployed.

# allies-07
enemy-approaching = Enemy approaching.
Expand Down
104 changes: 53 additions & 51 deletions mods/ra/maps/allies-06a/allies06a-AI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
information, see COPYING.
]]

SovietsActivated = false

WTransWays =
{
{ WaterUnloadEntry1.Location, WaterUnload1.Location },
Expand All @@ -20,23 +22,23 @@ WTransUnits =
}
WTransDelays =
{
easy = 4,
normal = 3,
hard = 1
easy = DateTime.Seconds(240),
normal = DateTime.Seconds(180),
hard = DateTime.Seconds(140)
}

BuildDelays =
{
easy = 90,
normal = 60,
hard = 30
easy = DateTime.Seconds(90),
normal = DateTime.Seconds(60),
hard = DateTime.Seconds(30)
}

WaterAttacks =
FirstAirDelays =
{
easy = 1,
normal = 2,
hard = 3
easy = DateTime.Seconds(180),
normal = DateTime.Seconds(120),
hard = DateTime.Seconds(90)
}

WaterAttackTypes =
Expand All @@ -52,6 +54,7 @@ InfTypes =
{
{ "e1", "e1", "e1"},
{ "e2", "e1", "e1"},
{ "e2", "e2", "e1"},
{ "e4", "e4", "e1"}
}

Expand All @@ -62,14 +65,12 @@ AttackRallyPoints =
{ SovietOreAttack2.Location }
}

ImportantBuildings = { WeaponsFactory, Airfield, dome2, SovietConyard }
ImportantBuildings = { WeaponsFactory, Airfield, EastRadarDome, SovietConyard }
SovietAircraftType = { "yak" }
Yaks = { }
IdlingUnits = { }
IdlingTanks = { tank1, tank2, tank3, tank4, tank5, tank6, tank7, tank8 }
IdlingNavalUnits = { }

InitialiseAttack = function()
PrepareTankDefenders = function()
Utils.Do(ImportantBuildings, function(a)
Trigger.OnDamaged(a, function()
Utils.Do(IdlingTanks, function(unit)
Expand All @@ -81,23 +82,23 @@ InitialiseAttack = function()
end)
end

Attack = 0
InfantryWave = 0
ProduceInfantry = function()
if SovietBarracks.IsDead or SovietBarracks.Owner ~= USSR then
return
end

Attack = Attack + 1
InfantryWave = InfantryWave + 1
local toBuild = Utils.Random(InfTypes)
USSR.Build(toBuild, function(units)
if Attack == 2 and not AttackTnk1.IsDead then
if InfantryWave == 2 and not AttackTnk1.IsDead then
units[#units + 1] = AttackTnk1
elseif Attack == 4 and not AttackTnk2.IsDead then
elseif InfantryWave == 4 and not AttackTnk2.IsDead then
units[#units + 1] = AttackTnk2
end

SendAttack(units, Utils.Random(AttackRallyPoints))
Trigger.AfterDelay(DateTime.Seconds(BuildDelays), ProduceInfantry)
Trigger.AfterDelay(BuildDelays[Difficulty], ProduceInfantry)
end)
end

Expand All @@ -115,24 +116,22 @@ ProduceVehicles = function()
end

ProduceNaval = function()
if not ShouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.Type == "syrd" end) < 1 then
Trigger.AfterDelay(DateTime.Minutes(1), ProduceNaval)
if not Greece.HasPrerequisites({ "syrd" }) then
Trigger.AfterDelay(DateTime.Seconds(60), ProduceNaval)
return
end

ShouldProduce = true

if SubPen.IsDead or SubPen.Owner ~= USSR then
return
end

USSR.Build(WaterAttackTypes, function(units)
USSR.Build(WaterAttackTypes[Difficulty], function(units)
Utils.Do(units, function(unit)
IdlingNavalUnits[#IdlingNavalUnits + 1] = unit
end)

Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), ProduceNaval)
if #IdlingNavalUnits >= WaterAttacks then
if #IdlingNavalUnits >= #WaterAttackTypes[Difficulty] then
Trigger.AfterDelay(DateTime.Seconds(20), function()
SendAttack(SetupNavalAttackGroup(), { Harbor.Location })
end)
Expand All @@ -146,15 +145,12 @@ ProduceAircraft = function()
end

USSR.Build(SovietAircraftType, function(units)
local yak = units[1]
Yaks[#Yaks + 1] = yak

Trigger.OnKilled(yak, ProduceAircraft)
if #Yaks == 1 then
Trigger.AfterDelay(DateTime.Seconds(BuildDelays), ProduceAircraft)
end

InitializeAttackAircraft(yak, Greece)
Utils.Do(units, function(yak)
InitializeAttackAircraft(yak, Greece)
Trigger.OnKilled(yak, function()
Trigger.AfterDelay(BuildDelays[Difficulty], ProduceAircraft)
end)
end)
end)
end

Expand All @@ -167,7 +163,7 @@ end

SetupNavalAttackGroup = function()
local units = { }
for i = 0, 3 do
for i = 1, 3 do
if #IdlingNavalUnits == 0 then
return units
end
Expand All @@ -184,7 +180,7 @@ end

WTransWaves = function()
local way = Utils.Random(WTransWays)
local units = Utils.Random(WTransUnits)
local units = Utils.Random(WTransUnits[Difficulty])
local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2]
Utils.Do(attackUnits, function(a)
Trigger.OnAddedToWorld(a, function()
Expand All @@ -193,25 +189,31 @@ WTransWaves = function()
end)
end)

Trigger.AfterDelay(DateTime.Minutes(WTransDelays), WTransWaves)
Trigger.AfterDelay(WTransDelays[Difficulty], WTransWaves)
end

ActivateAI = function()
WaterAttackTypes = WaterAttackTypes[Difficulty]
WaterAttacks = WaterAttacks[Difficulty]
WTransUnits = WTransUnits[Difficulty]
WTransDelays = WTransDelays[Difficulty]
BuildDelays = BuildDelays[Difficulty]

InitialiseAttack()
Trigger.AfterDelay(DateTime.Seconds(10), ProduceInfantry)
Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(10), function()
ProduceAircraft()
ProduceVehicles()
end)
if SovietsActivated then
return
end
SovietsActivated = true

WeaponsFactory.RallyPoint = WeaponMeetPoint.Location
SubPen.RallyPoint = SubMeetPoint.Location
Trigger.AfterDelay(DateTime.Minutes(5) + DateTime.Seconds(10), ProduceNaval)
Trigger.AfterDelay(DateTime.Minutes(WTransDelays), WTransWaves)
PrepareTankDefenders()
ProduceInfantry()
Trigger.AfterDelay(DateTime.Minutes(1), ProduceVehicles)

Trigger.AfterDelay(FirstAirDelays[Difficulty], ProduceAircraft)
Trigger.OnProduction(Airfield, function()
if not YakCamera.IsInWorld then
return
end

-- This begins neutral to lessen its effect on ground attacks.
YakCamera.Owner = USSR
end)

Trigger.OnAnyKilled(USSR.GetActorsByType("ss"), ProduceNaval)
Trigger.AfterDelay(WTransDelays[Difficulty], WTransWaves)
end