Add Soviet attacks, scrap chinook timer since we might have pathing issues if Tanya is on the island and we have off-map attacks. Counter this by bringing back reinforcements timer
This commit is contained in:
@@ -15,6 +15,7 @@ using System.Linq;
|
|||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Mods.RA.Activities;
|
using OpenRA.Mods.RA.Activities;
|
||||||
using OpenRA.Mods.RA.Air;
|
using OpenRA.Mods.RA.Air;
|
||||||
|
using OpenRA.Mods.RA.Buildings;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
@@ -56,7 +57,16 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
Player allies2;
|
Player allies2;
|
||||||
Player soviets;
|
Player soviets;
|
||||||
|
|
||||||
|
Actor sovietBarracks;
|
||||||
|
Actor sovietWarFactory;
|
||||||
|
|
||||||
|
const string InfantryQueueName = "Infantry";
|
||||||
|
const string VehicleQueueName = "Vehicle";
|
||||||
|
static readonly string[] sovietInfantry = { "e1", "e2", "e3", "dog" };
|
||||||
|
static readonly string[] sovietVehicles = { "3tnk", "v2rl" };
|
||||||
|
|
||||||
static readonly string[] reinforcements = { "1tnk", "1tnk", "jeep", "mcv" };
|
static readonly string[] reinforcements = { "1tnk", "1tnk", "jeep", "mcv" };
|
||||||
|
|
||||||
const string ChinookName = "tran";
|
const string ChinookName = "tran";
|
||||||
const string SignalFlareName = "flare";
|
const string SignalFlareName = "flare";
|
||||||
const string EngineerName = "e6";
|
const string EngineerName = "e6";
|
||||||
@@ -96,9 +106,13 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
{
|
{
|
||||||
DisplayObjective();
|
DisplayObjective();
|
||||||
}
|
}
|
||||||
if (world.FrameNumber == 200)
|
if (world.FrameNumber == 25 * 10)
|
||||||
{
|
{
|
||||||
SendReinforcements();
|
StartReinforcementsTimer();
|
||||||
|
}
|
||||||
|
if (world.FrameNumber % 25 == 0)
|
||||||
|
{
|
||||||
|
BuildSovietUnits();
|
||||||
}
|
}
|
||||||
if (!engineerMiss.Destroyed && engineer == null && AlliesControlMiss())
|
if (!engineerMiss.Destroyed && engineer == null && AlliesControlMiss())
|
||||||
{
|
{
|
||||||
@@ -113,7 +127,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
DisplayObjective();
|
DisplayObjective();
|
||||||
SpawnSignalFlare();
|
SpawnSignalFlare();
|
||||||
Sound.Play("flaren1.aud");
|
Sound.Play("flaren1.aud");
|
||||||
StartChinookTimer();
|
SendChinook();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (currentObjective == 1)
|
else if (currentObjective == 1)
|
||||||
@@ -133,14 +147,48 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeSovietAI()
|
void BuildSovietUnits()
|
||||||
{
|
{
|
||||||
if (!Game.IsHost)
|
var powerManager = soviets.PlayerActor.Trait<PowerManager>();
|
||||||
|
if (powerManager.ExcessPower < 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var logic = world.LocalPlayer.PlayerActor.TraitsImplementing<IBot>().First(b => b.Info.Name == "Soviet AI");
|
if (!sovietBarracks.Destroyed)
|
||||||
logic.Activate(soviets);
|
{
|
||||||
|
BuildUnitIfQueueIdle(soviets, InfantryQueueName, sovietInfantry[world.SharedRandom.Next(sovietInfantry.Length)]);
|
||||||
|
}
|
||||||
|
if (!sovietWarFactory.Destroyed)
|
||||||
|
{
|
||||||
|
BuildUnitIfQueueIdle(soviets, VehicleQueueName, sovietVehicles[world.SharedRandom.Next(sovietVehicles.Length)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitializeSoviets()
|
||||||
|
{
|
||||||
|
var res = soviets.PlayerActor.Trait<PlayerResources>();
|
||||||
|
res.GiveCash(100000);
|
||||||
|
sovietBarracks.Trait<RallyPoint>().rallyPoint = allies2BasePoint.Location;
|
||||||
|
sovietWarFactory.Trait<RallyPoint>().rallyPoint = allies2BasePoint.Location;
|
||||||
|
sovietBarracks.Trait<PrimaryBuilding>().SetPrimaryProducer(sovietBarracks, true);
|
||||||
|
sovietWarFactory.Trait<PrimaryBuilding>().SetPrimaryProducer(sovietWarFactory, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerable<ProductionQueue> FindQueues(Player player, string category)
|
||||||
|
{
|
||||||
|
return world.ActorsWithTrait<ProductionQueue>()
|
||||||
|
.Where(a => a.Actor.Owner == player && a.Trait.Info.Type == category)
|
||||||
|
.Select(a => a.Trait);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildUnitIfQueueIdle(Player player, string category, string unit)
|
||||||
|
{
|
||||||
|
var queue = FindQueues(player, category).FirstOrDefault(q => q.CurrentItem() == null);
|
||||||
|
if (queue == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
world.IssueOrder(Order.StartProduction(queue.self, unit, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpawnSignalFlare()
|
void SpawnSignalFlare()
|
||||||
@@ -148,17 +196,17 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
world.CreateActor(SignalFlareName, new TypeDictionary { new OwnerInit(allies1), new LocationInit(extractionLZ.Location) });
|
world.CreateActor(SignalFlareName, new TypeDictionary { new OwnerInit(allies1), new LocationInit(extractionLZ.Location) });
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartChinookTimer()
|
void StartReinforcementsTimer()
|
||||||
{
|
{
|
||||||
var timer = new CountdownTimerWidget("Extraction arrives in", 1500 * 6, ChinookTimerExpired, new float2(128, 96));
|
Sound.Play("timergo1.aud");
|
||||||
|
var timer = new CountdownTimerWidget("Reinforcements arrive in", 1500 * 12, ReinforcementsTimerExpired, new float2(128, 96));
|
||||||
Ui.Root.AddChild(timer);
|
Ui.Root.AddChild(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChinookTimerExpired(CountdownTimerWidget timer)
|
void ReinforcementsTimerExpired(CountdownTimerWidget timer)
|
||||||
{
|
{
|
||||||
Sound.Play("reinfor1.aud");
|
|
||||||
timer.Visible = false;
|
timer.Visible = false;
|
||||||
SendChinook();
|
SendReinforcements();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendReinforcements()
|
void SendReinforcements()
|
||||||
@@ -225,12 +273,14 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
extractionLZ = actors["ExtractionLZ"];
|
extractionLZ = actors["ExtractionLZ"];
|
||||||
extractionLZEntryPoint = actors["ExtractionLZEntryPoint"];
|
extractionLZEntryPoint = actors["ExtractionLZEntryPoint"];
|
||||||
engineerMiss = actors["EngineerMiss"];
|
engineerMiss = actors["EngineerMiss"];
|
||||||
|
sovietBarracks = actors["SovietBarracks"];
|
||||||
|
sovietWarFactory = actors["SovietWarFactory"];
|
||||||
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);
|
||||||
w.WorldActor.Trait<Shroud>().Explore(w, sam4.Location, 2);
|
w.WorldActor.Trait<Shroud>().Explore(w, sam4.Location, 2);
|
||||||
Game.MoveViewport(((w.LocalPlayer ?? allies1) == allies1 ? chinookHusk.Location : allies2BasePoint.Location).ToFloat2());
|
Game.MoveViewport(((w.LocalPlayer ?? allies1) == allies1 ? chinookHusk.Location : allies2BasePoint.Location).ToFloat2());
|
||||||
InitializeSovietAI();
|
InitializeSoviets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -374,7 +374,7 @@ Actors:
|
|||||||
Actor529: brik
|
Actor529: brik
|
||||||
Location: 55,71
|
Location: 55,71
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor287: barr
|
SovietBarracks: barr
|
||||||
Location: 54,57
|
Location: 54,57
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor256: e1
|
Actor256: e1
|
||||||
@@ -647,7 +647,7 @@ Actors:
|
|||||||
Actor138: tc01
|
Actor138: tc01
|
||||||
Location: 104,82
|
Location: 104,82
|
||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
Actor170: weap
|
SovietWarFactory: weap
|
||||||
Location: 50,43
|
Location: 50,43
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor164: e1
|
Actor164: e1
|
||||||
@@ -938,7 +938,7 @@ Actors:
|
|||||||
Actor401: brik
|
Actor401: brik
|
||||||
Location: 50,72
|
Location: 50,72
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor54: barr
|
Actor287: barr
|
||||||
Location: 74,82
|
Location: 74,82
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor311: t10
|
Actor311: t10
|
||||||
@@ -1427,11 +1427,11 @@ Actors:
|
|||||||
Actor452: tent
|
Actor452: tent
|
||||||
Location: 36,97
|
Location: 36,97
|
||||||
Owner: Allies2
|
Owner: Allies2
|
||||||
Actor453: proc
|
Actor478: gun
|
||||||
Location: 27,96
|
Location: 37,95
|
||||||
Owner: Allies2
|
Owner: Allies2
|
||||||
Actor457: weap
|
Actor170: weap
|
||||||
Location: 30,104
|
Location: 23,103
|
||||||
Owner: Allies2
|
Owner: Allies2
|
||||||
Actor459: powr
|
Actor459: powr
|
||||||
Location: 38,101
|
Location: 38,101
|
||||||
@@ -1448,9 +1448,9 @@ Actors:
|
|||||||
Actor83: dome
|
Actor83: dome
|
||||||
Location: 36,108
|
Location: 36,108
|
||||||
Owner: Allies2
|
Owner: Allies2
|
||||||
Allies2BasePoint: waypoint
|
Actor484: pbox.e1
|
||||||
Location: 32,97
|
Location: 33,98
|
||||||
Owner: Neutral
|
Owner: Allies2
|
||||||
Actor183: brik
|
Actor183: brik
|
||||||
Location: 24,47
|
Location: 24,47
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
@@ -1479,7 +1479,7 @@ Actors:
|
|||||||
Location: 30,87
|
Location: 30,87
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
ReinforcementsEntryPoint: waypoint
|
ReinforcementsEntryPoint: waypoint
|
||||||
Location: 24,111
|
Location: 31,111
|
||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
Actor456: cycl
|
Actor456: cycl
|
||||||
Location: 36,85
|
Location: 36,85
|
||||||
@@ -1718,17 +1718,17 @@ Actors:
|
|||||||
Actor451: e1
|
Actor451: e1
|
||||||
Location: 35,88
|
Location: 35,88
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor476: pbox.e1
|
Allies2BasePoint: waypoint
|
||||||
Location: 31,95
|
Location: 31,107
|
||||||
Owner: Allies2
|
Owner: Neutral
|
||||||
Actor484: gun
|
Actor54: proc
|
||||||
Location: 37,95
|
Location: 25,95
|
||||||
Owner: Allies2
|
Owner: Allies2
|
||||||
Actor470: cycl
|
Actor470: cycl
|
||||||
Location: 31,84
|
Location: 31,84
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor478: gun
|
Actor476: gun
|
||||||
Location: 25,95
|
Location: 29,95
|
||||||
Owner: Allies2
|
Owner: Allies2
|
||||||
Actor477: e2
|
Actor477: e2
|
||||||
Location: 34,87
|
Location: 34,87
|
||||||
@@ -1748,16 +1748,6 @@ Smudges:
|
|||||||
Rules:
|
Rules:
|
||||||
Player:
|
Player:
|
||||||
-ConquestVictoryConditions:
|
-ConquestVictoryConditions:
|
||||||
HackyAI@SovietAI:
|
|
||||||
Name: Soviet AI
|
|
||||||
BuildingFractions:
|
|
||||||
UnitsToBuild:
|
|
||||||
dog: 10%
|
|
||||||
e1: 50%
|
|
||||||
e2: 20%
|
|
||||||
e3: 10%
|
|
||||||
3tnk: 50%
|
|
||||||
SquadSize: 10
|
|
||||||
World:
|
World:
|
||||||
-CrateDrop:
|
-CrateDrop:
|
||||||
-SpawnMPUnits:
|
-SpawnMPUnits:
|
||||||
|
|||||||
Reference in New Issue
Block a user