public void Move(Player me, World world, Game game, Move move) { InitializeTick(me, world, game, move); if (me.RemainingActionCooldownTicks != 0) { return; } var nuclearAlarm = NuclearEvader.CheckNuclearAlarm(); if (nuclearAlarm) { return; } if (MainGameTasks.Any() && !NuclearAlarm) { ProcessTask(MainGameTasks.Dequeue()); return; } }
private void InitializeTick(Player me, World world, Game game, Move move) { Me = me; World = world; Game = game; Action = move; _turnsPer60Ticks = _turnsPer60TicksMin + 3 * world.Facilities.Count(f => f.OwnerPlayerId == Me.Id && f.Type == FacilityType.ControlCenter); if (TurnAfterLast60Tick.Any() && TurnAfterLast60Tick.Peek() <= World.TickIndex - 60) { TurnAfterLast60Tick.Dequeue(); } foreach (Vehicle vehicle in World.NewVehicles) { VehicleById[vehicle.Id] = vehicle; UpdateTickByVehicleId[vehicle.Id] = world.TickIndex; } foreach (VehicleUpdate vehicleUpdate in world.VehicleUpdates) { long vehicleId = vehicleUpdate.Id; if (vehicleUpdate.Durability == 0) { VehicleById.Remove(vehicleId); UpdateTickByVehicleId.Remove(vehicleId); } else { VehicleById[vehicleId] = new Vehicle(VehicleById[vehicleId], vehicleUpdate); UpdateTickByVehicleId[vehicleId] = world.TickIndex; } } InitStrategy(); if (World.TickIndex % 16 == 0) { IndicatorFacillites.Update(World.Facilities); GameGrid.Update(EnemyVehicles, World.Facilities); } if ((World.TickIndex + 64) % 512 == 0) { foreach (var squad in GroupManager.Squads.Where(s => s.Id >= (int)Group.NewGroup)) { StrategyController.FindSingleEnemy(squad); } } UpDateDelayedTasks(); if (Me.RemainingNuclearStrikeCooldownTicks <= 0) { if (World.TickIndex % 2 == 0) { if (!EnemyVehicles.Any() || !MyVehicles.Any()) { return; } foreach (var cell in GameGrid.Grid) { if (cell.EnemyCount > 5) { foreach (var squad in GroupManager.Squads) { if (cell.Distance(squad) < 200) { var enemies = EnemyVehicles.Where(v => v.X > cell.X * 64 && v.X <(cell.X + 1) * 64 && v.Y> cell.Y * 64 && v.Y < (cell.Y + 1) * 64 && v.Type != VehicleType.Arrv).ToList(); if (!enemies.Any()) { continue; } var enemyCenter = enemies.CenterXY(); var navodchick = MyVehicles.FirstOrDefault(v => v.Durability > 90 && v.VisionRange * 0.8 > v.GetDistanceTo(enemyCenter.X, enemyCenter.Y)); if (navodchick != null) { MainGameTasks.Enqueue(Act.Nuclear(new MyPoint(enemyCenter.X, enemyCenter.Y), navodchick.Id)); } } } } } } } }