Add general attack code to shellmap

This commit is contained in:
Scott_NZ
2013-04-06 17:15:05 +13:00
parent 30ae1186d8
commit 455dd98eec
2 changed files with 40 additions and 11 deletions

View File

@@ -41,15 +41,19 @@ namespace OpenRA.Mods.RA.Missions
Actor paradropEntry; Actor paradropEntry;
static readonly string[] ParadropUnits = { "e1", "e1", "e1", "e2", "e2" }; static readonly string[] ParadropUnits = { "e1", "e1", "e1", "e2", "e2" };
Actor offmapAttackerSpawn1;
Actor offmapAttackerSpawn2;
Actor offmapAttackerSpawn3;
Actor[] offmapAttackerSpawns;
static readonly string[] OffmapAttackers = { "ftrk", "apc", "ttnk", "1tnk" };
Dictionary<string, Actor> mapActors; Dictionary<string, Actor> mapActors;
public void Tick(Actor self) public void Tick(Actor self)
{ {
MissionUtils.CapOre(soviets); if (world.FrameNumber % 100 == 0)
if (world.FrameNumber % 20 == 0 && coastUnitsLeft-- > 0)
{ {
var u = world.CreateActor(CoastUnits.Random(world.SharedRandom), soviets, coastRP1.Location, null); var u = world.CreateActor(OffmapAttackers.Random(world.SharedRandom), soviets, offmapAttackerSpawns.Random(world.SharedRandom).Location, 128);
u.QueueActivity(new Move.Move(coastRP2.Location, 0));
u.QueueActivity(new AttackMove.AttackMoveActivity(u, new Move.Move(attackLocation.Location, 0))); u.QueueActivity(new AttackMove.AttackMoveActivity(u, new Move.Move(attackLocation.Location, 0)));
} }
@@ -58,6 +62,13 @@ namespace OpenRA.Mods.RA.Missions
.Except(mapActors.Values)) .Except(mapActors.Values))
actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Move.Move(attackLocation.Location, 0))); actor.QueueActivity(new AttackMove.AttackMoveActivity(actor, new Move.Move(attackLocation.Location, 0)));
if (world.FrameNumber % 20 == 0 && coastUnitsLeft-- > 0)
{
var u = world.CreateActor(CoastUnits.Random(world.SharedRandom), soviets, coastRP1.Location, null);
u.QueueActivity(new Move.Move(coastRP2.Location, 0));
u.QueueActivity(new AttackMove.AttackMoveActivity(u, new Move.Move(attackLocation.Location, 0)));
}
if (--waitTicks <= 0) if (--waitTicks <= 0)
{ {
if (++mul <= div) if (++mul <= div)
@@ -75,6 +86,8 @@ namespace OpenRA.Mods.RA.Missions
MissionUtils.Paradrop(world, soviets, ParadropUnits, paradropEntry.Location, paradropLZ.Location); MissionUtils.Paradrop(world, soviets, ParadropUnits, paradropEntry.Location, paradropLZ.Location);
} }
} }
MissionUtils.CapOre(soviets);
} }
public void WorldLoaded(World w) public void WorldLoaded(World w)
@@ -99,6 +112,11 @@ namespace OpenRA.Mods.RA.Missions
var t5 = mapActors["ViewportTarget5"]; var t5 = mapActors["ViewportTarget5"];
viewportTargets = new[] { t1, t2, t3, t4, t5 }.Select(t => t.Location.ToInt2()).ToList(); viewportTargets = new[] { t1, t2, t3, t4, t5 }.Select(t => t.Location.ToInt2()).ToList();
offmapAttackerSpawn1 = mapActors["OffmapAttackerSpawn1"];
offmapAttackerSpawn2 = mapActors["OffmapAttackerSpawn2"];
offmapAttackerSpawn3 = mapActors["OffmapAttackerSpawn3"];
offmapAttackerSpawns = new[] { offmapAttackerSpawn1, offmapAttackerSpawn2, offmapAttackerSpawn3 };
foreach (var actor in mapActors.Values.Where(a => a.Owner == allies || a.HasTrait<Bridge>())) foreach (var actor in mapActors.Values.Where(a => a.Owner == allies || a.HasTrait<Bridge>()))
{ {
if (actor.Owner == allies && actor.HasTrait<AutoTarget>()) if (actor.Owner == allies && actor.HasTrait<AutoTarget>())

View File

@@ -26,6 +26,7 @@ Players:
OwnsWorld: True OwnsWorld: True
NonCombatant: True NonCombatant: True
Race: allies Race: allies
Allies: Allies
PlayerReference@Creeps: PlayerReference@Creeps:
Name: Creeps Name: Creeps
NonCombatant: True NonCombatant: True
@@ -34,6 +35,7 @@ Players:
Name: Allies Name: Allies
Race: allies Race: allies
ColorRamp: 161,134,200,30 ColorRamp: 161,134,200,30
Allies: Neutral
Enemies: Soviets Enemies: Soviets
PlayerReference@Soviets: PlayerReference@Soviets:
Name: Soviets Name: Soviets
@@ -159,9 +161,9 @@ Actors:
Actor38: v28 Actor38: v28
Location: 59,68 Location: 59,68
Owner: Neutral Owner: Neutral
Actor39: v27.gun Actor39: v27
Location: 63,68 Location: 63,68
Owner: Allies Owner: Neutral
Actor40: dome Actor40: dome
Location: 55,19 Location: 55,19
Owner: Soviets Owner: Soviets
@@ -180,9 +182,9 @@ Actors:
Actor45: v28.gun Actor45: v28.gun
Location: 47,63 Location: 47,63
Owner: Allies Owner: Allies
Actor46: v22 Actor46: v22.gun
Location: 61,63 Location: 61,63
Owner: Neutral Owner: Allies
Actor47: v27 Actor47: v27
Location: 55,65 Location: 55,65
Owner: Neutral Owner: Neutral
@@ -737,6 +739,15 @@ Actors:
Actor212: flare Actor212: flare
Location: 43,79 Location: 43,79
Owner: Neutral Owner: Neutral
OffmapAttackerSpawn1: waypoint
Location: 10,1
Owner: Neutral
OffmapAttackerSpawn2: waypoint
Location: 84,1
Owner: Neutral
OffmapAttackerSpawn3: waypoint
Location: 1,50
Owner: Neutral
Smudges: Smudges:
@@ -751,10 +762,10 @@ Rules:
TRAN.Husk2: TRAN.Husk2:
Burns: Burns:
Damage: 0 Damage: 0
V27.Gun: V22.Gun:
Inherits: V27 Inherits: V22
RenderBuilding: RenderBuilding:
Image: V27 Image: V22
AutoTarget: AutoTarget:
Armament: Armament:
Weapon: Dragon Weapon: Dragon