Esempio n. 1
0
 private PlayerOrders(PlayerOrders original, PlayersRemap playersRemap, GalaxyRemap galaxyRemap)
 {
     this.DevelopmentFocusIndex = original.DevelopmentFocusIndex;
     this.DevelopmentQueue      = new Dictionary <string, int>();
     foreach (var item in original.DevelopmentQueue)
     {
         this.DevelopmentQueue.Add(item.Key, item.Value);
     }
     this.ResearchFocus     = original.ResearchFocus;
     this.ConstructionPlans = new Dictionary <AConstructionSite, ConstructionOrders>();
     foreach (var item in original.ConstructionPlans)
     {
         this.ConstructionPlans.Add(playersRemap.Site(item.Key), item.Value.Copy());
     }
     this.ShipOrders = new Dictionary <Vector2D, HashSet <Fleet> >();
     foreach (var item in original.ShipOrders)
     {
         this.ShipOrders.Add(item.Key, copyFleetRegroup(item.Value, playersRemap));
     }
     this.ColonizationOrders = new Dictionary <Planet, ColonizationPlan>();
     foreach (var item in original.ColonizationOrders)
     {
         this.ColonizationOrders.Add(galaxyRemap.Planets[item.Key], item.Value);
     }
     this.RefitOrders = new Dictionary <Design, Design>();
     foreach (var item in original.RefitOrders)
     {
         this.RefitOrders.Add(playersRemap.Designs[item.Key], copyRefitTo(item.Value, playersRemap));
     }
     this.AudienceRequests = new HashSet <int>();
     foreach (var item in original.AudienceRequests)
     {
         this.AudienceRequests.Add(item);
     }
 }
Esempio n. 2
0
        public GameCopy ReadonlyCopy()
        {
            var copy = new MainGame();

            GalaxyRemap  galaxyRemap  = this.States.CopyGalaxy();
            PlayersRemap playersRemap = this.States.CopyPlayers(
                this.AllPlayers.ToDictionary(x => x, x => x.Copy(galaxyRemap)),
                galaxyRemap);

            foreach (var playerPair in playersRemap.Players)
            {
                playerPair.Value.Orders = playerPair.Key.Orders.Copy(playersRemap, galaxyRemap);
            }

            copy.MainPlayers         = this.MainPlayers.Select(p => playersRemap.Players[p]).ToArray();
            copy.StareaterOrganelles = playersRemap.Players[this.StareaterOrganelles];
            copy.Turn = this.Turn;

            copy.IsReadOnly = true;
            copy.Statics    = this.Statics;
            copy.States     = this.States.Copy(playersRemap, galaxyRemap);
            copy.Derivates  = this.Derivates.Copy(playersRemap);

            return(new GameCopy(copy, playersRemap, galaxyRemap));
        }
		private ColonizationPlan(ColonizationPlan original, GalaxyRemap galaxyRemap, Planet destination) 
		{
			this.Destination = destination;
			this.Sources = new List<StarData>();
			foreach(var item in original.Sources)
				this.Sources.Add(galaxyRemap.Stars[item]);
 
			 
		}
Esempio n. 4
0
        public GalaxyRemap CopyGalaxy()
        {
            var remap = new GalaxyRemap(new Dictionary <StarData, StarData>(), new Dictionary <Planet, Planet>());

            remap.Stars   = this.Stars.ToDictionary(x => x, x => x.Copy());
            remap.Planets = this.Planets.ToDictionary(x => x, x => x.Copy(remap));

            return(remap);
        }
Esempio n. 5
0
        private Player(Player original, GalaxyRemap galaxyRemap)
        {
            this.Name  = original.Name;
            this.Color = original.Color;
            copyPlayerControl(original);

            this.UnlockedDesigns = new HashSet <PredefinedDesign>();
            foreach (var item in original.UnlockedDesigns)
            {
                this.UnlockedDesigns.Add(item);
            }
            this.Intelligence = original.Intelligence.Copy(galaxyRemap);


                        #if DEBUG
            this.id = NextId();
                        #endif
        }
Esempio n. 6
0
        public StatesDB Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap)
        {
            var copy = new StatesDB();

            copy.Stars = new StarCollection();
            copy.Stars.Add(galaxyRemap.Stars.Values);

            copy.Wormholes = new WormholeCollection();
            copy.Wormholes.Add(this.Wormholes.Select(x => x.Copy(galaxyRemap)));

            copy.Planets = new PlanetCollection();
            copy.Planets.Add(galaxyRemap.Planets.Values);

            copy.Colonies = new ColonyCollection();
            copy.Colonies.Add(playersRemap.Colonies.Values);

            copy.Stellarises = new StellarisCollection();
            copy.Stellarises.Add(playersRemap.Stellarises.Values);

            copy.ColonizationProjects = new ColonizationCollection();
            copy.ColonizationProjects.Add(playersRemap.Colonizations.Values);

            copy.Fleets = new FleetCollection();
            copy.Fleets.Add(playersRemap.Fleets.Values);

            copy.Designs = new DesignCollection();
            copy.Designs.Add(playersRemap.Designs.Values);

            copy.DevelopmentAdvances = new DevelopmentProgressCollection();
            copy.DevelopmentAdvances.Add(this.DevelopmentAdvances.Select(x => x.Copy(playersRemap)));

            copy.ResearchAdvances = new ResearchProgressCollection();
            copy.ResearchAdvances.Add(this.ResearchAdvances.Select(x => x.Copy(playersRemap)));

            copy.Treaties = new TreatyCollection();
            copy.Treaties.Add(this.Treaties.Select(x => x.Copy(playersRemap)));

            return(copy);
        }
Esempio n. 7
0
        internal PlayersRemap CopyPlayers(Dictionary <Player, Player> playersRemap, GalaxyRemap galaxyRemap)
        {
            var remap = new PlayersRemap(
                playersRemap,
                new Dictionary <AConstructionSite, Colony>(),
                new Dictionary <AConstructionSite, StellarisAdmin>(),
                new Dictionary <Design, Design>(),
                new Dictionary <Fleet, Fleet>(),
                new Dictionary <ColonizationProject, ColonizationProject>(),
                new Dictionary <AMission, AMission>()
                );

            remap.Colonies      = this.Colonies.ToDictionary(x => (AConstructionSite)x, x => x.Copy(remap, galaxyRemap));
            remap.Stellarises   = this.Stellarises.ToDictionary(x => (AConstructionSite)x, x => x.Copy(remap, galaxyRemap));
            remap.Designs       = this.Designs.ToDictionary(x => x, x => x.Copy(remap));
            remap.Colonizations = this.ColonizationProjects.ToDictionary(x => x, x => x.Copy(remap, galaxyRemap));
            remap.Missions      = this.Fleets.SelectMany(x => x.Missions).Distinct().ToDictionary(x => x, x => x.Copy(remap, galaxyRemap));
            remap.Fleets        = this.Fleets.ToDictionary(x => x, x => x.Copy(remap));

            foreach (var player in playersRemap.Keys)
            {
                foreach (var fleetOrders in player.Orders.ShipOrders.Values)
                {
                    foreach (var fleet in fleetOrders)
                    {
                        foreach (var mission in fleet.Missions.Where(x => !remap.Missions.ContainsKey(x)))
                        {
                            remap.Missions.Add(mission, mission.Copy(remap, galaxyRemap));
                        }
                        remap.Fleets.Add(fleet, fleet.Copy(remap));
                    }
                }
            }

            return(remap);
        }
Esempio n. 8
0
 internal Player Copy(GalaxyRemap galaxyRemap)
 {
     return(new Player(this, galaxyRemap));
 }
Esempio n. 9
0
 public override AMission Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap)
 {
     return(new MoveMission(this.Destination, this.UsedWormhole));
 }
Esempio n. 10
0
 public override AMission Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap)
 {
     return(new ColonizationMission(galaxyRemap.Planets[this.Target]));
 }
Esempio n. 11
0
 public abstract AMission Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap);
Esempio n. 12
0
 internal StellarisAdmin Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap)
 {
     return(new StellarisAdmin(this, galaxyRemap.Stars[this.Location.Star], playersRemap.Players[this.Owner]));
 }
Esempio n. 13
0
 internal PlayerOrders Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap)
 {
     return(new PlayerOrders(this, playersRemap, galaxyRemap));
 }
Esempio n. 14
0
 public GameCopy(MainGame game, PlayersRemap players, GalaxyRemap map)
 {
     this.Game    = game;
     this.Players = players;
     this.Map     = map;
 }
Esempio n. 15
0
 public override AMission Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap)
 {
     return(new SkipTurnMission());
 }
Esempio n. 16
0
 internal Planet Copy(GalaxyRemap galaxyRemap)
 {
     return(new Planet(this, galaxyRemap.Stars[this.Star]));
 }
Esempio n. 17
0
		internal ColonizationPlan Copy(GalaxyRemap galaxyRemap) 
		{
			return new ColonizationPlan(this, galaxyRemap, galaxyRemap.Planets[this.Destination]);
 
		} 
Esempio n. 18
0
 internal Wormhole Copy(GalaxyRemap galaxyRemap)
 {
     return(new Wormhole(galaxyRemap.Stars[this.FromStar], galaxyRemap.Stars[this.ToStar]));
 }
Esempio n. 19
0
 internal Colony Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap)
 {
     return(new Colony(this, galaxyRemap.Planets[this.Location.Planet], playersRemap.Players[this.Owner]));
 }