spaces → tabs for @NukemBro's latest missions
This commit is contained in:
@@ -20,360 +20,360 @@ using OpenRA.Widgets;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA.Missions
|
namespace OpenRA.Mods.RA.Missions
|
||||||
{
|
{
|
||||||
class FortLonestarScriptInfo : TraitInfo<FortLonestarScript>, Requires<SpawnMapActorsInfo> { }
|
class FortLonestarScriptInfo : TraitInfo<FortLonestarScript>, Requires<SpawnMapActorsInfo> { }
|
||||||
|
|
||||||
class FortLonestarScript : IWorldLoaded, ITick
|
class FortLonestarScript : IWorldLoaded, ITick
|
||||||
{
|
{
|
||||||
Player multi0;
|
Player multi0;
|
||||||
Player soviets;
|
Player soviets;
|
||||||
|
|
||||||
Actor entry1;
|
Actor entry1;
|
||||||
Actor entry2;
|
Actor entry2;
|
||||||
Actor entry3;
|
Actor entry3;
|
||||||
Actor entry4;
|
Actor entry4;
|
||||||
Actor entry5;
|
Actor entry5;
|
||||||
Actor entry6;
|
Actor entry6;
|
||||||
Actor entry7;
|
Actor entry7;
|
||||||
Actor entry8;
|
Actor entry8;
|
||||||
CPos[] sovietEntryPoints;
|
CPos[] sovietEntryPoints;
|
||||||
Actor paradrop1;
|
Actor paradrop1;
|
||||||
Actor paradrop2;
|
Actor paradrop2;
|
||||||
Actor paradrop3;
|
Actor paradrop3;
|
||||||
Actor paradrop4;
|
Actor paradrop4;
|
||||||
Actor patrol1;
|
Actor patrol1;
|
||||||
Actor patrol2;
|
Actor patrol2;
|
||||||
Actor patrol3;
|
Actor patrol3;
|
||||||
Actor patrol4;
|
Actor patrol4;
|
||||||
World world;
|
World world;
|
||||||
|
|
||||||
int WaveNumber = 0;
|
int WaveNumber = 0;
|
||||||
InfoWidget evacuateWidget;
|
InfoWidget evacuateWidget;
|
||||||
const string ShortEvacuateTemplate = "Wave {0}";
|
const string ShortEvacuateTemplate = "Wave {0}";
|
||||||
static readonly string[] Patrol = { "e1", "e2", "e1" };
|
static readonly string[] Patrol = { "e1", "e2", "e1" };
|
||||||
static readonly string[] Infantry = { "e4", "e1", "e1", "e2", "e1", "e2" };
|
static readonly string[] Infantry = { "e4", "e1", "e1", "e2", "e1", "e2" };
|
||||||
static readonly string[] Vehicles = { "arty", "ftrk", "ftrk", "apc", "apc" };
|
static readonly string[] Vehicles = { "arty", "ftrk", "ftrk", "apc", "apc" };
|
||||||
const string tank = "3tnk";
|
const string tank = "3tnk";
|
||||||
const string v2 = "v2rl";
|
const string v2 = "v2rl";
|
||||||
const string boss = "4tnk";
|
const string boss = "4tnk";
|
||||||
|
|
||||||
const int TimerTicks = 1;
|
const int TimerTicks = 1;
|
||||||
|
|
||||||
int AttackSquad = 6;
|
int AttackSquad = 6;
|
||||||
int AttackSquadCount = 1;
|
int AttackSquadCount = 1;
|
||||||
int VehicleSquad = 2;
|
int VehicleSquad = 2;
|
||||||
int VehicleSquadCount = 1;
|
int VehicleSquadCount = 1;
|
||||||
|
|
||||||
int patrolAttackFrame;
|
int patrolAttackFrame;
|
||||||
int patrolattackAtFrameIncrement;
|
int patrolattackAtFrameIncrement;
|
||||||
int WaveAttackFrame;
|
int WaveAttackFrame;
|
||||||
int WaveAttackAtFrameIncrement;
|
int WaveAttackAtFrameIncrement;
|
||||||
int VehicleAttackFrame;
|
int VehicleAttackFrame;
|
||||||
int VehicleAttackAtFrameIncrement;
|
int VehicleAttackAtFrameIncrement;
|
||||||
|
|
||||||
void MissionAccomplished(string text)
|
void MissionAccomplished(string text)
|
||||||
{
|
{
|
||||||
MissionUtils.CoopMissionAccomplished(world, text, multi0);
|
MissionUtils.CoopMissionAccomplished(world, text, multi0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttackNearestAlliedActor(Actor self)
|
void AttackNearestAlliedActor(Actor self)
|
||||||
{
|
{
|
||||||
var enemies = world.Actors.Where(u => u.IsInWorld && !u.IsDead() && (u.Owner == multi0)
|
var enemies = world.Actors.Where(u => u.IsInWorld && !u.IsDead() && (u.Owner == multi0)
|
||||||
&& ((u.HasTrait<Building>() && !u.HasTrait<Mobile>())));
|
&& ((u.HasTrait<Building>() && !u.HasTrait<Mobile>())));
|
||||||
var targetEnemy = enemies.OrderBy(u => (self.CenterLocation - u.CenterLocation).LengthSquared).FirstOrDefault();
|
var targetEnemy = enemies.OrderBy(u => (self.CenterLocation - u.CenterLocation).LengthSquared).FirstOrDefault();
|
||||||
if (targetEnemy != null)
|
if (targetEnemy != null)
|
||||||
{
|
{
|
||||||
self.QueueActivity(new AttackMove.AttackMoveActivity(self, new Attack(Target.FromActor(targetEnemy), WRange.FromCells(6))));
|
self.QueueActivity(new AttackMove.AttackMoveActivity(self, new Attack(Target.FromActor(targetEnemy), WRange.FromCells(6))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendVehicles()
|
void SendVehicles()
|
||||||
{
|
{
|
||||||
if (SpawnVehicles == true)
|
if (SpawnVehicles == true)
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= VehicleSquadCount; i++)
|
for (int i = 1; i <= VehicleSquadCount; i++)
|
||||||
{
|
{
|
||||||
var route = world.SharedRandom.Next(sovietEntryPoints.Length);
|
var route = world.SharedRandom.Next(sovietEntryPoints.Length);
|
||||||
var spawnPoint = sovietEntryPoints[route];
|
var spawnPoint = sovietEntryPoints[route];
|
||||||
for (int r = 1; r <= VehicleSquad; r++)
|
for (int r = 1; r <= VehicleSquad; r++)
|
||||||
{
|
{
|
||||||
var squad = world.CreateActor(Vehicles.Random(world.SharedRandom),
|
var squad = world.CreateActor(Vehicles.Random(world.SharedRandom),
|
||||||
new TypeDictionary
|
new TypeDictionary
|
||||||
{
|
{
|
||||||
new LocationInit(spawnPoint),
|
new LocationInit(spawnPoint),
|
||||||
new OwnerInit(soviets)
|
new OwnerInit(soviets)
|
||||||
});
|
});
|
||||||
squad.QueueActivity(new AttackMove.AttackMoveActivity(squad, new Move.Move(paradrop1.Location, 3)));
|
squad.QueueActivity(new AttackMove.AttackMoveActivity(squad, new Move.Move(paradrop1.Location, 3)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendWave()
|
void SendWave()
|
||||||
{
|
{
|
||||||
if (SpawnWave == true)
|
if (SpawnWave == true)
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= AttackSquadCount; i++)
|
for (int i = 1; i <= AttackSquadCount; i++)
|
||||||
{
|
{
|
||||||
world.Actors.Where(u => u.IsInWorld && !u.IsDead() && (u.Owner == soviets)
|
world.Actors.Where(u => u.IsInWorld && !u.IsDead() && (u.Owner == soviets)
|
||||||
&& !u.HasTrait<Mobile>());
|
&& !u.HasTrait<Mobile>());
|
||||||
var route = world.SharedRandom.Next(sovietEntryPoints.Length);
|
var route = world.SharedRandom.Next(sovietEntryPoints.Length);
|
||||||
var spawnPoint = sovietEntryPoints[route];
|
var spawnPoint = sovietEntryPoints[route];
|
||||||
for (int r = 1; r < AttackSquad; r++)
|
for (int r = 1; r < AttackSquad; r++)
|
||||||
{
|
{
|
||||||
var squad = world.CreateActor(Infantry.Random(world.SharedRandom),
|
var squad = world.CreateActor(Infantry.Random(world.SharedRandom),
|
||||||
new TypeDictionary
|
new TypeDictionary
|
||||||
{
|
{
|
||||||
new LocationInit(spawnPoint),
|
new LocationInit(spawnPoint),
|
||||||
new OwnerInit(soviets)
|
new OwnerInit(soviets)
|
||||||
});
|
});
|
||||||
squad.QueueActivity(new AttackMove.AttackMoveActivity(squad, new Move.Move(paradrop1.Location, 3)));
|
squad.QueueActivity(new AttackMove.AttackMoveActivity(squad, new Move.Move(paradrop1.Location, 3)));
|
||||||
var scatteredUnits = world.FindAliveCombatantActorsInCircle(Util.CenterOfCell(paradrop1.Location), 15)
|
var scatteredUnits = world.FindAliveCombatantActorsInCircle(Util.CenterOfCell(paradrop1.Location), 15)
|
||||||
.Where(unit => unit.IsIdle && unit.HasTrait<Mobile>() && unit.Owner == soviets);
|
.Where(unit => unit.IsIdle && unit.HasTrait<Mobile>() && unit.Owner == soviets);
|
||||||
foreach (var unit in scatteredUnits)
|
foreach (var unit in scatteredUnits)
|
||||||
{
|
{
|
||||||
AttackNearestAlliedActor(unit);
|
AttackNearestAlliedActor(unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendPatrol(string[] squad, Player owner, CPos location, CPos move)
|
void SendPatrol(string[] squad, Player owner, CPos location, CPos move)
|
||||||
{
|
{
|
||||||
if (SpawnPatrol)
|
if (SpawnPatrol)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < squad.Length; i++)
|
for (int i = 0; i < squad.Length; i++)
|
||||||
{
|
{
|
||||||
var actor = world.CreateActor(squad[i], new TypeDictionary
|
var actor = world.CreateActor(squad[i], new TypeDictionary
|
||||||
{
|
{
|
||||||
new OwnerInit(owner),
|
new OwnerInit(owner),
|
||||||
new LocationInit(location)
|
new LocationInit(location)
|
||||||
});
|
});
|
||||||
actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Move.Move(move, 3)));
|
actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Move.Move(move, 3)));
|
||||||
AttackNearestAlliedActor(actor);
|
AttackNearestAlliedActor(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendBoss(string unit)
|
void SendBoss(string unit)
|
||||||
{
|
{
|
||||||
var route = world.SharedRandom.Next(sovietEntryPoints.Length);
|
var route = world.SharedRandom.Next(sovietEntryPoints.Length);
|
||||||
var spawnPoint = sovietEntryPoints[route];
|
var spawnPoint = sovietEntryPoints[route];
|
||||||
var actor = world.CreateActor(unit, new TypeDictionary
|
var actor = world.CreateActor(unit, new TypeDictionary
|
||||||
{
|
{
|
||||||
new OwnerInit(soviets),
|
new OwnerInit(soviets),
|
||||||
new LocationInit(spawnPoint)
|
new LocationInit(spawnPoint)
|
||||||
});
|
});
|
||||||
if (multi0 != null)
|
if (multi0 != null)
|
||||||
{
|
{
|
||||||
AttackNearestAlliedActor(actor);
|
AttackNearestAlliedActor(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wave(string text)
|
void Wave(string text)
|
||||||
{
|
{
|
||||||
Game.AddChatLine(Color.Cyan, "Wave Sequence", text);
|
Game.AddChatLine(Color.Cyan, "Wave Sequence", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (multi0.WinState != WinState.Undefined) return;
|
if (multi0.WinState != WinState.Undefined) return;
|
||||||
|
|
||||||
if (world.FrameNumber == patrolAttackFrame)
|
if (world.FrameNumber == patrolAttackFrame)
|
||||||
{
|
{
|
||||||
patrolAttackFrame += patrolattackAtFrameIncrement;
|
patrolAttackFrame += patrolattackAtFrameIncrement;
|
||||||
patrolattackAtFrameIncrement = Math.Max(patrolattackAtFrameIncrement - 5, 100);
|
patrolattackAtFrameIncrement = Math.Max(patrolattackAtFrameIncrement - 5, 100);
|
||||||
SendPatrol(Patrol, soviets, patrol1.Location, paradrop1.Location);
|
SendPatrol(Patrol, soviets, patrol1.Location, paradrop1.Location);
|
||||||
SendPatrol(Patrol, soviets, patrol2.Location, paradrop2.Location);
|
SendPatrol(Patrol, soviets, patrol2.Location, paradrop2.Location);
|
||||||
SendPatrol(Patrol, soviets, patrol3.Location, paradrop3.Location);
|
SendPatrol(Patrol, soviets, patrol3.Location, paradrop3.Location);
|
||||||
SendPatrol(Patrol, soviets, patrol4.Location, paradrop4.Location);
|
SendPatrol(Patrol, soviets, patrol4.Location, paradrop4.Location);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == WaveAttackFrame)
|
if (world.FrameNumber == WaveAttackFrame)
|
||||||
{
|
{
|
||||||
WaveAttackFrame += WaveAttackAtFrameIncrement;
|
WaveAttackFrame += WaveAttackAtFrameIncrement;
|
||||||
WaveAttackAtFrameIncrement = Math.Max(WaveAttackAtFrameIncrement - 5, 100);
|
WaveAttackAtFrameIncrement = Math.Max(WaveAttackAtFrameIncrement - 5, 100);
|
||||||
SendWave();
|
SendWave();
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == VehicleAttackFrame)
|
if (world.FrameNumber == VehicleAttackFrame)
|
||||||
{
|
{
|
||||||
VehicleAttackFrame += VehicleAttackAtFrameIncrement;
|
VehicleAttackFrame += VehicleAttackAtFrameIncrement;
|
||||||
VehicleAttackAtFrameIncrement = Math.Max(VehicleAttackAtFrameIncrement - 5, 100);
|
VehicleAttackAtFrameIncrement = Math.Max(VehicleAttackAtFrameIncrement - 5, 100);
|
||||||
SendVehicles();
|
SendVehicles();
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == TimerTicks)
|
if (world.FrameNumber == TimerTicks)
|
||||||
{
|
{
|
||||||
evacuateWidget = new InfoWidget("");
|
evacuateWidget = new InfoWidget("");
|
||||||
Ui.Root.AddChild(evacuateWidget);
|
Ui.Root.AddChild(evacuateWidget);
|
||||||
WaveNumber++;
|
WaveNumber++;
|
||||||
Wave("One Initializing");
|
Wave("One Initializing");
|
||||||
UpdateWaveSequence();
|
UpdateWaveSequence();
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 2)
|
if (world.FrameNumber == 1500 * 2)
|
||||||
{
|
{
|
||||||
WaveNumber++;
|
WaveNumber++;
|
||||||
Wave("Two Initializing");
|
Wave("Two Initializing");
|
||||||
SpawnPatrol = false;
|
SpawnPatrol = false;
|
||||||
AttackSquad = 7;
|
AttackSquad = 7;
|
||||||
AttackSquadCount = 2;
|
AttackSquadCount = 2;
|
||||||
UpdateWaveSequence();
|
UpdateWaveSequence();
|
||||||
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
|
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
|
||||||
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location + new CVec(0, -2));
|
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location + new CVec(0, -2));
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 4)
|
if (world.FrameNumber == 1500 * 4)
|
||||||
{
|
{
|
||||||
WaveNumber++;
|
WaveNumber++;
|
||||||
Wave("Three Initializing");
|
Wave("Three Initializing");
|
||||||
UpdateWaveSequence();
|
UpdateWaveSequence();
|
||||||
AttackSquad = 8;
|
AttackSquad = 8;
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 6)
|
if (world.FrameNumber == 1500 * 6)
|
||||||
{
|
{
|
||||||
WaveNumber++;
|
WaveNumber++;
|
||||||
Wave("Four Initializing");
|
Wave("Four Initializing");
|
||||||
UpdateWaveSequence();
|
UpdateWaveSequence();
|
||||||
AttackSquad = 9;
|
AttackSquad = 9;
|
||||||
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
|
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
|
||||||
MissionUtils.Parabomb(world, soviets, entry2.Location, paradrop3.Location);
|
MissionUtils.Parabomb(world, soviets, entry2.Location, paradrop3.Location);
|
||||||
AttackSquadCount = 3;
|
AttackSquadCount = 3;
|
||||||
VehicleSquad = 3;
|
VehicleSquad = 3;
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 8)
|
if (world.FrameNumber == 1500 * 8)
|
||||||
{
|
{
|
||||||
WaveNumber++;
|
WaveNumber++;
|
||||||
Wave("Five Initializing");
|
Wave("Five Initializing");
|
||||||
UpdateWaveSequence();
|
UpdateWaveSequence();
|
||||||
AttackSquad = 10;
|
AttackSquad = 10;
|
||||||
VehicleSquad = 4;
|
VehicleSquad = 4;
|
||||||
VehicleSquadCount = 2;
|
VehicleSquadCount = 2;
|
||||||
SendBoss(tank);
|
SendBoss(tank);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 11)
|
if (world.FrameNumber == 1500 * 11)
|
||||||
{
|
{
|
||||||
WaveNumber++;
|
WaveNumber++;
|
||||||
Wave("Six Initializing");
|
Wave("Six Initializing");
|
||||||
UpdateWaveSequence();
|
UpdateWaveSequence();
|
||||||
AttackSquad = 11;
|
AttackSquad = 11;
|
||||||
AttackSquadCount = 4;
|
AttackSquadCount = 4;
|
||||||
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
|
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
|
||||||
MissionUtils.Parabomb(world, soviets, entry4.Location, paradrop1.Location);
|
MissionUtils.Parabomb(world, soviets, entry4.Location, paradrop1.Location);
|
||||||
MissionUtils.Parabomb(world, soviets, entry6.Location, paradrop3.Location);
|
MissionUtils.Parabomb(world, soviets, entry6.Location, paradrop3.Location);
|
||||||
MissionUtils.Parabomb(world, soviets, entry5.Location, paradrop3.Location);
|
MissionUtils.Parabomb(world, soviets, entry5.Location, paradrop3.Location);
|
||||||
SendBoss(tank);
|
SendBoss(tank);
|
||||||
SendBoss(tank);
|
SendBoss(tank);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 14)
|
if (world.FrameNumber == 1500 * 14)
|
||||||
{
|
{
|
||||||
WaveNumber++;
|
WaveNumber++;
|
||||||
Wave("Seven Initializing");
|
Wave("Seven Initializing");
|
||||||
UpdateWaveSequence();
|
UpdateWaveSequence();
|
||||||
AttackSquad = 12;
|
AttackSquad = 12;
|
||||||
VehicleSquad = 5;
|
VehicleSquad = 5;
|
||||||
VehicleSquadCount = 3;
|
VehicleSquadCount = 3;
|
||||||
SendBoss(v2);
|
SendBoss(v2);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 17)
|
if (world.FrameNumber == 1500 * 17)
|
||||||
{
|
{
|
||||||
SpawnVehicles = true;
|
SpawnVehicles = true;
|
||||||
WaveNumber++;
|
WaveNumber++;
|
||||||
Wave("Eight Initializing");
|
Wave("Eight Initializing");
|
||||||
UpdateWaveSequence();
|
UpdateWaveSequence();
|
||||||
AttackSquad = 13;
|
AttackSquad = 13;
|
||||||
AttackSquadCount = 5;
|
AttackSquadCount = 5;
|
||||||
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
|
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
|
||||||
MissionUtils.Parabomb(world, soviets, entry4.Location, paradrop1.Location);
|
MissionUtils.Parabomb(world, soviets, entry4.Location, paradrop1.Location);
|
||||||
MissionUtils.Parabomb(world, soviets, entry6.Location, paradrop3.Location);
|
MissionUtils.Parabomb(world, soviets, entry6.Location, paradrop3.Location);
|
||||||
MissionUtils.Parabomb(world, soviets, entry5.Location, paradrop3.Location);
|
MissionUtils.Parabomb(world, soviets, entry5.Location, paradrop3.Location);
|
||||||
MissionUtils.Parabomb(world, soviets, entry2.Location, paradrop2.Location);
|
MissionUtils.Parabomb(world, soviets, entry2.Location, paradrop2.Location);
|
||||||
MissionUtils.Parabomb(world, soviets, entry3.Location, paradrop2.Location);
|
MissionUtils.Parabomb(world, soviets, entry3.Location, paradrop2.Location);
|
||||||
SendBoss(v2);
|
SendBoss(v2);
|
||||||
SendBoss(tank);
|
SendBoss(tank);
|
||||||
SendBoss(v2);
|
SendBoss(v2);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 21)
|
if (world.FrameNumber == 1500 * 21)
|
||||||
{
|
{
|
||||||
WaveNumber++;
|
WaveNumber++;
|
||||||
Wave("Nine Initializing");
|
Wave("Nine Initializing");
|
||||||
UpdateWaveSequence();
|
UpdateWaveSequence();
|
||||||
AttackSquad = 14;
|
AttackSquad = 14;
|
||||||
VehicleSquad = 6;
|
VehicleSquad = 6;
|
||||||
VehicleSquadCount = 4;
|
VehicleSquadCount = 4;
|
||||||
SendBoss(v2);
|
SendBoss(v2);
|
||||||
SendBoss(tank);
|
SendBoss(tank);
|
||||||
SendBoss(tank);
|
SendBoss(tank);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 25)
|
if (world.FrameNumber == 1500 * 25)
|
||||||
{
|
{
|
||||||
WaveNumber++;
|
WaveNumber++;
|
||||||
Wave("Ten Initializing");
|
Wave("Ten Initializing");
|
||||||
UpdateWaveSequence();
|
UpdateWaveSequence();
|
||||||
AttackSquad = 15;
|
AttackSquad = 15;
|
||||||
AttackSquadCount = 6;
|
AttackSquadCount = 6;
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location + new CVec(0, -2));
|
MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location + new CVec(0, -2));
|
||||||
MissionUtils.Parabomb(world, soviets, entry2.Location, paradrop3.Location + new CVec(0, -2));
|
MissionUtils.Parabomb(world, soviets, entry2.Location, paradrop3.Location + new CVec(0, -2));
|
||||||
MissionUtils.Parabomb(world, soviets, entry4.Location, paradrop2.Location + new CVec(0, -2));
|
MissionUtils.Parabomb(world, soviets, entry4.Location, paradrop2.Location + new CVec(0, -2));
|
||||||
MissionUtils.Parabomb(world, soviets, entry5.Location, paradrop4.Location + new CVec(0, -2));
|
MissionUtils.Parabomb(world, soviets, entry5.Location, paradrop4.Location + new CVec(0, -2));
|
||||||
MissionUtils.Parabomb(world, soviets, entry2.Location, paradrop1.Location + new CVec(0, 2));
|
MissionUtils.Parabomb(world, soviets, entry2.Location, paradrop1.Location + new CVec(0, 2));
|
||||||
MissionUtils.Parabomb(world, soviets, entry4.Location, paradrop3.Location + new CVec(0, 2));
|
MissionUtils.Parabomb(world, soviets, entry4.Location, paradrop3.Location + new CVec(0, 2));
|
||||||
MissionUtils.Parabomb(world, soviets, entry3.Location, paradrop2.Location + new CVec(0, 2));
|
MissionUtils.Parabomb(world, soviets, entry3.Location, paradrop2.Location + new CVec(0, 2));
|
||||||
MissionUtils.Parabomb(world, soviets, entry5.Location, paradrop4.Location + new CVec(0, 2));
|
MissionUtils.Parabomb(world, soviets, entry5.Location, paradrop4.Location + new CVec(0, 2));
|
||||||
}
|
}
|
||||||
SendBoss(boss);
|
SendBoss(boss);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 30)
|
if (world.FrameNumber == 1500 * 30)
|
||||||
{
|
{
|
||||||
SpawnWave = false;
|
SpawnWave = false;
|
||||||
SpawnVehicles = false;
|
SpawnVehicles = false;
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 1500 * 31)
|
if (world.FrameNumber == 1500 * 31)
|
||||||
{
|
{
|
||||||
MissionAccomplished("You and your mates have Survived the Onslaught!");
|
MissionAccomplished("You and your mates have Survived the Onslaught!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateWaveSequence()
|
void UpdateWaveSequence()
|
||||||
{
|
{
|
||||||
evacuateWidget.Text = ShortEvacuateTemplate.F(WaveNumber);
|
evacuateWidget.Text = ShortEvacuateTemplate.F(WaveNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpawnPatrol = true;
|
bool SpawnPatrol = true;
|
||||||
|
|
||||||
bool SpawnWave = true;
|
bool SpawnWave = true;
|
||||||
|
|
||||||
bool SpawnVehicles = true;
|
bool SpawnVehicles = true;
|
||||||
|
|
||||||
public void WorldLoaded(World w)
|
public void WorldLoaded(World w)
|
||||||
{
|
{
|
||||||
world = w;
|
world = w;
|
||||||
soviets = w.Players.Single(p => p.InternalName == "Soviets");
|
soviets = w.Players.Single(p => p.InternalName == "Soviets");
|
||||||
multi0 = w.Players.Single(p => p.InternalName == "Multi0");
|
multi0 = w.Players.Single(p => p.InternalName == "Multi0");
|
||||||
patrolAttackFrame = 750;
|
patrolAttackFrame = 750;
|
||||||
patrolattackAtFrameIncrement = 750;
|
patrolattackAtFrameIncrement = 750;
|
||||||
WaveAttackFrame = 500;
|
WaveAttackFrame = 500;
|
||||||
WaveAttackAtFrameIncrement = 500;
|
WaveAttackAtFrameIncrement = 500;
|
||||||
VehicleAttackFrame = 2000;
|
VehicleAttackFrame = 2000;
|
||||||
VehicleAttackAtFrameIncrement = 2000;
|
VehicleAttackAtFrameIncrement = 2000;
|
||||||
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
||||||
entry1 = actors["Entry1"];
|
entry1 = actors["Entry1"];
|
||||||
entry2 = actors["Entry2"];
|
entry2 = actors["Entry2"];
|
||||||
entry3 = actors["Entry3"];
|
entry3 = actors["Entry3"];
|
||||||
entry4 = actors["Entry4"];
|
entry4 = actors["Entry4"];
|
||||||
entry5 = actors["Entry5"];
|
entry5 = actors["Entry5"];
|
||||||
entry6 = actors["Entry6"];
|
entry6 = actors["Entry6"];
|
||||||
entry7 = actors["Entry7"];
|
entry7 = actors["Entry7"];
|
||||||
entry8 = actors["Entry8"];
|
entry8 = actors["Entry8"];
|
||||||
sovietEntryPoints = new[] { entry1, entry2, entry3, entry4, entry5, entry6, entry7, entry8 }.Select(p => p.Location).ToArray();
|
sovietEntryPoints = new[] { entry1, entry2, entry3, entry4, entry5, entry6, entry7, entry8 }.Select(p => p.Location).ToArray();
|
||||||
paradrop1 = actors["Paradrop1"];
|
paradrop1 = actors["Paradrop1"];
|
||||||
paradrop2 = actors["Paradrop2"];
|
paradrop2 = actors["Paradrop2"];
|
||||||
paradrop3 = actors["Paradrop3"];
|
paradrop3 = actors["Paradrop3"];
|
||||||
paradrop4 = actors["Paradrop4"];
|
paradrop4 = actors["Paradrop4"];
|
||||||
patrol1 = actors["Patrol1"];
|
patrol1 = actors["Patrol1"];
|
||||||
patrol2 = actors["Patrol2"];
|
patrol2 = actors["Patrol2"];
|
||||||
patrol3 = actors["Patrol3"];
|
patrol3 = actors["Patrol3"];
|
||||||
patrol4 = actors["Patrol4"];
|
patrol4 = actors["Patrol4"];
|
||||||
MissionUtils.PlayMissionMusic();
|
MissionUtils.PlayMissionMusic();
|
||||||
Game.AddChatLine(Color.Cyan, "Mission", "Defend Fort LoneStar At All costs!");
|
Game.AddChatLine(Color.Cyan, "Mission", "Defend Fort LoneStar At All costs!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,387 +23,387 @@ using OpenRA.Scripting;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA.Missions
|
namespace OpenRA.Mods.RA.Missions
|
||||||
{
|
{
|
||||||
class Survival02ScriptInfo : TraitInfo<Survival02Script>, Requires<SpawnMapActorsInfo> { }
|
class Survival02ScriptInfo : TraitInfo<Survival02Script>, Requires<SpawnMapActorsInfo> { }
|
||||||
|
|
||||||
class Survival02Script : IHasObjectives, IWorldLoaded, ITick
|
class Survival02Script : IHasObjectives, IWorldLoaded, ITick
|
||||||
{
|
{
|
||||||
public event Action<bool> OnObjectivesUpdated = notify => { };
|
public event Action<bool> OnObjectivesUpdated = notify => { };
|
||||||
|
|
||||||
public IEnumerable<Objective> Objectives { get { return objectives.Values; } }
|
public IEnumerable<Objective> Objectives { get { return objectives.Values; } }
|
||||||
|
|
||||||
Dictionary<int, Objective> objectives = new Dictionary<int, Objective>
|
Dictionary<int, Objective> objectives = new Dictionary<int, Objective>
|
||||||
{
|
{
|
||||||
{ maintainPresenceID, new Objective(ObjectiveType.Primary, maintainPresence, ObjectiveStatus.InProgress) },
|
{ maintainPresenceID, new Objective(ObjectiveType.Primary, maintainPresence, ObjectiveStatus.InProgress) },
|
||||||
{ destroySovietsID, new Objective(ObjectiveType.Primary, destroySoviets, ObjectiveStatus.Inactive) },
|
{ destroySovietsID, new Objective(ObjectiveType.Primary, destroySoviets, ObjectiveStatus.Inactive) },
|
||||||
};
|
};
|
||||||
const int destroySovietsID = 0;
|
const int destroySovietsID = 0;
|
||||||
const string destroySoviets = "Excellent work Commander! We have reinforced our position enough to initiate a counter-attack. Destroy the remaining Soviet forces in the area!";
|
const string destroySoviets = "Excellent work Commander! We have reinforced our position enough to initiate a counter-attack. Destroy the remaining Soviet forces in the area!";
|
||||||
const int maintainPresenceID = 1;
|
const int maintainPresenceID = 1;
|
||||||
const string maintainPresence = "Commander! The Soviets have rendered us useless... Reports indicate Soviet reinforcements are coming to finish us off... the situation looks bleak...";
|
const string maintainPresence = "Commander! The Soviets have rendered us useless... Reports indicate Soviet reinforcements are coming to finish us off... the situation looks bleak...";
|
||||||
|
|
||||||
Player allies;
|
Player allies;
|
||||||
Player soviets;
|
Player soviets;
|
||||||
|
|
||||||
Actor sovietEntry1;
|
Actor sovietEntry1;
|
||||||
Actor sovietEntry2;
|
Actor sovietEntry2;
|
||||||
Actor sovietEntry3;
|
Actor sovietEntry3;
|
||||||
CPos[] sovietentrypoints;
|
CPos[] sovietentrypoints;
|
||||||
CPos[] newsovietentrypoints;
|
CPos[] newsovietentrypoints;
|
||||||
|
|
||||||
Actor sovietrally;
|
Actor sovietrally;
|
||||||
Actor sovietrally1;
|
Actor sovietrally1;
|
||||||
Actor sovietrally2;
|
Actor sovietrally2;
|
||||||
Actor sovietrally3;
|
Actor sovietrally3;
|
||||||
Actor sovietrally4;
|
Actor sovietrally4;
|
||||||
Actor sovietrally5;
|
Actor sovietrally5;
|
||||||
Actor sovietrally6;
|
Actor sovietrally6;
|
||||||
Actor sovietrally8;
|
Actor sovietrally8;
|
||||||
CPos[] sovietrallypoints;
|
CPos[] sovietrallypoints;
|
||||||
CPos[] newsovietrallypoints;
|
CPos[] newsovietrallypoints;
|
||||||
|
|
||||||
Actor sovietparadrop1;
|
Actor sovietparadrop1;
|
||||||
Actor sovietparadrop2;
|
Actor sovietparadrop2;
|
||||||
Actor sovietparadrop3;
|
Actor sovietparadrop3;
|
||||||
Actor sovietparadropEntry;
|
Actor sovietparadropEntry;
|
||||||
|
|
||||||
Actor alliesbase;
|
Actor alliesbase;
|
||||||
Actor factory;
|
Actor factory;
|
||||||
Actor barrack1;
|
Actor barrack1;
|
||||||
|
|
||||||
Actor drum1;
|
Actor drum1;
|
||||||
Actor drum2;
|
Actor drum2;
|
||||||
Actor drum3;
|
Actor drum3;
|
||||||
Actor FranceEntry;
|
Actor FranceEntry;
|
||||||
Actor FranceRally;
|
Actor FranceRally;
|
||||||
Actor FranceparaEntry1;
|
Actor FranceparaEntry1;
|
||||||
Actor FranceparaEntry2;
|
Actor FranceparaEntry2;
|
||||||
Actor FranceparaEntry3;
|
Actor FranceparaEntry3;
|
||||||
|
|
||||||
|
|
||||||
World world;
|
World world;
|
||||||
|
|
||||||
CountdownTimer survivalTimer;
|
CountdownTimer survivalTimer;
|
||||||
CountdownTimerWidget survivalTimerWidget;
|
CountdownTimerWidget survivalTimerWidget;
|
||||||
|
|
||||||
const int timerTicks = 1500 * 10;
|
const int timerTicks = 1500 * 10;
|
||||||
const int attackTicks = 1500 * 1;
|
const int attackTicks = 1500 * 1;
|
||||||
const int sovietAttackGroupSize = 7;
|
const int sovietAttackGroupSize = 7;
|
||||||
const int SovietGroupSize = 4;
|
const int SovietGroupSize = 4;
|
||||||
|
|
||||||
const string Camera = "Camera";
|
const string Camera = "Camera";
|
||||||
const string InfantryQueueName = "Infantry";
|
const string InfantryQueueName = "Infantry";
|
||||||
const string Flare = "flare";
|
const string Flare = "flare";
|
||||||
|
|
||||||
static readonly string[] FrenchSquad = { "2tnk", "2tnk", "mcv" };
|
static readonly string[] FrenchSquad = { "2tnk", "2tnk", "mcv" };
|
||||||
static readonly string[] SovietInfantry = { "e1", "e4", "e2" };
|
static readonly string[] SovietInfantry = { "e1", "e4", "e2" };
|
||||||
static readonly string[] SovietVehicles = { "3tnk", "3tnk", "v2rl" };
|
static readonly string[] SovietVehicles = { "3tnk", "3tnk", "v2rl" };
|
||||||
static readonly string[] SovietTanks = { "3tnk", "3tnk", "3tnk" };
|
static readonly string[] SovietTanks = { "3tnk", "3tnk", "3tnk" };
|
||||||
static readonly string[] squad = { "e1", "e1", "e2", "e4", "e4" };
|
static readonly string[] squad = { "e1", "e1", "e2", "e4", "e4" };
|
||||||
static readonly string[] platoon = { "e1", "e1", "e2", "e4", "e4", "e1", "e1", "e2", "e4", "e4" };
|
static readonly string[] platoon = { "e1", "e1", "e2", "e4", "e4", "e1", "e1", "e2", "e4", "e4" };
|
||||||
|
|
||||||
int ProduceAtFrame;
|
int ProduceAtFrame;
|
||||||
int ProduceAtFrameIncrement;
|
int ProduceAtFrameIncrement;
|
||||||
int attackAtFrame;
|
int attackAtFrame;
|
||||||
int attackAtFrameIncrement;
|
int attackAtFrameIncrement;
|
||||||
|
|
||||||
void MissionAccomplished(string text)
|
void MissionAccomplished(string text)
|
||||||
{
|
{
|
||||||
MissionUtils.CoopMissionAccomplished(world, text, allies);
|
MissionUtils.CoopMissionAccomplished(world, text, allies);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MissionFailed(string text)
|
void MissionFailed(string text)
|
||||||
{
|
{
|
||||||
MissionUtils.CoopMissionFailed(world, text, allies);
|
MissionUtils.CoopMissionFailed(world, text, allies);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Message(string text)
|
void Message(string text)
|
||||||
{
|
{
|
||||||
Game.AddChatLine(Color.Aqua, "Incoming Report", text);
|
Game.AddChatLine(Color.Aqua, "Incoming Report", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSovietUnitsToDefensiveStance()
|
void SetSovietUnitsToDefensiveStance()
|
||||||
{
|
{
|
||||||
foreach (var actor in world.Actors.Where(a => a.IsInWorld && a.Owner == soviets && !a.IsDead() && a.HasTrait<AutoTarget>()))
|
foreach (var actor in world.Actors.Where(a => a.IsInWorld && a.Owner == soviets && !a.IsDead() && a.HasTrait<AutoTarget>()))
|
||||||
actor.Trait<AutoTarget>().stance = UnitStance.Defend;
|
actor.Trait<AutoTarget>().stance = UnitStance.Defend;
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor FirstUnshroudedOrDefault(IEnumerable<Actor> actors, World world, int shroudRange)
|
Actor FirstUnshroudedOrDefault(IEnumerable<Actor> actors, World world, int shroudRange)
|
||||||
{
|
{
|
||||||
return actors.FirstOrDefault(u => world.FindAliveCombatantActorsInCircle(u.CenterLocation, shroudRange).All(a => !a.HasTrait<CreatesShroud>()));
|
return actors.FirstOrDefault(u => world.FindAliveCombatantActorsInCircle(u.CenterLocation, shroudRange).All(a => !a.HasTrait<CreatesShroud>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttackNearestAlliedActor(Actor self)
|
void AttackNearestAlliedActor(Actor self)
|
||||||
{
|
{
|
||||||
var enemies = world.Actors.Where(u => u.AppearsHostileTo(self) && (u.Owner == allies)
|
var enemies = world.Actors.Where(u => u.AppearsHostileTo(self) && (u.Owner == allies)
|
||||||
&& ((u.HasTrait<Building>() && !u.HasTrait<Wall>()) || u.HasTrait<Mobile>()) && u.IsInWorld && !u.IsDead());
|
&& ((u.HasTrait<Building>() && !u.HasTrait<Wall>()) || u.HasTrait<Mobile>()) && u.IsInWorld && !u.IsDead());
|
||||||
|
|
||||||
var enemy = FirstUnshroudedOrDefault(enemies.OrderBy(u => (self.CenterLocation - u.CenterLocation).LengthSquared), world, 20);
|
var enemy = FirstUnshroudedOrDefault(enemies.OrderBy(u => (self.CenterLocation - u.CenterLocation).LengthSquared), world, 20);
|
||||||
if (enemy != null)
|
if (enemy != null)
|
||||||
self.QueueActivity(new AttackMove.AttackMoveActivity(self, new Attack(Target.FromActor(enemy), WRange.FromCells(3))));
|
self.QueueActivity(new AttackMove.AttackMoveActivity(self, new Attack(Target.FromActor(enemy), WRange.FromCells(3))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpawnAndAttack(string[] squad, Player owner, CPos location)
|
void SpawnAndAttack(string[] squad, Player owner, CPos location)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < squad.Length; i++)
|
for (int i = 0; i < squad.Length; i++)
|
||||||
{
|
{
|
||||||
var actor = world.CreateActor(squad[i], new TypeDictionary { new OwnerInit(owner), new LocationInit(location) });
|
var actor = world.CreateActor(squad[i], new TypeDictionary { new OwnerInit(owner), new LocationInit(location) });
|
||||||
AttackNearestAlliedActor(actor);
|
AttackNearestAlliedActor(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpawnFlare(Player owner, Actor location)
|
void SpawnFlare(Player owner, Actor location)
|
||||||
{
|
{
|
||||||
world.CreateActor(Flare, new TypeDictionary { new OwnerInit(owner), new LocationInit(location.Location) });
|
world.CreateActor(Flare, new TypeDictionary { new OwnerInit(owner), new LocationInit(location.Location) });
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinalAttack()
|
void FinalAttack()
|
||||||
{
|
{
|
||||||
SpawnAndAttack(SovietTanks, soviets, sovietEntry1.Location);
|
SpawnAndAttack(SovietTanks, soviets, sovietEntry1.Location);
|
||||||
SpawnAndAttack(SovietTanks, soviets, sovietEntry1.Location);
|
SpawnAndAttack(SovietTanks, soviets, sovietEntry1.Location);
|
||||||
SpawnAndAttack(SovietTanks, soviets, sovietEntry2.Location);
|
SpawnAndAttack(SovietTanks, soviets, sovietEntry2.Location);
|
||||||
SpawnAndAttack(platoon, soviets, sovietEntry1.Location);
|
SpawnAndAttack(platoon, soviets, sovietEntry1.Location);
|
||||||
SpawnAndAttack(platoon, soviets, sovietEntry2.Location);
|
SpawnAndAttack(platoon, soviets, sovietEntry2.Location);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrenchReinforcements()
|
void FrenchReinforcements()
|
||||||
{
|
{
|
||||||
Game.MoveViewport(sovietrally1.Location.ToFloat2());
|
Game.MoveViewport(sovietrally1.Location.ToFloat2());
|
||||||
MissionUtils.Parabomb(world, allies, FranceparaEntry1.Location, drum3.Location);
|
MissionUtils.Parabomb(world, allies, FranceparaEntry1.Location, drum3.Location);
|
||||||
MissionUtils.Parabomb(world, allies, FranceparaEntry3.Location, drum2.Location);
|
MissionUtils.Parabomb(world, allies, FranceparaEntry3.Location, drum2.Location);
|
||||||
MissionUtils.Parabomb(world, allies, FranceparaEntry2.Location, drum1.Location);
|
MissionUtils.Parabomb(world, allies, FranceparaEntry2.Location, drum1.Location);
|
||||||
for (int i = 0; i < FrenchSquad.Length; i++)
|
for (int i = 0; i < FrenchSquad.Length; i++)
|
||||||
{
|
{
|
||||||
var actor = world.CreateActor(FrenchSquad[i], new TypeDictionary { new OwnerInit(allies), new LocationInit(FranceEntry.Location) });
|
var actor = world.CreateActor(FrenchSquad[i], new TypeDictionary { new OwnerInit(allies), new LocationInit(FranceEntry.Location) });
|
||||||
actor.QueueActivity(new Move.Move(FranceRally.Location));
|
actor.QueueActivity(new Move.Move(FranceRally.Location));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (allies.WinState != WinState.Undefined)
|
if (allies.WinState != WinState.Undefined)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
survivalTimer.Tick();
|
survivalTimer.Tick();
|
||||||
if (allies != null)
|
if (allies != null)
|
||||||
{
|
{
|
||||||
ManageSovietUnits();
|
ManageSovietUnits();
|
||||||
}
|
}
|
||||||
|
|
||||||
var unitsAndBuildings = world.Actors.Where(a => !a.IsDead() && a.IsInWorld && (a.HasTrait<Mobile>() || (a.HasTrait<Building>() && !a.HasTrait<Wall>())));
|
var unitsAndBuildings = world.Actors.Where(a => !a.IsDead() && a.IsInWorld && (a.HasTrait<Mobile>() || (a.HasTrait<Building>() && !a.HasTrait<Wall>())));
|
||||||
if (!unitsAndBuildings.Any(a => a.Owner == soviets))
|
if (!unitsAndBuildings.Any(a => a.Owner == soviets))
|
||||||
{
|
{
|
||||||
objectives[destroySovietsID].Status = ObjectiveStatus.Completed;
|
objectives[destroySovietsID].Status = ObjectiveStatus.Completed;
|
||||||
MissionAccomplished("We have destroyed the remaining Soviet presence!");
|
MissionAccomplished("We have destroyed the remaining Soviet presence!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.FrameNumber == ProduceAtFrame)
|
if (world.FrameNumber == ProduceAtFrame)
|
||||||
{
|
{
|
||||||
ProduceAtFrame += ProduceAtFrameIncrement;
|
ProduceAtFrame += ProduceAtFrameIncrement;
|
||||||
ProduceAtFrameIncrement = Math.Max(ProduceAtFrameIncrement - 5, 100);
|
ProduceAtFrameIncrement = Math.Max(ProduceAtFrameIncrement - 5, 100);
|
||||||
InitializeSovietFactories(barrack1, sovietrally.Location);
|
InitializeSovietFactories(barrack1, sovietrally.Location);
|
||||||
BuildSovietUnits(factory, barrack1);
|
BuildSovietUnits(factory, barrack1);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == attackAtFrame)
|
if (world.FrameNumber == attackAtFrame)
|
||||||
{
|
{
|
||||||
attackAtFrame += attackAtFrameIncrement;
|
attackAtFrame += attackAtFrameIncrement;
|
||||||
attackAtFrameIncrement = Math.Max(attackAtFrameIncrement - 5, 100);
|
attackAtFrameIncrement = Math.Max(attackAtFrameIncrement - 5, 100);
|
||||||
ManageSovietVehicles();
|
ManageSovietVehicles();
|
||||||
if (producing)
|
if (producing)
|
||||||
{
|
{
|
||||||
BuildSovietVehicles(sovietentrypoints, sovietrallypoints);
|
BuildSovietVehicles(sovietentrypoints, sovietrallypoints);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
BuildSovietVehicles(newsovietentrypoints, newsovietrallypoints);
|
BuildSovietVehicles(newsovietentrypoints, newsovietrallypoints);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == attackTicks)
|
if (world.FrameNumber == attackTicks)
|
||||||
{
|
{
|
||||||
SpawnAndAttack(squad, soviets, sovietrally5.Location);
|
SpawnAndAttack(squad, soviets, sovietrally5.Location);
|
||||||
SpawnAndAttack(squad, soviets, sovietrally6.Location);
|
SpawnAndAttack(squad, soviets, sovietrally6.Location);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == attackTicks * 3)
|
if (world.FrameNumber == attackTicks * 3)
|
||||||
{
|
{
|
||||||
SpawnFlare(soviets, sovietparadrop3);
|
SpawnFlare(soviets, sovietparadrop3);
|
||||||
MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop3.Location);
|
MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop3.Location);
|
||||||
SpawnAndAttack(squad, soviets, sovietrally2.Location);
|
SpawnAndAttack(squad, soviets, sovietrally2.Location);
|
||||||
SpawnAndAttack(platoon, soviets, sovietrally5.Location);
|
SpawnAndAttack(platoon, soviets, sovietrally5.Location);
|
||||||
SpawnAndAttack(platoon, soviets, sovietrally6.Location);
|
SpawnAndAttack(platoon, soviets, sovietrally6.Location);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == attackTicks * 5)
|
if (world.FrameNumber == attackTicks * 5)
|
||||||
{
|
{
|
||||||
SpawnFlare(soviets, sovietparadrop2);
|
SpawnFlare(soviets, sovietparadrop2);
|
||||||
MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop2.Location);
|
MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop2.Location);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == attackTicks * 7)
|
if (world.FrameNumber == attackTicks * 7)
|
||||||
{
|
{
|
||||||
SpawnFlare(soviets, sovietparadrop1);
|
SpawnFlare(soviets, sovietparadrop1);
|
||||||
MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop1.Location);
|
MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop1.Location);
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == attackTicks * 10)
|
if (world.FrameNumber == attackTicks * 10)
|
||||||
{
|
{
|
||||||
SpawnFlare(soviets, sovietparadrop1);
|
SpawnFlare(soviets, sovietparadrop1);
|
||||||
MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop1.Location);
|
MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop1.Location);
|
||||||
ManageSovietUnits();
|
ManageSovietUnits();
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == attackTicks * 12)
|
if (world.FrameNumber == attackTicks * 12)
|
||||||
{
|
{
|
||||||
Sound.Play("reinfor1.aud");
|
Sound.Play("reinfor1.aud");
|
||||||
FrenchReinforcements();
|
FrenchReinforcements();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartCountDownTimer()
|
void StartCountDownTimer()
|
||||||
{
|
{
|
||||||
Sound.Play("timergo1.aud");
|
Sound.Play("timergo1.aud");
|
||||||
survivalTimer = new CountdownTimer(timerTicks, CountDownTimerExpired, true);
|
survivalTimer = new CountdownTimer(timerTicks, CountDownTimerExpired, true);
|
||||||
survivalTimerWidget = new CountdownTimerWidget(survivalTimer, "Time Until Soviet Reinforcements Arrive: {0}");
|
survivalTimerWidget = new CountdownTimerWidget(survivalTimer, "Time Until Soviet Reinforcements Arrive: {0}");
|
||||||
Ui.Root.AddChild(survivalTimerWidget);
|
Ui.Root.AddChild(survivalTimerWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountDownTimerExpired(CountdownTimer countDownTimer)
|
void CountDownTimerExpired(CountdownTimer countDownTimer)
|
||||||
{
|
{
|
||||||
survivalTimerWidget.Visible = false;
|
survivalTimerWidget.Visible = false;
|
||||||
Message("The Soviet reinforcements are approuching!");
|
Message("The Soviet reinforcements are approuching!");
|
||||||
BuildSovietVehicles(newsovietentrypoints, newsovietrallypoints);
|
BuildSovietVehicles(newsovietentrypoints, newsovietrallypoints);
|
||||||
FinalAttack();
|
FinalAttack();
|
||||||
producing = false;
|
producing = false;
|
||||||
objectives[maintainPresenceID].Status = ObjectiveStatus.Completed;
|
objectives[maintainPresenceID].Status = ObjectiveStatus.Completed;
|
||||||
objectives[destroySovietsID].Status = ObjectiveStatus.InProgress;
|
objectives[destroySovietsID].Status = ObjectiveStatus.InProgress;
|
||||||
OnObjectivesUpdated(true);
|
OnObjectivesUpdated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeSovietFactories(Actor tent, CPos rally)
|
void InitializeSovietFactories(Actor tent, CPos rally)
|
||||||
{
|
{
|
||||||
if (tent.IsInWorld && !tent.IsDead())
|
if (tent.IsInWorld && !tent.IsDead())
|
||||||
{
|
{
|
||||||
var sbrp = tent.Trait<RallyPoint>();
|
var sbrp = tent.Trait<RallyPoint>();
|
||||||
sbrp.rallyPoint = rally;
|
sbrp.rallyPoint = rally;
|
||||||
sbrp.nearEnough = 6;
|
sbrp.nearEnough = 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSovietUnit(string category, string unit)
|
void BuildSovietUnit(string category, string unit)
|
||||||
{
|
{
|
||||||
var queueTent = MissionUtils.FindQueues(world, soviets, category).FirstOrDefault(q => q.CurrentItem() == null);
|
var queueTent = MissionUtils.FindQueues(world, soviets, category).FirstOrDefault(q => q.CurrentItem() == null);
|
||||||
if (queueTent == null) return;
|
if (queueTent == null) return;
|
||||||
queueTent.ResolveOrder(queueTent.self, Order.StartProduction(queueTent.self, unit, 1));
|
queueTent.ResolveOrder(queueTent.self, Order.StartProduction(queueTent.self, unit, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSovietUnits(Actor factory, Actor tent)
|
void BuildSovietUnits(Actor factory, Actor tent)
|
||||||
{
|
{
|
||||||
if (barrack1.IsInWorld && !barrack1.IsDead())
|
if (barrack1.IsInWorld && !barrack1.IsDead())
|
||||||
{
|
{
|
||||||
BuildSovietUnit(InfantryQueueName, SovietInfantry.Random(world.SharedRandom));
|
BuildSovietUnit(InfantryQueueName, SovietInfantry.Random(world.SharedRandom));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManageSovietUnits()
|
void ManageSovietUnits()
|
||||||
{
|
{
|
||||||
var units = world.FindAliveCombatantActorsInCircle(sovietrally.CenterLocation, 3)
|
var units = world.FindAliveCombatantActorsInCircle(sovietrally.CenterLocation, 3)
|
||||||
.Where(u => u.IsIdle && u.HasTrait<IMove>() && u.HasTrait<AttackBase>() && u.Owner == soviets);
|
.Where(u => u.IsIdle && u.HasTrait<IMove>() && u.HasTrait<AttackBase>() && u.Owner == soviets);
|
||||||
if (units.Count() >= sovietAttackGroupSize)
|
if (units.Count() >= sovietAttackGroupSize)
|
||||||
{
|
{
|
||||||
foreach (var unit in units)
|
foreach (var unit in units)
|
||||||
{
|
{
|
||||||
var route = world.SharedRandom.Next(sovietrallypoints.Length);
|
var route = world.SharedRandom.Next(sovietrallypoints.Length);
|
||||||
unit.QueueActivity(new Move.Move(sovietrally3.Location));
|
unit.QueueActivity(new Move.Move(sovietrally3.Location));
|
||||||
unit.QueueActivity(new Wait(300));
|
unit.QueueActivity(new Wait(300));
|
||||||
unit.QueueActivity(new Move.Move(sovietrallypoints[route]));
|
unit.QueueActivity(new Move.Move(sovietrallypoints[route]));
|
||||||
AttackNearestAlliedActor(unit);
|
AttackNearestAlliedActor(unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSovietVehicles(CPos[] spawnpoints, CPos[] rallypoints)
|
void BuildSovietVehicles(CPos[] spawnpoints, CPos[] rallypoints)
|
||||||
{
|
{
|
||||||
var route = world.SharedRandom.Next(spawnpoints.Length);
|
var route = world.SharedRandom.Next(spawnpoints.Length);
|
||||||
var spawnPoint = spawnpoints[route];
|
var spawnPoint = spawnpoints[route];
|
||||||
var rally = world.SharedRandom.Next(rallypoints.Length);
|
var rally = world.SharedRandom.Next(rallypoints.Length);
|
||||||
var rallyPoint = rallypoints[rally];
|
var rallyPoint = rallypoints[rally];
|
||||||
var unit = world.CreateActor(SovietVehicles.Random(world.SharedRandom),
|
var unit = world.CreateActor(SovietVehicles.Random(world.SharedRandom),
|
||||||
new TypeDictionary
|
new TypeDictionary
|
||||||
{
|
{
|
||||||
new LocationInit(spawnPoint),
|
new LocationInit(spawnPoint),
|
||||||
new OwnerInit(soviets)
|
new OwnerInit(soviets)
|
||||||
});
|
});
|
||||||
unit.QueueActivity(new AttackMove.AttackMoveActivity(unit, new Move.Move(rallyPoint, 3)));
|
unit.QueueActivity(new AttackMove.AttackMoveActivity(unit, new Move.Move(rallyPoint, 3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManageSovietVehicles()
|
void ManageSovietVehicles()
|
||||||
{
|
{
|
||||||
foreach (var rallyPoint in sovietrallypoints)
|
foreach (var rallyPoint in sovietrallypoints)
|
||||||
{
|
{
|
||||||
var units = world.FindAliveCombatantActorsInCircle(Util.CenterOfCell(rallyPoint), 10)
|
var units = world.FindAliveCombatantActorsInCircle(Util.CenterOfCell(rallyPoint), 10)
|
||||||
.Where(u => u.IsIdle && u.HasTrait<Mobile>() && u.HasTrait<AttackBase>() && u.Owner == soviets);
|
.Where(u => u.IsIdle && u.HasTrait<Mobile>() && u.HasTrait<AttackBase>() && u.Owner == soviets);
|
||||||
if (units.Count() >= SovietGroupSize)
|
if (units.Count() >= SovietGroupSize)
|
||||||
{
|
{
|
||||||
foreach (var unit in units)
|
foreach (var unit in units)
|
||||||
AttackNearestAlliedActor(unit);
|
AttackNearestAlliedActor(unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var scatteredUnits = world.Actors.Where(u => u.IsInWorld && !u.IsDead() && u.HasTrait<Mobile>() && u.IsIdle && u.Owner == soviets)
|
var scatteredUnits = world.Actors.Where(u => u.IsInWorld && !u.IsDead() && u.HasTrait<Mobile>() && u.IsIdle && u.Owner == soviets)
|
||||||
.Except(world.WorldActor.Trait<SpawnMapActors>().Actors.Values)
|
.Except(world.WorldActor.Trait<SpawnMapActors>().Actors.Values)
|
||||||
.Except(sovietrallypoints.SelectMany(rp => world.FindAliveCombatantActorsInCircle(Util.CenterOfCell(rp), 10)));
|
.Except(sovietrallypoints.SelectMany(rp => world.FindAliveCombatantActorsInCircle(Util.CenterOfCell(rp), 10)));
|
||||||
|
|
||||||
foreach (var unit in scatteredUnits)
|
foreach (var unit in scatteredUnits)
|
||||||
AttackNearestAlliedActor(unit);
|
AttackNearestAlliedActor(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool producing = true;
|
bool producing = true;
|
||||||
|
|
||||||
public void WorldLoaded(World w)
|
public void WorldLoaded(World w)
|
||||||
{
|
{
|
||||||
world = w;
|
world = w;
|
||||||
allies = w.Players.SingleOrDefault(p => p.InternalName == "Allies");
|
allies = w.Players.SingleOrDefault(p => p.InternalName == "Allies");
|
||||||
if (allies != null)
|
if (allies != null)
|
||||||
{
|
{
|
||||||
ProduceAtFrame = 300;
|
ProduceAtFrame = 300;
|
||||||
ProduceAtFrameIncrement = 300;
|
ProduceAtFrameIncrement = 300;
|
||||||
attackAtFrame = 450;
|
attackAtFrame = 450;
|
||||||
attackAtFrameIncrement = 450;
|
attackAtFrameIncrement = 450;
|
||||||
}
|
}
|
||||||
soviets = w.Players.Single(p => p.InternalName == "Soviets");
|
soviets = w.Players.Single(p => p.InternalName == "Soviets");
|
||||||
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
||||||
sovietEntry1 = actors["SovietEntry1"];
|
sovietEntry1 = actors["SovietEntry1"];
|
||||||
sovietEntry2 = actors["SovietEntry2"];
|
sovietEntry2 = actors["SovietEntry2"];
|
||||||
sovietEntry3 = actors["SovietEntry3"];
|
sovietEntry3 = actors["SovietEntry3"];
|
||||||
sovietentrypoints = new[] { sovietEntry1, sovietEntry2, sovietEntry3 }.Select(p => p.Location).ToArray();
|
sovietentrypoints = new[] { sovietEntry1, sovietEntry2, sovietEntry3 }.Select(p => p.Location).ToArray();
|
||||||
sovietrally = actors["SovietRally"];
|
sovietrally = actors["SovietRally"];
|
||||||
sovietrally1 = actors["SovietRally1"];
|
sovietrally1 = actors["SovietRally1"];
|
||||||
sovietrally2 = actors["SovietRally2"];
|
sovietrally2 = actors["SovietRally2"];
|
||||||
sovietrally3 = actors["SovietRally3"];
|
sovietrally3 = actors["SovietRally3"];
|
||||||
sovietrally4 = actors["SovietRally4"];
|
sovietrally4 = actors["SovietRally4"];
|
||||||
sovietrally5 = actors["SovietRally5"];
|
sovietrally5 = actors["SovietRally5"];
|
||||||
sovietrally6 = actors["SovietRally6"];
|
sovietrally6 = actors["SovietRally6"];
|
||||||
sovietrally8 = actors["SovietRally8"];
|
sovietrally8 = actors["SovietRally8"];
|
||||||
sovietrallypoints = new[] { sovietrally2, sovietrally4, sovietrally5, sovietrally6 }.Select(p => p.Location).ToArray();
|
sovietrallypoints = new[] { sovietrally2, sovietrally4, sovietrally5, sovietrally6 }.Select(p => p.Location).ToArray();
|
||||||
alliesbase = actors["AlliesBase"];
|
alliesbase = actors["AlliesBase"];
|
||||||
sovietparadropEntry = actors["SovietParaDropEntry"];
|
sovietparadropEntry = actors["SovietParaDropEntry"];
|
||||||
sovietparadrop1 = actors["SovietParaDrop1"];
|
sovietparadrop1 = actors["SovietParaDrop1"];
|
||||||
sovietparadrop2 = actors["SovietParaDrop2"];
|
sovietparadrop2 = actors["SovietParaDrop2"];
|
||||||
sovietparadrop3 = actors["SovietParaDrop3"];
|
sovietparadrop3 = actors["SovietParaDrop3"];
|
||||||
barrack1 = actors["barrack1"];
|
barrack1 = actors["barrack1"];
|
||||||
factory = actors["Factory"];
|
factory = actors["Factory"];
|
||||||
drum1 = actors["drum1"];
|
drum1 = actors["drum1"];
|
||||||
drum2 = actors["drum2"];
|
drum2 = actors["drum2"];
|
||||||
drum3 = actors["drum3"];
|
drum3 = actors["drum3"];
|
||||||
FranceEntry = actors["FranceEntry"];
|
FranceEntry = actors["FranceEntry"];
|
||||||
FranceRally = actors["FranceRally"];
|
FranceRally = actors["FranceRally"];
|
||||||
FranceparaEntry1 = actors["FranceparaEntry1"];
|
FranceparaEntry1 = actors["FranceparaEntry1"];
|
||||||
FranceparaEntry2 = actors["FranceparaEntry2"];
|
FranceparaEntry2 = actors["FranceparaEntry2"];
|
||||||
FranceparaEntry3 = actors["FranceparaEntry3"];
|
FranceparaEntry3 = actors["FranceparaEntry3"];
|
||||||
newsovietentrypoints = new[] { sovietparadropEntry, sovietEntry3 }.Select(p => p.Location).ToArray();
|
newsovietentrypoints = new[] { sovietparadropEntry, sovietEntry3 }.Select(p => p.Location).ToArray();
|
||||||
newsovietrallypoints = new[] { sovietrally3, sovietrally4, sovietrally8 }.Select(p => p.Location).ToArray();
|
newsovietrallypoints = new[] { sovietrally3, sovietrally4, sovietrally8 }.Select(p => p.Location).ToArray();
|
||||||
Game.MoveViewport(alliesbase.Location.ToFloat2());
|
Game.MoveViewport(alliesbase.Location.ToFloat2());
|
||||||
StartCountDownTimer();
|
StartCountDownTimer();
|
||||||
SetSovietUnitsToDefensiveStance();
|
SetSovietUnitsToDefensiveStance();
|
||||||
world.CreateActor(Camera, new TypeDictionary
|
world.CreateActor(Camera, new TypeDictionary
|
||||||
{
|
{
|
||||||
new OwnerInit(allies),
|
new OwnerInit(allies),
|
||||||
new LocationInit(sovietrally1.Location),
|
new LocationInit(sovietrally1.Location),
|
||||||
});
|
});
|
||||||
MissionUtils.PlayMissionMusic();
|
MissionUtils.PlayMissionMusic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user