Example #1
0
        void LabSecured()
        {
            SpawnSignalFlare();
            Sound.Play("flaren1.aud");
            SpawnEinsteinAtLab();
            SendShips();
            lab.QueueActivity(new Transform(lab, "stek")
            {
                SkipMakeAnims = true
            });

            objectives[FindEinsteinID].Status    = ObjectiveStatus.Completed;
            objectives[ExtractEinsteinID].Status = ObjectiveStatus.InProgress;
            OnObjectivesUpdated(true);
            currentAttackWaveFrameNumber = world.FrameNumber;

            if (difficulty == "Easy")
            {
                ExtractEinsteinAtLZ();
            }
            else
            {
                var infantry = MissionUtils.FindQueues(world, soviets, "Infantry").FirstOrDefault();
                if (infantry != null)
                {
                    infantry.ResolveOrder(infantry.self, Order.StartProduction(infantry.self, "e1", 5));
                }
            }
        }
Example #2
0
        public void WorldLoaded(World w, WorldRenderer wr)
        {
            world                         = w;
            soviets                       = w.Players.Single(p => p.InternalName == "Soviets");
            multi0                        = w.Players.Single(p => p.InternalName == "Multi0");
            patrolAttackFrame             = 750;
            patrolattackAtFrameIncrement  = 750;
            WaveAttackFrame               = 500;
            WaveAttackAtFrameIncrement    = 500;
            VehicleAttackFrame            = 2000;
            VehicleAttackAtFrameIncrement = 2000;
            var actors = w.WorldActor.Trait <SpawnMapActors>().Actors;

            entry1            = actors["Entry1"];
            entry2            = actors["Entry2"];
            entry3            = actors["Entry3"];
            entry4            = actors["Entry4"];
            entry5            = actors["Entry5"];
            entry6            = actors["Entry6"];
            entry7            = actors["Entry7"];
            entry8            = actors["Entry8"];
            sovietEntryPoints = new[] { entry1, entry2, entry3, entry4, entry5, entry6, entry7, entry8 }.Select(p => p.Location).ToArray();
            paradrop1         = actors["Paradrop1"];
            paradrop2         = actors["Paradrop2"];
            paradrop3         = actors["Paradrop3"];
            paradrop4         = actors["Paradrop4"];
            patrol1           = actors["Patrol1"];
            patrol2           = actors["Patrol2"];
            patrol3           = actors["Patrol3"];
            patrol4           = actors["Patrol4"];
            MissionUtils.PlayMissionMusic();
            Game.AddChatLine(Color.Cyan, "Mission", "Defend Fort LoneStar At All costs!");
        }
        public void Tick(Actor self)
        {
            if (ussr.WinState != WinState.Undefined)
            {
                return;
            }

            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 == france))
            {
                destroy.Status = ObjectiveStatus.Completed;
                MissionAccomplished("We destroyed the resistance.");
            }
            else if (!unitsAndBuildings.Any(a => a.Owner == ussr))
            {
                destroy.Status = ObjectiveStatus.Failed;
                MissionFailed("We were destroyed by the resistance.");
            }
            if (!startJeepParadropped && startJeep.IsDead())
            {
                Sound.Play("reinfor1.aud");
                MissionUtils.Paradrop(world, ussr, Reinforcements, paradropEntryPoint1.Location, paradropPoint1.Location);
                startJeepParadropped = true;
            }
            if (!churchParadropped && church.IsDead())
            {
                Sound.Play("reinfor1.aud");
                MissionUtils.Paradrop(world, ussr, Reinforcements, paradropEntryPoint2.Location, paradropPoint2.Location);
                churchParadropped = true;
            }
        }
        void OnSuperTankDomeInfiltrated(Actor spy)
        {
            if (superTankDomeInfiltratedTick != -1)
            {
                return;
            }

            superTankDome.QueueActivity(new Transform(superTankDome, "dome")
            {
                SkipMakeAnims = true
            });

            world.AddFrameEndTask(_ =>
            {
                superTanks.Do(world.Remove);
                turkey.Stances[greece] = turkey.Stances[neutral] = Stance.Ally;
                greece.Stances[turkey] = neutral.Stances[turkey] = Stance.Ally;
                greece.Shroud.ExploreAll(world);
                superTanks.Do(world.Add);
            });

            foreach (var tank in superTanks.Where(t => !t.IsDead() && t.IsInWorld))
            {
                MissionUtils.AttackNearestLandActor(false, tank, ussr);
            }

            superTankDomeInfiltratedTick = world.FrameNumber;

            objectives[InfiltrateRadarDomeID].Status = ObjectiveStatus.Completed;
            OnObjectivesUpdated(true);
        }
Example #5
0
 void MissionFailed(string text)
 {
     MissionUtils.CoopMissionFailed(world, text, allies1, allies2);
     if (reinforcementsTimer != null)
     {
         reinforcementsTimerWidget.Visible = false;
     }
 }
Example #6
0
        public void WorldLoaded(World w, WorldRenderer wr)
        {
            world         = w;
            worldRenderer = wr;

            allies = w.Players.SingleOrDefault(p => p.InternalName == "Allies");
            if (allies != null)
            {
                ProduceAtFrame          = 300;
                ProduceAtFrameIncrement = 300;
                attackAtFrame           = 450;
                attackAtFrameIncrement  = 450;
            }
            soviets = w.Players.Single(p => p.InternalName == "Soviets");
            var actors = w.WorldActor.Trait <SpawnMapActors>().Actors;

            sovietEntry1        = actors["SovietEntry1"];
            sovietEntry2        = actors["SovietEntry2"];
            sovietEntry3        = actors["SovietEntry3"];
            sovietentrypoints   = new[] { sovietEntry1, sovietEntry2, sovietEntry3 }.Select(p => p.Location).ToArray();
            sovietrally         = actors["SovietRally"];
            sovietrally1        = actors["SovietRally1"];
            sovietrally2        = actors["SovietRally2"];
            sovietrally3        = actors["SovietRally3"];
            sovietrally4        = actors["SovietRally4"];
            sovietrally5        = actors["SovietRally5"];
            sovietrally6        = actors["SovietRally6"];
            sovietrally8        = actors["SovietRally8"];
            sovietrallypoints   = new[] { sovietrally2, sovietrally4, sovietrally5, sovietrally6 }.Select(p => p.Location).ToArray();
            alliesbase          = actors["AlliesBase"];
            sovietparadropEntry = actors["SovietParaDropEntry"];
            sovietparadrop1     = actors["SovietParaDrop1"];
            sovietparadrop2     = actors["SovietParaDrop2"];
            sovietparadrop3     = actors["SovietParaDrop3"];
            barrack1            = actors["barrack1"];
            factory             = actors["Factory"];
            drum1                = actors["drum1"];
            drum2                = actors["drum2"];
            drum3                = actors["drum3"];
            FranceEntry          = actors["FranceEntry"];
            FranceRally          = actors["FranceRally"];
            FranceparaEntry1     = actors["FranceparaEntry1"];
            FranceparaEntry2     = actors["FranceparaEntry2"];
            FranceparaEntry3     = actors["FranceparaEntry3"];
            newsovietentrypoints = new[] { sovietparadropEntry, sovietEntry3 }.Select(p => p.Location).ToArray();
            newsovietrallypoints = new[] { sovietrally3, sovietrally4, sovietrally8 }.Select(p => p.Location).ToArray();

            worldRenderer.Viewport.Center(alliesbase.CenterPosition);
            StartCountDownTimer();
            SetSovietUnitsToDefensiveStance();
            world.CreateActor(Camera, new TypeDictionary
            {
                new OwnerInit(allies),
                new LocationInit(sovietrally1.Location),
            });
            MissionUtils.PlayMissionMusic();
        }
Example #7
0
 void ExtractEinsteinAtLZ()
 {
     einsteinChinook = MissionUtils.ExtractUnitWithChinook(
         world,
         allies1,
         einstein,
         extractionLZEntryPoint.Location,
         extractionLZ.Location,
         extractionLZEntryPoint.Location);
 }
Example #8
0
        void BuildSovietUnit(string category, string unit)
        {
            var queueTent = MissionUtils.FindQueues(world, soviets, category).FirstOrDefault(q => q.CurrentItem() == null);

            if (queueTent == null)
            {
                return;
            }
            queueTent.ResolveOrder(queueTent.self, Order.StartProduction(queueTent.self, unit, 1));
        }
Example #9
0
        void BuildSovietAircraft()
        {
            var queue = MissionUtils.FindQueues(world, soviets, "Plane").FirstOrDefault(q => q.CurrentItem() == null);

            if (queue == null || SovietAircraft().Count() >= maxSovietYaks)
            {
                return;
            }

            queue.ResolveOrder(queue.self, Order.StartProduction(queue.self, YakName, 1));
        }
Example #10
0
        void BuildSovietUnit(string category, string unit)
        {
            var queue = MissionUtils.FindQueues(world, soviets, category).FirstOrDefault(q => q.CurrentItem() == null);

            if (queue == null)
            {
                return;
            }
            if (Game.IsHost)
            {
                world.IssueOrder(Order.StartProduction(queue.self, unit, 1));
            }
        }
Example #11
0
 void FrenchReinforcements()
 {
     Game.MoveViewport(sovietrally1.Location.ToFloat2());
     MissionUtils.Parabomb(world, allies, FranceparaEntry1.Location, drum3.Location);
     MissionUtils.Parabomb(world, allies, FranceparaEntry3.Location, drum2.Location);
     MissionUtils.Parabomb(world, allies, FranceparaEntry2.Location, drum1.Location);
     for (int i = 0; i < FrenchSquad.Length; i++)
     {
         var actor = world.CreateActor(FrenchSquad[i], new TypeDictionary {
             new OwnerInit(allies), new LocationInit(FranceEntry.Location)
         });
         actor.QueueActivity(new Move.Move(FranceRally.Location));
     }
 }
Example #12
0
 void InsertTanyaAtLZ()
 {
     tanya = MissionUtils.InsertUnitWithChinook(
         world,
         allies,
         TanyaName,
         insertionLZEntryPoint.Location,
         insertionLZ.Location,
         chinookExitPoint.Location,
         unit =>
     {
         Sound.Play("laugh1.aud");
         unit.QueueActivity(new Move.Move(insertionLZ.Location - new CVec(1, 0)));
     }).Second;
 }
Example #13
0
        public void WorldLoaded(World w)
        {
            world = w;

            difficulty = w.LobbyInfo.GlobalSettings.Difficulty;
            Game.Debug("{0} difficulty selected".F(difficulty));

            allies  = w.Players.Single(p => p.InternalName == "Allies");
            soviets = w.Players.Single(p => p.InternalName == "Soviets");

            allies.PlayerActor.Trait <PlayerResources>().Cash = 0;

            var actors = w.WorldActor.Trait <SpawnMapActors>().Actors;

            insertionLZ            = actors["InsertionLZ"];
            extractionLZ           = actors["ExtractionLZ"];
            lab                    = actors["Lab"];
            insertionLZEntryPoint  = actors["InsertionLZEntryPoint"];
            chinookExitPoint       = actors["ChinookExitPoint"];
            extractionLZEntryPoint = actors["ExtractionLZEntryPoint"];
            shipSpawnPoint         = actors["ShipSpawnPoint"];
            shipMovePoint          = actors["ShipMovePoint"];
            attackEntryPoint1      = actors["SovietAttackEntryPoint1"];
            attackEntryPoint2      = actors["SovietAttackEntryPoint2"];
            SetAlliedUnitsToDefensiveStance();

            Game.MoveViewport(insertionLZ.Location.ToFloat2());

            if (w.LobbyInfo.IsSinglePlayer)
            {
                Media.PlayFMVFullscreen(w, "ally1.vqa", () =>
                                        Media.PlayFMVFullscreen(w, "landing.vqa", () =>
                {
                    InsertTanyaAtLZ();
                    SendPatrol();
                    MissionUtils.PlayMissionMusic();
                })
                                        );
            }
            else
            {
                InsertTanyaAtLZ();
                SendPatrol();
                MissionUtils.PlayMissionMusic();
            }
        }
        public void WorldLoaded(World w)
        {
            world = w;

            neutral = w.Players.Single(p => p.InternalName == "Neutral");
            greece  = w.Players.Single(p => p.InternalName == "Greece");
            ussr    = w.Players.Single(p => p.InternalName == "USSR");
            badGuy  = w.Players.Single(p => p.InternalName == "BadGuy");
            turkey  = w.Players.Single(p => p.InternalName == "Turkey");

            greece.PlayerActor.Trait <PlayerResources>().Cash = 0;
            ussr.PlayerActor.Trait <PlayerResources>().Cash   = 2000;

            var actors = w.WorldActor.Trait <SpawnMapActors>().Actors;

            startEntryPoint       = actors["StartEntryPoint"];
            startMovePoint        = actors["StartMovePoint"];
            startBridgeEndPoint   = actors["StartBridgeEndPoint"];
            alliedBaseTopLeft     = actors["AlliedBaseTopLeft"];
            alliedBaseBottomRight = actors["AlliedBaseBottomRight"];
            alliedBaseEntryPoint  = actors["AlliedBaseEntryPoint"];
            alliedBaseMovePoint   = actors["AlliedBaseMovePoint"];

            demitriChurch            = actors["DemitriChurch"];
            demitriChurchSpawnPoint  = actors["DemitriChurchSpawnPoint"];
            demitriTriggerAreaCenter = actors["DemitriTriggerAreaCenter"];
            demitriLZ = actors["DemitriLZ"];

            hospital = actors["Hospital"];
            hospitalCivilianSpawnPoint = actors["HospitalCivilianSpawnPoint"];
            hospitalSuperTankPoint     = actors["HospitalSuperTankPoint"];

            superTanks = actors.Values.Where(a => a.Info.Name == "5tnk" && a.Owner == turkey).ToArray();

            provingGroundsCameraPoint = actors["ProvingGroundsCameraPoint"];
            world.CreateActor("camera", greece, provingGroundsCameraPoint.Location, null);

            superTankDome = actors["SuperTankDome"];
            superTankDome.AddTrait(new InfiltrateAction(OnSuperTankDomeInfiltrated));
            superTankDome.AddTrait(new TransformedAction(self => superTankDome = self));

            Game.MoveViewport(startEntryPoint.Location.ToFloat2());
            MissionUtils.PlayMissionMusic();
        }
Example #15
0
        public void WorldLoaded(World w, WorldRenderer wr)
        {
            world = w;

            ussr   = w.Players.Single(p => p.InternalName == "USSR");
            france = w.Players.Single(p => p.InternalName == "France");

            var actors = w.WorldActor.Trait <SpawnMapActors>().Actors;

            startJeep           = actors["StartJeep"];
            startJeepMovePoint  = actors["StartJeepMovePoint"];
            paradropPoint1      = actors["ParadropPoint1"];
            paradropEntryPoint1 = actors["ParadropEntryPoint1"];
            paradropPoint2      = actors["ParadropPoint2"];
            paradropEntryPoint2 = actors["ParadropEntryPoint2"];
            church    = actors["Church"];
            airfield1 = actors["Airfield1"];
            airfield2 = actors["Airfield2"];
            airfield3 = actors["Airfield3"];
            airfields = new[] { airfield1, airfield2, airfield3 };

            wr.Viewport.Center(startJeep.CenterPosition);

            if (w.LobbyInfo.IsSinglePlayer)
            {
                Media.PlayFMVFullscreen(w, "soviet1.vqa", () =>
                {
                    LandYaks();
                    MoveJeep();
                    MissionUtils.PlayMissionMusic();
                });
            }
            else
            {
                LandYaks();
                MoveJeep();
                MissionUtils.PlayMissionMusic();
            }
        }
Example #16
0
        void ManageSovietUnits()
        {
            var units = world.FindAliveCombatantActorsInCircle(sovietRallyPoint.CenterPosition, WRange.FromCells(10))
                        .Where(u => u.IsIdle && u.HasTrait <Mobile>() && u.HasTrait <AttackBase>() && u.Owner == soviets)
                        .Except(world.WorldActor.Trait <SpawnMapActors>().Actors.Values);

            if (units.Count() >= SovietGroupSize)
            {
                foreach (var unit in units)
                {
                    MissionUtils.AttackNearestLandActor(true, unit, allies2);
                }
            }

            var scatteredUnits = world.Actors.Where(u => u.IsInWorld && !u.IsDead() && u.IsIdle &&
                                                    u.HasTrait <Mobile>() && u.HasTrait <AttackBase>() && u.Owner == soviets)
                                 .Except(world.WorldActor.Trait <SpawnMapActors>().Actors.Values)
                                 .Except(units);

            foreach (var unit in scatteredUnits)
            {
                MissionUtils.AttackNearestLandActor(true, unit, allies2);
            }
        }
Example #17
0
        public void Tick(Actor self)
        {
            if (allies1.WinState != WinState.Undefined)
            {
                return;
            }

            if (world.FrameNumber == 1)
            {
                SpawnAlliedUnit(McvName);
                evacuateWidget = new InfoWidget("");
                Ui.Root.AddChild(evacuateWidget);
                UpdateUnitsEvacuated();
            }
            if (world.FrameNumber == attackAtFrame)
            {
                SpawnSovietUnits();
                attackAtFrame         += attackAtFrameIncrement;
                attackAtFrameIncrement = Math.Max(attackAtFrameIncrement - 5, minAttackAtFrame);
            }

            if (world.FrameNumber == ReinforcementsTicks1 || world.FrameNumber == ReinforcementsTicks2)
            {
                Sound.Play("reinfor1.aud");
            }

            if (world.FrameNumber % 25 == 0)
            {
                if (world.FrameNumber >= ReinforcementsTicks1 && currentReinforcement1 < Reinforcements1.Length)
                {
                    SpawnAlliedUnit(Reinforcements1[currentReinforcement1++]);
                }

                if (world.FrameNumber >= ReinforcementsTicks2 && currentReinforcement2 < Reinforcements2.Length)
                {
                    SpawnAlliedUnit(Reinforcements2[currentReinforcement2++]);
                }
            }


            if (sovietParadrops > 0)
            {
                if (world.FrameNumber == sovietParadropTicks)
                {
                    Sound.Play("sovfapp1.aud");
                }

                if (world.FrameNumber >= sovietParadropTicks && world.FrameNumber % ParadropIncrement == 0)
                {
                    CPos lz;
                    CPos entry;
                    do
                    {
                        var x = world.SharedRandom.Next(paradropBox.X, paradropBox.X + paradropBox.Width);
                        var y = world.SharedRandom.Next(paradropBox.Y, paradropBox.Y + paradropBox.Height);
                        entry = new CPos(0, y);
                        lz    = new CPos(x, y);
                    }while (!ParadropTerrainTypes.Contains(world.GetTerrainType(lz)));
                    MissionUtils.Paradrop(world, soviets, SovietParadroppers, entry, lz);
                    sovietParadrops--;
                }
            }
            if (world.FrameNumber % 25 == 0)
            {
                ManageSovietUnits();
            }

            if (objectives[AirbaseID].Status != ObjectiveStatus.Completed)
            {
                if (world.FrameNumber % 25 == 0)
                {
                    BuildSovietAircraft();
                }

                ManageSovietAircraft();
            }

            EvacuateAlliedUnits(exit1TopLeft.CenterLocation, exit1BottomRight.CenterLocation, exit1ExitPoint.Location);
            EvacuateAlliedUnits(exit2TopLeft.CenterLocation, exit2BottomRight.CenterLocation, exit2ExitPoint.Location);

            CheckSovietAirbase();

            if (!world.Actors.Any(a => (a.Owner == allies1 || a.Owner == allies2) && a.IsInWorld && !a.IsDead() &&
                                  ((a.HasTrait <Building>() && !a.HasTrait <Wall>()) || a.HasTrait <BaseBuilding>())))
            {
                objectives[EvacuateID].Status = ObjectiveStatus.Failed;
                OnObjectivesUpdated(true);
                MissionFailed("The remaining Allied forces in the area have been wiped out.");
            }
        }
Example #18
0
 void MissionAccomplished(string text)
 {
     MissionUtils.CoopMissionAccomplished(world, text, allies1, allies2);
 }
Example #19
0
 void MissionFailed(string text)
 {
     MissionUtils.CoopMissionFailed(world, text, allies1, allies2);
 }
Example #20
0
 public void Tick(Actor self)
 {
     if (allies1.WinState != WinState.Undefined)
     {
         return;
     }
     if (world.FrameNumber % 50 == 1 && chinookHusk.IsInWorld)
     {
         world.Add(new Smoke(world, chinookHusk.CenterLocation, "smoke_m"));
     }
     if (world.FrameNumber == 1)
     {
         InitializeSovietFactories();
         StartReinforcementsTimer();
     }
     reinforcementsTimer.Tick();
     if (world.FrameNumber == ParatroopersTicks)
     {
         MissionUtils.Paradrop(world, soviets, Badger1Passengers, badgerEntryPoint1.Location, badgerDropPoint1.Location);
         MissionUtils.Paradrop(world, soviets, Badger2Passengers, badgerEntryPoint1.Location + new CVec(3, 0), badgerDropPoint2.Location);
         MissionUtils.Paradrop(world, soviets, Badger3Passengers, badgerEntryPoint1.Location + new CVec(6, 0), badgerDropPoint3.Location);
     }
     if (world.FrameNumber == FlamersTicks)
     {
         RushSovietFlamers();
     }
     if (world.FrameNumber == TanksTicks)
     {
         RushSovietUnits();
     }
     if (world.FrameNumber == ParabombTicks)
     {
         MissionUtils.Parabomb(world, soviets, badgerEntryPoint2.Location, parabombPoint1.Location);
         MissionUtils.Parabomb(world, soviets, badgerEntryPoint2.Location + new CVec(0, 3), parabombPoint2.Location);
     }
     if (world.FrameNumber == SovietReinforcementsTicks)
     {
         SendSovietReinforcements();
     }
     if (yak == null || (yak != null && !yak.IsDead() && (yak.GetCurrentActivity() is FlyCircle || yak.IsIdle)))
     {
         var alliedUnitsNearYakPoint = world.FindAliveCombatantActorsInCircle(yakAttackPoint.CenterLocation, 10)
                                       .Where(a => a.Owner != soviets && a.HasTrait <IMove>() && a != tanya && a != einstein && a != engineer);
         if (alliedUnitsNearYakPoint.Any())
         {
             YakStrafe(alliedUnitsNearYakPoint);
         }
     }
     if (world.FrameNumber % 25 == 0)
     {
         AddSovietCashIfRequired();
         BuildSovietUnits();
         ManageSovietUnits();
     }
     UpdateDeaths();
     if (objectives[FindEinsteinID].Status == ObjectiveStatus.InProgress)
     {
         if (AlliesNearTown())
         {
             objectives[FindEinsteinID].Status = ObjectiveStatus.Completed;
             OnObjectivesUpdated(true);
             TransferTownUnitsToAllies();
             SovietsAttackTown();
         }
     }
     if (objectives[DestroySamSitesID].Status == ObjectiveStatus.InProgress)
     {
         if (sam1.Destroyed && sam2.Destroyed && sam3.Destroyed && sam4.Destroyed)
         {
             objectives[DestroySamSitesID].Status = ObjectiveStatus.Completed;
             objectives[ExtractEinsteinID].Status = ObjectiveStatus.InProgress;
             OnObjectivesUpdated(true);
             SpawnSignalFlare();
             Sound.Play("flaren1.aud");
             ExtractEinsteinAtLZ();
         }
     }
     if (objectives[ExtractEinsteinID].Status == ObjectiveStatus.InProgress && einsteinChinook != null)
     {
         if (einsteinChinook.Destroyed)
         {
             objectives[ExtractEinsteinID].Status  = ObjectiveStatus.Failed;
             objectives[MaintainPresenceID].Status = ObjectiveStatus.Failed;
             OnObjectivesUpdated(true);
             MissionFailed("The extraction helicopter was destroyed.");
         }
         else if (!world.Map.IsInMap(einsteinChinook.Location) && einsteinChinook.Trait <Cargo>().Passengers.Contains(einstein))
         {
             objectives[ExtractEinsteinID].Status  = ObjectiveStatus.Completed;
             objectives[MaintainPresenceID].Status = ObjectiveStatus.Completed;
             if (objectives[FewDeathsID].Status == ObjectiveStatus.InProgress)
             {
                 objectives[FewDeathsID].Status = ObjectiveStatus.Completed;
             }
             OnObjectivesUpdated(true);
             MissionAccomplished("Einstein was rescued.");
         }
     }
     if (tanya.Destroyed)
     {
         MissionFailed("Tanya was killed.");
     }
     else if (einstein.Destroyed)
     {
         MissionFailed("Einstein was killed.");
     }
     world.AddFrameEndTask(w =>
     {
         if (!world.FindAliveCombatantActorsInCircle(allies2BasePoint.CenterLocation, 20).Any(a => a.HasTrait <Building>() && !a.HasTrait <Wall>() && a.Owner == allies2))
         {
             objectives[MaintainPresenceID].Status = ObjectiveStatus.Failed;
             OnObjectivesUpdated(true);
             MissionFailed("The Allied reinforcements have been defeated.");
         }
     });
 }
Example #21
0
 void MissionFailed(string text)
 {
     MissionUtils.CoopMissionFailed(world, text, ussr);
 }
Example #22
0
 void MissionAccomplished(string text)
 {
     MissionUtils.CoopMissionAccomplished(world, text, ussr);
 }
        public void Tick(Actor self)
        {
            if (greece.WinState != WinState.Undefined)
            {
                return;
            }

            if (world.FrameNumber == 1)
            {
                SpawnAndMoveBridgeUnits(info.FirstStartUnits);
            }

            else if (world.FrameNumber == 25 * 3)
            {
                SpawnAndMoveBridgeUnits(info.SecondStartUnits);
            }

            else if (world.FrameNumber == 25 * 8)
            {
                SpawnAndMoveBridgeUnits(info.ThirdStartUnits);
            }

            MissionUtils.CapOre(ussr);

            if (!hospitalEvacuated && !hospital.IsDead() && MissionUtils.AreaSecuredWithUnits(world, greece, hospital.CenterLocation, 5))
            {
                EvacuateCivilians();
                hospitalEvacuated = true;
            }

            if (baseTransferredTick == -1)
            {
                var actorsInBase = world.FindUnits(alliedBaseTopLeft.CenterLocation, alliedBaseBottomRight.CenterLocation).Where(a => a != a.Owner.PlayerActor);
                if (actorsInBase.Any(a => a.Owner == greece))
                {
                    SetupAlliedBase(actorsInBase);
                    baseTransferredTick = world.FrameNumber;
                    objectives[FindOutpostID].Status = ObjectiveStatus.Completed;
                    OnObjectivesUpdated(true);
                }
            }
            else if (superTankDomeInfiltratedTick == -1)
            {
                if (world.FrameNumber == baseTransferredTick + 25 * 100)
                {
                    foreach (var tank in superTanks.Where(t => !t.IsDead() && t.IsInWorld))
                    {
                        tank.QueueActivity(false, new Move.Move(hospitalSuperTankPoint.Location, 2));
                    }
                }

                else if (world.FrameNumber == baseTransferredTick + 25 * 180)
                {
                    foreach (var tank in superTanks.Where(t => !t.IsDead() && t.IsInWorld))
                    {
                        tank.QueueActivity(false, new Move.Move(alliedBaseBottomRight.Location, 2));
                    }
                }

                else if (world.FrameNumber == baseTransferredTick + 25 * 280)
                {
                    foreach (var tank in superTanks.Where(t => !t.IsDead() && t.IsInWorld))
                    {
                        tank.QueueActivity(false, new Move.Move(demitriTriggerAreaCenter.Location, 2));
                    }
                }

                else if (world.FrameNumber == baseTransferredTick + 25 * 480)
                {
                    foreach (var tank in superTanks.Where(t => !t.IsDead() && t.IsInWorld))
                    {
                        tank.QueueActivity(false, new Move.Move(demitriLZ.Location, 4));
                    }
                }
            }
            else
            {
                if (world.FrameNumber % 25 == 0)
                {
                    foreach (var tank in superTanks.Where(t => !t.IsDead() && t.IsInWorld && t.IsIdle))
                    {
                        MissionUtils.AttackNearestLandActor(false, tank, ussr);
                    }
                }
                if (world.FrameNumber == superTankDomeInfiltratedTick + 25 * 180)
                {
                    foreach (var actor in world.Actors.Where(a => !a.IsDead() && (a.Owner == ussr || a.Owner == badGuy)))
                    {
                        actor.Kill(actor);
                    }
                }
                if (world.FrameNumber == superTankDomeInfiltratedTick + 25 * 181)
                {
                    foreach (var tank in superTanks.Where(t => !t.IsDead()))
                    {
                        tank.Kill(tank);
                    }
                    superTanksDestroyed = true;
                }
            }
            if (objectives[EvacuateDemitriID].Status != ObjectiveStatus.Completed)
            {
                if (demitri == null)
                {
                    if (demitriChurch.IsDead())
                    {
                        objectives[EvacuateDemitriID].Status = ObjectiveStatus.Failed;
                        OnObjectivesUpdated(true);
                        MissionFailed("Dr. Demitri was killed.");
                    }

                    else if (MissionUtils.AreaSecuredWithUnits(world, greece, demitriTriggerAreaCenter.CenterLocation, 3))
                    {
                        demitri = world.CreateActor("demitri", greece, demitriChurchSpawnPoint.Location, null);
                        demitri.QueueActivity(new Move.Move(demitriTriggerAreaCenter.Location, 0));
                        demitriLZFlare = world.CreateActor("flare", greece, demitriLZ.Location, null);
                        Sound.Play("flaren1.aud");
                        var chinookEntry = new CPos(demitriLZ.Location.X, 0);
                        demitriChinook = MissionUtils.ExtractUnitWithChinook(world, greece, demitri, chinookEntry, demitriLZ.Location, chinookEntry);
                    }
                }
                else if (demitri.IsDead())
                {
                    objectives[EvacuateDemitriID].Status = ObjectiveStatus.Failed;
                    OnObjectivesUpdated(true);
                    MissionFailed("Dr. Demitri was killed.");
                }
                else if (demitriChinook != null && !demitriChinook.IsDead() && !world.Map.IsInMap(demitriChinook.Location) && demitriChinook.Trait <Cargo>().Passengers.Contains(demitri))
                {
                    demitriLZFlare.Destroy();
                    SpawnAndMoveAlliedBaseUnits(info.FirstBaseUnits);
                    objectives[EvacuateDemitriID].Status = ObjectiveStatus.Completed;
                    OnObjectivesUpdated(true);
                }
            }
            if (!world.Actors.Any(a => a.Owner == greece && a.IsInWorld && !a.IsDead() &&
                                  ((a.HasTrait <Building>() && !a.HasTrait <Wall>()) || a.HasTrait <BaseBuilding>() || a.HasTrait <Mobile>())))
            {
                MissionFailed("The remaining Allied forces in the area have been wiped out.");
            }
            if (superTankDomeInfiltratedTick == -1 && superTankDome.IsDead())
            {
                objectives[InfiltrateRadarDomeID].Status = ObjectiveStatus.Failed;
                OnObjectivesUpdated(true);
                MissionFailed("The Soviet radar dome was destroyed.");
            }
            if (superTanksDestroyed && objectives[EvacuateDemitriID].Status == ObjectiveStatus.Completed)
            {
                MissionAccomplished("Dr. Demitri has been extracted and the super tanks have been dealt with.");
            }
        }
Example #24
0
		public void WorldLoaded(World w, WorldRenderer wr)
		{
			world = w;
			worldRenderer = wr;

			difficulty = w.LobbyInfo.GlobalSettings.Difficulty;
			Game.Debug("{0} difficulty selected".F(difficulty));

			allies1 = w.Players.Single(p => p.InternalName == "Allies1");
			allies2 = w.Players.SingleOrDefault(p => p.InternalName == "Allies2");

			allies1.PlayerActor.Trait<PlayerResources>().Cash = 0;
			if (allies2 == null)
				allies2 = allies1;
			else
				allies2.PlayerActor.Trait<PlayerResources>().Cash = 0;

			soviets = w.Players.Single(p => p.InternalName == "Soviets");
			creeps = w.Players.Single(p => p.InternalName == "Creeps");
			infiltrateLab.Text = InfiltrateLabTemplate.F(allies1 != allies2 ? "spies" : "spy");

			destroyBaseTicks = difficulty == "Hard" ? 1500 * 25 : difficulty == "Normal" ? 1500 * 28 : 1500 * 31;

			var actors = w.WorldActor.Trait<SpawnMapActors>().Actors;

			spyReinforcementsEntryPoint = actors["SpyReinforcementsEntryPoint"];
			spyReinforcementsUnloadPoint = actors["SpyReinforcementsUnloadPoint"];
			spyReinforcementsExitPoint = actors["SpyReinforcementsExitPoint"];

			hijackTruck = actors["HijackTruck"];
			baseGuard = actors["BaseGuard"];
			baseGuardMovePos = actors["BaseGuardMovePos"];
			baseGuardTruckPos = actors["BaseGuardTruckPos"];
			patrolPoints1 = new[]
			{
				actors["PatrolPoint11"].Location,
				actors["PatrolPoint12"].Location,
				actors["PatrolPoint13"].Location,
				actors["PatrolPoint14"].Location,
				actors["PatrolPoint15"].Location
			};
			patrolPoints2 = patrolPoints1;
			patrolPoints3 = new[]
			{
				actors["PatrolPoint21"].Location,
				actors["PatrolPoint22"].Location,
				actors["PatrolPoint23"].Location,
				actors["PatrolPoint24"].Location,
				actors["PatrolPoint25"].Location
			};
			patrolPoints4 = new[]
			{
				actors["PatrolPoint31"].Location,
				actors["PatrolPoint32"].Location,
				actors["PatrolPoint33"].Location,
				actors["PatrolPoint34"].Location
			};
			patrolPoints5 = new[]
			{
				actors["PatrolPoint41"].Location,
				actors["PatrolPoint42"].Location,
				actors["PatrolPoint43"].Location,
				actors["PatrolPoint44"].Location,
				actors["PatrolPoint45"].Location
			};

			lab = actors["Lab"];
			lab.AddTrait(new InfiltrateAction(OnLabInfiltrated));
			lab.AddTrait(new TransformedAction(self => lab = self));

			reinforcementsEntryPoint = actors["ReinforcementsEntryPoint"];
			reinforcementsUnloadPoint = actors["ReinforcementsUnloadPoint"];

			patrols = new List<Patrol>
			{
				new Patrol(world, new[] { "e1", "e1", "e1", "e1", "e1" }, soviets, patrolPoints1, 0),
				new Patrol(world, new[] { "e1", "dog.patrol", "dog.patrol" }, soviets, patrolPoints2, 2),
				new Patrol(world, new[] { "e1", "dog.patrol", "dog.patrol" }, soviets, patrolPoints4, 0),
				new Patrol(world, new[] { "e1", "dog.patrol", "dog.patrol" }, soviets, patrolPoints5, 0),
			};
			if (difficulty == "Hard")
				patrols.Add(new Patrol(world, new[] { "e1", "e1", "dog.patrol" }, soviets, patrolPoints3, 0));

			bridgeTank = actors["BridgeTank"];
			bridgeAttackPoint = actors["BridgeAttackPoint"];
			bridge = world.Actors
				.Where(a => a.HasTrait<Bridge>() && !a.IsDead())
				.OrderBy(a => (a.Location - bridgeAttackPoint.Location).LengthSquared)
				.FirstOrDefault();

			var ta1 = actors["TownAttacker1"];
			var ta2 = actors["TownAttacker2"];
			var ta3 = actors["TownAttacker3"];
			var ta4 = actors["TownAttacker4"];
			var ta5 = actors["TownAttacker5"];
			var ta6 = actors["TownAttacker6"];
			var ta7 = actors["TownAttacker7"];

			townAttackers = new[] { ta1, ta2, ta3, ta4, ta5, ta6, ta7 };

			OnObjectivesUpdated(false);
			SetupSubStances();

			worldRenderer.Viewport.Center(spyReinforcementsEntryPoint.CenterPosition);
			MissionUtils.PlayMissionMusic();
		}
Example #25
0
		public void Tick(Actor self)
		{
			if (allies1.WinState != WinState.Undefined) return;

			if (world.FrameNumber == 1)
				InsertSpies();

			if (frameInfiltrated != -1)
			{
				if (world.FrameNumber == frameInfiltrated + 100)
				{
					Sound.Play("aarrivs1.aud");
					worldRenderer.Viewport.Center(reinforcementsUnloadPoint.CenterPosition);
					world.AddFrameEndTask(w => SendReinforcements());
				}
				if (world.FrameNumber == frameInfiltrated + 200)
				{
					Sound.Play("timergo1.aud");
					destroyBaseTimer = new CountdownTimer(destroyBaseTicks, OnDestroyBaseTimerExpired, true);
					destroyBaseTimerWidget = new CountdownTimerWidget(destroyBaseTimer, "Secure lab in: {0}");
					Ui.Root.AddChild(destroyBaseTimerWidget);
				}

				if (world.FrameNumber >= frameInfiltrated + 200)
					destroyBaseTimer.Tick();

				if (world.FrameNumber == frameInfiltrated + 1500 * 12 && !bridgeTank.IsDead() && bridgeTank.IsInWorld && !bridge.IsDead())
				{
					bridgeTank.QueueActivity(new Attack(Target.FromPos(bridge.CenterPosition), WRange.FromCells(4)));
					attackingBridge = true;
				}
				if (attackingBridge && bridge.IsDead())
				{
					if (!bridgeTank.IsDead())
						bridgeTank.CancelActivity();
					attackingBridge = false;
				}

				if (world.FrameNumber == frameInfiltrated + 1500 * 6)
					foreach (var attacker in townAttackers.Where(a => !a.IsDead() && a.IsInWorld))
					{
						attacker.CancelActivity();
						attacker.QueueActivity(new AttackMove.AttackMoveActivity(attacker, new Move.Move(reinforcementsUnloadPoint.Location + new CVec(10, -15), 3)));
					}
			}

			if (attackingTown)
			{
				foreach (var attacker in townAttackers.Where(u => u.IsIdle && !u.IsDead() && u.IsInWorld))
				{
					var enemies = world.Actors.Where(u => u.Owner == creeps && u.HasTrait<ITargetable>()
						&& ((u.HasTrait<Building>() && !u.HasTrait<Wall>() && !u.HasTrait<Bridge>()) || u.HasTrait<Mobile>()) && !u.IsDead() && u.IsInWorld);

					var enemy = enemies.ClosestTo(attacker);
					if (enemy != null)
						attacker.QueueActivity(new AttackMove.AttackMoveActivity(attacker, new Attack(Target.FromActor(enemy), WRange.FromCells(3))));
					else
					{
						attackingTown = false;
						break;
					}
				}
			}

			foreach (var patrol in patrols)
				patrol.DoPatrol();

			MissionUtils.CapOre(soviets);

			BaseGuardTick();

			if (world.FrameNumber == nextCivilianMove)
			{
				var civilians = world.Actors.Where(a => !a.IsDead() && a.IsInWorld && a.Owner == creeps && a.HasTrait<Mobile>());
				if (civilians.Any())
				{
					var civilian = civilians.Random(world.SharedRandom);
					civilian.Trait<Mobile>().Nudge(civilian, civilian, true);
					nextCivilianMove += world.SharedRandom.Next(1, 75);
				}
			}

			world.AddFrameEndTask(w =>
			{
				if ((allies1Spy.IsDead() && !allies1SpyInfiltratedLab) || (allies2Spy != null && allies2Spy.IsDead() && !allies2SpyInfiltratedLab))
				{
					infiltrateLab.Status = ObjectiveStatus.Failed;
					OnObjectivesUpdated(true);
					MissionFailed("{0} spy was killed.".F(allies1 != allies2 ? "A" : "The"));
				}
				else if (lab.IsDead())
				{
					if (infiltrateLab.Status == ObjectiveStatus.InProgress)
						infiltrateLab.Status = ObjectiveStatus.Failed;
					else if (destroyBase.Status == ObjectiveStatus.InProgress)
						destroyBase.Status = ObjectiveStatus.Failed;
					OnObjectivesUpdated(true);
					MissionFailed("The Soviet research laboratory was destroyed.");
				}
				else if (!world.Actors.Any(a => (a.Owner == allies1 || a.Owner == allies2) && !a.IsDead()
					&& (a.HasTrait<Building>() && !a.HasTrait<Wall>()) || a.HasTrait<BaseBuilding>()))
				{
					destroyBase.Status = ObjectiveStatus.Failed;
					OnObjectivesUpdated(true);
					MissionFailed("The remaining Allied forces in the area have been wiped out.");
				}
				else if (SovietBaseDestroyed() && infiltrateLab.Status == ObjectiveStatus.Completed)
				{
					destroyBase.Status = ObjectiveStatus.Completed;
					OnObjectivesUpdated(true);
					MissionAccomplished("The Soviet research laboratory has been secured successfully.");
				}
			});
		}
Example #26
0
        public void Tick(Actor self)
        {
            if (multi0.WinState != WinState.Undefined)
            {
                return;
            }

            if (world.FrameNumber == patrolAttackFrame)
            {
                patrolAttackFrame           += patrolattackAtFrameIncrement;
                patrolattackAtFrameIncrement = Math.Max(patrolattackAtFrameIncrement - 5, 100);
                SendPatrol(Patrol, soviets, patrol1.Location, paradrop1.Location);
                SendPatrol(Patrol, soviets, patrol2.Location, paradrop2.Location);
                SendPatrol(Patrol, soviets, patrol3.Location, paradrop3.Location);
                SendPatrol(Patrol, soviets, patrol4.Location, paradrop4.Location);
            }
            if (world.FrameNumber == WaveAttackFrame)
            {
                WaveAttackFrame           += WaveAttackAtFrameIncrement;
                WaveAttackAtFrameIncrement = Math.Max(WaveAttackAtFrameIncrement - 5, 100);
                SendWave();
            }
            if (world.FrameNumber == VehicleAttackFrame)
            {
                VehicleAttackFrame           += VehicleAttackAtFrameIncrement;
                VehicleAttackAtFrameIncrement = Math.Max(VehicleAttackAtFrameIncrement - 5, 100);
                SendVehicles();
            }
            if (world.FrameNumber == TimerTicks)
            {
                evacuateWidget = new InfoWidget("");
                Ui.Root.AddChild(evacuateWidget);
                WaveNumber++;
                Wave("One Initializing");
                UpdateWaveSequence();
            }
            if (world.FrameNumber == 1500 * 2)
            {
                WaveNumber++;
                Wave("Two Initializing");
                SpawnPatrol      = false;
                AttackSquad      = 7;
                AttackSquadCount = 2;
                UpdateWaveSequence();
                MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
                MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location + new CVec(0, -2));
            }
            if (world.FrameNumber == 1500 * 4)
            {
                WaveNumber++;
                Wave("Three Initializing");
                UpdateWaveSequence();
                AttackSquad = 8;
            }
            if (world.FrameNumber == 1500 * 6)
            {
                WaveNumber++;
                Wave("Four Initializing");
                UpdateWaveSequence();
                AttackSquad = 9;
                MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
                MissionUtils.Parabomb(world, soviets, entry2.Location, paradrop3.Location);
                AttackSquadCount = 3;
                VehicleSquad     = 3;
            }
            if (world.FrameNumber == 1500 * 8)
            {
                WaveNumber++;
                Wave("Five Initializing");
                UpdateWaveSequence();
                AttackSquad       = 10;
                VehicleSquad      = 4;
                VehicleSquadCount = 2;
                SendBoss(tank);
            }
            if (world.FrameNumber == 1500 * 11)
            {
                WaveNumber++;
                Wave("Six Initializing");
                UpdateWaveSequence();
                AttackSquad      = 11;
                AttackSquadCount = 4;
                MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
                MissionUtils.Parabomb(world, soviets, entry4.Location, paradrop1.Location);
                MissionUtils.Parabomb(world, soviets, entry6.Location, paradrop3.Location);
                MissionUtils.Parabomb(world, soviets, entry5.Location, paradrop3.Location);
                SendBoss(tank);
                SendBoss(tank);
            }
            if (world.FrameNumber == 1500 * 14)
            {
                WaveNumber++;
                Wave("Seven Initializing");
                UpdateWaveSequence();
                AttackSquad       = 12;
                VehicleSquad      = 5;
                VehicleSquadCount = 3;
                SendBoss(v2);
            }
            if (world.FrameNumber == 1500 * 17)
            {
                SpawnVehicles = true;
                WaveNumber++;
                Wave("Eight Initializing");
                UpdateWaveSequence();
                AttackSquad      = 13;
                AttackSquadCount = 5;
                MissionUtils.Parabomb(world, soviets, entry1.Location, paradrop1.Location);
                MissionUtils.Parabomb(world, soviets, entry4.Location, paradrop1.Location);
                MissionUtils.Parabomb(world, soviets, entry6.Location, paradrop3.Location);
                MissionUtils.Parabomb(world, soviets, entry5.Location, paradrop3.Location);
                MissionUtils.Parabomb(world, soviets, entry2.Location, paradrop2.Location);
                MissionUtils.Parabomb(world, soviets, entry3.Location, paradrop2.Location);
                SendBoss(v2);
                SendBoss(tank);
                SendBoss(v2);
            }
            if (world.FrameNumber == 1500 * 21)
            {
                WaveNumber++;
                Wave("Nine Initializing");
                UpdateWaveSequence();
                AttackSquad       = 14;
                VehicleSquad      = 6;
                VehicleSquadCount = 4;
                SendBoss(v2);
                SendBoss(tank);
                SendBoss(tank);
            }
            if (world.FrameNumber == 1500 * 25)
            {
                WaveNumber++;
                Wave("Ten Initializing");
                UpdateWaveSequence();
                AttackSquad      = 15;
                AttackSquadCount = 6;
                for (int i = 0; i < 2; i++)
                {
                    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, entry4.Location, paradrop2.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, entry4.Location, paradrop3.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));
                }
                SendBoss(boss);
            }
            if (world.FrameNumber == 1500 * 30)
            {
                SpawnWave     = false;
                SpawnVehicles = false;
            }
            if (world.FrameNumber == 1500 * 31)
            {
                MissionAccomplished("You and your mates have Survived the Onslaught!");
            }
        }
Example #27
0
 IEnumerable <Actor> ClosestAlliedBuildings(Actor actor, int range)
 {
     return(MissionUtils.ClosestPlayerBuildings(world, allies2, actor.CenterLocation, range));
 }
Example #28
0
        public void WorldLoaded(World w)
        {
            world = w;

            allies = w.Players.SingleOrDefault(p => p.InternalName == "Allies");
            if (allies != null)
            {
                attackAtFrameInf          = 300;
                attackAtFrameIncrementInf = 300;
                attackAtFrame             = 450;
                attackAtFrameIncrement    = 450;
            }

            difficulty = w.LobbyInfo.GlobalSettings.Difficulty;
            Game.Debug("{0} difficulty selected".F(difficulty));

            switch (difficulty)
            {
            case "Hard":
                attackAtFrameIncrement    = 350;
                attackAtFrameIncrementInf = 200;
                break;

            case "Normal":
                attackAtFrameIncrement    = 450;
                attackAtFrameIncrementInf = 300;
                break;

            case "Easy":
                attackAtFrameIncrement    = 550;
                attackAtFrameIncrementInf = 400;
                break;
            }

            soviets = w.Players.Single(p => p.InternalName == "Soviets");
            var actors = w.WorldActor.Trait <SpawnMapActors>().Actors;

            sovietEntryPoint1    = actors["sovietEntryPoint1"];
            sovietEntryPoint2    = actors["sovietEntryPoint2"];
            sovietEntryPoint3    = actors["sovietEntryPoint3"];
            sovietEntryPoint4    = actors["sovietEntryPoint4"];
            sovietEntryPoint5    = actors["sovietEntryPoint5"];
            sovietEntryPoints    = new[] { sovietEntryPoint1, sovietEntryPoint2, sovietEntryPoint3, sovietEntryPoint4, sovietEntryPoint5 }.Select(p => p.Location).ToArray();
            sovietRallyPoint1    = actors["sovietRallyPoint1"];
            sovietRallyPoint2    = actors["sovietRallyPoint2"];
            sovietRallyPoint3    = actors["sovietRallyPoint3"];
            sovietRallyPoint4    = actors["sovietRallyPoint4"];
            sovietRallyPoint5    = actors["sovietRallyPoint5"];
            sovietRallyPoints    = new[] { sovietRallyPoint1, sovietRallyPoint2, sovietRallyPoint3, sovietRallyPoint4, sovietRallyPoint5 }.Select(p => p.Location).ToArray();
            alliesbase           = actors["alliesbase"];
            alliesbase1          = actors["alliesbase1"];
            alliesbase2          = actors["alliesbase2"];
            badgerEntryPoint1    = actors["BadgerEntryPoint1"];
            badgerEntryPoint2    = actors["BadgerEntryPoint2"];
            sovietEntryPoint7    = actors["sovietEntryPoint7"];
            sovietinfantryentry1 = actors["SovietInfantryEntry1"];
            sovietinfantryrally1 = actors["SovietInfantryRally1"];
            paraDrop1            = actors["ParaDrop1"];
            paraDrop2            = actors["ParaDrop2"];
            barrack1             = actors["Barrack1"];
            sam1 = actors["Sam1"];
            sam2 = actors["Sam2"];

            var shroud = allies.PlayerActor.Trait <Shroud>();

            shroud.Explore(w, sam1.Location, 4);
            shroud.Explore(w, sam2.Location, 4);

            Game.MoveViewport(alliesbase.Location.ToFloat2());
            StartCountDownTimer();
            SendSquad1();
            SendSquad2();
            MissionUtils.PlayMissionMusic();
        }
Example #29
0
        public void WorldLoaded(World w)
        {
            world = w;

            difficulty = w.LobbyInfo.GlobalSettings.Difficulty;
            Game.Debug("{0} difficulty selected".F(difficulty));

            allies1 = w.Players.Single(p => p.InternalName == "Allies1");
            allies2 = w.Players.SingleOrDefault(p => p.InternalName == "Allies2");

            var res = allies1.PlayerActor.Trait <PlayerResources>();

            if (allies2 == null)
            {
                res.Cash = 10000;
                allies2  = allies1;
            }
            else
            {
                res.Cash = 5000;
                res      = allies2.PlayerActor.Trait <PlayerResources>();
                res.Cash = 5000;
            }

            attackAtFrame           = attackAtFrameIncrement = difficulty == "Hard" || difficulty == "Normal" ? 500 : 600;
            minAttackAtFrame        = difficulty == "Hard" || difficulty == "Normal" ? 100 : 150;
            unitsEvacuatedThreshold = difficulty == "Hard" ? 200 : difficulty == "Normal" ? 100 : 50;
            maxSovietYaks           = difficulty == "Hard" ? 4 : difficulty == "Normal" ? 2 : 0;
            sovietParadrops         = difficulty == "Hard" ? 40 : difficulty == "Normal" ? 20 : 0;
            sovietParadropTicks     = difficulty == "Hard" ? 1500 * 17 : 1500 * 20;
            sovietUnits2Ticks       = difficulty == "Hard" ? 1500 * 12 : 1500 * 15;

            objectives[EvacuateID].Text = objectives[EvacuateID].Text.F(unitsEvacuatedThreshold);

            allies  = w.Players.Single(p => p.InternalName == "Allies");
            soviets = w.Players.Single(p => p.InternalName == "Soviets");

            var actors = w.WorldActor.Trait <SpawnMapActors>().Actors;

            exit1TopLeft      = actors["Exit1TopLeft"];
            exit1BottomRight  = actors["Exit1BottomRight"];
            exit1ExitPoint    = actors["Exit1ExitPoint"];
            exit2TopLeft      = actors["Exit2TopLeft"];
            exit2BottomRight  = actors["Exit2BottomRight"];
            exit2ExitPoint    = actors["Exit2ExitPoint"];
            allies1EntryPoint = actors["Allies1EntryPoint"];
            allies1MovePoint  = actors["Allies1MovePoint"];
            allies2EntryPoint = actors["Allies2EntryPoint"];
            allies2MovePoint  = actors["Allies2MovePoint"];
            sovietEntryPoint1 = actors["SovietEntryPoint1"];
            sovietEntryPoint2 = actors["SovietEntryPoint2"];
            sovietEntryPoint3 = actors["SovietEntryPoint3"];
            sovietEntryPoint4 = actors["SovietEntryPoint4"];
            sovietEntryPoint5 = actors["SovietEntryPoint5"];
            sovietEntryPoint6 = actors["SovietEntryPoint6"];
            sovietEntryPoints = new[] { sovietEntryPoint1, sovietEntryPoint2, sovietEntryPoint3, sovietEntryPoint4, sovietEntryPoint5, sovietEntryPoint6 }.Select(p => p.Location).ToArray();
            sovietRallyPoint1 = actors["SovietRallyPoint1"];
            sovietRallyPoint2 = actors["SovietRallyPoint2"];
            sovietRallyPoint3 = actors["SovietRallyPoint3"];
            sovietRallyPoint4 = actors["SovietRallyPoint4"];
            sovietRallyPoint5 = actors["SovietRallyPoint5"];
            sovietRallyPoint6 = actors["SovietRallyPoint6"];
            sovietRallyPoints = new[] { sovietRallyPoint1, sovietRallyPoint2, sovietRallyPoint3, sovietRallyPoint4, sovietRallyPoint5, sovietRallyPoint6 }.Select(p => p.Location).ToArray();
            sovietAirfields   = actors.Values.Where(a => a.Owner == soviets && a.HasTrait <Production>() && a.Info.Traits.Get <ProductionInfo>().Produces.Contains("Plane")).ToArray();
            var topLeft     = actors["ParadropBoxTopLeft"];
            var bottomRight = actors["ParadropBoxBottomRight"];

            paradropBox = new Rectangle(topLeft.Location.X, topLeft.Location.Y, bottomRight.Location.X - topLeft.Location.X, bottomRight.Location.Y - topLeft.Location.Y);

            if (w.LocalPlayer == null || w.LocalPlayer == allies1)
            {
                Game.MoveViewport(allies1EntryPoint.Location.ToFloat2());
            }

            else
            {
                Game.MoveViewport(allies2EntryPoint.Location.ToFloat2());
            }

            OnObjectivesUpdated(false);
            MissionUtils.PlayMissionMusic();
        }
 void MissionFailed(string text)
 {
     MissionUtils.CoopMissionFailed(world, text, greece);
 }