Esempio n. 1
0
        private void doConstruction(StaticsDB statics, StatesDB states, TemporaryDB derivates)
        {
            var oldPlans = Player.Orders.ConstructionPlans;

            Player.Orders.ConstructionPlans = new Dictionary <AConstructionSite, ConstructionOrders>();

            foreach (var colony in states.Colonies.OwnedBy[Player])
            {
                if (oldPlans.ContainsKey(colony))
                {
                    var updatedPlans = updateConstructionPlans(
                        statics,
                        oldPlans[colony],
                        derivates.Of(colony),
                        this.TechLevels
                        );

                    Player.Orders.ConstructionPlans.Add(colony, updatedPlans);
                }
                else
                {
                    Player.Orders.ConstructionPlans.Add(colony, new ConstructionOrders(PlayerOrders.DefaultSiteSpendingRatio));
                }
            }

            foreach (var stellaris in states.Stellarises.OwnedBy[Player])
            {
                if (oldPlans.ContainsKey(stellaris))
                {
                    var updatedPlans = updateConstructionPlans(
                        statics,
                        oldPlans[stellaris],
                        derivates.Of(stellaris),
                        this.TechLevels
                        );

                    Player.Orders.ConstructionPlans.Add(stellaris, updatedPlans);
                }
                else
                {
                    Player.Orders.ConstructionPlans.Add(stellaris, new ConstructionOrders(PlayerOrders.DefaultSiteSpendingRatio));
                }
            }
        }
        public void ProcessPrecombat(StaticsDB statics, StatesDB states, TemporaryDB derivates)
        {
            var catalizers = states.Fleets.OwnedBy[this.OrganellePlayer].SelectMany(x => x.Ships).Where(x => x.Design.IdCode == CatalyzerId).Sum(x => x.Quantity);

            if (catalizers < MaxCatalyzers)
            {
                var nativeDesign = states.Designs.OwnedBy[this.OrganellePlayer].First(x => x.IdCode == CatalyzerId);

                var star = states.Stars.First();
                derivates.Of(this.OrganellePlayer).SpawnShip(star, nativeDesign, 1, new AMission[0], states);
            }
        }
        public void Initialize(StatesDB states, StaticsDB statics, TemporaryDB derivates)
        {
            this.OrganellePlayer.Intelligence.Initialize(states.Stars.Select(
                                                             star => new Stareater.Galaxy.Builders.StarSystem(star, states.Planets.At[star].ToArray())
                                                             ));
            foreach (var star in states.Stars)
            {
                this.OrganellePlayer.Intelligence.StarFullyVisited(star, 0);
            }

            foreach (var template in statics.NativeDesigns)
            {
                makeDesign(statics, states, template.Key, template.Value, derivates.Of(this.OrganellePlayer));
            }
        }
Esempio n. 4
0
        public void Apply(StatesDB states, TemporaryDB derivates, AConstructionSite site, long quantity)
        {
            var project  = states.ColonizationProjects.Of[Destination].FirstOrDefault(x => x.Owner == this.ColonizerDesign.Owner);
            var missions = new LinkedList <AMission>();

            missions.AddLast(new SkipTurnMission());

            //TODO(later) check shortest path
            if (site.Location.Star != Destination.Star)
            {
                var lastStar = site.Location.Star;
                var nextStar = Destination.Star;
                var wormhole = states.Wormholes.At[lastStar].FirstOrDefault(x => x.FromStar == nextStar || x.ToStar == nextStar);
                missions.AddLast(new MoveMission(Destination.Star, wormhole));
            }

            missions.AddLast(new ColonizationMission(Destination));

            //TODO(v0.6) report new ship construction
            derivates.Of(site.Owner).SpawnShip(site.Location.Star, this.ColonizerDesign, quantity, missions, states);
        }
 public void Apply(StatesDB states, TemporaryDB derivates, AConstructionSite site, long quantity)
 {
     //TODO(v0.6) report new ship construction
     derivates.Of(site.Owner).SpawnShip(site.Location.Star, this.Design, quantity, new AMission[0], states);
 }