-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
df3b6dd
commit 0cff91f
Showing
8 changed files
with
1,393 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
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,195 @@ | ||
--[[ | ||
Copyright 2007-2020 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. | ||
]] | ||
|
||
AttackPaths = { WaypointGroup3, WaypointGroup4, WaypointGroup5 } | ||
NodBase = { handofnod, nodairfield, nodrefinery, NodYard, nodpower1, nodpower2, nodpower3, nodpower4, gun1, gun2, nodsilo1, nodsilo2, nodsilo3, nodsilo4} | ||
|
||
PatrolProductionQueue = { } | ||
|
||
InfantryAttackGroup = { } | ||
InfantryGroupSize = 5 | ||
InfantryProductionCooldown = DateTime.Minutes(3) | ||
InfantryProductionTypes = { "e1", "e1", "e1", "e3", "e3", "e4" } | ||
HarvesterProductionType = { "harv" } | ||
|
||
VehicleAttackGroup = { } | ||
VehicleGroupSize = 5 | ||
VehicleProductionCooldown = DateTime.Minutes(3) | ||
VehicleProductionTypes = { "bggy", "bggy", "bike", "ltnk", "ltnk" } | ||
|
||
StartingCash = 14000 | ||
|
||
BaseRefinery = { type = "proc", pos = CPos.New(24, 16), cost = 1500 } | ||
BaseGun1 = { type = "gun", pos = CPos.New( 21, 19), cost = 600 } | ||
BaseGun2 = { type = "gun", pos = CPos.New( 26, 21), cost = 600 } | ||
BaseNuke1 = { type = "nuke", pos = CPos.New( 23, 14), cost = 500 } | ||
BaseNuke2 = { type = "nuke", pos = CPos.New( 10, 9), cost = 500 } | ||
BaseNuke3 = { type = "nuke", pos = CPos.New( 6, 8), cost = 500 } | ||
BaseNuke4 = { type = "nuke", pos = CPos.New( 8, 8), cost = 500 } | ||
InfantryProduction = { type = "hand", pos = CPos.New(27, 17), cost = 500 } | ||
VehicleProduction = { type = "afld", pos = CPos.New(27, 14), cost = 2000 } | ||
|
||
NodGuards = { Actor154, Actor155, Actor218, Actor219 } | ||
|
||
BaseBuildings = { BaseRefinery, BaseNuke1, BaseNuke2, BaseNuke3, BaseNuke4, InfantryProduction, VehicleProduction, BaseGun1, BaseGun2 } | ||
|
||
BuildBuilding = function(building, cyard) | ||
if CyardIsBuilding or Nod.Cash < building.cost then | ||
Trigger.AfterDelay(DateTime.Seconds(10), function() BuildBuilding(building, cyard) end) | ||
return | ||
end | ||
|
||
CyardIsBuilding = true | ||
|
||
Nod.Cash = Nod.Cash - building.cost | ||
Trigger.AfterDelay(Actor.BuildTime(building.type), function() | ||
CyardIsBuilding = false | ||
|
||
if cyard.IsDead or cyard.Owner ~= Nod then | ||
Nod.Cash = Nod.Cash + building.cost | ||
return | ||
end | ||
|
||
local actor = Actor.Create(building.type, true, { Owner = Nod, Location = building.pos }) | ||
|
||
if actor.Type == 'hand' or actor.Type == 'pyle' then | ||
Trigger.AfterDelay(DateTime.Seconds(10), function() ProduceInfantry(actor) end) | ||
elseif actor.Type == 'afld' or actor.Type == 'weap' then | ||
Trigger.AfterDelay(DateTime.Seconds(10), function() ProduceVehicle(actor) end) | ||
end | ||
|
||
Trigger.OnKilled(actor, function() | ||
BuildBuilding(building, cyard) | ||
end) | ||
|
||
RepairBuilding(GDI, actor, 0.75) | ||
end) | ||
end | ||
|
||
CheckForHarvester = function() | ||
local harv = Nod.GetActorsByType("harv") | ||
return #harv > 0 | ||
end | ||
|
||
GuardBase = function() | ||
Utils.Do(NodBase, function(building) | ||
Trigger.OnDamaged(building, function() | ||
Utils.Do(NodGuards, function(guard) | ||
if not guard.IsDead and not building.IsDead then | ||
guard.Stop() | ||
guard.Guard(building) | ||
end | ||
end) | ||
end) | ||
end) | ||
end | ||
|
||
ProduceHarvester = function(building) | ||
if not buildingHarvester then | ||
buildingHarvester = true | ||
building.Build(HarvesterProductionType, function() | ||
buildingHarvester = false | ||
end) | ||
end | ||
end | ||
|
||
ProduceInfantry = function(building) | ||
if building.IsDead or building.Owner ~= Nod then | ||
return | ||
elseif not CheckForHarvester() then | ||
Trigger.AfterDelay(DateTime.Seconds(10), function() ProduceInfantry(building) end) | ||
return | ||
end | ||
|
||
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9)) | ||
local toBuild = { Utils.Random(InfantryProductionTypes) } | ||
local Path = Utils.Random(AttackPaths) | ||
building.Build(toBuild, function(unit) | ||
InfantryAttackGroup[#InfantryAttackGroup + 1] = unit[1] | ||
|
||
if #InfantryAttackGroup >= InfantryGroupSize then | ||
MoveAndHunt(InfantryAttackGroup, Path) | ||
InfantryAttackGroup = { } | ||
Trigger.AfterDelay(InfantryProductionCooldown, function() ProduceInfantry(building) end) | ||
else | ||
Trigger.AfterDelay(delay, function() ProduceInfantry(building) end) | ||
end | ||
end) | ||
|
||
end | ||
|
||
ProduceVehicle = function(building) | ||
if building.IsDead or building.Owner ~= Nod then | ||
return | ||
elseif not CheckForHarvester() then | ||
ProduceHarvester(building) | ||
Trigger.AfterDelay(DateTime.Seconds(10), function() ProduceVehicle(building) end) | ||
return | ||
end | ||
|
||
local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17)) | ||
local toBuild = { Utils.Random(VehicleProductionTypes) } | ||
local Path = Utils.Random(AttackPaths) | ||
building.Build(toBuild, function(unit) | ||
VehicleAttackGroup[#VehicleAttackGroup + 1] = unit[1] | ||
|
||
if #VehicleAttackGroup >= VehicleGroupSize then | ||
MoveAndHunt(VehicleAttackGroup, Path) | ||
VehicleAttackGroup = { } | ||
Trigger.AfterDelay(VehicleProductionCooldown, function() ProduceVehicle(building) end) | ||
else | ||
Trigger.AfterDelay(delay, function() ProduceVehicle(building) end) | ||
end | ||
end) | ||
end | ||
|
||
StartAI = function() | ||
Nod.Cash = StartingCash | ||
GuardBase() | ||
end | ||
|
||
Trigger.OnAllKilledOrCaptured(NodBase, function() | ||
Utils.Do(Nod.GetGroundAttackers(), IdleHunt) | ||
end) | ||
|
||
Trigger.OnKilled(nodrefinery, function(building) | ||
BuildBuilding(BaseRefinery, NodYard) | ||
end) | ||
|
||
Trigger.OnKilled(nodpower1, function(building) | ||
BuildBuilding(BaseNuke1, NodYard) | ||
end) | ||
|
||
Trigger.OnKilled(nodpower2, function(building) | ||
BuildBuilding(BaseNuke2, NodYard) | ||
end) | ||
|
||
Trigger.OnKilled(nodpower3, function(building) | ||
BuildBuilding(BaseNuke3, NodYard) | ||
end) | ||
|
||
Trigger.OnKilled(nodpower4, function(building) | ||
BuildBuilding(BaseNuke4, NodYard) | ||
end) | ||
|
||
Trigger.OnKilled(gun1, function(building) | ||
BuildBuilding(BaseGun1, NodYard) | ||
end) | ||
|
||
Trigger.OnKilled(gun2, function(building) | ||
BuildBuilding(BaseGun2, NodYard) | ||
end) | ||
|
||
Trigger.OnKilled(handofnod, function(building) | ||
BuildBuilding(InfantryProduction, NodYard) | ||
end) | ||
|
||
Trigger.OnKilled(nodairfield, function(building) | ||
BuildBuilding(VehicleProduction, NodYard) | ||
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,153 @@ | ||
--[[ | ||
Copyright 2007-2020 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. | ||
]] | ||
|
||
SamSites = { sam1, sam2, sam3 } | ||
|
||
WaypointGroup1 = { waypoint4, waypoint5, waypoint6, waypoint7, waypoint10, waypoint11, waypoint12 } | ||
WaypointGroup2 = { waypoint4, waypoint5, waypoint13, waypoint16 } | ||
WaypointGroup3 = { waypoint4, waypoint5, waypoint6, waypoint8 } | ||
WaypointGroup4 = { waypoint4, waypoint5, waypoint6, waypoint7, waypoint9 } | ||
WaypointGroup5 = { waypoint4, waypoint5, waypoint6 } | ||
WaypointGroup6 = { waypoint4, waypoint5, waypoint6, waypoint7, waypoint14, waypoint15 } | ||
WaypointGroup7 = { waypoint4, waypoint5 } | ||
WaypointGroupCiv = { waypoint0, waypoint1, waypoint2, waypoint3 } | ||
|
||
Atk1 = { units = { ['ltnk'] = 1 }, waypoints = WaypointGroup1, delay = 0 } | ||
Atk2 = { units = { ['ltnk'] = 1 }, waypoints = WaypointGroup2, delay = 0 } | ||
Civ1 = { units = { ['c3'] = 1 }, waypoints = WaypointGroupCiv, delay = 0 } | ||
Nod1 = { units = { ['e1'] = 2, ['e2'] = 2, ['e4'] = 2 }, waypoints = WaypointGroup3, delay = 90 } | ||
Nod2 = { units = { ['e3'] = 2, ['e4'] = 2 }, waypoints = WaypointGroup3, delay = 130 } | ||
Nod3 = { units = { ['e1'] = 2, ['e3'] = 3 }, waypoints = WaypointGroup3, delay = 50 } | ||
Nod4 = { units = { ['bggy'] = 2 }, waypoints = WaypointGroup3, delay = 200 } | ||
Nod5 = { units = { ['e4'] = 2, ['ltnk'] = 1 }, waypoints = WaypointGroup1, delay = 250 } | ||
Nod6 = { units = { ['arty'] = 1 }, waypoints = WaypointGroup4, delay = 40 } | ||
Nod7 = { units = { ['e3'] = 2, ['e4'] = 2 }, waypoints = WaypointGroup4, delay = 40 } -- and guard 3, loop 4 | ||
Nod8 = { units = { ['ltnk'] = 1, ['bggy'] = 1 }, waypoints = WaypointGroup3, delay = 170 } | ||
Auto1 = { units = { ['e1'] = 2, ['e2'] = 2 }, waypoints = WaypointGroup5, delay = 50 } | ||
Auto2 = { units = { ['e3'] = 3, ['e4'] = 2 }, waypoints = WaypointGroup3, delay = 50 } | ||
Auto3 = { units = { ['ltnk'] = 1, ['bggy'] = 1 }, waypoints = WaypointGroup3, delay = 50 } | ||
Auto4 = { units = { ['bggy'] = 2 }, waypoints = WaypointGroup7, delay = 50 } -- wp4, wp5, guard 3, loop 2 | ||
Auto5 = { units = { ['ltnk'] = 1 }, waypoints = WaypointGroup6, delay = 50 } | ||
Auto6 = { units = { ['arty'] = 1 }, waypoints = WaypointGroup4, delay = 50 } | ||
Auto7 = { units = { ['e3'] = 3, ['e4'] = 2 }, waypoints = WaypointGroup6, delay = 50 } | ||
|
||
AutoAttackWaves = { Atk1, Atk2, Nod1, Nod2, Nod3, Nod4, Nod5, Nod6, Nod7, Nod8, Auto1, Auto2, Auto3, Auto4, Auto5, Auto6, Auto7 } | ||
|
||
StationaryGuardUnits = { Actor181, Actor182, Actor183, Actor184, Actor198, Actor199, Actor157, Actor175, Actor176, Actor173, Actor174, Actor158, Actor200, Actor159, Actor179, Actor180, Actor184, Actor185, Actor216, Actor217, Actor153, Actor215, Actor214, Actor213} | ||
|
||
DamagedGDIAssets = { Actor126, Actor127, Actor128, Actor129, Actor130,Actor131, Actor132, Actor133, Actor134, Actor135, Actor136, Actor137, Actor138, Actor160, Actor161, Actor162, Actor163, Actor164, Actor165, Actor166, Actor168, Actor169, Actor170} | ||
|
||
StartStationaryGuards = function(StationaryGuards) | ||
Utils.Do(StationaryGuards, function(unit) | ||
if not unit.IsDead then | ||
unit.Patrol( { unit.Location } , true, 20) | ||
end | ||
end) | ||
end | ||
|
||
SendWaves = function(counter, Waves) | ||
if counter <= #Waves then | ||
local team = Waves[counter] | ||
|
||
for type, amount in pairs(team.units) do | ||
MoveAndHunt(Utils.Take(amount, Nod.GetActorsByType(type)), team.waypoints) | ||
end | ||
|
||
Trigger.AfterDelay(DateTime.Seconds(team.delay), function() SendWaves(counter + 1, Waves) end) | ||
end | ||
end | ||
|
||
SendAttackWave = function(team) | ||
for type, amount in pairs(team.units) do | ||
count = 0 | ||
local actors = Nod.GetActorsByType(type) | ||
Utils.Do(actors, function(actor) | ||
if actor.IsIdle and count < amount then | ||
SetAttackWaypoints(actor, team.waypoints) | ||
IdleHunt(actor) | ||
count = count + 1 | ||
end | ||
end) | ||
end | ||
end | ||
|
||
SetAttackWaypoints = function(actor, waypoints) | ||
if not actor.IsDead then | ||
Utils.Do(waypoints, function(waypoint) | ||
actor.AttackMove(waypoint.Location) | ||
end) | ||
end | ||
end | ||
|
||
CeckRepairGDIAssetsObjective = function() | ||
local failed = false | ||
local repaired = true | ||
Utils.Do(DamagedGDIAssets, function(actor) | ||
if actor.IsDead then | ||
failed = true | ||
elseif actor.Health < actor.MaxHealth then | ||
repaired = false | ||
end | ||
end) | ||
|
||
if failed then | ||
GDI.MarkFailedObjective(RepairAssets) | ||
return | ||
elseif repaired then | ||
GDI.MarkCompletedObjective(RepairAssets) | ||
return | ||
end | ||
Trigger.AfterDelay(DateTime.Seconds(3), function() CeckRepairGDIAssetsObjective() end) | ||
end | ||
|
||
WorldLoaded = function() | ||
GDI = Player.GetPlayer("GDI") | ||
Nod = Player.GetPlayer("Nod") | ||
|
||
Camera.Position = DefaultCameraPosition.CenterPosition | ||
|
||
StartStationaryGuards(StationaryGuardUnits) | ||
|
||
StartAI() | ||
|
||
InitObjectives(GDI) | ||
|
||
SecureArea = GDI.AddObjective("Destroy the Nod strike force.") | ||
KillGDI = Nod.AddObjective("Kill all enemies!") | ||
|
||
RepairAssets = GDI.AddObjective("Repair GDI base and vehicles.", "Secondary", false) | ||
Trigger.AfterDelay(DateTime.Seconds(5), function() CeckRepairGDIAssetsObjective() end) | ||
|
||
AirSupport = GDI.AddObjective("Destroy the SAM sites to receive air support.", "Secondary", false) | ||
Trigger.OnAllKilled(SamSites, function() | ||
GDI.MarkCompletedObjective(AirSupport) | ||
Actor.Create("airstrike.proxy", true, { Owner = GDI }) | ||
end) | ||
|
||
local InitialArrivingUnits = { Actor166 } | ||
Utils.Do(InitialArrivingUnits, function(unit) | ||
unit.Move(unit.Location + CVec.New(1, 1), 0) | ||
end) | ||
|
||
Trigger.AfterDelay(DateTime.Minutes(1), function() SendWaves(1, AutoAttackWaves) end) | ||
Trigger.AfterDelay(DateTime.Minutes(2), function() ProduceInfantry(handofnod) end) | ||
Trigger.AfterDelay(DateTime.Minutes(2), function() ProduceVehicle(nodairfield) end) | ||
|
||
end | ||
|
||
Tick = function() | ||
if DateTime.GameTime > DateTime.Seconds(5) then | ||
if GDI.HasNoRequiredUnits() then | ||
Nod.MarkCompletedObjective(KillGDI) | ||
end | ||
if Nod.HasNoRequiredUnits() then | ||
GDI.MarkCompletedObjective(SecureArea) | ||
end | ||
end | ||
end |
Binary file not shown.
Loading
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.