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 (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."); } }); }
public void Tick(Actor self) { if (allies1.WinState != WinState.Undefined) { return; } if (world.FrameNumber % 50 == 1 && chinookHusk.IsInWorld) { world.Add(new Smoke(world, chinookHusk.CenterPosition, "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 == ParabombTicks) { MissionUtils.Parabomb(world, soviets, badgerEntryPoint2.Location, parabombPoint1.Location); MissionUtils.Parabomb(world, soviets, badgerEntryPoint2.Location + new CVec(0, 3), parabombPoint2.Location); } if (allies1 != allies2) { if (yak == null || (yak != null && !yak.IsDead() && (yak.GetCurrentActivity() is FlyCircle || yak.IsIdle))) { var alliedUnitsNearYakPoint = world.FindAliveCombatantActorsInCircle(yakAttackPoint.CenterPosition, WRange.FromCells(10)) .Where(a => a.Owner != soviets && a.HasTrait <IPositionable>() && a != tanya && a != einstein && a != engineer); if (alliedUnitsNearYakPoint.Any()) { YakStrafe(alliedUnitsNearYakPoint); } } } if (currentReinforcement > -1 && currentReinforcement < Reinforcements.Length && world.FrameNumber % 25 == 0) { SpawnAlliedUnit(Reinforcements[currentReinforcement++]); } if (world.FrameNumber % 25 == 0) { BuildSovietUnits(); ManageSovietUnits(); } UpdateDeaths(); if (findEinstein.Status == ObjectiveStatus.InProgress) { if (AlliesNearTown()) { findEinstein.Status = ObjectiveStatus.Completed; OnObjectivesUpdated(true); TransferTownUnitsToAllies(); SovietsAttackTown(); } } if (destroySamSites.Status == ObjectiveStatus.InProgress) { if (sams.All(s => s.IsDead() || s.Owner != soviets)) { destroySamSites.Status = ObjectiveStatus.Completed; extractEinstein.Status = ObjectiveStatus.InProgress; OnObjectivesUpdated(true); world.CreateActor(SignalFlareName, new TypeDictionary { new OwnerInit(allies1), new LocationInit(extractionLZ.Location) }); Sound.Play("flaren1.aud"); ExtractEinsteinAtLZ(); } } if (extractEinstein.Status == ObjectiveStatus.InProgress && einsteinChinook != null) { if (einsteinChinook.IsDead()) { extractEinstein.Status = ObjectiveStatus.Failed; OnObjectivesUpdated(true); MissionFailed("The extraction helicopter was destroyed."); } else if (!world.Map.IsInMap(einsteinChinook.Location) && einsteinChinook.Trait <Cargo>().Passengers.Contains(einstein)) { extractEinstein.Status = ObjectiveStatus.Completed; maintainPresence.Status = ObjectiveStatus.Completed; if (fewDeaths.Status == ObjectiveStatus.InProgress) { fewDeaths.Status = ObjectiveStatus.Completed; } OnObjectivesUpdated(true); MissionAccomplished("Einstein was rescued."); } } if (tanya.IsDead()) { MissionFailed("Tanya was killed."); } else if (einstein.IsDead()) { MissionFailed("Einstein was killed."); } world.AddFrameEndTask(w => { if (!w.FindAliveCombatantActorsInBox(alliedBaseTopLeft, alliedBaseBottomRight) .Any(a => (a.Owner == allies || a.Owner == allies2) && (a.HasTrait <Building>() && !a.HasTrait <Wall>()) || a.HasTrait <BaseBuilding>())) { maintainPresence.Status = ObjectiveStatus.Failed; OnObjectivesUpdated(true); MissionFailed("The Allied reinforcements have been defeated."); } }); }
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; } survivalTimer.Tick(); if (allies != null) { ManageSovietUnits(); } 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 == soviets)) { objectives[destroySovietsID].Status = ObjectiveStatus.Completed; MissionAccomplished("We have destroyed the remaining Soviet presence!"); } if (world.FrameNumber == ProduceAtFrame) { ProduceAtFrame += ProduceAtFrameIncrement; ProduceAtFrameIncrement = Math.Max(ProduceAtFrameIncrement - 5, 100); InitializeSovietFactories(barrack1, sovietrally.Location); BuildSovietUnits(factory, barrack1); } if (world.FrameNumber == attackAtFrame) { attackAtFrame += attackAtFrameIncrement; attackAtFrameIncrement = Math.Max(attackAtFrameIncrement - 5, 100); ManageSovietVehicles(); if (producing) { BuildSovietVehicles(sovietentrypoints, sovietrallypoints); } else { BuildSovietVehicles(newsovietentrypoints, newsovietrallypoints); } } if (world.FrameNumber == attackTicks) { SpawnAndAttack(squad, soviets, sovietrally5.Location); SpawnAndAttack(squad, soviets, sovietrally6.Location); } if (world.FrameNumber == attackTicks * 3) { SpawnFlare(soviets, sovietparadrop3); MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop3.Location); SpawnAndAttack(squad, soviets, sovietrally2.Location); SpawnAndAttack(platoon, soviets, sovietrally5.Location); SpawnAndAttack(platoon, soviets, sovietrally6.Location); } if (world.FrameNumber == attackTicks * 5) { SpawnFlare(soviets, sovietparadrop2); MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop2.Location); } if (world.FrameNumber == attackTicks * 7) { SpawnFlare(soviets, sovietparadrop1); MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop1.Location); } if (world.FrameNumber == attackTicks * 10) { SpawnFlare(soviets, sovietparadrop1); MissionUtils.Paradrop(world, soviets, squad, sovietparadropEntry.Location, sovietparadrop1.Location); ManageSovietUnits(); } if (world.FrameNumber == attackTicks * 12) { Sound.Play("reinfor1.aud"); FrenchReinforcements(); } }