Add Soviet apc/flamer rush after 7 minutes
This commit is contained in:
@@ -51,11 +51,11 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
Actor badgerEntryPoint;
|
Actor badgerEntryPoint;
|
||||||
Actor badgerDropPoint;
|
Actor badgerDropPoint;
|
||||||
Actor sovietRallyPoint;
|
Actor sovietRallyPoint;
|
||||||
|
Actor flamersEntryPoint;
|
||||||
|
|
||||||
Actor einsteinChinook;
|
Actor einsteinChinook;
|
||||||
|
|
||||||
World world;
|
World world;
|
||||||
|
|
||||||
Player allies1;
|
Player allies1;
|
||||||
Player allies2;
|
Player allies2;
|
||||||
Player soviets;
|
Player soviets;
|
||||||
@@ -67,19 +67,24 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
const string InfantryQueueName = "Infantry";
|
const string InfantryQueueName = "Infantry";
|
||||||
const string VehicleQueueName = "Vehicle";
|
const string VehicleQueueName = "Vehicle";
|
||||||
static readonly string[] SovietInfantry = { "e1", "e2", "e3" };
|
static List<string> sovietInfantry = new List<string> { "e1", "e2", "e3" };
|
||||||
static readonly string[] SovietVehicles = { "3tnk" };
|
static List<string> sovietVehicles = new List<string> { "3tnk" };
|
||||||
const int SovietGroupSize = 5;
|
static readonly string[] SovietVehicleAdditions = { "v2rl" };
|
||||||
|
const int SovietGroupSize = 3;
|
||||||
|
const int SovietVehicleAdditionsTicks = 1500 * 4;
|
||||||
|
|
||||||
const int StartReinforcementsTicks = 25 * 10;
|
|
||||||
const int ReinforcementsTicks = 1500 * 12;
|
const int ReinforcementsTicks = 1500 * 12;
|
||||||
static readonly string[] Reinforcements = { "2tnk", "2tnk", "2tnk", "mcv" };
|
static readonly string[] Reinforcements = { "2tnk", "2tnk", "2tnk", "mcv" };
|
||||||
const int ReinforcementsCash = 2000;
|
const int ReinforcementsCash = 2000;
|
||||||
|
|
||||||
const int ParatroopersTicks = 1500 * 5;
|
const int ParatroopersTicks = 1500 * 10;
|
||||||
static readonly string[] Paratroopers = { "e1", "e1", "e1", "e2", "3tnk" };
|
static readonly string[] Paratroopers = { "e1", "e1", "e1", "e2", "3tnk" };
|
||||||
const string BadgerName = "badr";
|
const string BadgerName = "badr";
|
||||||
|
|
||||||
|
const int FlamerTicks = 1500 * 7;
|
||||||
|
static readonly string[] Flamers = { "e4", "e4", "e4", "e4", "e4" };
|
||||||
|
const string ApcName = "apc";
|
||||||
|
|
||||||
const string ChinookName = "tran";
|
const string ChinookName = "tran";
|
||||||
const string SignalFlareName = "flare";
|
const string SignalFlareName = "flare";
|
||||||
const string EngineerName = "e6";
|
const string EngineerName = "e6";
|
||||||
@@ -138,15 +143,20 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
if (world.FrameNumber == 1)
|
if (world.FrameNumber == 1)
|
||||||
{
|
{
|
||||||
InitializeSovietFactories();
|
InitializeSovietFactories();
|
||||||
}
|
|
||||||
if (world.FrameNumber == StartReinforcementsTicks)
|
|
||||||
{
|
|
||||||
StartReinforcementsTimer();
|
StartReinforcementsTimer();
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == ParatroopersTicks)
|
if (world.FrameNumber == ParatroopersTicks)
|
||||||
{
|
{
|
||||||
ParadropSovietUnits();
|
ParadropSovietUnits();
|
||||||
}
|
}
|
||||||
|
if (world.FrameNumber == FlamerTicks)
|
||||||
|
{
|
||||||
|
RushSovietFlamers();
|
||||||
|
}
|
||||||
|
if (world.FrameNumber == SovietVehicleAdditionsTicks)
|
||||||
|
{
|
||||||
|
sovietVehicles.AddRange(SovietVehicleAdditions);
|
||||||
|
}
|
||||||
if (world.FrameNumber % 25 == 0)
|
if (world.FrameNumber % 25 == 0)
|
||||||
{
|
{
|
||||||
AddSovietCashIfRequired();
|
AddSovietCashIfRequired();
|
||||||
@@ -212,28 +222,25 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
{
|
{
|
||||||
if (!sovietBarracks.Destroyed)
|
if (!sovietBarracks.Destroyed)
|
||||||
{
|
{
|
||||||
BuildSovietUnit(InfantryQueueName, SovietInfantry.Random(world.SharedRandom));
|
BuildSovietUnit(InfantryQueueName, sovietInfantry.Random(world.SharedRandom));
|
||||||
}
|
}
|
||||||
if (!sovietWarFactory.Destroyed)
|
if (!sovietWarFactory.Destroyed)
|
||||||
{
|
{
|
||||||
BuildSovietUnit(VehicleQueueName, SovietVehicles.Random(world.SharedRandom));
|
BuildSovietUnit(VehicleQueueName, sovietVehicles.Random(world.SharedRandom));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManageSovietUnits()
|
void ManageSovietUnits()
|
||||||
{
|
{
|
||||||
var idleSovietUnits = UnitsNearActor(allies2BasePoint, 20).Where(a => a.Owner == soviets && a.IsIdle);
|
var idleSovietUnits = ForcesNearActor(allies2BasePoint, 20).Where(a => a.Owner == soviets && a.IsIdle);
|
||||||
var idleSovietUnitsAtRP = UnitsNearActor(sovietRallyPoint, 5).Where(a => a.Owner == soviets && a.IsIdle);
|
var idleSovietUnitsAtRP = ForcesNearActor(sovietRallyPoint, 5).Where(a => a.Owner == soviets && a.IsIdle);
|
||||||
if (idleSovietUnitsAtRP.Count() >= SovietGroupSize)
|
if (idleSovietUnitsAtRP.Count() >= SovietGroupSize)
|
||||||
{
|
{
|
||||||
idleSovietUnits = idleSovietUnits.Union(idleSovietUnitsAtRP);
|
idleSovietUnits = idleSovietUnits.Union(idleSovietUnitsAtRP);
|
||||||
}
|
}
|
||||||
foreach (var unit in idleSovietUnits)
|
foreach (var unit in idleSovietUnits)
|
||||||
{
|
{
|
||||||
var closestAlliedBuilding = BuildingsNearActor(allies2BasePoint, 20)
|
var closestAlliedBuilding = ClosestAlliedBuilding(unit, 20);
|
||||||
.Where(a => a.Owner == allies2)
|
|
||||||
.OrderBy(a => (unit.Location - a.Location).LengthSquared)
|
|
||||||
.FirstOrDefault();
|
|
||||||
if (closestAlliedBuilding != null)
|
if (closestAlliedBuilding != null)
|
||||||
{
|
{
|
||||||
unit.QueueActivity(new AttackMove.AttackMoveActivity(unit, new Move.Move(closestAlliedBuilding.Location, 3)));
|
unit.QueueActivity(new AttackMove.AttackMoveActivity(unit, new Move.Move(closestAlliedBuilding.Location, 3)));
|
||||||
@@ -241,6 +248,14 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Actor ClosestAlliedBuilding(Actor actor, int range)
|
||||||
|
{
|
||||||
|
return BuildingsNearActor(allies2BasePoint, range)
|
||||||
|
.Where(a => a.Owner == allies2)
|
||||||
|
.OrderBy(a => (actor.Location - a.Location).LengthSquared)
|
||||||
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
void InitializeSovietFactories()
|
void InitializeSovietFactories()
|
||||||
{
|
{
|
||||||
sovietBarracks.Trait<RallyPoint>().rallyPoint = sovietRallyPoint.Location;
|
sovietBarracks.Trait<RallyPoint>().rallyPoint = sovietRallyPoint.Location;
|
||||||
@@ -296,6 +311,23 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RushSovietFlamers()
|
||||||
|
{
|
||||||
|
var closestAlliedBuilding = ClosestAlliedBuilding(badgerDropPoint, 10);
|
||||||
|
if (closestAlliedBuilding == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var apc = world.CreateActor(ApcName, new TypeDictionary { new OwnerInit(soviets), new LocationInit(flamersEntryPoint.Location) });
|
||||||
|
foreach (var flamer in Flamers)
|
||||||
|
{
|
||||||
|
var unit = world.CreateActor(false, flamer, new TypeDictionary { new OwnerInit(soviets) });
|
||||||
|
apc.Trait<Cargo>().Load(apc, unit);
|
||||||
|
}
|
||||||
|
apc.QueueActivity(new MoveAdjacentTo(Target.FromActor(closestAlliedBuilding)));
|
||||||
|
apc.QueueActivity(new UnloadCargo(true));
|
||||||
|
}
|
||||||
|
|
||||||
void ReinforcementsTimerExpired(CountdownTimerWidget timer)
|
void ReinforcementsTimerExpired(CountdownTimerWidget timer)
|
||||||
{
|
{
|
||||||
timer.Visible = false;
|
timer.Visible = false;
|
||||||
@@ -331,21 +363,25 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
einsteinChinook.QueueActivity(new RemoveSelf());
|
einsteinChinook.QueueActivity(new RemoveSelf());
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<Actor> BuildingsNearActor(Actor actor, int range)
|
|
||||||
{
|
|
||||||
return world.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range)
|
|
||||||
.Where(a => a.IsInWorld && a != world.WorldActor && !a.Destroyed && a.HasTrait<Building>() && !a.HasTrait<Wall>() && !a.Owner.NonCombatant);
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerable<Actor> UnitsNearActor(Actor actor, int range)
|
IEnumerable<Actor> UnitsNearActor(Actor actor, int range)
|
||||||
{
|
{
|
||||||
return world.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range)
|
return world.FindUnitsInCircle(actor.CenterLocation, Game.CellSize * range)
|
||||||
.Where(a => a.IsInWorld && a != world.WorldActor && !a.Destroyed && a.HasTrait<IMove>() && !a.Owner.NonCombatant);
|
.Where(a => a.IsInWorld && a != world.WorldActor && !a.Destroyed && !a.Owner.NonCombatant);
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerable<Actor> BuildingsNearActor(Actor actor, int range)
|
||||||
|
{
|
||||||
|
return UnitsNearActor(actor, range).Where(a => a.HasTrait<Building>() && !a.HasTrait<Wall>());
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerable<Actor> ForcesNearActor(Actor actor, int range)
|
||||||
|
{
|
||||||
|
return UnitsNearActor(actor, range).Where(a => a.HasTrait<IMove>());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlliesControlMiss()
|
bool AlliesControlMiss()
|
||||||
{
|
{
|
||||||
var units = UnitsNearActor(engineerMiss, EngineerMissClearRange);
|
var units = ForcesNearActor(engineerMiss, EngineerMissClearRange);
|
||||||
return units.Any() && units.All(a => a.Owner == allies1);
|
return units.Any() && units.All(a => a.Owner == allies1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,6 +415,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
sovietBarracks = actors["SovietBarracks"];
|
sovietBarracks = actors["SovietBarracks"];
|
||||||
sovietWarFactory = actors["SovietWarFactory"];
|
sovietWarFactory = actors["SovietWarFactory"];
|
||||||
sovietRallyPoint = actors["SovietRallyPoint"];
|
sovietRallyPoint = actors["SovietRallyPoint"];
|
||||||
|
flamersEntryPoint = actors["FlamersEntryPoint"];
|
||||||
w.WorldActor.Trait<Shroud>().Explore(w, sam1.Location, 2);
|
w.WorldActor.Trait<Shroud>().Explore(w, sam1.Location, 2);
|
||||||
w.WorldActor.Trait<Shroud>().Explore(w, sam2.Location, 2);
|
w.WorldActor.Trait<Shroud>().Explore(w, sam2.Location, 2);
|
||||||
w.WorldActor.Trait<Shroud>().Explore(w, sam3.Location, 2);
|
w.WorldActor.Trait<Shroud>().Explore(w, sam3.Location, 2);
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user