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."); } }); }
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."); } }
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); }
public void Tick(Actor self) { if (allies.WinState != WinState.Undefined) { return; } survivalTimer.Tick(); if (world.FrameNumber == attackAtFrame) { attackAtFrame += attackAtFrameIncrement; attackAtFrameIncrement = Math.Max(attackAtFrameIncrement - 5, 100); SpawnSovietUnits(); ManageSovietUnits(); MissionUtils.CapOre(soviets); } if (world.FrameNumber == attackAtFrameInf) { attackAtFrameInf += attackAtFrameIncrementInf; attackAtFrameIncrementInf = Math.Max(attackAtFrameIncrementInf - 5, 100); SpawnSovietInfantry(); } if (barrack1.Destroyed) { spawningInfantry = false; } if (world.FrameNumber == paradropTicks) { MissionUtils.Paradrop(world, soviets, badger1Passengers, badgerEntryPoint1.Location, paraDrop1.Location); MissionUtils.Paradrop(world, soviets, badger1Passengers, badgerEntryPoint2.Location, paraDrop2.Location); } if (world.FrameNumber == paradropTicks * 2) { MissionUtils.Paradrop(world, soviets, badger1Passengers, badgerEntryPoint1.Location, alliesbase2.Location); MissionUtils.Paradrop(world, soviets, badger1Passengers, badgerEntryPoint2.Location, alliesbase1.Location); } if (world.FrameNumber == 1500 * 23) { attackAtFrame = 100; attackAtFrameIncrement = 100; } if (world.FrameNumber == 1500 * 25) { spawningSovietUnits = false; spawningInfantry = false; } if (destroySoviets.Status == ObjectiveStatus.InProgress) { if (barrack1.Destroyed) { destroySoviets.Status = ObjectiveStatus.Completed; OnObjectivesUpdated(true); MissionAccomplished("The French forces have survived and dismantled the soviet presence in the area!"); } } }
public void Tick(Actor self) { if (allies.WinState != WinState.Undefined) { return; } if (world.FrameNumber % 1000 == 0) { Sound.Play(Taunts[world.SharedRandom.Next(Taunts.Length)]); } if (objectives[FindEinsteinID].Status == ObjectiveStatus.InProgress) { if (AlliesControlLab()) { LabSecured(); } if (lab.Destroyed) { objectives[FindEinsteinID].Status = ObjectiveStatus.Failed; OnObjectivesUpdated(true); MissionFailed("Einstein was killed."); } } if (objectives[ExtractEinsteinID].Status == ObjectiveStatus.InProgress) { if (difficulty != "Easy") { ManageSovietUnits(); if (world.FrameNumber >= currentAttackWaveFrameNumber + 400) { SpawnSovietUnits(AttackWave); currentAttackWave++; currentAttackWaveFrameNumber = world.FrameNumber; if (currentAttackWave >= EinsteinChinookAttackWave) { SpawnSovietUnits(LastAttackWaveAddition); } if (currentAttackWave == EinsteinChinookAttackWave) { ExtractEinsteinAtLZ(); } } } if (einsteinChinook != null) { if (einsteinChinook.Destroyed) { objectives[ExtractEinsteinID].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; OnObjectivesUpdated(true); MissionAccomplished("Einstein was rescued"); } } } if (tanya != null && tanya.Destroyed) { MissionFailed("Tanya was killed."); } else if (einstein != null && einstein.Destroyed) { MissionFailed("Einstein was killed."); } MissionUtils.CapOre(soviets); }