예제 #1
0
        private void calcSimulation()
        {
            this.SimulationEta  = 0;
            this.SimulationFuel = 0;

            if (!this.selection.Any(x => x.Value.Quantity > 0))
            {
                return;
            }

            var playerProc = this.game.Derivates.Players.Of[this.Fleet.Owner.Data];
            var fleet      = this.selectedFleet(simulationWaypoints.Select(x => new MoveMission(x.StartStar, x.DestionationStar, x.UsedWormhole)));

            var lastPosition = this.Fleet.FleetData.Position;
            var speedFormula = game.Statics.ShipFormulas.GalaxySpeed;
            var voidSpeed    = speedFormula.Evaluate(FleetProcessor.SpeedVars(this.game.Statics, playerProc, this.carriedSelection, false).Get);
            var laneSpeed    = speedFormula.Evaluate(FleetProcessor.SpeedVars(this.game.Statics, playerProc, this.carriedSelection, true).Get);

            foreach (var waypoint in simulationWaypoints)
            {
                var speed = waypoint.UsingWormhole ? laneSpeed : voidSpeed;

                var distance = (waypoint.Destionation - lastPosition).Length;
                this.SimulationEta += distance / speed;
                this.SimulationFuel = Math.Max(playerProc.FuelUsage(fleet, waypoint.StartStar.Position, waypoint.Destionation, game), this.SimulationFuel);
                lastPosition        = waypoint.Destionation;
            }
        }
예제 #2
0
        public FleetProcessingVisitor(Fleet fleet, MainGame game)
        {
            this.fleet       = fleet;
            this.game        = game;
            this.newPosition = fleet.Position;
            this.missions    = new LinkedList <AMission>(fleet.Missions);

            this.voidSpeed = game.Statics.ShipFormulas.GalaxySpeed.Evaluate(
                FleetProcessor.SpeedVars(
                    this.game.Statics,
                    game.Derivates[fleet.Owner],
                    fleet.Ships.ToDictionary(x => x.Design, x => x.Quantity),
                    false
                    ).Get
                );
            this.laneSpeed = game.Statics.ShipFormulas.GalaxySpeed.Evaluate(
                FleetProcessor.SpeedVars(
                    this.game.Statics,
                    game.Derivates[fleet.Owner],
                    fleet.Ships.ToDictionary(x => x.Design, x => x.Quantity),
                    true
                    ).Get
                );
        }