Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
288dfdb
commit 9fb8f6c
Showing
7 changed files
with
1,405 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
--[[ | ||
Copyright 2007-2018 The OpenRA Developers (see AUTHORS) | ||
This file is part of OpenRA, which is free software. It is made | ||
available to you under the terms of the GNU General Public License | ||
as published by the Free Software Foundation, either version 3 of | ||
the License, or (at your option) any later version. For more | ||
information, see COPYING. | ||
]] | ||
IdlingUnits = { } | ||
AttackGroup = { } | ||
AttackGroupSize = 10 | ||
BGAttackGroup = { } | ||
BGAttackGroupSize = 8 | ||
SovietAircraftType = { "yak" } | ||
Yaks = { } | ||
SovietInfantry = { "e1", "e2", "e4" } | ||
SovietVehicles = | ||
{ | ||
hard = { "3tnk", "3tnk", "v2rl" }, | ||
normal = { "3tnk" }, | ||
easy = { "3tnk", "apc" } | ||
} | ||
|
||
ProductionInterval = | ||
{ | ||
easy = DateTime.Seconds(30), | ||
normal = DateTime.Seconds(15), | ||
hard = DateTime.Seconds(5) | ||
} | ||
|
||
IdleHunt = function(unit) if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt) end end | ||
|
||
ParadropDelay = { DateTime.Seconds(30), DateTime.Minutes(1) } | ||
ParadropWaves = 6 | ||
ParadropLZs = { ParaLZ1.CenterPosition, ParaLZ2.CenterPosition, ParaLZ3.CenterPosition, ParaLZ4.CenterPosition } | ||
Paradropped = 0 | ||
|
||
Paradrop = function() | ||
Trigger.AfterDelay(Utils.RandomInteger(ParadropDelay[1], ParadropDelay[2]), function() | ||
local units = PowerProxy.SendParatroopers(Utils.Random(ParadropLZs)) | ||
Utils.Do(units, function(unit) | ||
Trigger.OnAddedToWorld(unit, IdleHunt) | ||
end) | ||
|
||
Paradropped = Paradropped + 1 | ||
if Paradropped <= ParadropWaves then | ||
Paradrop() | ||
end | ||
end) | ||
end | ||
|
||
SendBGAttackGroup = function() | ||
if #BGAttackGroup < BGAttackGroupSize then | ||
return | ||
end | ||
|
||
Utils.Do(BGAttackGroup, function(unit) | ||
if not unit.IsDead then | ||
Trigger.OnIdle(unit, unit.Hunt) | ||
end | ||
end) | ||
|
||
BGAttackGroup = { } | ||
end | ||
|
||
ProduceBadGuyInfantry = function() | ||
if BadGuyRax.IsDead or BadGuyRax.Owner ~= badguy then | ||
return | ||
end | ||
|
||
badguy.Build({ Utils.Random(SovietInfantry) }, function(units) | ||
table.insert(BGAttackGroup, units[1]) | ||
SendBGAttackGroup() | ||
Trigger.AfterDelay(ProductionInterval[Map.LobbyOption("difficulty")], ProduceBadGuyInfantry) | ||
end) | ||
end | ||
|
||
SendAttackGroup = function() | ||
if #AttackGroup < AttackGroupSize then | ||
return | ||
end | ||
|
||
Utils.Do(AttackGroup, function(unit) | ||
if not unit.IsDead then | ||
Trigger.OnIdle(unit, unit.Hunt) | ||
end | ||
end) | ||
|
||
AttackGroup = { } | ||
end | ||
|
||
ProduceUSSRInfantry = function() | ||
if USSRRax.IsDead or USSRRax.Owner ~= ussr then | ||
return | ||
end | ||
|
||
ussr.Build({ Utils.Random(SovietInfantry) }, function(units) | ||
table.insert(AttackGroup, units[1]) | ||
SendAttackGroup() | ||
Trigger.AfterDelay(ProductionInterval[Map.LobbyOption("difficulty")], ProduceUSSRInfantry) | ||
end) | ||
end | ||
|
||
ProduceVehicles = function() | ||
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then | ||
return | ||
end | ||
|
||
ussr.Build({ Utils.Random(SovietVehicles) }, function(units) | ||
table.insert(AttackGroup, units[1]) | ||
SendAttackGroup() | ||
Trigger.AfterDelay(ProductionInterval[Map.LobbyOption("difficulty")], ProduceVehicles) | ||
end) | ||
end | ||
|
||
ProduceAircraft = function() | ||
if (Airfield1.IsDead or Airfield1.Owner ~= ussr) and (Airfield2.IsDead or Airfield2.Owner ~= ussr) and (Airfield3.IsDead or Airfield3.Owner ~= ussr) and (Airfield4.IsDead or Airfield4.Owner ~= ussr) then | ||
return | ||
end | ||
|
||
ussr.Build(SovietAircraftType, function(units) | ||
local yak = units[1] | ||
Yaks[#Yaks + 1] = yak | ||
|
||
Trigger.OnKilled(yak, ProduceAircraft) | ||
|
||
local alive = Utils.Where(Yaks, function(y) return not y.IsDead end) | ||
if #alive < 2 then | ||
Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Map.LobbyOption("difficulty")] / 2), ProduceAircraft) | ||
end | ||
|
||
TargetAndAttack(yak) | ||
end) | ||
end | ||
|
||
TargetAndAttack = function(yak, target) | ||
if not target or target.IsDead or (not target.IsInWorld) then | ||
local enemies = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == greece and self.HasProperty("Health") and yak.CanTarget(self) end) | ||
if #enemies > 0 then | ||
target = Utils.Random(enemies) | ||
end | ||
end | ||
|
||
if target and yak.AmmoCount() > 0 and yak.CanTarget(target) then | ||
yak.Attack(target) | ||
else | ||
yak.ReturnToBase() | ||
end | ||
|
||
yak.CallFunc(function() | ||
TargetAndAttack(yak, target) | ||
end) | ||
end | ||
|
||
ActivateAI = function() | ||
local difficulty = Map.LobbyOption("difficulty") | ||
SovietVehicles = SovietVehicles[difficulty] | ||
|
||
local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) | ||
Utils.Do(buildings, function(actor) | ||
Trigger.OnDamaged(actor, function(building) | ||
if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then | ||
building.StartBuildingRepairs() | ||
end | ||
end) | ||
end) | ||
|
||
Paradrop() | ||
ProduceBadGuyInfantry() | ||
ProduceUSSRInfantry() | ||
ProduceVehicles() | ||
ProduceAircraft() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
--[[ | ||
Copyright 2007-2018 The OpenRA Developers (see AUTHORS) | ||
This file is part of OpenRA, which is free software. It is made | ||
available to you under the terms of the GNU General Public License | ||
as published by the Free Software Foundation, either version 3 of | ||
the License, or (at your option) any later version. For more | ||
information, see COPYING. | ||
]] | ||
DestroySubPensTriggerActivator = { Spen1, Spen2, Spen3, Spen4, Spen5 } | ||
ClearSubActivityTriggerActivator = { Sub1, Sub2, Sub3, Sub4, Sub5, Sub6, Sub7, Sub8, Sub9, Sub10, Sub11, Sub12, Sub13, Sub14, Sub15, Sub16, Sub17 } | ||
AlliedGunboats = { "pt", "pt", "pt" } | ||
BeachRifles = { BeachRifle1, BeachRifle2, BeachRifle3, BeachRifle4 } | ||
|
||
lstReinforcements = | ||
{ | ||
first = | ||
{ | ||
actors = { "mcv", "jeep", "2tnk", "2tnk" }, | ||
entryPath = { AlliedMCVEntry.Location, Unload1.Location }, | ||
exitPath = { AlliedMCVEntry.Location } | ||
}, | ||
second = | ||
{ | ||
actors = { "jeep", "2tnk", "e1", "e1", "e1" }, | ||
entryPath = { AlliedMCVEntry.Location, Unload1.Location }, | ||
exitPath = { AlliedMCVEntry.Location } | ||
} | ||
} | ||
|
||
if Map.LobbyOption("difficulty") == "easy" then | ||
ActivateAIDelay = DateTime.Minutes(1) | ||
else | ||
ActivateAIDelay = DateTime.Seconds(30) | ||
end | ||
|
||
RaidingParty = { "3tnk", "3tnk", "v2rl", "e1", "e2"} | ||
BaseRaidDelay1 = { DateTime.Minutes(1), DateTime.Minutes(2) } | ||
BaseRaidDelay2 = { DateTime.Minutes(3), DateTime.Minutes(4) } | ||
RaidOnePath = { RaidOneEntry.Location, RaidOneLanding.Location } | ||
RaidTwoPath = { RaidTwoEntry.Location, RaidTwoLanding.Location } | ||
|
||
StartTimer = false | ||
TimerColor = Player.GetPlayer("USSR").Color | ||
TimerTicks = DateTime.Minutes(10) | ||
ticked = TimerTicks | ||
StartTimerDelay = DateTime.Minutes(5) | ||
|
||
InitialAlliedReinforcements = function() | ||
Trigger.AfterDelay(DateTime.Seconds(1), function() | ||
Reinforcements.Reinforce(greece, AlliedGunboats, { GunboatEntry.Location, waypoint42.Location }, 2) | ||
Media.PlaySpeechNotification(greece, "ReinforcementsArrived") | ||
local reinforcement = lstReinforcements.first | ||
Reinforcements.ReinforceWithTransport(greece, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) | ||
end) | ||
end | ||
|
||
BeachRunners = function() | ||
Trigger.AfterDelay(DateTime.Seconds(7), function() | ||
Utils.Do(BeachRifles, function(actor) | ||
actor.Move(BeachRifleDestination.Location) | ||
end) | ||
end) | ||
end | ||
|
||
SecondAlliedLanding = function() | ||
Trigger.AfterDelay(DateTime.Minutes(1), function() | ||
Media.PlaySpeechNotification(greece, "ReinforcementsArrived") | ||
local reinforcement = lstReinforcements.second | ||
Reinforcements.ReinforceWithTransport(greece, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) | ||
end) | ||
end | ||
|
||
CaptureRadarDome = function() | ||
Trigger.OnKilled(RadarDome, function() | ||
greece.MarkFailedObjective(CaptureRadarDomeObj) | ||
end) | ||
|
||
Trigger.OnCapture(RadarDome, function() | ||
greece.MarkCompletedObjective(CaptureRadarDomeObj) | ||
BaseRaids() | ||
end) | ||
end | ||
|
||
BaseRaids = function() | ||
if Map.LobbyOption("difficulty") == "easy" then | ||
return | ||
else | ||
Trigger.AfterDelay(Utils.RandomInteger(BaseRaidDelay1[1], BaseRaidDelay1[2]), function() | ||
local raiders = Reinforcements.ReinforceWithTransport(ussr, "lst", RaidingParty, RaidOnePath, { RaidOneEntry.Location })[2] | ||
Utils.Do(raiders, function(a) | ||
Trigger.OnAddedToWorld(a, function() | ||
a.AttackMove(PlayerBase.Location) | ||
IdleHunt(a) | ||
end) | ||
end) | ||
end) | ||
|
||
Trigger.AfterDelay(Utils.RandomInteger(BaseRaidDelay2[1], BaseRaidDelay2[2]), function() | ||
local raiders = Reinforcements.ReinforceWithTransport(ussr, "lst", RaidingParty, RaidTwoPath, { RaidTwoEntry.Location })[2] | ||
Utils.Do(raiders, function(a) | ||
Trigger.OnAddedToWorld(a, function() | ||
a.AttackMove(PlayerBase.Location) | ||
IdleHunt(a) | ||
end) | ||
end) | ||
end) | ||
end | ||
end | ||
|
||
StartTimerFunction = function() | ||
if Map.LobbyOption("difficulty") == "hard" then | ||
StartTimer = true | ||
Media.PlaySpeechNotification(greece, "TimerStarted") | ||
end | ||
end | ||
|
||
FinishTimer = function() | ||
for i = 0, 5, 1 do | ||
local c = TimerColor | ||
if i % 2 == 0 then | ||
c = HSLColor.White | ||
end | ||
|
||
Trigger.AfterDelay(DateTime.Seconds(i), function() UserInterface.SetMissionText("Enemy approaching", c) end) | ||
end | ||
Trigger.AfterDelay(DateTime.Seconds(6), function() UserInterface.SetMissionText("") end) | ||
end | ||
|
||
BattalionWays = | ||
{ | ||
{ HardEntry1.Location, HardLanding1.Location }, | ||
{ HardEntry2.Location, HardLanding2.Location }, | ||
{ HardEntry3.Location, HardLanding3.Location }, | ||
{ HardEntry4.Location, HardLanding4.Location }, | ||
{ HardEntry5.Location, HardLanding5.Location }, | ||
{ HardEntry6.Location, HardLanding6.Location } | ||
} | ||
|
||
SendArmoredBattalion = function() | ||
Media.PlaySpeechNotification(greece, "EnemyUnitsApproaching") | ||
Utils.Do(BattalionWays, function(way) | ||
local units = { "3tnk", "3tnk", "3tnk", "4tnk", "4tnk" } | ||
local armor = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] | ||
Utils.Do(armor, function(a) | ||
Trigger.OnAddedToWorld(a, function() | ||
a.AttackMove(PlayerBase.Location) | ||
IdleHunt(a) | ||
end) | ||
end) | ||
end) | ||
end | ||
|
||
DestroySubPensCompleted = function() | ||
greece.MarkCompletedObjective(DestroySubPens) | ||
end | ||
|
||
ClearSubActivityCompleted = function() | ||
greece.MarkCompletedObjective(ClearSubActivity) | ||
end | ||
|
||
Tick = function() | ||
ussr.Cash = 5000 | ||
badguy.Cash = 500 | ||
|
||
if StartTimer then | ||
if ticked > 0 then | ||
UserInterface.SetMissionText("Soviet armored battalion arrives in " .. Utils.FormatTime(ticked), TimerColor) | ||
ticked = ticked - 1 | ||
elseif ticked == 0 then | ||
FinishTimer() | ||
SendArmoredBattalion() | ||
ticked = ticked - 1 | ||
end | ||
end | ||
|
||
if greece.HasNoRequiredUnits() then | ||
ussr.MarkCompletedObjective(BeatAllies) | ||
end | ||
end | ||
|
||
WorldLoaded = function() | ||
greece = Player.GetPlayer("Greece") | ||
ussr = Player.GetPlayer("USSR") | ||
badguy = Player.GetPlayer("BadGuy") | ||
|
||
Camera.Position = DefaultCameraPosition.CenterPosition | ||
|
||
CaptureRadarDomeObj = greece.AddPrimaryObjective("Capture the Radar Dome.") | ||
DestroySubPens = greece.AddPrimaryObjective("Destroy all Soviet Sub Pens") | ||
ClearSubActivity = greece.AddSecondaryObjective("Clear the area of all sub activity") | ||
BeatAllies = ussr.AddPrimaryObjective("Defeat the Allied forces.") | ||
|
||
Trigger.OnObjectiveCompleted(greece, function(p, id) | ||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") | ||
end) | ||
Trigger.OnObjectiveFailed(greece, function(p, id) | ||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") | ||
end) | ||
|
||
Trigger.OnPlayerLost(greece, function() | ||
Trigger.AfterDelay(DateTime.Seconds(1), function() | ||
Media.PlaySpeechNotification(greece, "MissionFailed") | ||
end) | ||
end) | ||
Trigger.OnPlayerWon(greece, function() | ||
Trigger.AfterDelay(DateTime.Seconds(1), function() | ||
Media.PlaySpeechNotification(greece, "MissionAccomplished") | ||
end) | ||
end) | ||
|
||
PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) | ||
|
||
InitialAlliedReinforcements() | ||
SecondAlliedLanding() | ||
BeachRunners() | ||
CaptureRadarDome() | ||
Trigger.AfterDelay(ActivateAIDelay, ActivateAI) | ||
Trigger.AfterDelay(StartTimerDelay, StartTimerFunction) | ||
|
||
Trigger.OnAllRemovedFromWorld(DestroySubPensTriggerActivator, DestroySubPensCompleted) | ||
Trigger.OnAllRemovedFromWorld(ClearSubActivityTriggerActivator, ClearSubActivityCompleted) | ||
end |
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.