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);
        }
示例#2
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);
            }
        }
        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.");
            }
        }
示例#4
0
        public void Tick(Actor self)
        {
            if (world.FrameNumber % 100 == 0)
            {
                var actor = OffmapAttackers.Random(world.SharedRandom);
                var spawn = offmapAttackerSpawns.Random(world.SharedRandom);
                var u     = world.CreateActor(actor, soviets, spawn.Location, Util.GetFacing(attackLocation.Location - spawn.Location, 0));
                var cargo = u.TraitOrDefault <Cargo>();
                if (cargo != null)
                {
                    while (cargo.HasSpace(1))
                    {
                        cargo.Load(u, world.CreateActor(false, AttackerCargo.Random(world.SharedRandom), soviets, null, null));
                    }
                }
                u.QueueActivity(new AttackMove.AttackMoveActivity(u, new Move.Move(attackLocation.Location, 0)));
            }

            if (world.FrameNumber % 25 == 0)
            {
                foreach (var actor in world.Actors.Where(a => a.IsInWorld && a.IsIdle && !a.IsDead() &&
                                                         a.HasTrait <AttackBase>() && a.HasTrait <Mobile>()).Except(actors.Values))
                {
                    MissionUtils.AttackNearestLandActor(true, actor, actor.Owner == soviets ? allies : soviets);
                }

                MissionUtils.StartProduction(world, allies, "Infantry", InfantryProductionUnits.Random(world.SharedRandom));
                MissionUtils.StartProduction(world, allies, "Vehicle", VehicleProductionUnits.Random(world.SharedRandom));
            }

            if (world.FrameNumber % 20 == 0 && coastUnitsLeft-- > 0)
            {
                var u = world.CreateActor(CoastUnits.Random(world.SharedRandom), soviets, coastWP1.Location, null);
                u.QueueActivity(new Move.Move(coastWP2.Location, 0));
                u.QueueActivity(new AttackMove.AttackMoveActivity(u, new Move.Move(attackLocation.Location, 0)));
            }

            if (world.FrameNumber == nextCivilianMove)
            {
                var civilians = world.Actors.Where(a => !a.IsDead() && a.IsInWorld && a.Owner == neutral && 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);
                }
            }

            if (world.FrameNumber == 1)
            {
                MissionUtils.Paradrop(world, soviets, ParadropUnits, paradrop1Entry.Location, paradrop1LZ.Location);
                MissionUtils.Paradrop(world, soviets, ParadropUnits, paradrop2Entry.Location, paradrop2LZ.Location);
            }

            if (--waitTicks <= 0)
            {
                if (++mul <= div)
                {
                    Game.MoveViewport(float2.Lerp(viewportOrigin, viewportTarget, mul / div));
                }
                else
                {
                    mul            = 0;
                    viewportOrigin = viewportTarget;
                    viewportTarget = viewportTargets[(viewportTargetNumber = (viewportTargetNumber + 1) % viewportTargets.Count)];
                    waitTicks      = 100;

                    if (viewportTargetNumber == 0)
                    {
                        coastUnitsLeft = 15;
                        SendChinookReinforcements(chinook1Entry.Location, chinook1LZ);
                        SendChinookReinforcements(chinook2Entry.Location, chinook2LZ);
                    }
                    if (viewportTargetNumber == 1)
                    {
                        MissionUtils.Paradrop(world, soviets, ParadropUnits, paradrop1Entry.Location, paradrop1LZ.Location);
                        MissionUtils.Paradrop(world, soviets, ParadropUnits, paradrop2Entry.Location, paradrop2LZ.Location);
                    }
                    if (viewportTargetNumber == 2)
                    {
                        AttackWithHeavyTanks();
                        ChronoSpawnMediumTanks();
                    }
                    if (viewportTargetNumber == 4)
                    {
                        FlyMigs(mig1Waypoints);
                        FlyMigs(mig2Waypoints);
                    }
                }
            }

            MissionUtils.CapOre(soviets);
        }