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 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); } }
internal PlayerProcessor Copy(PlayersRemap playersRemap) { var copy = new PlayerProcessor(playersRemap.Players[this.Player]); copy.DesignStats = this.DesignStats.ToDictionary(x => playersRemap.Designs[x.Key], x => x.Value); copy.DevelopmentPlan = (this.DevelopmentPlan != null) ? new List <DevelopmentResult>(this.DevelopmentPlan) : null; copy.RefitCosts = this.RefitCosts.ToDictionary(x => playersRemap.Designs[x.Key], x => x.Value.ToDictionary(y => playersRemap.Designs[y.Key], y => y.Value)); copy.ResearchPlan = (this.ResearchPlan != null) ? new List <ResearchResult>(this.ResearchPlan) : null; copy.TechLevels = new Dictionary <string, double>(this.TechLevels); return(copy); }
private Fleet(Fleet original, PlayersRemap playersRemap, Player owner) { this.Owner = owner; this.Position = original.Position; this.Missions = new LinkedList <AMission>(); foreach (var item in original.Missions) { this.Missions.AddLast(playersRemap.Missions[item]); } this.Ships = new ShipGroupCollection(); foreach (var item in original.Ships) { this.Ships.Add(item.Copy(playersRemap)); } }
internal TemporaryDB Copy(PlayersRemap playersRemap) { var copy = new TemporaryDB(); copy.Colonies = new ColonyProcessorCollection(); copy.Colonies.Add(this.Colonies.Select(x => x.Copy(playersRemap))); copy.Stellarises = new StellarisProcessorCollection(); copy.Stellarises.Add(this.Stellarises.Select(x => x.Copy(playersRemap))); copy.Players = new PlayerProcessorCollection(); copy.Players.Add(this.Players.Select(x => x.Copy(playersRemap))); copy.Natives = this.Natives.Copy(playersRemap); return(copy); }
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); }
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); }
public override AMission Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap) { return(new MoveMission(this.Destination, this.UsedWormhole)); }
internal StellarisAdmin Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap) { return(new StellarisAdmin(this, galaxyRemap.Stars[this.Location.Star], playersRemap.Players[this.Owner])); }
private Design copyRefitTo(Design original, PlayersRemap playersRemap) { return((original == null) ? null : playersRemap.Designs[original]); }
private HashSet <Fleet> copyFleetRegroup(IEnumerable <Fleet> original, PlayersRemap playersRemap) { return(new HashSet <Fleet>(original.Select(x => playersRemap.Fleets[x]))); }
internal StellarisProcessor Copy(PlayersRemap playerRemap) { return(new StellarisProcessor(playerRemap.Stellarises[this.Stellaris], this)); }
public GameCopy(MainGame game, PlayersRemap players, GalaxyRemap map) { this.Game = game; this.Players = players; this.Map = map; }
internal ColonyProcessor Copy(PlayersRemap playerRemap) { return(new ColonyProcessor(playerRemap.Colonies[this.Colony], this)); }
internal Design Copy(PlayersRemap playersRemap) { return(new Design(this, playersRemap.Players[this.Owner])); }
public abstract AMission Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap);
internal Fleet Copy(PlayersRemap playersRemap) { return(new Fleet(this, playersRemap, playersRemap.Players[this.Owner])); }
internal NativesProcessor Copy(PlayersRemap playersRemap) { return(new NativesProcessor(playersRemap.Players[this.OrganellePlayer])); }
public override AMission Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap) { return(new ColonizationMission(galaxyRemap.Planets[this.Target])); }
public override AMission Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap) { return(new SkipTurnMission()); }
internal PlayerOrders Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap) { return(new PlayerOrders(this, playersRemap, galaxyRemap)); }
internal ShipGroup Copy(PlayersRemap playersRemap) { return(new ShipGroup(playersRemap.Designs[this.Design], this.Quantity, this.Damage, this.UpgradePoints)); }
internal Colony Copy(PlayersRemap playersRemap, GalaxyRemap galaxyRemap) { return(new Colony(this, galaxyRemap.Planets[this.Location.Planet], playersRemap.Players[this.Owner])); }