diff --git a/FrEee.Core/App.config b/FrEee.Core.Domain/App.config similarity index 100% rename from FrEee.Core/App.config rename to FrEee.Core.Domain/App.config diff --git a/FrEee.Core/ClassDiagram1.cd b/FrEee.Core.Domain/ClassDiagram1.cd similarity index 100% rename from FrEee.Core/ClassDiagram1.cd rename to FrEee.Core.Domain/ClassDiagram1.cd diff --git a/FrEee.Core/Extensions/ChecksExtensions.cs b/FrEee.Core.Domain/Extensions/ChecksExtensions.cs similarity index 98% rename from FrEee.Core/Extensions/ChecksExtensions.cs rename to FrEee.Core.Domain/Extensions/ChecksExtensions.cs index 44030b5e0..b461d0bd4 100644 --- a/FrEee.Core/Extensions/ChecksExtensions.cs +++ b/FrEee.Core.Domain/Extensions/ChecksExtensions.cs @@ -10,7 +10,6 @@ using System.Reflection; using FrEee.Utility; using FrEee.Objects.Civilization.Orders; -using FrEee.Serialization; using FrEee.Objects.Technology; using FrEee.Objects.GameState; using FrEee.Modding; @@ -281,7 +280,7 @@ internal static Visibility CheckSpaceObjectVisibility(this ISpaceObject sobj, Em var seers = sys.FindSpaceObjects(s => s.Owner == emp && !s.IsMemory); if (!seers.Any() || sobj.IsHiddenFrom(emp)) { - if (Galaxy.Current.OmniscientView && sobj.StarSystem.ExploredByEmpires.Contains(emp)) + if (Galaxy.Current.GameSetup.OmniscientView && sobj.StarSystem.ExploredByEmpires.Contains(emp)) return Visibility.Visible; if (emp.AllSystemsExploredFromStart) return Visibility.Fogged; @@ -356,7 +355,7 @@ public static bool HasVisibility(this ISpaceObject sobj, Empire emp, Visibility var seers = sys.FindSpaceObjects(s => s.Owner == emp && !s.IsMemory); if (!seers.Any() || sobj.IsHiddenFrom(emp)) { - if (Galaxy.Current.OmniscientView && sobj.StarSystem.ExploredByEmpires.Contains(emp)) + if (Galaxy.Current.GameSetup.OmniscientView && sobj.StarSystem.ExploredByEmpires.Contains(emp)) return Visibility.Visible >= desiredVisibility; if (emp.AllSystemsExploredFromStart) return Visibility.Fogged >= desiredVisibility; diff --git a/FrEee.Core/Extensions/CommonExtensions.cs b/FrEee.Core.Domain/Extensions/CommonExtensions.cs similarity index 99% rename from FrEee.Core/Extensions/CommonExtensions.cs rename to FrEee.Core.Domain/Extensions/CommonExtensions.cs index 1161f79d1..d4c5b5aac 100644 --- a/FrEee.Core/Extensions/CommonExtensions.cs +++ b/FrEee.Core.Domain/Extensions/CommonExtensions.cs @@ -1193,7 +1193,7 @@ public static ResourceQuantity StandardIncome(this IIncomeProducer o) var amount = abil.Value1.ToInt(); if (resource.HasValue) - amount = Galaxy.Current.StandardMiningModel.GetRate(amount, o.ResourceValue[resource], pcts[resource] / 100d); + amount = Galaxy.Current.GameSetup.StandardMiningModel.GetRate(amount, o.ResourceValue[resource], pcts[resource] / 100d); income.Add(resource, amount); } diff --git a/FrEee.Core/Extensions/ComparisonExtensions.cs b/FrEee.Core.Domain/Extensions/ComparisonExtensions.cs similarity index 100% rename from FrEee.Core/Extensions/ComparisonExtensions.cs rename to FrEee.Core.Domain/Extensions/ComparisonExtensions.cs diff --git a/FrEee.Core/Extensions/ConversionExtensions.cs b/FrEee.Core.Domain/Extensions/ConversionExtensions.cs similarity index 100% rename from FrEee.Core/Extensions/ConversionExtensions.cs rename to FrEee.Core.Domain/Extensions/ConversionExtensions.cs diff --git a/FrEee.Core/Extensions/CopyingExtensions.cs b/FrEee.Core.Domain/Extensions/CopyingExtensions.cs similarity index 100% rename from FrEee.Core/Extensions/CopyingExtensions.cs rename to FrEee.Core.Domain/Extensions/CopyingExtensions.cs diff --git a/FrEee.Core/Extensions/GameEnumerableExtensions.cs b/FrEee.Core.Domain/Extensions/GameEnumerableExtensions.cs similarity index 100% rename from FrEee.Core/Extensions/GameEnumerableExtensions.cs rename to FrEee.Core.Domain/Extensions/GameEnumerableExtensions.cs diff --git a/FrEee.Core/FrEee.Core.csproj b/FrEee.Core.Domain/FrEee.Core.Domain.csproj similarity index 100% rename from FrEee.Core/FrEee.Core.csproj rename to FrEee.Core.Domain/FrEee.Core.Domain.csproj diff --git a/FrEee.Core/FrEee.csproj.old b/FrEee.Core.Domain/FrEee.csproj.old similarity index 100% rename from FrEee.Core/FrEee.csproj.old rename to FrEee.Core.Domain/FrEee.csproj.old diff --git a/FrEee.Core/FrEee.ico b/FrEee.Core.Domain/FrEee.ico similarity index 100% rename from FrEee.Core/FrEee.ico rename to FrEee.Core.Domain/FrEee.ico diff --git a/FrEee.Core/FrEeeConstants.cs b/FrEee.Core.Domain/FrEeeConstants.cs similarity index 100% rename from FrEee.Core/FrEeeConstants.cs rename to FrEee.Core.Domain/FrEeeConstants.cs diff --git a/FrEee.Core/FrEeeStrongName.snk b/FrEee.Core.Domain/FrEeeStrongName.snk similarity index 100% rename from FrEee.Core/FrEeeStrongName.snk rename to FrEee.Core.Domain/FrEeeStrongName.snk diff --git a/FrEee.Core/Modding/Abilities/Ability.cs b/FrEee.Core.Domain/Modding/Abilities/Ability.cs similarity index 99% rename from FrEee.Core/Modding/Abilities/Ability.cs rename to FrEee.Core.Domain/Modding/Abilities/Ability.cs index d586d2e07..d392f37e3 100644 --- a/FrEee.Core/Modding/Abilities/Ability.cs +++ b/FrEee.Core.Domain/Modding/Abilities/Ability.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.Linq; using FrEee.Objects.GameState; -using FrEee.Serialization; using FrEee.Utility; namespace FrEee.Modding.Abilities; diff --git a/FrEee.Core/Modding/Abilities/AbilityRule.cs b/FrEee.Core.Domain/Modding/Abilities/AbilityRule.cs similarity index 100% rename from FrEee.Core/Modding/Abilities/AbilityRule.cs rename to FrEee.Core.Domain/Modding/Abilities/AbilityRule.cs diff --git a/FrEee.Core/Modding/Abilities/AbilityTargets.cs b/FrEee.Core.Domain/Modding/Abilities/AbilityTargets.cs similarity index 100% rename from FrEee.Core/Modding/Abilities/AbilityTargets.cs rename to FrEee.Core.Domain/Modding/Abilities/AbilityTargets.cs diff --git a/FrEee.Core/Modding/Abilities/AbilityValueRule.cs b/FrEee.Core.Domain/Modding/Abilities/AbilityValueRule.cs similarity index 100% rename from FrEee.Core/Modding/Abilities/AbilityValueRule.cs rename to FrEee.Core.Domain/Modding/Abilities/AbilityValueRule.cs diff --git a/FrEee.Core/Modding/Abilities/Extensions.cs b/FrEee.Core.Domain/Modding/Abilities/Extensions.cs similarity index 100% rename from FrEee.Core/Modding/Abilities/Extensions.cs rename to FrEee.Core.Domain/Modding/Abilities/Extensions.cs diff --git a/FrEee.Core/Modding/Abilities/IAbilityObject.cs b/FrEee.Core.Domain/Modding/Abilities/IAbilityObject.cs similarity index 97% rename from FrEee.Core/Modding/Abilities/IAbilityObject.cs rename to FrEee.Core.Domain/Modding/Abilities/IAbilityObject.cs index bb29e0a18..b67241e29 100644 --- a/FrEee.Core/Modding/Abilities/IAbilityObject.cs +++ b/FrEee.Core.Domain/Modding/Abilities/IAbilityObject.cs @@ -1,4 +1,4 @@ -using FrEee.Serialization; +using FrEee.Objects.GameState; using System.Collections.Generic; namespace FrEee.Modding.Abilities; diff --git a/FrEee.Core/Modding/Abilities/ICommonAbilityObject.cs b/FrEee.Core.Domain/Modding/Abilities/ICommonAbilityObject.cs similarity index 100% rename from FrEee.Core/Modding/Abilities/ICommonAbilityObject.cs rename to FrEee.Core.Domain/Modding/Abilities/ICommonAbilityObject.cs diff --git a/FrEee.Core/Modding/Abilities/IOwnableAbilityObject.cs b/FrEee.Core.Domain/Modding/Abilities/IOwnableAbilityObject.cs similarity index 100% rename from FrEee.Core/Modding/Abilities/IOwnableAbilityObject.cs rename to FrEee.Core.Domain/Modding/Abilities/IOwnableAbilityObject.cs diff --git a/FrEee.Core/Modding/ComputedFormula.cs b/FrEee.Core.Domain/Modding/ComputedFormula.cs similarity index 100% rename from FrEee.Core/Modding/ComputedFormula.cs rename to FrEee.Core.Domain/Modding/ComputedFormula.cs diff --git a/FrEee.Core/Modding/DamageType.cs b/FrEee.Core.Domain/Modding/DamageType.cs similarity index 100% rename from FrEee.Core/Modding/DamageType.cs rename to FrEee.Core.Domain/Modding/DamageType.cs diff --git a/FrEee.Core/Modding/DataFile.cs b/FrEee.Core.Domain/Modding/DataFile.cs similarity index 100% rename from FrEee.Core/Modding/DataFile.cs rename to FrEee.Core.Domain/Modding/DataFile.cs diff --git a/FrEee.Core/Modding/DataParsingException.cs b/FrEee.Core.Domain/Modding/DataParsingException.cs similarity index 100% rename from FrEee.Core/Modding/DataParsingException.cs rename to FrEee.Core.Domain/Modding/DataParsingException.cs diff --git a/FrEee.Core/Modding/EmpireTraitRequirement.cs b/FrEee.Core.Domain/Modding/EmpireTraitRequirement.cs similarity index 100% rename from FrEee.Core/Modding/EmpireTraitRequirement.cs rename to FrEee.Core.Domain/Modding/EmpireTraitRequirement.cs diff --git a/FrEee.Core/Modding/EventMessageTarget.cs b/FrEee.Core.Domain/Modding/EventMessageTarget.cs similarity index 100% rename from FrEee.Core/Modding/EventMessageTarget.cs rename to FrEee.Core.Domain/Modding/EventMessageTarget.cs diff --git a/FrEee.Core/Modding/EventSeverity.cs b/FrEee.Core.Domain/Modding/EventSeverity.cs similarity index 100% rename from FrEee.Core/Modding/EventSeverity.cs rename to FrEee.Core.Domain/Modding/EventSeverity.cs diff --git a/FrEee.Core/Modding/EventTemplate.cs b/FrEee.Core.Domain/Modding/EventTemplate.cs similarity index 100% rename from FrEee.Core/Modding/EventTemplate.cs rename to FrEee.Core.Domain/Modding/EventTemplate.cs diff --git a/FrEee.Core/Modding/EventType.cs b/FrEee.Core.Domain/Modding/EventType.cs similarity index 98% rename from FrEee.Core/Modding/EventType.cs rename to FrEee.Core.Domain/Modding/EventType.cs index 90de912e4..e405a918c 100644 --- a/FrEee.Core/Modding/EventType.cs +++ b/FrEee.Core.Domain/Modding/EventType.cs @@ -1,5 +1,4 @@ using FrEee.Objects.GameState; -using FrEee.Serialization; using System.Collections.Generic; namespace FrEee.Modding; diff --git a/FrEee.Core/Modding/Field.cs b/FrEee.Core.Domain/Modding/Field.cs similarity index 100% rename from FrEee.Core/Modding/Field.cs rename to FrEee.Core.Domain/Modding/Field.cs diff --git a/FrEee.Core/Modding/Formula.cs b/FrEee.Core.Domain/Modding/Formula.cs similarity index 100% rename from FrEee.Core/Modding/Formula.cs rename to FrEee.Core.Domain/Modding/Formula.cs diff --git a/FrEee.Core/Modding/FormulaContext.cs b/FrEee.Core.Domain/Modding/FormulaContext.cs similarity index 100% rename from FrEee.Core/Modding/FormulaContext.cs rename to FrEee.Core.Domain/Modding/FormulaContext.cs diff --git a/FrEee.Core/Modding/FormulaType.cs b/FrEee.Core.Domain/Modding/FormulaType.cs similarity index 100% rename from FrEee.Core/Modding/FormulaType.cs rename to FrEee.Core.Domain/Modding/FormulaType.cs diff --git a/FrEee.Core/Modding/IFormula.cs b/FrEee.Core.Domain/Modding/IFormula.cs similarity index 100% rename from FrEee.Core/Modding/IFormula.cs rename to FrEee.Core.Domain/Modding/IFormula.cs diff --git a/FrEee.Core/Modding/IFormulaHost.cs b/FrEee.Core.Domain/Modding/IFormulaHost.cs similarity index 100% rename from FrEee.Core/Modding/IFormulaHost.cs rename to FrEee.Core.Domain/Modding/IFormulaHost.cs diff --git a/FrEee.Core/Modding/IModObject.cs b/FrEee.Core.Domain/Modding/IModObject.cs similarity index 100% rename from FrEee.Core/Modding/IModObject.cs rename to FrEee.Core.Domain/Modding/IModObject.cs diff --git a/FrEee.Core/Modding/LiteralFormula.cs b/FrEee.Core.Domain/Modding/LiteralFormula.cs similarity index 100% rename from FrEee.Core/Modding/LiteralFormula.cs rename to FrEee.Core.Domain/Modding/LiteralFormula.cs diff --git a/FrEee.Core/Modding/Loaders/AbilityLoader.cs b/FrEee.Core.Domain/Modding/Loaders/AbilityLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/AbilityLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/AbilityLoader.cs diff --git a/FrEee.Core/Modding/Loaders/AbilityRuleLoader.cs b/FrEee.Core.Domain/Modding/Loaders/AbilityRuleLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/AbilityRuleLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/AbilityRuleLoader.cs diff --git a/FrEee.Core/Modding/Loaders/ComponentLoader.cs b/FrEee.Core.Domain/Modding/Loaders/ComponentLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/ComponentLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/ComponentLoader.cs diff --git a/FrEee.Core/Modding/Loaders/CultureLoader.cs b/FrEee.Core.Domain/Modding/Loaders/CultureLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/CultureLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/CultureLoader.cs diff --git a/FrEee.Core/Modding/Loaders/DamageTypeLoader.cs b/FrEee.Core.Domain/Modding/Loaders/DamageTypeLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/DamageTypeLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/DamageTypeLoader.cs diff --git a/FrEee.Core/Modding/Loaders/DataFileLoader.cs b/FrEee.Core.Domain/Modding/Loaders/DataFileLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/DataFileLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/DataFileLoader.cs diff --git a/FrEee.Core/Modding/Loaders/DesignRoleLoader.cs b/FrEee.Core.Domain/Modding/Loaders/DesignRoleLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/DesignRoleLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/DesignRoleLoader.cs diff --git a/FrEee.Core/Modding/Loaders/EmpireAILoader.cs b/FrEee.Core.Domain/Modding/Loaders/EmpireAILoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/EmpireAILoader.cs rename to FrEee.Core.Domain/Modding/Loaders/EmpireAILoader.cs diff --git a/FrEee.Core/Modding/Loaders/EventLoader.cs b/FrEee.Core.Domain/Modding/Loaders/EventLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/EventLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/EventLoader.cs diff --git a/FrEee.Core/Modding/Loaders/EventTypeLoader.cs b/FrEee.Core.Domain/Modding/Loaders/EventTypeLoader.cs similarity index 97% rename from FrEee.Core/Modding/Loaders/EventTypeLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/EventTypeLoader.cs index 0a4d310b4..b5fad5c92 100644 --- a/FrEee.Core/Modding/Loaders/EventTypeLoader.cs +++ b/FrEee.Core.Domain/Modding/Loaders/EventTypeLoader.cs @@ -1,5 +1,4 @@ using FrEee.Objects.GameState; -using FrEee.Serialization; using System.Collections.Generic; using System.Linq; diff --git a/FrEee.Core/Modding/Loaders/FacilityLoader.cs b/FrEee.Core.Domain/Modding/Loaders/FacilityLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/FacilityLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/FacilityLoader.cs diff --git a/FrEee.Core/Modding/Loaders/GalaxyLoader.cs b/FrEee.Core.Domain/Modding/Loaders/GalaxyLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/GalaxyLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/GalaxyLoader.cs diff --git a/FrEee.Core/Modding/Loaders/HappinessModelLoader.cs b/FrEee.Core.Domain/Modding/Loaders/HappinessModelLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/HappinessModelLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/HappinessModelLoader.cs diff --git a/FrEee.Core/Modding/Loaders/HullLoader.cs b/FrEee.Core.Domain/Modding/Loaders/HullLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/HullLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/HullLoader.cs diff --git a/FrEee.Core/Modding/Loaders/ILoader.cs b/FrEee.Core.Domain/Modding/Loaders/ILoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/ILoader.cs rename to FrEee.Core.Domain/Modding/Loaders/ILoader.cs diff --git a/FrEee.Core/Modding/Loaders/ModInfoLoader.cs b/FrEee.Core.Domain/Modding/Loaders/ModInfoLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/ModInfoLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/ModInfoLoader.cs diff --git a/FrEee.Core/Modding/Loaders/ModSettingsLoader.cs b/FrEee.Core.Domain/Modding/Loaders/ModSettingsLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/ModSettingsLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/ModSettingsLoader.cs diff --git a/FrEee.Core/Modding/Loaders/MountLoader.cs b/FrEee.Core.Domain/Modding/Loaders/MountLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/MountLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/MountLoader.cs diff --git a/FrEee.Core/Modding/Loaders/PopulationModifierLoader.cs b/FrEee.Core.Domain/Modding/Loaders/PopulationModifierLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/PopulationModifierLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/PopulationModifierLoader.cs diff --git a/FrEee.Core/Modding/Loaders/RequirementLoader.cs b/FrEee.Core.Domain/Modding/Loaders/RequirementLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/RequirementLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/RequirementLoader.cs diff --git a/FrEee.Core/Modding/Loaders/ScriptLoader.cs b/FrEee.Core.Domain/Modding/Loaders/ScriptLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/ScriptLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/ScriptLoader.cs diff --git a/FrEee.Core/Modding/Loaders/StarSystemLoader.cs b/FrEee.Core.Domain/Modding/Loaders/StarSystemLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/StarSystemLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/StarSystemLoader.cs diff --git a/FrEee.Core/Modding/Loaders/StellarAbilityLoader.cs b/FrEee.Core.Domain/Modding/Loaders/StellarAbilityLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/StellarAbilityLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/StellarAbilityLoader.cs diff --git a/FrEee.Core/Modding/Loaders/StellarObjectLoader.cs b/FrEee.Core.Domain/Modding/Loaders/StellarObjectLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/StellarObjectLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/StellarObjectLoader.cs diff --git a/FrEee.Core/Modding/Loaders/StellarObjectSizeLoader.cs b/FrEee.Core.Domain/Modding/Loaders/StellarObjectSizeLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/StellarObjectSizeLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/StellarObjectSizeLoader.cs diff --git a/FrEee.Core/Modding/Loaders/TechnologyLoader.cs b/FrEee.Core.Domain/Modding/Loaders/TechnologyLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/TechnologyLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/TechnologyLoader.cs diff --git a/FrEee.Core/Modding/Loaders/TextLoader.cs b/FrEee.Core.Domain/Modding/Loaders/TextLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/TextLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/TextLoader.cs diff --git a/FrEee.Core/Modding/Loaders/TraitLoader.cs b/FrEee.Core.Domain/Modding/Loaders/TraitLoader.cs similarity index 100% rename from FrEee.Core/Modding/Loaders/TraitLoader.cs rename to FrEee.Core.Domain/Modding/Loaders/TraitLoader.cs diff --git a/FrEee.Core/Modding/MetaRecord.cs b/FrEee.Core.Domain/Modding/MetaRecord.cs similarity index 100% rename from FrEee.Core/Modding/MetaRecord.cs rename to FrEee.Core.Domain/Modding/MetaRecord.cs diff --git a/FrEee.Core/Modding/MetaRecordParameter.cs b/FrEee.Core.Domain/Modding/MetaRecordParameter.cs similarity index 100% rename from FrEee.Core/Modding/MetaRecordParameter.cs rename to FrEee.Core.Domain/Modding/MetaRecordParameter.cs diff --git a/FrEee.Core/Modding/Mod.cs b/FrEee.Core.Domain/Modding/Mod.cs similarity index 100% rename from FrEee.Core/Modding/Mod.cs rename to FrEee.Core.Domain/Modding/Mod.cs diff --git a/FrEee.Core/Modding/ModInfo.cs b/FrEee.Core.Domain/Modding/ModInfo.cs similarity index 100% rename from FrEee.Core/Modding/ModInfo.cs rename to FrEee.Core.Domain/Modding/ModInfo.cs diff --git a/FrEee.Core/Modding/ModProgress.cs b/FrEee.Core.Domain/Modding/ModProgress.cs similarity index 100% rename from FrEee.Core/Modding/ModProgress.cs rename to FrEee.Core.Domain/Modding/ModProgress.cs diff --git a/FrEee.Core/Modding/ModReference.cs b/FrEee.Core.Domain/Modding/ModReference.cs similarity index 100% rename from FrEee.Core/Modding/ModReference.cs rename to FrEee.Core.Domain/Modding/ModReference.cs diff --git a/FrEee.Core/Modding/ModReferenceKeyedDictionary.cs b/FrEee.Core.Domain/Modding/ModReferenceKeyedDictionary.cs similarity index 100% rename from FrEee.Core/Modding/ModReferenceKeyedDictionary.cs rename to FrEee.Core.Domain/Modding/ModReferenceKeyedDictionary.cs diff --git a/FrEee.Core/Modding/ModReferenceList.cs b/FrEee.Core.Domain/Modding/ModReferenceList.cs similarity index 100% rename from FrEee.Core/Modding/ModReferenceList.cs rename to FrEee.Core.Domain/Modding/ModReferenceList.cs diff --git a/FrEee.Core/Modding/ModReferenceSet.cs b/FrEee.Core.Domain/Modding/ModReferenceSet.cs similarity index 100% rename from FrEee.Core/Modding/ModReferenceSet.cs rename to FrEee.Core.Domain/Modding/ModReferenceSet.cs diff --git a/FrEee.Core/Modding/ModSettings.cs b/FrEee.Core.Domain/Modding/ModSettings.cs similarity index 100% rename from FrEee.Core/Modding/ModSettings.cs rename to FrEee.Core.Domain/Modding/ModSettings.cs diff --git a/FrEee.Core/Modding/ObjectFormula.cs b/FrEee.Core.Domain/Modding/ObjectFormula.cs similarity index 100% rename from FrEee.Core/Modding/ObjectFormula.cs rename to FrEee.Core.Domain/Modding/ObjectFormula.cs diff --git a/FrEee.Core/Modding/PopulationModifier.cs b/FrEee.Core.Domain/Modding/PopulationModifier.cs similarity index 100% rename from FrEee.Core/Modding/PopulationModifier.cs rename to FrEee.Core.Domain/Modding/PopulationModifier.cs diff --git a/FrEee.Core/Modding/Record.cs b/FrEee.Core.Domain/Modding/Record.cs similarity index 100% rename from FrEee.Core/Modding/Record.cs rename to FrEee.Core.Domain/Modding/Record.cs diff --git a/FrEee.Core/Modding/Requirement.cs b/FrEee.Core.Domain/Modding/Requirement.cs similarity index 100% rename from FrEee.Core/Modding/Requirement.cs rename to FrEee.Core.Domain/Modding/Requirement.cs diff --git a/FrEee.Core/Modding/RequirementType.cs b/FrEee.Core.Domain/Modding/RequirementType.cs similarity index 100% rename from FrEee.Core/Modding/RequirementType.cs rename to FrEee.Core.Domain/Modding/RequirementType.cs diff --git a/FrEee.Core/Modding/ResourceFormula.cs b/FrEee.Core.Domain/Modding/ResourceFormula.cs similarity index 100% rename from FrEee.Core/Modding/ResourceFormula.cs rename to FrEee.Core.Domain/Modding/ResourceFormula.cs diff --git a/FrEee.Core/Modding/Scripts/CSScript.cs b/FrEee.Core.Domain/Modding/Scripts/CSScript.cs similarity index 100% rename from FrEee.Core/Modding/Scripts/CSScript.cs rename to FrEee.Core.Domain/Modding/Scripts/CSScript.cs diff --git a/FrEee.Core/Modding/Scripts/IScript.cs b/FrEee.Core.Domain/Modding/Scripts/IScript.cs similarity index 100% rename from FrEee.Core/Modding/Scripts/IScript.cs rename to FrEee.Core.Domain/Modding/Scripts/IScript.cs diff --git a/FrEee.Core/Modding/Scripts/PythonScript.cs b/FrEee.Core.Domain/Modding/Scripts/PythonScript.cs similarity index 100% rename from FrEee.Core/Modding/Scripts/PythonScript.cs rename to FrEee.Core.Domain/Modding/Scripts/PythonScript.cs diff --git a/FrEee.Core/Modding/Scripts/PythonScriptEngine.cs b/FrEee.Core.Domain/Modding/Scripts/PythonScriptEngine.cs similarity index 100% rename from FrEee.Core/Modding/Scripts/PythonScriptEngine.cs rename to FrEee.Core.Domain/Modding/Scripts/PythonScriptEngine.cs diff --git a/FrEee.Core/Modding/Scripts/ScriptRequirement.cs b/FrEee.Core.Domain/Modding/Scripts/ScriptRequirement.cs similarity index 100% rename from FrEee.Core/Modding/Scripts/ScriptRequirement.cs rename to FrEee.Core.Domain/Modding/Scripts/ScriptRequirement.cs diff --git a/FrEee.Core/Modding/StellarObjectLocations/CircleRadiusStellarObjectLocation.cs b/FrEee.Core.Domain/Modding/StellarObjectLocations/CircleRadiusStellarObjectLocation.cs similarity index 100% rename from FrEee.Core/Modding/StellarObjectLocations/CircleRadiusStellarObjectLocation.cs rename to FrEee.Core.Domain/Modding/StellarObjectLocations/CircleRadiusStellarObjectLocation.cs diff --git a/FrEee.Core/Modding/StellarObjectLocations/CoordStellarObjectLocation.cs b/FrEee.Core.Domain/Modding/StellarObjectLocations/CoordStellarObjectLocation.cs similarity index 100% rename from FrEee.Core/Modding/StellarObjectLocations/CoordStellarObjectLocation.cs rename to FrEee.Core.Domain/Modding/StellarObjectLocations/CoordStellarObjectLocation.cs diff --git a/FrEee.Core/Modding/StellarObjectLocations/IStellarObjectLocation.cs b/FrEee.Core.Domain/Modding/StellarObjectLocations/IStellarObjectLocation.cs similarity index 100% rename from FrEee.Core/Modding/StellarObjectLocations/IStellarObjectLocation.cs rename to FrEee.Core.Domain/Modding/StellarObjectLocations/IStellarObjectLocation.cs diff --git a/FrEee.Core/Modding/StellarObjectLocations/RingStellarObjectLocation.cs b/FrEee.Core.Domain/Modding/StellarObjectLocations/RingStellarObjectLocation.cs similarity index 100% rename from FrEee.Core/Modding/StellarObjectLocations/RingStellarObjectLocation.cs rename to FrEee.Core.Domain/Modding/StellarObjectLocations/RingStellarObjectLocation.cs diff --git a/FrEee.Core/Modding/StellarObjectLocations/SameAsStellarObjectLocation.cs b/FrEee.Core.Domain/Modding/StellarObjectLocations/SameAsStellarObjectLocation.cs similarity index 100% rename from FrEee.Core/Modding/StellarObjectLocations/SameAsStellarObjectLocation.cs rename to FrEee.Core.Domain/Modding/StellarObjectLocations/SameAsStellarObjectLocation.cs diff --git a/FrEee.Core/Modding/StellarObjectSize.cs b/FrEee.Core.Domain/Modding/StellarObjectSize.cs similarity index 100% rename from FrEee.Core/Modding/StellarObjectSize.cs rename to FrEee.Core.Domain/Modding/StellarObjectSize.cs diff --git a/FrEee.Core/Modding/Templates/AsteroidFieldTemplate.cs b/FrEee.Core.Domain/Modding/Templates/AsteroidFieldTemplate.cs similarity index 89% rename from FrEee.Core/Modding/Templates/AsteroidFieldTemplate.cs rename to FrEee.Core.Domain/Modding/Templates/AsteroidFieldTemplate.cs index 4a509a4a1..21c1ded40 100644 --- a/FrEee.Core/Modding/Templates/AsteroidFieldTemplate.cs +++ b/FrEee.Core.Domain/Modding/Templates/AsteroidFieldTemplate.cs @@ -85,9 +85,9 @@ public AsteroidField Instantiate() if (abil != null) asteroids.IntrinsicAbilities.Add(abil); - asteroids.ResourceValue[Resource.Minerals] = RandomHelper.Range(Galaxy.Current.MinSpawnedAsteroidValue, Galaxy.Current.MaxSpawnedAsteroidValue); - asteroids.ResourceValue[Resource.Organics] = RandomHelper.Range(Galaxy.Current.MinSpawnedAsteroidValue, Galaxy.Current.MaxSpawnedAsteroidValue); - asteroids.ResourceValue[Resource.Radioactives] = RandomHelper.Range(Galaxy.Current.MinSpawnedAsteroidValue, Galaxy.Current.MaxSpawnedAsteroidValue); + asteroids.ResourceValue[Resource.Minerals] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedAsteroidValue, Galaxy.Current.GameSetup.MaxSpawnedAsteroidValue); + asteroids.ResourceValue[Resource.Organics] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedAsteroidValue, Galaxy.Current.GameSetup.MaxSpawnedAsteroidValue); + asteroids.ResourceValue[Resource.Radioactives] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedAsteroidValue, Galaxy.Current.GameSetup.MaxSpawnedAsteroidValue); return asteroids; } diff --git a/FrEee.Core/Modding/Templates/ComponentTemplate.cs b/FrEee.Core.Domain/Modding/Templates/ComponentTemplate.cs similarity index 100% rename from FrEee.Core/Modding/Templates/ComponentTemplate.cs rename to FrEee.Core.Domain/Modding/Templates/ComponentTemplate.cs diff --git a/FrEee.Core/Modding/Templates/FacilityTemplate.cs b/FrEee.Core.Domain/Modding/Templates/FacilityTemplate.cs similarity index 100% rename from FrEee.Core/Modding/Templates/FacilityTemplate.cs rename to FrEee.Core.Domain/Modding/Templates/FacilityTemplate.cs diff --git a/FrEee.Core/Modding/Templates/GalaxyTemplate.cs b/FrEee.Core.Domain/Modding/Templates/GalaxyTemplate.cs similarity index 95% rename from FrEee.Core/Modding/Templates/GalaxyTemplate.cs rename to FrEee.Core.Domain/Modding/Templates/GalaxyTemplate.cs index 314a43129..e8a55622c 100644 --- a/FrEee.Core/Modding/Templates/GalaxyTemplate.cs +++ b/FrEee.Core.Domain/Modding/Templates/GalaxyTemplate.cs @@ -100,17 +100,7 @@ public Galaxy Instantiate() public Galaxy Instantiate(Status status, double desiredProgress, PRNG dice) { var gal = new Galaxy(); - gal.Width = GameSetup.GalaxySize.Width; - gal.Height = GameSetup.GalaxySize.Height; - gal.MinPlanetValue = GameSetup.MinPlanetValue; - gal.MinSpawnedPlanetValue = GameSetup.MinSpawnedPlanetValue; - gal.MaxSpawnedPlanetValue = GameSetup.MaxSpawnedPlanetValue; - gal.MaxPlanetValue = GameSetup.MaxPlanetValue; - gal.MinAsteroidValue = GameSetup.MinAsteroidValue; - gal.MinSpawnedAsteroidValue = GameSetup.MinSpawnedAsteroidValue; - gal.MaxSpawnedAsteroidValue = GameSetup.MaxSpawnedAsteroidValue; - gal.EventFrequency = GameSetup.EventFrequency; - gal.MaximumEventSeverity = GameSetup.MaximumEventSeverity; + gal.GameSetup = GameSetup; var bounds = new Rectangle(-GameSetup.GalaxySize.Width / 2, -GameSetup.GalaxySize.Height / 2, GameSetup.GalaxySize.Width, GameSetup.GalaxySize.Height); var unusedNames = new List(Mod.Current.StarSystemNames); diff --git a/FrEee.Core/Modding/Templates/PlanetTemplate.cs b/FrEee.Core.Domain/Modding/Templates/PlanetTemplate.cs similarity index 91% rename from FrEee.Core/Modding/Templates/PlanetTemplate.cs rename to FrEee.Core.Domain/Modding/Templates/PlanetTemplate.cs index f1381daaa..0b00d6110 100644 --- a/FrEee.Core/Modding/Templates/PlanetTemplate.cs +++ b/FrEee.Core.Domain/Modding/Templates/PlanetTemplate.cs @@ -91,9 +91,9 @@ public Planet Instantiate() if (abil != null) planet.IntrinsicAbilities.Add(abil); - planet.ResourceValue[Resource.Minerals] = RandomHelper.Range(Galaxy.Current.MinSpawnedPlanetValue, Galaxy.Current.MaxSpawnedPlanetValue); - planet.ResourceValue[Resource.Organics] = RandomHelper.Range(Galaxy.Current.MinSpawnedPlanetValue, Galaxy.Current.MaxSpawnedPlanetValue); - planet.ResourceValue[Resource.Radioactives] = RandomHelper.Range(Galaxy.Current.MinSpawnedPlanetValue, Galaxy.Current.MaxSpawnedPlanetValue); + planet.ResourceValue[Resource.Minerals] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedPlanetValue, Galaxy.Current.GameSetup.MaxSpawnedPlanetValue); + planet.ResourceValue[Resource.Organics] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedPlanetValue, Galaxy.Current.GameSetup.MaxSpawnedPlanetValue); + planet.ResourceValue[Resource.Radioactives] = RandomHelper.Range(Galaxy.Current.GameSetup.MinSpawnedPlanetValue, Galaxy.Current.GameSetup.MaxSpawnedPlanetValue); planet.ConditionsAmount = RandomHelper.Range(Mod.Current.Settings.MinRandomPlanetConditions, Mod.Current.Settings.MaxRandomPlanetConditions); diff --git a/FrEee.Core/Modding/Templates/RandomAbilityTemplate.cs b/FrEee.Core.Domain/Modding/Templates/RandomAbilityTemplate.cs similarity index 100% rename from FrEee.Core/Modding/Templates/RandomAbilityTemplate.cs rename to FrEee.Core.Domain/Modding/Templates/RandomAbilityTemplate.cs diff --git a/FrEee.Core/Modding/Templates/StarSystemTemplate.cs b/FrEee.Core.Domain/Modding/Templates/StarSystemTemplate.cs similarity index 100% rename from FrEee.Core/Modding/Templates/StarSystemTemplate.cs rename to FrEee.Core.Domain/Modding/Templates/StarSystemTemplate.cs diff --git a/FrEee.Core/Modding/Templates/StarTemplate.cs b/FrEee.Core.Domain/Modding/Templates/StarTemplate.cs similarity index 100% rename from FrEee.Core/Modding/Templates/StarTemplate.cs rename to FrEee.Core.Domain/Modding/Templates/StarTemplate.cs diff --git a/FrEee.Core/Modding/Templates/StormTemplate.cs b/FrEee.Core.Domain/Modding/Templates/StormTemplate.cs similarity index 100% rename from FrEee.Core/Modding/Templates/StormTemplate.cs rename to FrEee.Core.Domain/Modding/Templates/StormTemplate.cs diff --git a/FrEee.Core/Objects/Civilization/Aptitude.cs b/FrEee.Core.Domain/Objects/Civilization/Aptitude.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Aptitude.cs rename to FrEee.Core.Domain/Objects/Civilization/Aptitude.cs diff --git a/FrEee.Core/Objects/Civilization/CargoStorage/Cargo.cs b/FrEee.Core.Domain/Objects/Civilization/CargoStorage/Cargo.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/CargoStorage/Cargo.cs rename to FrEee.Core.Domain/Objects/Civilization/CargoStorage/Cargo.cs diff --git a/FrEee.Core/Objects/Civilization/CargoStorage/CargoDelta.cs b/FrEee.Core.Domain/Objects/Civilization/CargoStorage/CargoDelta.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/CargoStorage/CargoDelta.cs rename to FrEee.Core.Domain/Objects/Civilization/CargoStorage/CargoDelta.cs diff --git a/FrEee.Core/Objects/Civilization/CargoStorage/ICargoContainer.cs b/FrEee.Core.Domain/Objects/Civilization/CargoStorage/ICargoContainer.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/CargoStorage/ICargoContainer.cs rename to FrEee.Core.Domain/Objects/Civilization/CargoStorage/ICargoContainer.cs diff --git a/FrEee.Core/Objects/Civilization/CargoStorage/ICargoTransferrer.cs b/FrEee.Core.Domain/Objects/Civilization/CargoStorage/ICargoTransferrer.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/CargoStorage/ICargoTransferrer.cs rename to FrEee.Core.Domain/Objects/Civilization/CargoStorage/ICargoTransferrer.cs diff --git a/FrEee.Core/Objects/Civilization/Colony.cs b/FrEee.Core.Domain/Objects/Civilization/Colony.cs similarity index 99% rename from FrEee.Core/Objects/Civilization/Colony.cs rename to FrEee.Core.Domain/Objects/Civilization/Colony.cs index 4f7877729..1e78cf40d 100644 --- a/FrEee.Core/Objects/Civilization/Colony.cs +++ b/FrEee.Core.Domain/Objects/Civilization/Colony.cs @@ -12,7 +12,6 @@ using FrEee.Objects.GameState; using FrEee.Extensions; using FrEee.Utility; -using FrEee.Serialization; using FrEee.Modding.Abilities; namespace FrEee.Objects.Civilization; diff --git a/FrEee.Core/Objects/Civilization/Construction/ConstructionQueue.cs b/FrEee.Core.Domain/Objects/Civilization/Construction/ConstructionQueue.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Construction/ConstructionQueue.cs rename to FrEee.Core.Domain/Objects/Civilization/Construction/ConstructionQueue.cs diff --git a/FrEee.Core/Objects/Civilization/Construction/IConstructable.cs b/FrEee.Core.Domain/Objects/Civilization/Construction/IConstructable.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Construction/IConstructable.cs rename to FrEee.Core.Domain/Objects/Civilization/Construction/IConstructable.cs diff --git a/FrEee.Core/Objects/Civilization/Construction/IConstructionOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Construction/IConstructionOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Construction/IConstructionOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Construction/IConstructionOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Construction/IConstructionTemplate.cs b/FrEee.Core.Domain/Objects/Civilization/Construction/IConstructionTemplate.cs similarity index 97% rename from FrEee.Core/Objects/Civilization/Construction/IConstructionTemplate.cs rename to FrEee.Core.Domain/Objects/Civilization/Construction/IConstructionTemplate.cs index d710278a0..7fa8d4bbf 100644 --- a/FrEee.Core/Objects/Civilization/Construction/IConstructionTemplate.cs +++ b/FrEee.Core.Domain/Objects/Civilization/Construction/IConstructionTemplate.cs @@ -1,7 +1,6 @@ using FrEee.Objects.Civilization; using FrEee.Objects.GameState; using FrEee.Objects.Technology; -using FrEee.Serialization; using FrEee.Utility; namespace FrEee.Objects.Civilization.Construction; diff --git a/FrEee.Core/Objects/Civilization/Construction/IConstructor.cs b/FrEee.Core.Domain/Objects/Civilization/Construction/IConstructor.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Construction/IConstructor.cs rename to FrEee.Core.Domain/Objects/Civilization/Construction/IConstructor.cs diff --git a/FrEee.Core/Objects/Civilization/Culture.cs b/FrEee.Core.Domain/Objects/Civilization/Culture.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Culture.cs rename to FrEee.Core.Domain/Objects/Civilization/Culture.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Actions/AcceptProposalAction.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Actions/AcceptProposalAction.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Actions/AcceptProposalAction.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Actions/AcceptProposalAction.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Actions/BreakTreatyAction.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Actions/BreakTreatyAction.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Actions/BreakTreatyAction.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Actions/BreakTreatyAction.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Actions/DeclareWarAction.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Actions/DeclareWarAction.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Actions/DeclareWarAction.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Actions/DeclareWarAction.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Actions/DiplomaticAction.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Actions/DiplomaticAction.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Actions/DiplomaticAction.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Actions/DiplomaticAction.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Actions/RejectProposalAction.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Actions/RejectProposalAction.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Actions/RejectProposalAction.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Actions/RejectProposalAction.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/AllianceLevel.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/AllianceLevel.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/AllianceLevel.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/AllianceLevel.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/AllowedTrades.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/AllowedTrades.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/AllowedTrades.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/AllowedTrades.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Clauses/AllianceClause.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/AllianceClause.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Clauses/AllianceClause.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/AllianceClause.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Clauses/Clause.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/Clause.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Clauses/Clause.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/Clause.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Clauses/CooperativeResearchClause.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/CooperativeResearchClause.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Clauses/CooperativeResearchClause.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/CooperativeResearchClause.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Clauses/FreeTradeClause.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/FreeTradeClause.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Clauses/FreeTradeClause.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/FreeTradeClause.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Clauses/ShareAbilityClause.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/ShareAbilityClause.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Clauses/ShareAbilityClause.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/ShareAbilityClause.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Clauses/ShareCombatLogsClause.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/ShareCombatLogsClause.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Clauses/ShareCombatLogsClause.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/ShareCombatLogsClause.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Clauses/ShareDesignsClause.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/ShareDesignsClause.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Clauses/ShareDesignsClause.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/ShareDesignsClause.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Clauses/ShareVisionClause.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/ShareVisionClause.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Clauses/ShareVisionClause.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/ShareVisionClause.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Clauses/SharingPriority.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/SharingPriority.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Clauses/SharingPriority.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/SharingPriority.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Clauses/TributeClause.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/TributeClause.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Clauses/TributeClause.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Clauses/TributeClause.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Messages/ActionMessage.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/ActionMessage.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Messages/ActionMessage.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/ActionMessage.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Messages/GeneralMessage.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/GeneralMessage.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Messages/GeneralMessage.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/GeneralMessage.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Messages/IMessage.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/IMessage.cs similarity index 93% rename from FrEee.Core/Objects/Civilization/Diplomacy/Messages/IMessage.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/IMessage.cs index e546a4c82..84496e948 100644 --- a/FrEee.Core/Objects/Civilization/Diplomacy/Messages/IMessage.cs +++ b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/IMessage.cs @@ -1,5 +1,4 @@ using FrEee.Objects.GameState; -using FrEee.Serialization; namespace FrEee.Objects.Civilization.Diplomacy.Messages; diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Messages/Message.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/Message.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Messages/Message.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/Message.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Messages/ProposalMessage.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/ProposalMessage.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Messages/ProposalMessage.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Messages/ProposalMessage.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Package.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Package.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Package.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Package.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Proposal.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Proposal.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Proposal.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Proposal.cs diff --git a/FrEee.Core/Objects/Civilization/Diplomacy/Relations.cs b/FrEee.Core.Domain/Objects/Civilization/Diplomacy/Relations.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Diplomacy/Relations.cs rename to FrEee.Core.Domain/Objects/Civilization/Diplomacy/Relations.cs diff --git a/FrEee.Core/Objects/Civilization/Empire.cs b/FrEee.Core.Domain/Objects/Civilization/Empire.cs similarity index 99% rename from FrEee.Core/Objects/Civilization/Empire.cs rename to FrEee.Core.Domain/Objects/Civilization/Empire.cs index 13e5a0680..79a7081c2 100644 --- a/FrEee.Core/Objects/Civilization/Empire.cs +++ b/FrEee.Core.Domain/Objects/Civilization/Empire.cs @@ -120,7 +120,7 @@ public bool AllSystemsExploredFromStart get { if (allSystemsExploredFromStart is null) - allSystemsExploredFromStart = Galaxy.Current.AllSystemsExploredFromStart || this.HasAbility("Galaxy Seen"); + allSystemsExploredFromStart = Galaxy.Current.GameSetup.AllSystemsExplored || this.HasAbility("Galaxy Seen"); return allSystemsExploredFromStart.Value; } } @@ -867,7 +867,7 @@ public void ComputeResearchProgress() { // can we see it? // TODO - rankings too, not just scores - var disp = Galaxy.Current.ScoreDisplay; + var disp = Galaxy.Current.GameSetup.ScoreDisplay; bool showit = false; if (viewer == null) showit = true; // host can see everyone's scores diff --git a/FrEee.Core/Objects/Civilization/EmpireStatus.cs b/FrEee.Core.Domain/Objects/Civilization/EmpireStatus.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/EmpireStatus.cs rename to FrEee.Core.Domain/Objects/Civilization/EmpireStatus.cs diff --git a/FrEee.Core/Objects/Civilization/HappinessModel.cs b/FrEee.Core.Domain/Objects/Civilization/HappinessModel.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/HappinessModel.cs rename to FrEee.Core.Domain/Objects/Civilization/HappinessModel.cs diff --git a/FrEee.Core/Objects/Civilization/IIncomeProducer.cs b/FrEee.Core.Domain/Objects/Civilization/IIncomeProducer.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/IIncomeProducer.cs rename to FrEee.Core.Domain/Objects/Civilization/IIncomeProducer.cs diff --git a/FrEee.Core/Objects/Civilization/INameable.cs b/FrEee.Core.Domain/Objects/Civilization/INameable.cs similarity index 92% rename from FrEee.Core/Objects/Civilization/INameable.cs rename to FrEee.Core.Domain/Objects/Civilization/INameable.cs index 33748c714..d3d5b3dd3 100644 --- a/FrEee.Core/Objects/Civilization/INameable.cs +++ b/FrEee.Core.Domain/Objects/Civilization/INameable.cs @@ -1,5 +1,4 @@ using FrEee.Objects.GameState; -using FrEee.Serialization; namespace FrEee.Objects.Civilization; diff --git a/FrEee.Core/Objects/Civilization/IOrderable.cs b/FrEee.Core.Domain/Objects/Civilization/IOrderable.cs similarity index 96% rename from FrEee.Core/Objects/Civilization/IOrderable.cs rename to FrEee.Core.Domain/Objects/Civilization/IOrderable.cs index f75895a4f..8d8c9de66 100644 --- a/FrEee.Core/Objects/Civilization/IOrderable.cs +++ b/FrEee.Core.Domain/Objects/Civilization/IOrderable.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using FrEee.Objects.Civilization.Orders; -using FrEee.Serialization; +using FrEee.Objects.GameState; namespace FrEee.Objects.Civilization; diff --git a/FrEee.Core/Objects/Civilization/IOwnable.cs b/FrEee.Core.Domain/Objects/Civilization/IOwnable.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/IOwnable.cs rename to FrEee.Core.Domain/Objects/Civilization/IOwnable.cs diff --git a/FrEee.Core/Objects/Civilization/Mood.cs b/FrEee.Core.Domain/Objects/Civilization/Mood.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Mood.cs rename to FrEee.Core.Domain/Objects/Civilization/Mood.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/ActivateAbilityOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/ActivateAbilityOrder.cs similarity index 98% rename from FrEee.Core/Objects/Civilization/Orders/ActivateAbilityOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/ActivateAbilityOrder.cs index 66223efb2..4908ad7fd 100644 --- a/FrEee.Core/Objects/Civilization/Orders/ActivateAbilityOrder.cs +++ b/FrEee.Core.Domain/Objects/Civilization/Orders/ActivateAbilityOrder.cs @@ -169,7 +169,7 @@ public void Execute(IOrderable ord) // figure out where the warp point goes, according to our game setup's warp point placement strategy // only in the target system - in the source system we get a warp point at the sector where the WP opener was - var toSector = Galaxy.Current.WarpPointPlacementStrategy.GetWarpPointSector(fromSys.Location, toSys.Location); + var toSector = Galaxy.Current.GameSetup.WarpPointPlacementStrategy.GetWarpPointSector(fromSys.Location, toSys.Location); // create the warp points var wp1 = wpt1.Instantiate(); diff --git a/FrEee.Core/Objects/Civilization/Orders/ColonizeOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/ColonizeOrder.cs similarity index 97% rename from FrEee.Core/Objects/Civilization/Orders/ColonizeOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/ColonizeOrder.cs index 41a1dbddd..9857d0734 100644 --- a/FrEee.Core/Objects/Civilization/Orders/ColonizeOrder.cs +++ b/FrEee.Core.Domain/Objects/Civilization/Orders/ColonizeOrder.cs @@ -214,12 +214,12 @@ public IEnumerable GetErrors(IOrderable o) // no such colony module yield return sobj.CreateLogMessage(sobj + " cannot colonize " + Planet + " because it lacks a " + Planet.Surface + " colony module.", LogMessageType.Warning); } - if (Galaxy.Current.CanColonizeOnlyBreathable && Planet.Atmosphere != sobj.Owner.PrimaryRace.NativeAtmosphere) + if (Galaxy.Current.GameSetup.CanColonizeOnlyBreathable && Planet.Atmosphere != sobj.Owner.PrimaryRace.NativeAtmosphere) { // can only colonize breathable atmosphere (due to game setup option) yield return sobj.CreateLogMessage(sobj + " cannot colonize " + Planet + " because we can only colonize " + sobj.Owner.PrimaryRace.NativeAtmosphere + " planets.", LogMessageType.Warning); } - if (Galaxy.Current.CanColonizeOnlyHomeworldSurface && Planet.Surface != sobj.Owner.PrimaryRace.NativeSurface) + if (Galaxy.Current.GameSetup.CanColonizeOnlyHomeworldSurface && Planet.Surface != sobj.Owner.PrimaryRace.NativeSurface) { // can only colonize breathable atmosphere (due to game setup option) yield return sobj.CreateLogMessage(sobj + " cannot colonize " + Planet + " because we can only colonize " + sobj.Owner.PrimaryRace.NativeSurface + " planets.", LogMessageType.Warning); diff --git a/FrEee.Core/Objects/Civilization/Orders/ConstructionOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/ConstructionOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/ConstructionOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/ConstructionOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/EvadeOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/EvadeOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/EvadeOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/EvadeOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/IMovementOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/IMovementOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/IMovementOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/IMovementOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/IOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/IOrder.cs similarity index 97% rename from FrEee.Core/Objects/Civilization/Orders/IOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/IOrder.cs index 2f2ac15b4..cd1d78aa0 100644 --- a/FrEee.Core/Objects/Civilization/Orders/IOrder.cs +++ b/FrEee.Core.Domain/Objects/Civilization/Orders/IOrder.cs @@ -1,6 +1,5 @@ using FrEee.Objects.GameState; using FrEee.Objects.LogMessages; -using FrEee.Serialization; using System.Collections.Generic; namespace FrEee.Objects.Civilization.Orders; diff --git a/FrEee.Core/Objects/Civilization/Orders/IPathfindingOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/IPathfindingOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/IPathfindingOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/IPathfindingOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/IRecyclable.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/IRecyclable.cs similarity index 97% rename from FrEee.Core/Objects/Civilization/Orders/IRecyclable.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/IRecyclable.cs index 0d0e33b89..0c064ed01 100644 --- a/FrEee.Core/Objects/Civilization/Orders/IRecyclable.cs +++ b/FrEee.Core.Domain/Objects/Civilization/Orders/IRecyclable.cs @@ -1,6 +1,5 @@ using FrEee.Objects.GameState; using FrEee.Objects.Space; -using FrEee.Serialization; using FrEee.Utility; namespace FrEee.Objects.Civilization.Orders; diff --git a/FrEee.Core/Objects/Civilization/Orders/IRecycleBehavior.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/IRecycleBehavior.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/IRecycleBehavior.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/IRecycleBehavior.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/MoveOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/MoveOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/MoveOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/MoveOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/PathfindingOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/PathfindingOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/PathfindingOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/PathfindingOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/PursueOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/PursueOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/PursueOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/PursueOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/RecycleBehaviors/ScrapBehavior.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/RecycleBehaviors/ScrapBehavior.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/RecycleBehaviors/ScrapBehavior.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/RecycleBehaviors/ScrapBehavior.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/RecycleFacilityOrCargoOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/RecycleFacilityOrCargoOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/RecycleFacilityOrCargoOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/RecycleFacilityOrCargoOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/RecycleVehicleInSpaceOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/RecycleVehicleInSpaceOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/RecycleVehicleInSpaceOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/RecycleVehicleInSpaceOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/SentryOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/SentryOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/SentryOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/SentryOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/TransferCargoOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/TransferCargoOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/TransferCargoOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/TransferCargoOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/UpgradeFacilityOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/UpgradeFacilityOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/UpgradeFacilityOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/UpgradeFacilityOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/WarpOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/WarpOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/WarpOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/WarpOrder.cs diff --git a/FrEee.Core/Objects/Civilization/Orders/WaypointOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/WaypointOrder.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Orders/WaypointOrder.cs rename to FrEee.Core.Domain/Objects/Civilization/Orders/WaypointOrder.cs diff --git a/FrEee.Core/Objects/Civilization/PlayerInfo.cs b/FrEee.Core.Domain/Objects/Civilization/PlayerInfo.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/PlayerInfo.cs rename to FrEee.Core.Domain/Objects/Civilization/PlayerInfo.cs diff --git a/FrEee.Core/Objects/Civilization/Race.cs b/FrEee.Core.Domain/Objects/Civilization/Race.cs similarity index 99% rename from FrEee.Core/Objects/Civilization/Race.cs rename to FrEee.Core.Domain/Objects/Civilization/Race.cs index 0b889f9c0..ce2231656 100644 --- a/FrEee.Core/Objects/Civilization/Race.cs +++ b/FrEee.Core.Domain/Objects/Civilization/Race.cs @@ -10,7 +10,6 @@ using System.Linq; using FrEee.Objects.GameState; using FrEee.Utility; -using FrEee.Serialization; using FrEee.Modding.Abilities; namespace FrEee.Objects.Civilization; diff --git a/FrEee.Core/Objects/Civilization/SectorWaypoint.cs b/FrEee.Core.Domain/Objects/Civilization/SectorWaypoint.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/SectorWaypoint.cs rename to FrEee.Core.Domain/Objects/Civilization/SectorWaypoint.cs diff --git a/FrEee.Core/Objects/Civilization/SpaceObjectWaypoint.cs b/FrEee.Core.Domain/Objects/Civilization/SpaceObjectWaypoint.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/SpaceObjectWaypoint.cs rename to FrEee.Core.Domain/Objects/Civilization/SpaceObjectWaypoint.cs diff --git a/FrEee.Core/Objects/Civilization/Trait.cs b/FrEee.Core.Domain/Objects/Civilization/Trait.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Trait.cs rename to FrEee.Core.Domain/Objects/Civilization/Trait.cs diff --git a/FrEee.Core/Objects/Civilization/Waypoint.cs b/FrEee.Core.Domain/Objects/Civilization/Waypoint.cs similarity index 100% rename from FrEee.Core/Objects/Civilization/Waypoint.cs rename to FrEee.Core.Domain/Objects/Civilization/Waypoint.cs diff --git a/FrEee.Core/Objects/Commands/AddOrderCommand.cs b/FrEee.Core.Domain/Objects/Commands/AddOrderCommand.cs similarity index 98% rename from FrEee.Core/Objects/Commands/AddOrderCommand.cs rename to FrEee.Core.Domain/Objects/Commands/AddOrderCommand.cs index 20ca38ab4..c67297305 100644 --- a/FrEee.Core/Objects/Commands/AddOrderCommand.cs +++ b/FrEee.Core.Domain/Objects/Commands/AddOrderCommand.cs @@ -3,7 +3,6 @@ using FrEee.Objects.Civilization.Orders; using FrEee.Objects.GameState; using FrEee.Objects.LogMessages; -using FrEee.Serialization; using System; using System.Collections.Generic; diff --git a/FrEee.Core/Objects/Commands/ClearPlayerNoteCommand.cs b/FrEee.Core.Domain/Objects/Commands/ClearPlayerNoteCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/ClearPlayerNoteCommand.cs rename to FrEee.Core.Domain/Objects/Commands/ClearPlayerNoteCommand.cs diff --git a/FrEee.Core/Objects/Commands/ClearPrivateNameCommand.cs b/FrEee.Core.Domain/Objects/Commands/ClearPrivateNameCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/ClearPrivateNameCommand.cs rename to FrEee.Core.Domain/Objects/Commands/ClearPrivateNameCommand.cs diff --git a/FrEee.Core/Objects/Commands/Command.cs b/FrEee.Core.Domain/Objects/Commands/Command.cs similarity index 100% rename from FrEee.Core/Objects/Commands/Command.cs rename to FrEee.Core.Domain/Objects/Commands/Command.cs diff --git a/FrEee.Core/Objects/Commands/CreateDesignCommand.cs b/FrEee.Core.Domain/Objects/Commands/CreateDesignCommand.cs similarity index 97% rename from FrEee.Core/Objects/Commands/CreateDesignCommand.cs rename to FrEee.Core.Domain/Objects/Commands/CreateDesignCommand.cs index 5e57dc5a3..1eefe8f52 100644 --- a/FrEee.Core/Objects/Commands/CreateDesignCommand.cs +++ b/FrEee.Core.Domain/Objects/Commands/CreateDesignCommand.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using FrEee.Objects.Vehicles; -using FrEee.Serialization; +using FrEee.Objects.GameState; namespace FrEee.Objects.Commands; diff --git a/FrEee.Core/Objects/Commands/CreateFleetCommand.cs b/FrEee.Core.Domain/Objects/Commands/CreateFleetCommand.cs similarity index 98% rename from FrEee.Core/Objects/Commands/CreateFleetCommand.cs rename to FrEee.Core.Domain/Objects/Commands/CreateFleetCommand.cs index a53400bf5..6d1155655 100644 --- a/FrEee.Core/Objects/Commands/CreateFleetCommand.cs +++ b/FrEee.Core.Domain/Objects/Commands/CreateFleetCommand.cs @@ -1,7 +1,6 @@ using FrEee.Objects.Civilization; using FrEee.Objects.GameState; using FrEee.Objects.Space; -using FrEee.Serialization; using System.Collections.Generic; namespace FrEee.Objects.Commands; diff --git a/FrEee.Core/Objects/Commands/CreateWaypointCommand.cs b/FrEee.Core.Domain/Objects/Commands/CreateWaypointCommand.cs similarity index 96% rename from FrEee.Core/Objects/Commands/CreateWaypointCommand.cs rename to FrEee.Core.Domain/Objects/Commands/CreateWaypointCommand.cs index d0af2150a..967d01c15 100644 --- a/FrEee.Core/Objects/Commands/CreateWaypointCommand.cs +++ b/FrEee.Core.Domain/Objects/Commands/CreateWaypointCommand.cs @@ -1,5 +1,5 @@ using FrEee.Objects.Civilization; -using FrEee.Serialization; +using FrEee.Objects.GameState; using System.Collections.Generic; namespace FrEee.Objects.Commands; diff --git a/FrEee.Core/Objects/Commands/DeleteMessageCommand.cs b/FrEee.Core.Domain/Objects/Commands/DeleteMessageCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/DeleteMessageCommand.cs rename to FrEee.Core.Domain/Objects/Commands/DeleteMessageCommand.cs diff --git a/FrEee.Core/Objects/Commands/DeleteWaypointCommand.cs b/FrEee.Core.Domain/Objects/Commands/DeleteWaypointCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/DeleteWaypointCommand.cs rename to FrEee.Core.Domain/Objects/Commands/DeleteWaypointCommand.cs diff --git a/FrEee.Core/Objects/Commands/DisbandFleetCommand.cs b/FrEee.Core.Domain/Objects/Commands/DisbandFleetCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/DisbandFleetCommand.cs rename to FrEee.Core.Domain/Objects/Commands/DisbandFleetCommand.cs diff --git a/FrEee.Core/Objects/Commands/EditStrategyCommand.cs b/FrEee.Core.Domain/Objects/Commands/EditStrategyCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/EditStrategyCommand.cs rename to FrEee.Core.Domain/Objects/Commands/EditStrategyCommand.cs diff --git a/FrEee.Core/Objects/Commands/HotkeyWaypointCommand.cs b/FrEee.Core.Domain/Objects/Commands/HotkeyWaypointCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/HotkeyWaypointCommand.cs rename to FrEee.Core.Domain/Objects/Commands/HotkeyWaypointCommand.cs diff --git a/FrEee.Core/Objects/Commands/ICommand.cs b/FrEee.Core.Domain/Objects/Commands/ICommand.cs similarity index 97% rename from FrEee.Core/Objects/Commands/ICommand.cs rename to FrEee.Core.Domain/Objects/Commands/ICommand.cs index 9d339487d..cc71b825c 100644 --- a/FrEee.Core/Objects/Commands/ICommand.cs +++ b/FrEee.Core.Domain/Objects/Commands/ICommand.cs @@ -1,6 +1,5 @@ using FrEee.Objects.Civilization; using FrEee.Objects.GameState; -using FrEee.Serialization; using System.Collections.Generic; namespace FrEee.Objects.Commands; diff --git a/FrEee.Core/Objects/Commands/ICreateDesignCommand.cs b/FrEee.Core.Domain/Objects/Commands/ICreateDesignCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/ICreateDesignCommand.cs rename to FrEee.Core.Domain/Objects/Commands/ICreateDesignCommand.cs diff --git a/FrEee.Core/Objects/Commands/IOrderCommand.cs b/FrEee.Core.Domain/Objects/Commands/IOrderCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/IOrderCommand.cs rename to FrEee.Core.Domain/Objects/Commands/IOrderCommand.cs diff --git a/FrEee.Core/Objects/Commands/JoinFleetCommand.cs b/FrEee.Core.Domain/Objects/Commands/JoinFleetCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/JoinFleetCommand.cs rename to FrEee.Core.Domain/Objects/Commands/JoinFleetCommand.cs diff --git a/FrEee.Core/Objects/Commands/LeaveFleetCommand.cs b/FrEee.Core.Domain/Objects/Commands/LeaveFleetCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/LeaveFleetCommand.cs rename to FrEee.Core.Domain/Objects/Commands/LeaveFleetCommand.cs diff --git a/FrEee.Core/Objects/Commands/MinisterToggleCommand.cs b/FrEee.Core.Domain/Objects/Commands/MinisterToggleCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/MinisterToggleCommand.cs rename to FrEee.Core.Domain/Objects/Commands/MinisterToggleCommand.cs diff --git a/FrEee.Core/Objects/Commands/OrderCommand.cs b/FrEee.Core.Domain/Objects/Commands/OrderCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/OrderCommand.cs rename to FrEee.Core.Domain/Objects/Commands/OrderCommand.cs diff --git a/FrEee.Core/Objects/Commands/RearrangeOrdersCommand.cs b/FrEee.Core.Domain/Objects/Commands/RearrangeOrdersCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/RearrangeOrdersCommand.cs rename to FrEee.Core.Domain/Objects/Commands/RearrangeOrdersCommand.cs diff --git a/FrEee.Core/Objects/Commands/RemoveOrderCommand.cs b/FrEee.Core.Domain/Objects/Commands/RemoveOrderCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/RemoveOrderCommand.cs rename to FrEee.Core.Domain/Objects/Commands/RemoveOrderCommand.cs diff --git a/FrEee.Core/Objects/Commands/ResearchCommand.cs b/FrEee.Core.Domain/Objects/Commands/ResearchCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/ResearchCommand.cs rename to FrEee.Core.Domain/Objects/Commands/ResearchCommand.cs diff --git a/FrEee.Core/Objects/Commands/SendMessageCommand.cs b/FrEee.Core.Domain/Objects/Commands/SendMessageCommand.cs similarity index 98% rename from FrEee.Core/Objects/Commands/SendMessageCommand.cs rename to FrEee.Core.Domain/Objects/Commands/SendMessageCommand.cs index e34fb66d3..2f2c9cd7d 100644 --- a/FrEee.Core/Objects/Commands/SendMessageCommand.cs +++ b/FrEee.Core.Domain/Objects/Commands/SendMessageCommand.cs @@ -2,7 +2,6 @@ using FrEee.Extensions; using System.Collections.Generic; using FrEee.Objects.Civilization.Diplomacy.Messages; -using FrEee.Serialization; using FrEee.Objects.GameState; namespace FrEee.Objects.Commands; diff --git a/FrEee.Core/Objects/Commands/SetObsoleteFlagCommand.cs b/FrEee.Core.Domain/Objects/Commands/SetObsoleteFlagCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/SetObsoleteFlagCommand.cs rename to FrEee.Core.Domain/Objects/Commands/SetObsoleteFlagCommand.cs diff --git a/FrEee.Core/Objects/Commands/SetPlayerInfoCommand.cs b/FrEee.Core.Domain/Objects/Commands/SetPlayerInfoCommand.cs similarity index 94% rename from FrEee.Core/Objects/Commands/SetPlayerInfoCommand.cs rename to FrEee.Core.Domain/Objects/Commands/SetPlayerInfoCommand.cs index cee96549f..52bcca271 100644 --- a/FrEee.Core/Objects/Commands/SetPlayerInfoCommand.cs +++ b/FrEee.Core.Domain/Objects/Commands/SetPlayerInfoCommand.cs @@ -1,5 +1,5 @@ using FrEee.Objects.Civilization; -using FrEee.Serialization; +using FrEee.Objects.GameState; using System; using System.Collections.Generic; diff --git a/FrEee.Core/Objects/Commands/SetPlayerNoteCommand.cs b/FrEee.Core.Domain/Objects/Commands/SetPlayerNoteCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/SetPlayerNoteCommand.cs rename to FrEee.Core.Domain/Objects/Commands/SetPlayerNoteCommand.cs diff --git a/FrEee.Core/Objects/Commands/SetPrivateNameCommand.cs b/FrEee.Core.Domain/Objects/Commands/SetPrivateNameCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/SetPrivateNameCommand.cs rename to FrEee.Core.Domain/Objects/Commands/SetPrivateNameCommand.cs diff --git a/FrEee.Core/Objects/Commands/SetPublicNameCommand.cs b/FrEee.Core.Domain/Objects/Commands/SetPublicNameCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/SetPublicNameCommand.cs rename to FrEee.Core.Domain/Objects/Commands/SetPublicNameCommand.cs diff --git a/FrEee.Core/Objects/Commands/ToggleOrdersOnHoldCommand.cs b/FrEee.Core.Domain/Objects/Commands/ToggleOrdersOnHoldCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/ToggleOrdersOnHoldCommand.cs rename to FrEee.Core.Domain/Objects/Commands/ToggleOrdersOnHoldCommand.cs diff --git a/FrEee.Core/Objects/Commands/ToggleRepeatOrdersCommand.cs b/FrEee.Core.Domain/Objects/Commands/ToggleRepeatOrdersCommand.cs similarity index 100% rename from FrEee.Core/Objects/Commands/ToggleRepeatOrdersCommand.cs rename to FrEee.Core.Domain/Objects/Commands/ToggleRepeatOrdersCommand.cs diff --git a/FrEee.Core/Objects/Events/Event.cs b/FrEee.Core.Domain/Objects/Events/Event.cs similarity index 99% rename from FrEee.Core/Objects/Events/Event.cs rename to FrEee.Core.Domain/Objects/Events/Event.cs index a361973e9..1bfb0ebf2 100644 --- a/FrEee.Core/Objects/Events/Event.cs +++ b/FrEee.Core.Domain/Objects/Events/Event.cs @@ -8,7 +8,6 @@ using System.IO; using System.Linq; using System.Text.RegularExpressions; -using FrEee.Serialization; using FrEee.Objects.GameState; using FrEee.Extensions; using FrEee.Utility; diff --git a/FrEee.Core/Objects/Events/EventMessage.cs b/FrEee.Core.Domain/Objects/Events/EventMessage.cs similarity index 100% rename from FrEee.Core/Objects/Events/EventMessage.cs rename to FrEee.Core.Domain/Objects/Events/EventMessage.cs diff --git a/FrEee.Core.Domain/Objects/GameState/Galaxy.cs b/FrEee.Core.Domain/Objects/GameState/Galaxy.cs new file mode 100644 index 000000000..37e04e450 --- /dev/null +++ b/FrEee.Core.Domain/Objects/GameState/Galaxy.cs @@ -0,0 +1,1214 @@ +using FrEee.Objects.Civilization; +using FrEee.Objects.Civilization.Diplomacy.Clauses; +using FrEee.Processes.Combat.Grid; +using FrEee.Objects.Commands; +using FrEee.Objects.Events; +using FrEee.Objects.LogMessages; +using FrEee.Modding; +using FrEee.Utility; +using FrEee.Serialization; +using FrEee.Extensions; +using Microsoft.Scripting.Utils; +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using FrEee.Objects.Civilization.Construction; +using FrEee.Objects.Vehicles; +using FrEee.Objects.Civilization.Orders; +using FrEee.Objects.VictoryConditions; +using FrEee.Objects.Space; +using FrEee.Objects.Civilization.Diplomacy; +using FrEee.Objects.Technology; +using FrEee.Extensions; +using FrEee.Utility; +using FrEee.Processes.Combat; +using FrEee.Modding.Abilities; +using FrEee.Processes.Setup; +using FrEee.Processes.Setup.WarpPointPlacementStrategies; + +namespace FrEee.Objects.GameState; + +/// +/// Prevents IDs from being assigned to objects when calling AssignIDs. +/// TODO - move to utility namespace? +/// +public class DoNotAssignIDAttribute : Attribute +{ + public DoNotAssignIDAttribute(bool recurse = true) + { + Recurse = recurse; + } + + /// + /// Should the "don't assign ID" rule be recursive? + /// + public bool Recurse { get; private set; } +} + +/// +/// A galaxy in which the game is played. +/// +[Serializable] +public class Galaxy : ICommonAbilityObject +{ + public Galaxy() + { + Current = this; + if (Mod.Current != null) + ModPath = Mod.Current.RootPath; + StarSystemLocations = new List>(); + Empires = new List(); + Name = "Unnamed"; + TurnNumber = 1; + referrables = new Dictionary(); + AbilityCache = new SafeDictionary>(); + CommonAbilityCache = new SafeDictionary, IEnumerable>(); + SharedAbilityCache = new SafeDictionary, IEnumerable>(); + GivenTreatyClauseCache = new SafeDictionary>(); + ReceivedTreatyClauseCache = new SafeDictionary>(); + Battles = new HashSet(); + ScriptNotes = new DynamicDictionary(); + /*if (Mod.Current != null) + { + foreach (var q in Mod.Current.Objects.OfType()) + AssignID(q); + }*/ + } + + /// + /// The current galaxy. Shouldn't change except at loading a game or turn processing. + /// + public static Galaxy? Current { get; set; } + + public AbilityTargets AbilityTarget + { + get { return AbilityTargets.Galaxy; } + } + + /// + /// The battles which have taken place this turn. + /// + public ICollection Battles { get; private set; } + + public IEnumerable Children + { + get { return StarSystemLocations.Select(l => l.Item); } + } + + public string CommandFileName + { + get + { + if (PlayerNumber > 0) + return Name + "_" + TurnNumber + "_" + PlayerNumber + FrEeeConstants.PlayerCommandsSaveGameExtension; + else + throw new InvalidOperationException("The game host does not have a command file."); + } + } + + /// + /// The empire whose turn it is. + /// + public Empire CurrentEmpire { get; set; } + + /// + /// The current tick in turn processing. 0 = start of turn, 1 = end of turn. + /// + public double CurrentTick { get; set; } + + /// + /// The empires participating in the game. + /// + public IList Empires { get; private set; } + + /// + /// Per mille chance of a random event occurring, per turn, per player. + /// + public double EventFrequency { get; set; } + + public string GameFileName + { + get + { + if (PlayerNumber > 0) + return Name + "_" + TurnNumber + "_" + PlayerNumber + FrEeeConstants.SaveGameExtension; + else + return Name + "_" + TurnNumber + FrEeeConstants.SaveGameExtension; + } + } + + public int Height + { + get; + set; + } + + public IEnumerable IntrinsicAbilities + { + // TODO - galaxy wide abilities? + get { yield break; } + } + + /// + /// Is the ability cache enabled? + /// Always enabled on the client side; only when a flag is set on the server side. + /// + public bool IsAbilityCacheEnabled + { + get + { + return Empire.Current != null || isAbilityCacheEnabled; + } + } + + /// + /// Is this a single player game? If so, autoprocess the turn after the player takes his turn. + /// + public bool IsSinglePlayer { get; set; } + + public int MaxX + { + get { return StarSystemLocations.MaxOrDefault(ssl => ssl.Location.X); } + } + + public int MaxY + { + get { return StarSystemLocations.MaxOrDefault(ssl => ssl.Location.Y); } + } + + public int MinX + { + get { return StarSystemLocations.MinOrDefault(ssl => ssl.Location.X); } + } + + public int MinY + { + get { return StarSystemLocations.MinOrDefault(ssl => ssl.Location.Y); } + } + + private string modPath; + + /// + /// The mod being played. + /// + [SerializationPriority(1)] + [ForceSerializationWhenDefaultValue] + public string ModPath + { + get => modPath; + set + { + if (Mod.Current == null || Mod.Current.RootPath != value) + Mod.Load(value); + modPath = value; + } + } + + /// + /// The game name. + /// + public string Name { get; set; } + + /// + /// The next tick size, for ship movement. + /// + public double NextTickSize { get; internal set; } + + public IEnumerable Parents + { + get + { + yield break; + } + } + + /// + /// Events which have been warned of and are pending execution. + /// + public ICollection PendingEvents { get; private set; } = new List(); + + /// + /// The current player number (1 is the first player, 0 is the game host). + /// + public int PlayerNumber + { + get { return Empires.IndexOf(CurrentEmpire) + 1; } + } + + public IEnumerable Referrables { get { return referrables.Values; } } + + /// + /// Notes that mod scripts can play with. + /// + public DynamicDictionary ScriptNotes { get; private set; } + + /// + /// The current stardate. Advances 0.1 years per turn. + /// + public string Stardate + { + get + { + return TurnNumber.ToStardate(); + } + } + + /// + /// The locations of the star systems in the galaxy. + /// + public ICollection> StarSystemLocations { get; private set; } + + /// + /// Current time equals turn number plus tick minus 1. + /// + public double Timestamp { get { return TurnNumber + CurrentTick - 1; } } + + /// + /// The current turn number. + /// + public int TurnNumber { get; set; } + + /// + /// Number of turns of uninterrupted galactic peace (Non-Aggression or better between all surviving empires). + /// + public int TurnsOfPeace + { + get + { + // TODO - treaties + return 0; + } + } + + /// + /// Vertical space occupied by star systems. + /// + public int UsedHeight + { + get + { + if (!StarSystemLocations.Any()) + return 0; + return StarSystemLocations.Max(ssl => ssl.Location.Y) - StarSystemLocations.Min(ssl => ssl.Location.Y) + 1; + } + } + + /// + /// Horizontal space occuped by star systems. + /// + public int UsedWidth + { + get + { + if (!StarSystemLocations.Any()) + return 0; + return StarSystemLocations.Max(ssl => ssl.Location.X) - StarSystemLocations.Min(ssl => ssl.Location.X) + 1; + } + } + + /// + /// Cache of abilities belonging to game objects. + /// + [DoNotSerialize] + internal SafeDictionary> AbilityCache { get; private set; } + + /// + /// Cache of abilities belonging to common game objects that can have different abilities for each empire. + /// + [DoNotSerialize] + internal SafeDictionary, IEnumerable> CommonAbilityCache { get; private set; } + + /// + /// Cache of treaty clauses given by empires. + /// + [DoNotSerialize] + internal SafeDictionary> GivenTreatyClauseCache { get; set; } + + /// + /// Cache of treaty clauses received by empires. + /// + [DoNotSerialize] + internal SafeDictionary> ReceivedTreatyClauseCache { get; set; } + + /// + /// Anything in the game that can be referenced from the client side + /// using a Reference object instead of passing whole objects around. + /// Stuff needs to be registered to be found though! + /// + [SerializationPriority(2)] + internal IDictionary referrables { get; set; } + + /// + /// Cache of abilities that are shared to empires from other objects due to treaties. + /// + [DoNotSerialize] + internal SafeDictionary, IEnumerable> SharedAbilityCache { get; private set; } + + /// + /// Serialized string value of the galaxy at the beginning of the turn. + /// + [DoNotSerialize] + internal string StringValue + { + get + { + if (stringValue == null) + StringValue = SaveToString(false); + return stringValue; + } + set + { + stringValue = value; + } + } + + private bool isAbilityCacheEnabled; + + private IDictionary lastBattleTimestamps = new SafeDictionary(); + + private string stringValue; + + public static string GetEmpireCommandsSavePath(string gameName, int turnNumber, int empireNumber) + { + return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Savegame", string.Format("{0}_{1}_{2:d4}{3}", gameName, turnNumber, empireNumber, FrEeeConstants.PlayerCommandsSaveGameExtension)); + } + + public static string GetGameSavePath(string gameName, int turnNumber, int empireNumber) + { + return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Savegame", empireNumber < 1 ? + string.Format("{0}_{1}{2}", gameName, turnNumber, FrEeeConstants.SaveGameExtension) : + string.Format("{0}_{1}_{2:d4}{3}", gameName, turnNumber, empireNumber, FrEeeConstants.SaveGameExtension)); + } + + /// + /// Initializes a new game. Sets Galaxy.Current. + /// + /// if there is no mod loaded. + /// A status object to report status back to the GUI. + /// How much progress should we report back to the GUI when we're done initializing the galaxy? 1.0 means all done with everything that needs to be done. + public static void Initialize(GameSetup gsu, PRNG dice, Status status = null, double desiredProgress = 1.0) + { + if (Mod.Current == null) + throw new InvalidOperationException("Cannot initialize a galaxy without a mod. Load a mod into Mod.Current first."); + + if (dice == null) + dice = new PRNG(DateTime.Now.Millisecond + 1000 * DateTime.Now.Second + 60000 * DateTime.Now.Minute); + + var startProgress = status == null ? 0d : status.Progress; + var progressPerStep = (desiredProgress - startProgress) / 4d; + + // create the game + if (Current == null) + { + var galtemp = gsu.GalaxyTemplate; + galtemp.GameSetup = gsu; + Current = galtemp.Instantiate(status, startProgress + progressPerStep, dice); + } + else + { + Current.GameSetup = gsu; + } + if (status != null) + status.Message = "Populating galaxy"; + gsu.PopulateGalaxy(Current, dice); + Current.SaveTechLevelsForUniqueness(); + if (status != null) + status.Progress += progressPerStep; + + // set single player flag + Current.IsSinglePlayer = gsu.IsSinglePlayer; + + // run init script + if (status != null) + status.Message = "Executing script"; + PythonScriptEngine.RunScript(Mod.Current.GameInitScript); + if (status != null) + status.Progress += progressPerStep; + + // save the game + if (status != null) + status.Message = "Saving game"; + SaveAll(status, desiredProgress); + } + + /// + /// Loads a savegame from the Savegame folder. + /// Note that if it was renamed, it might have different game name, turn number, player number, etc. than the filename indicates. + /// + /// + public static void Load(string filename) + { + var fs = new FileStream(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), FrEeeConstants.SaveGameDirectory, filename), FileMode.Open); + Current = Serializer.Deserialize(fs); + if (Current.ModPath == null) + Mod.Load(null); // skipped in deserialization because it is null but the mod needs to be loaded! + if (Empire.Current != null) + { + // load library of designs, strategies, etc. + Library.Load(); + } + fs.Close(); + fs.Dispose(); + Current.PopulatePropertyValues(); + } + + /// + /// Loads a host savegame from the Savegame folder. + /// + /// + /// + public static void Load(string gameName, int turnNumber) + { + Load(gameName + "_" + turnNumber + FrEeeConstants.SaveGameExtension); + } + + /// + /// Loads a player savegame from the Savegame folder. + /// + /// + /// + /// + public static void Load(string gameName, int turnNumber, int playerNumber) + { + Load(gameName + "_" + turnNumber + "_" + playerNumber.ToString("d4") + FrEeeConstants.SaveGameExtension); + } + + /// + /// Loads from a string in memory. + /// + /// + public static void LoadFromString(string serializedData) + { + Current = Serializer.DeserializeFromString(serializedData); + //Current.SpaceObjectIDCheck("after loading from memory"); + + + if (Current.ModPath == null) + Mod.Load(null); // skipped in deserialization because it is null but the mod needs to be loaded! + + if (Empire.Current != null) + { + // initialize IronPython galaxy on load + Current.StringValue = serializedData; + var formula = new ComputedFormula("Galaxy.Current.TurnNumber", null, true); + var turn = formula.Value; + + // load library of designs, strategies, etc. + Library.Load(); + } + + Current.PopulatePropertyValues(); + } + + /// + /// Populates property values specified by . + /// + private void PopulatePropertyValues() + { + // TODO: cache list of properties to populate when deserializing? + // enumerate all referrables + foreach (var referrable in Referrables) + { + // find referrable's properties + var props = referrable.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + foreach (var prop in props) + { + // search property's attributes for PopulateAttribute + foreach (var att in prop.GetCustomAttributes()) + { + if (att.GetType().IsGenericType && att.GetType().GetGenericTypeDefinition() == typeof(PopulateAttribute<>)) + { + // found PopulateAttribute + // create populator + var populatorType = att.GetType().GetGenericArguments()[0]; + var populator = (IPopulator)populatorType.Instantiate(); + + // get value from populator and save it into the referrable's property + prop.SetValue(referrable, populator.Populate(referrable)); + } + } + } + } + } + + /// + /// Saves all empires' tech levels in the other empires for uniqueness calculations. + /// + internal void SaveTechLevelsForUniqueness() + { + if (Current.GameSetup.TechnologyUniqueness != 0) + { + foreach (var emp in Current.Empires) + { + emp.OtherPlayersTechLevels.Clear(); + foreach (var emp2 in Current.Empires.ExceptSingle(emp)) + { + foreach (var tech in Mod.Current.Technologies) + { + if (emp.OtherPlayersTechLevels[tech] == null) + emp.OtherPlayersTechLevels[tech] = new List(); + emp.OtherPlayersTechLevels[tech].Add(emp2.ResearchedTechnologies[tech]); + } + } + } + } + } + + /// + /// Saves the master view and all players' views of the galaxy, unless single player, in which case only the first player's view is saved. + /// + /// if CurrentEmpire is not null. + public static void SaveAll(Status status = null, double desiredProgress = 1d) + { + if (Current.CurrentEmpire != null) + throw new InvalidOperationException("Can only save player galaxy views from the master galaxy view."); + + var progressPerSaveLoad = (desiredProgress - (status == null ? 0d : status.Progress)) / (Current.IsSinglePlayer ? 3 : Current.Empires.Count + 2); + //Current.SpaceObjectIDCheck("before saving"); + + // save master view + if (status != null) + status.Message = "Saving game (host)"; + var gamname = Current.Save(); + if (status != null) + status.Progress += progressPerSaveLoad; + //Current.SpaceObjectIDCheck("after saving master view to disk"); + + // save player views + for (int i = 0; i < Current.Empires.Count; i++) + { + Load(gamname); + if (Current.Empires[i].IsPlayerEmpire) + { + if (status != null) + status.Message = "Saving game (player " + (i + 1) + ")"; + Current.CurrentEmpire = Current.Empires[i]; + Current.Redact(); + //Current.SpaceObjectIDCheck("after creating player view for " + Current.Empires[i]); + Current.Save(false); // already asssigned IDs in the redact phase + if (status != null) + status.Progress += progressPerSaveLoad; + } + } + + // TODO - only reload master view if we really need to + if (status != null) + status.Message = "Saving game"; + Load(gamname); + if (status != null) + status.Progress += progressPerSaveLoad; + + //Current.SpaceObjectIDCheck("after reloading master view"); + } + + /// + /// Assigns an ID to an object. + /// Will dispose of an object that has a negative ID if it hasn't already been disposed of. + /// + /// The object. + /// The ID, or 0 to generate a new ID (unless the ID is already valid). + /// The new ID. + public long AssignID(IReferrable r, long id = 0) + { + if (r.ID < 0 || r.IsDisposed) + { + if (!r.IsDisposed) + r.Dispose(); + return r.ID; + } + + if (r.HasValidID()) + return r.ID; // no need to reassign ID + else if (referrables.ContainsKey(r.ID)) + { + // HACK - already exists, just log an error but don't overwrite anything + // we need to fix start combatants having the same IDs as the real objects... + Console.Error.WriteLine("The galaxy thinks that " + referrables[r.ID] + " has the ID " + r.ID + " but " + r + " claims to have that ID as well."); + return r.ID; + } + + var oldid = r.ID; + long newid = oldid <= 0 ? id : oldid; + + while (newid <= 0 || referrables.ContainsKey(newid)) + { + newid = RandomHelper.Range(1L, long.MaxValue); + } + r.ID = newid; + referrables.Add(newid, r); + + // clean up old IDs + if (oldid > 0 && referrables.ContainsKey(oldid) && oldid != newid) + referrables.Remove(oldid); + + return newid; + } + + /// + /// Assigns IDs to referrable objects in the galaxy and purges disposed objects. + /// Doesn't assign IDs to objects via DoNotAssignID properties, or to memories (or sub-objects of them). + /// + public void CleanGameState() + { + var parser = new ObjectGraphParser(); + bool canAssign = true; + foreach (var kvp in referrables.ToArray()) + { + if (kvp.Value.IsDisposed) + referrables.Remove(kvp.Key); + } + parser.Property += (pname, o, val) => + { + var prop = o.GetType().FindProperty(pname); + var isMemory = val is IFoggable && (val as IFoggable).IsMemory; + canAssign = !prop.HasAttribute() && !isMemory; + if (isMemory) + return false; // no recursion! + if (prop.GetAttributes().Any(a => a.Recurse)) + return false; // no recursion! + else + return true; + }; + var colls = new List(); + parser.StartObject += o => + { + if (o is IReferrable && canAssign) + { + var r = (IReferrable)o; + AssignID(r); + } + if (o is IEnumerable) + { + colls.Add((IEnumerable)o); + } + }; + parser.EndObject += o => + { + if (o is IEnumerable) + { + colls.Remove((IEnumerable)o); + } + }; + parser.Parse(this); + foreach (var l in StarSystemLocations.ToArray()) + { + if (l.Item == null) + StarSystemLocations.Remove(l); + else + { + foreach (var l2 in l.Item.SpaceObjectLocations.ToArray()) + { + if (l2.Item == null || l2.Item.IsDisposed) + l.Item.SpaceObjectLocations.Remove(l2); + } + } + } + } + + public void ComputeNextTickSize() + { + var objs = FindSpaceObjects().Where(obj => obj.Orders.Any()); + objs = objs.Where(obj => !obj.IsMemory); + if (objs.Where(v => v.TimeToNextMove > 0).Any() && CurrentTick < 1.0) + { + // HACK - why are objects getting zero time to next move?! + var nextTickSize = objs.Where(v => v.TimeToNextMove > 0).Min(v => v.TimeToNextMove); + NextTickSize = Math.Min(1.0 - CurrentTick, nextTickSize); + } + else if (objs.Any()) + { + NextTickSize = objs.Min(v => v.TimePerMove); + } + else + NextTickSize = double.PositiveInfinity; + } + + /// + /// Creates a new empire. + /// + /// + public Empire CreateNewEmpire() + { + var emp = new Empire(); + emp.Name = "Randomly Generated Empire"; // TODO - load from EmpireNames.txt / EmpireTypes.txt + + // TODO - assign AI and primary race to empire + Empires.Add(emp); + return emp; + } + + /// + /// Disables the server side ability cache. + /// + public void DisableAbilityCache() + { + isAbilityCacheEnabled = false; + AbilityCache.Clear(); + CommonAbilityCache.Clear(); + SharedAbilityCache.Clear(); + } + + /// + /// Enables the server side ability cache. + /// + public void EnableAbilityCache() + { + isAbilityCacheEnabled = true; + } + + /// + /// Finds referrable objects in the galaxy. + /// + /// + /// + /// + public IEnumerable Find(Func condition = null) where T : IReferrable + { + if (condition == null) + condition = t => true; + return Referrables.OfType().Where(r => condition(r)); + } + + /// + /// Searches for space objects matching criteria. + /// + /// The type of space object. + /// The criteria. + /// The matching space objects. + public IEnumerable FindSpaceObjects(Func criteria = null) + { + return StarSystemLocations.SelectMany(l => l.Item.FindSpaceObjects(criteria)); + } + + public IEnumerable GetContainedAbilityObjects(Empire emp) + { + return StarSystemLocations.Select(ssl => ssl.Item).Concat(StarSystemLocations.SelectMany(ssl => ssl.Item.GetContainedAbilityObjects(emp))); + } + + public string GetEmpireCommandsSavePath(Empire emp) + { + return GetEmpireCommandsSavePath(Name, TurnNumber, Empires.IndexOf(emp) + 1); + } + + public string GetGameSavePath(Empire emp = null) + { + if (emp == null) + emp = CurrentEmpire; + return GetGameSavePath(Name, TurnNumber, emp == null ? 0 : Empires.IndexOf(emp) + 1); + } + + public IReferrable GetReferrable(long key) + { + if (!referrables.ContainsKey(key)) + return null; + return referrables[key]; + } + + /// + /// Finds the real version of a fake referrable. + /// + /// + /// The fake referrable. + /// + public T GetReferrable(T fakeobj) + where T : IReferrable + { + return (T)GetReferrable(fakeobj.ID); + } + + /// + /// Loads player commands into the current game state. + /// If this is the host view, commands will be loaded for all players. + /// If this is the player view, commands will be immediately executed so as to provide the player with a fresh game state. + /// + /// Player empires which did not submit commands and are not defeated. + public IEnumerable LoadCommands() + { + // whose commands are we loading? + var emps = new List(); + if (CurrentEmpire == null) + emps.AddRange(Empires); + else + emps.Add(CurrentEmpire); + + var noCmds = new List(); + + foreach (var emp in emps) + { + var plrfile = GetEmpireCommandsSavePath(emp); + if (File.Exists(plrfile)) + { + var fs = new FileStream(plrfile, FileMode.Open); + var cmds = DeserializeCommands(fs); + LoadCommands(emp, cmds); + fs.Close(); fs.Dispose(); + } + else if (emp.IsPlayerEmpire) + noCmds.Add(emp); + } + + if (CurrentEmpire != null) + { + foreach (var cmd in CurrentEmpire.Commands) + { + if (cmd.Executor == null) + CurrentEmpire.Log.Add(CurrentEmpire.CreateLogMessage($"{cmd} cannot be issued because its executor does not exist. Probably a bug...", LogMessageType.Error)); + else if (cmd.Issuer != cmd.Executor.Owner && cmd.Issuer != cmd.Executor) + CurrentEmpire.Log.Add(CurrentEmpire.CreateLogMessage("We cannot issue commands to " + cmd.Executor + " because it does not belong to us!", LogMessageType.Error)); + else + cmd.Execute(); + } + } + + return noCmds; + } + + /// + /// Only public for unit tests. You should probably call ProcessTurn instead. + /// + public void MoveShips() + { + var vlist = FindSpaceObjects().Where(sobj => sobj.Container == null && !sobj.IsMemory).Shuffle(); + foreach (var v in vlist) + { + // mark system explored if not already + var sys = v.StarSystem; + if (sys == null) + continue; // space object is dead, or not done being built + + if (CurrentTick == 0d && !v.Orders.OfType().Any()) + v.DealWithMines(); + + bool didStuff = v.ExecuteOrders(); + sys.MarkAsExploredBy(v.Owner); + + // update memory sight after movement + if (didStuff) + { + v.UpdateEmpireMemories(); + if (v.StarSystem != null && v.Owner != null) + { + foreach (var sobj in v.StarSystem.FindSpaceObjects().Where(sobj => sobj != v && !sobj.IsMemory && v.Owner.CanSee(sobj)).ToArray()) + v.Owner.UpdateMemory(sobj); + } + + // replenish shields after moving (who knows, we might be out of supplies, or about to hit a minefield) + v.ReplenishShields(); + } + + // check for battles + var sector = v.Sector; + if (v.Owner != null && // unowned objects can't pick fights + sector != null && // can't fight nowhere + sector.SpaceObjects.OfType().Any( + sobj => + (sobj.IsHostileTo(v.Owner) && sobj.Weapons.Any() || v.IsHostileTo(sobj.Owner) && v.Weapons.Any()) // any enemies? + && (sobj.Owner.CanSee(v) || v.Owner.CanSee(sobj)) // enemies are visible? + && (!lastBattleTimestamps.ContainsKey(sector) || lastBattleTimestamps[sector] < Timestamp - (v.StrategicSpeed == 0 ? 1d : 1d / v.StrategicSpeed)))) // have we fought here too recently? + { + // resolve the battle + var battle = new SpaceBattle(sector); + battle.Resolve(); + Battles.Add(battle); + foreach (var emp in battle.Empires) + emp.Log.Add(battle.CreateLogMessage(battle.NameFor(emp), LogMessageType.Battle)); + lastBattleTimestamps[sector] = Current.Timestamp; + } + } + } + + public Sector PickRandomSector(PRNG prng = null) + { + return StarSystemLocations.PickRandom(prng).Item.PickRandomSector(prng); + } + + /// + /// Removes any space objects, etc. that the current empire cannot see. + /// + public void Redact() + { + // save off empire scores first, before data is removed + foreach (var emp in Empires) + { + emp.Scores[TurnNumber] = emp.ComputeScore(Empire.Current); + } + + // the galaxy data itself + if (Empire.Current != null) + ScriptNotes.Clear(); + + // redact sub objects + var parser = new ObjectGraphParser(); + parser.StartObject += redactParser_StartObject; + parser.Parse(this); + + // clean up redacted objects that are not IFoggable + foreach (var x in StarSystemLocations.Where(x => x.Item.IsDisposed).ToArray()) + StarSystemLocations.Remove(x); + + // delete memories since they've been copied to "physical" objects already + foreach (var kvp in Empire.Current.Memory.ToArray()) + { + kvp.Value.Dispose(); + Empire.Current.Memory.Remove(kvp); + } + } + + public void Save(Stream stream, bool assignIDs = true) + { + if (assignIDs) + CleanGameState(); + foreach (var kvp in referrables.Where(kvp => kvp.Value.IsDisposed).ToArray()) + referrables.Remove(kvp); + Serializer.Serialize(this, stream); + } + + /// + /// Saves the game to an appropriately named file in the Savegame folder. + /// Files are named GameName_TurnNumber_PlayerNumber.gam for players (PlayerNumber is 1-indexed) + /// and GameName_TurnNumber.gam for the host. + /// + /// The filename saved to without the folder name (which is Savegame). + public string Save(bool assignIDs = true) + { + if (assignIDs) + CleanGameState(); + foreach (var kvp in referrables.Where(kvp => kvp.Value.ID < 0).ToArray()) + referrables.Remove(kvp); + string filename; + if (CurrentEmpire == null) + filename = Name + "_" + TurnNumber + ".gam"; + else + filename = Name + "_" + TurnNumber + "_" + (Empires.IndexOf(CurrentEmpire) + 1).ToString("d4") + ".gam"; + if (!Directory.Exists(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), FrEeeConstants.SaveGameDirectory))) + Directory.CreateDirectory(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), FrEeeConstants.SaveGameDirectory)); + var fs = new FileStream(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), FrEeeConstants.SaveGameDirectory, filename), FileMode.Create); + Serializer.Serialize(this, fs); + fs.Close(); fs.Dispose(); + return filename; + } + + /// + /// Saves the player's commands to an appropriately named file in the Savegame folder. + /// Files are named GameName_TurnNumber_PlayerNumber.plr. (PlayerNumber is 1-indexed and padded to 4 digits with zeroes) + /// This doesn't make sense for the host view, so an exception will be thrown if there is no current empire. + /// + /// The filename saved to without the folder name (which is Savegame). + /// if there is no current empire. + public string SaveCommands() + { + CleanGameState(); + if (CurrentEmpire == null) + throw new InvalidOperationException("Can't save commands without a current empire."); + foreach (var c in Empire.Current.Commands.OfType().ToArray()) + Empire.Current.Commands.Remove(c); + Empire.Current.Commands.Add(new SetPlayerInfoCommand(Empire.Current) { PlayerInfo = Empire.Current.PlayerInfo }); + if (!Directory.Exists(FrEeeConstants.SaveGameDirectory)) + Directory.CreateDirectory(FrEeeConstants.SaveGameDirectory); + var filename = GetEmpireCommandsSavePath(CurrentEmpire); + var fs = new FileStream(filename, FileMode.Create); + SerializeCommands(fs); + fs.Close(); fs.Dispose(); + + // save library of designs, commands, etc. + Library.Save(); + + return filename; + } + + public string SaveToString(bool assignIDs = true) + { + if (assignIDs) + CleanGameState(); + return Serializer.SerializeToString(this); + } + + public override string ToString() + { + if (CurrentEmpire == null) + return Name; + return Name + " - " + CurrentEmpire.Name + " - " + CurrentEmpire.LeaderName + " - " + Stardate; + } + + public void UnassignID(long id) + { + if (referrables.ContainsKey(id)) + { + var r = referrables[id]; + r.ID = -1; + referrables.Remove(id); + } + } + + public void UnassignID(IReferrable r) + { + if (r == null || r.ID < 0) + return; // nothing to do + if (referrables.ContainsKey(r.ID)) + { + if (referrables[r.ID] == r) + referrables.Remove(r.ID); + else + { + var galaxyThinksTheIDIs = referrables.SingleOrDefault(kvp => kvp.Value == r); + referrables.Remove(galaxyThinksTheIDIs); + } + } + else if (referrables.Values.Contains(r)) + { + try + { + referrables.Remove(referrables.Single(kvp => kvp.Value == r)); + } + catch (InvalidOperationException ex) + { + // HACK - why is the item not being found? sequence contains no matching element? it's right there! + Console.Error.WriteLine(ex); + } + } + //r.ID = -1; + } + + internal void SpaceObjectIDCheck(string when) + { + foreach (var sobj in FindSpaceObjects().ToArray()) + { + if (!referrables.ContainsKey(sobj.ID)) + AssignID(sobj); + if (sobj.ID > 0) + { + var r = referrables[sobj.ID]; + if (r != sobj) + { + // HACK - assume the space object that's actually in space is "real" + referrables[sobj.ID] = sobj; + Console.Error.WriteLine("Space object identity mismatch " + when + " for ID=" + sobj.ID + ". " + sobj + " is actually in space so it is replacing " + r + " in the referrables collection."); + } + } + } + } + + /// + /// Deserializes the player's commands. + /// + /// + /// + private static IList DeserializeCommands(Stream stream) + { + var cmds = Serializer.Deserialize>(stream); + + // check for client safety + foreach (var cmd in cmds.Where(cmd => cmd != null)) + { + cmd.CheckForClientSafety(); + } + + return cmds; + } + + internal void LoadCommands(Empire emp, IList cmds) + { + cmds = cmds.Where(cmd => cmd != null).Distinct().ToList(); // HACK - why would we have null/duplicate commands in a plr file?! + emp.Commands.Clear(); + var idmap = new Dictionary(); + foreach (var cmd in cmds) + { + if (cmd.NewReferrables.Any(r => r.IsDisposed)) + { + emp.Log.Add(new GenericLogMessage("Command \"" + cmd + "\" contained a reference to deleted object \"" + cmd.NewReferrables.First(r => r.IsDisposed) + "\" and will be ignored. This may be a game bug.")); + continue; + } + emp.Commands.Add(cmd); + foreach (var r in cmd.NewReferrables) + { + var clientid = r.ID; + var serverid = AssignID(r); + if (idmap.ContainsKey(clientid)) + { + if (idmap[clientid] != serverid) + throw new InvalidOperationException($"Adding {r} with ID {serverid} to client ID {clientid} for {emp} when that client ID is already mapped to server ID {idmap[clientid]}."); + // else do nothing + } + else + idmap.Add(clientid, serverid); + } + } + foreach (var cmd in cmds) + cmd.ReplaceClientIDs(idmap); // convert client IDs to server IDs + } + + private void redactParser_StartObject(object o) + { + if (o is IReferrable) + AssignID(o as IReferrable); + if (o is IFoggable obj && o is IReferrable r) + { + if (!obj.IsMemory) + { + var id = r.ID; + var vis = obj.CheckVisibility(CurrentEmpire); + if (vis < Visibility.Fogged) + obj.Dispose(); + if (vis == Visibility.Fogged && CurrentEmpire.Memory.ContainsKey(id)) + { + var mem = (IReferrable)CurrentEmpire.Memory[id]; + mem.CopyToExceptID(r, IDCopyBehavior.PreserveDestination); // memory sight! + if (mem is ILocated l1 && r is ILocated l2) + l2.Sector = l1.Sector; // hack to copy location just now without always copying it when an object is copied + obj.IsMemory = true; + } + obj.Redact(Empire.Current); + } + else + { + // memories are only visible to the empire which is seeing them! + // well unless we add some sort of intel project to see them or something... + if (!CurrentEmpire.Memory.Values.Contains(obj)) + obj.Dispose(); + } + } + //SpaceObjectIDCheck("when redacting " + o); + } + + /// + /// Serializes the player's commands. + /// + /// if no current empire + /// + private void SerializeCommands(Stream stream) + { + if (CurrentEmpire == null) + throw new InvalidOperationException("Can't serialize commands if there is no current empire."); + + Serializer.Serialize(CurrentEmpire.Commands, stream); + } + + /// + /// Disposes of any space objects that aren't in space, under construction, or part of the mod definition. + /// + private void SpaceObjectCleanup() + { + foreach (var sobj in Referrables.OfType().ToArray()) + { + bool dispose = true; + if (sobj.Sector != null) + dispose = false; // save space objects that are in space + else if (this is IUnit u && u.FindContainer() != null) // save units that are in cargo + dispose = false; + else if (Mod.Current.StellarObjectTemplates.Contains(sobj as StellarObject)) + dispose = false; // save stellar objects that are part of the mod templates + else if (Referrables.OfType().Any(q => q.Orders.Any(o => o.Item == sobj as IConstructable))) + dispose = false; // save constructable space objects under construction + if (dispose) + sobj.Dispose(); + } + } + + /// + /// The game setup used to create this galaxy. + /// + public GameSetup GameSetup { get; set; } +} diff --git a/FrEee.Core/Objects/GameState/GalaxyProgress.cs b/FrEee.Core.Domain/Objects/GameState/GalaxyProgress.cs similarity index 95% rename from FrEee.Core/Objects/GameState/GalaxyProgress.cs rename to FrEee.Core.Domain/Objects/GameState/GalaxyProgress.cs index ac100f7d1..63696fecc 100644 --- a/FrEee.Core/Objects/GameState/GalaxyProgress.cs +++ b/FrEee.Core.Domain/Objects/GameState/GalaxyProgress.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using FrEee.Serialization; using FrEee.Utility; namespace FrEee.Objects.GameState diff --git a/FrEee.Core/Objects/GameState/GalaxyReference.cs b/FrEee.Core.Domain/Objects/GameState/GalaxyReference.cs similarity index 100% rename from FrEee.Core/Objects/GameState/GalaxyReference.cs rename to FrEee.Core.Domain/Objects/GameState/GalaxyReference.cs diff --git a/FrEee.Core/Objects/GameState/GalaxyReferenceKeyedDictionary.cs b/FrEee.Core.Domain/Objects/GameState/GalaxyReferenceKeyedDictionary.cs similarity index 100% rename from FrEee.Core/Objects/GameState/GalaxyReferenceKeyedDictionary.cs rename to FrEee.Core.Domain/Objects/GameState/GalaxyReferenceKeyedDictionary.cs diff --git a/FrEee.Core/Objects/GameState/GalaxyReferenceList.cs b/FrEee.Core.Domain/Objects/GameState/GalaxyReferenceList.cs similarity index 86% rename from FrEee.Core/Objects/GameState/GalaxyReferenceList.cs rename to FrEee.Core.Domain/Objects/GameState/GalaxyReferenceList.cs index 8a19da989..bcb5a3d44 100644 --- a/FrEee.Core/Objects/GameState/GalaxyReferenceList.cs +++ b/FrEee.Core.Domain/Objects/GameState/GalaxyReferenceList.cs @@ -7,7 +7,7 @@ namespace FrEee.Objects.GameState { - public class GalaxyReferenceList + public class GalaxyReferenceList : ReferenceList, T> where T : IReferrable { diff --git a/FrEee.Core/Objects/GameState/GalaxyReferenceSet.cs b/FrEee.Core.Domain/Objects/GameState/GalaxyReferenceSet.cs similarity index 95% rename from FrEee.Core/Objects/GameState/GalaxyReferenceSet.cs rename to FrEee.Core.Domain/Objects/GameState/GalaxyReferenceSet.cs index 6ba0b8450..9e3f632c4 100644 --- a/FrEee.Core/Objects/GameState/GalaxyReferenceSet.cs +++ b/FrEee.Core.Domain/Objects/GameState/GalaxyReferenceSet.cs @@ -7,7 +7,7 @@ namespace FrEee.Objects.GameState { - [Serializable] + [Serializable] public class GalaxyReferenceSet : ReferenceSet, T> where T : IReferrable diff --git a/FrEee.Core/Objects/GameState/ICleanable.cs b/FrEee.Core.Domain/Objects/GameState/ICleanable.cs similarity index 100% rename from FrEee.Core/Objects/GameState/ICleanable.cs rename to FrEee.Core.Domain/Objects/GameState/ICleanable.cs diff --git a/FrEee.Core/Objects/GameState/IContainable.cs b/FrEee.Core.Domain/Objects/GameState/IContainable.cs similarity index 100% rename from FrEee.Core/Objects/GameState/IContainable.cs rename to FrEee.Core.Domain/Objects/GameState/IContainable.cs diff --git a/FrEee.Core/Objects/GameState/IFoggable.cs b/FrEee.Core.Domain/Objects/GameState/IFoggable.cs similarity index 100% rename from FrEee.Core/Objects/GameState/IFoggable.cs rename to FrEee.Core.Domain/Objects/GameState/IFoggable.cs diff --git a/FrEee.Core/Objects/GameState/INamed.cs b/FrEee.Core.Domain/Objects/GameState/INamed.cs similarity index 100% rename from FrEee.Core/Objects/GameState/INamed.cs rename to FrEee.Core.Domain/Objects/GameState/INamed.cs diff --git a/FrEee.Core/Objects/GameState/IPictorial.cs b/FrEee.Core.Domain/Objects/GameState/IPictorial.cs similarity index 100% rename from FrEee.Core/Objects/GameState/IPictorial.cs rename to FrEee.Core.Domain/Objects/GameState/IPictorial.cs diff --git a/FrEee.Core/Objects/GameState/IPromotable.cs b/FrEee.Core.Domain/Objects/GameState/IPromotable.cs similarity index 100% rename from FrEee.Core/Objects/GameState/IPromotable.cs rename to FrEee.Core.Domain/Objects/GameState/IPromotable.cs diff --git a/FrEee.Core/Utility/IReferrable.cs b/FrEee.Core.Domain/Objects/GameState/IReferrable.cs similarity index 88% rename from FrEee.Core/Utility/IReferrable.cs rename to FrEee.Core.Domain/Objects/GameState/IReferrable.cs index 5bdf88623..e6294c044 100644 --- a/FrEee.Core/Utility/IReferrable.cs +++ b/FrEee.Core.Domain/Objects/GameState/IReferrable.cs @@ -1,7 +1,7 @@ using System; using FrEee.Objects.Civilization; -namespace FrEee.Serialization; +namespace FrEee.Objects.GameState; /// /// Something that can be referred to from the client side using an ID. diff --git a/FrEee.Core/Objects/GameState/ITemplate.cs b/FrEee.Core.Domain/Objects/GameState/ITemplate.cs similarity index 100% rename from FrEee.Core/Objects/GameState/ITemplate.cs rename to FrEee.Core.Domain/Objects/GameState/ITemplate.cs diff --git a/FrEee.Core/Objects/GameState/IUnlockable.cs b/FrEee.Core.Domain/Objects/GameState/IUnlockable.cs similarity index 100% rename from FrEee.Core/Objects/GameState/IUnlockable.cs rename to FrEee.Core.Domain/Objects/GameState/IUnlockable.cs diff --git a/FrEee.Core/Objects/GameState/Visibility.cs b/FrEee.Core.Domain/Objects/GameState/Visibility.cs similarity index 100% rename from FrEee.Core/Objects/GameState/Visibility.cs rename to FrEee.Core.Domain/Objects/GameState/Visibility.cs diff --git a/FrEee.Core/Objects/LogMessages/GenericLogMessage.cs b/FrEee.Core.Domain/Objects/LogMessages/GenericLogMessage.cs similarity index 100% rename from FrEee.Core/Objects/LogMessages/GenericLogMessage.cs rename to FrEee.Core.Domain/Objects/LogMessages/GenericLogMessage.cs diff --git a/FrEee.Core/Objects/LogMessages/IPictorialLogMessage.cs b/FrEee.Core.Domain/Objects/LogMessages/IPictorialLogMessage.cs similarity index 100% rename from FrEee.Core/Objects/LogMessages/IPictorialLogMessage.cs rename to FrEee.Core.Domain/Objects/LogMessages/IPictorialLogMessage.cs diff --git a/FrEee.Core/Objects/LogMessages/LogMessage.cs b/FrEee.Core.Domain/Objects/LogMessages/LogMessage.cs similarity index 100% rename from FrEee.Core/Objects/LogMessages/LogMessage.cs rename to FrEee.Core.Domain/Objects/LogMessages/LogMessage.cs diff --git a/FrEee.Core/Objects/LogMessages/PictorialLogMessage.cs b/FrEee.Core.Domain/Objects/LogMessages/PictorialLogMessage.cs similarity index 100% rename from FrEee.Core/Objects/LogMessages/PictorialLogMessage.cs rename to FrEee.Core.Domain/Objects/LogMessages/PictorialLogMessage.cs diff --git a/FrEee.Core/Objects/SimulatedObjectWrappers.cs b/FrEee.Core.Domain/Objects/SimulatedObjectWrappers.cs similarity index 100% rename from FrEee.Core/Objects/SimulatedObjectWrappers.cs rename to FrEee.Core.Domain/Objects/SimulatedObjectWrappers.cs diff --git a/FrEee.Core/Objects/Space/AsteroidField.cs b/FrEee.Core.Domain/Objects/Space/AsteroidField.cs similarity index 100% rename from FrEee.Core/Objects/Space/AsteroidField.cs rename to FrEee.Core.Domain/Objects/Space/AsteroidField.cs diff --git a/FrEee.Core/Objects/Space/Conditions.cs b/FrEee.Core.Domain/Objects/Space/Conditions.cs similarity index 100% rename from FrEee.Core/Objects/Space/Conditions.cs rename to FrEee.Core.Domain/Objects/Space/Conditions.cs diff --git a/FrEee.Core/Objects/Space/Fleet.cs b/FrEee.Core.Domain/Objects/Space/Fleet.cs similarity index 100% rename from FrEee.Core/Objects/Space/Fleet.cs rename to FrEee.Core.Domain/Objects/Space/Fleet.cs diff --git a/FrEee.Core/Objects/Space/ILocated.cs b/FrEee.Core.Domain/Objects/Space/ILocated.cs similarity index 100% rename from FrEee.Core/Objects/Space/ILocated.cs rename to FrEee.Core.Domain/Objects/Space/ILocated.cs diff --git a/FrEee.Core/Objects/Space/IMineableSpaceObject.cs b/FrEee.Core.Domain/Objects/Space/IMineableSpaceObject.cs similarity index 100% rename from FrEee.Core/Objects/Space/IMineableSpaceObject.cs rename to FrEee.Core.Domain/Objects/Space/IMineableSpaceObject.cs diff --git a/FrEee.Core/Objects/Space/IMobileSpaceObject.cs b/FrEee.Core.Domain/Objects/Space/IMobileSpaceObject.cs similarity index 100% rename from FrEee.Core/Objects/Space/IMobileSpaceObject.cs rename to FrEee.Core.Domain/Objects/Space/IMobileSpaceObject.cs diff --git a/FrEee.Core/Objects/Space/ISpaceObject.cs b/FrEee.Core.Domain/Objects/Space/ISpaceObject.cs similarity index 98% rename from FrEee.Core/Objects/Space/ISpaceObject.cs rename to FrEee.Core.Domain/Objects/Space/ISpaceObject.cs index 9cab8374f..e75ba0d51 100644 --- a/FrEee.Core/Objects/Space/ISpaceObject.cs +++ b/FrEee.Core.Domain/Objects/Space/ISpaceObject.cs @@ -1,6 +1,5 @@ using FrEee.Modding.Abilities; using FrEee.Objects.GameState; -using FrEee.Serialization; using FrEee.Utility; namespace FrEee.Objects.Space; diff --git a/FrEee.Core/Objects/Space/IStellarObject.cs b/FrEee.Core.Domain/Objects/Space/IStellarObject.cs similarity index 96% rename from FrEee.Core/Objects/Space/IStellarObject.cs rename to FrEee.Core.Domain/Objects/Space/IStellarObject.cs index 3b20c64b8..34c56dad2 100644 --- a/FrEee.Core/Objects/Space/IStellarObject.cs +++ b/FrEee.Core.Domain/Objects/Space/IStellarObject.cs @@ -1,6 +1,6 @@ using FrEee.Modding; using FrEee.Modding.Abilities; -using FrEee.Serialization; +using FrEee.Objects.GameState; namespace FrEee.Objects.Space; diff --git a/FrEee.Core/Objects/Space/ObjectLocation.cs b/FrEee.Core.Domain/Objects/Space/ObjectLocation.cs similarity index 100% rename from FrEee.Core/Objects/Space/ObjectLocation.cs rename to FrEee.Core.Domain/Objects/Space/ObjectLocation.cs diff --git a/FrEee.Core/Objects/Space/Planet.cs b/FrEee.Core.Domain/Objects/Space/Planet.cs similarity index 99% rename from FrEee.Core/Objects/Space/Planet.cs rename to FrEee.Core.Domain/Objects/Space/Planet.cs index 937da93b0..594dacba0 100644 --- a/FrEee.Core/Objects/Space/Planet.cs +++ b/FrEee.Core.Domain/Objects/Space/Planet.cs @@ -16,7 +16,6 @@ using FrEee.Objects.Civilization.Orders; using FrEee.Objects.GameState; using FrEee.Extensions; -using FrEee.Serialization; using FrEee.Utility; using FrEee.Processes.Combat; using FrEee.Modding.Abilities; diff --git a/FrEee.Core/Objects/Space/Sector.cs b/FrEee.Core.Domain/Objects/Space/Sector.cs similarity index 100% rename from FrEee.Core/Objects/Space/Sector.cs rename to FrEee.Core.Domain/Objects/Space/Sector.cs diff --git a/FrEee.Core/Objects/Space/Star.cs b/FrEee.Core.Domain/Objects/Space/Star.cs similarity index 100% rename from FrEee.Core/Objects/Space/Star.cs rename to FrEee.Core.Domain/Objects/Space/Star.cs diff --git a/FrEee.Core/Objects/Space/StarSystem.cs b/FrEee.Core.Domain/Objects/Space/StarSystem.cs similarity index 99% rename from FrEee.Core/Objects/Space/StarSystem.cs rename to FrEee.Core.Domain/Objects/Space/StarSystem.cs index ebfcef412..9c329dd20 100644 --- a/FrEee.Core/Objects/Space/StarSystem.cs +++ b/FrEee.Core.Domain/Objects/Space/StarSystem.cs @@ -11,7 +11,6 @@ using FrEee.Extensions; using FrEee.Objects.GameState; using FrEee.Utility; -using FrEee.Serialization; using FrEee.Modding.Abilities; namespace FrEee.Objects.Space; diff --git a/FrEee.Core/Objects/Space/StellarObject.cs b/FrEee.Core.Domain/Objects/Space/StellarObject.cs similarity index 100% rename from FrEee.Core/Objects/Space/StellarObject.cs rename to FrEee.Core.Domain/Objects/Space/StellarObject.cs diff --git a/FrEee.Core/Objects/Space/StellarSize.cs b/FrEee.Core.Domain/Objects/Space/StellarSize.cs similarity index 100% rename from FrEee.Core/Objects/Space/StellarSize.cs rename to FrEee.Core.Domain/Objects/Space/StellarSize.cs diff --git a/FrEee.Core/Objects/Space/Storm.cs b/FrEee.Core.Domain/Objects/Space/Storm.cs similarity index 100% rename from FrEee.Core/Objects/Space/Storm.cs rename to FrEee.Core.Domain/Objects/Space/Storm.cs diff --git a/FrEee.Core/Objects/Space/WarpPoint.cs b/FrEee.Core.Domain/Objects/Space/WarpPoint.cs similarity index 99% rename from FrEee.Core/Objects/Space/WarpPoint.cs rename to FrEee.Core.Domain/Objects/Space/WarpPoint.cs index b0820a32d..192fd5306 100644 --- a/FrEee.Core/Objects/Space/WarpPoint.cs +++ b/FrEee.Core.Domain/Objects/Space/WarpPoint.cs @@ -5,7 +5,6 @@ using System; using System.Linq; using FrEee.Objects.GameState; -using FrEee.Serialization; using FrEee.Utility; using FrEee.Modding.Abilities; diff --git a/FrEee.Core/Objects/Technology/Component.cs b/FrEee.Core.Domain/Objects/Technology/Component.cs similarity index 100% rename from FrEee.Core/Objects/Technology/Component.cs rename to FrEee.Core.Domain/Objects/Technology/Component.cs diff --git a/FrEee.Core/Objects/Technology/ComponentReference.cs b/FrEee.Core.Domain/Objects/Technology/ComponentReference.cs similarity index 100% rename from FrEee.Core/Objects/Technology/ComponentReference.cs rename to FrEee.Core.Domain/Objects/Technology/ComponentReference.cs diff --git a/FrEee.Core/Objects/Technology/DirectFireWeaponInfo.cs b/FrEee.Core.Domain/Objects/Technology/DirectFireWeaponInfo.cs similarity index 100% rename from FrEee.Core/Objects/Technology/DirectFireWeaponInfo.cs rename to FrEee.Core.Domain/Objects/Technology/DirectFireWeaponInfo.cs diff --git a/FrEee.Core/Objects/Technology/Facility.cs b/FrEee.Core.Domain/Objects/Technology/Facility.cs similarity index 100% rename from FrEee.Core/Objects/Technology/Facility.cs rename to FrEee.Core.Domain/Objects/Technology/Facility.cs diff --git a/FrEee.Core/Objects/Technology/FacilityUpgrade.cs b/FrEee.Core.Domain/Objects/Technology/FacilityUpgrade.cs similarity index 100% rename from FrEee.Core/Objects/Technology/FacilityUpgrade.cs rename to FrEee.Core.Domain/Objects/Technology/FacilityUpgrade.cs diff --git a/FrEee.Core/Objects/Technology/Hull.cs b/FrEee.Core.Domain/Objects/Technology/Hull.cs similarity index 100% rename from FrEee.Core/Objects/Technology/Hull.cs rename to FrEee.Core.Domain/Objects/Technology/Hull.cs diff --git a/FrEee.Core/Objects/Technology/IHull.cs b/FrEee.Core.Domain/Objects/Technology/IHull.cs similarity index 100% rename from FrEee.Core/Objects/Technology/IHull.cs rename to FrEee.Core.Domain/Objects/Technology/IHull.cs diff --git a/FrEee.Core/Objects/Technology/IResearchable.cs b/FrEee.Core.Domain/Objects/Technology/IResearchable.cs similarity index 100% rename from FrEee.Core/Objects/Technology/IResearchable.cs rename to FrEee.Core.Domain/Objects/Technology/IResearchable.cs diff --git a/FrEee.Core/Objects/Technology/IUpgradeable.cs b/FrEee.Core.Domain/Objects/Technology/IUpgradeable.cs similarity index 100% rename from FrEee.Core/Objects/Technology/IUpgradeable.cs rename to FrEee.Core.Domain/Objects/Technology/IUpgradeable.cs diff --git a/FrEee.Core/Objects/Technology/Mount.cs b/FrEee.Core.Domain/Objects/Technology/Mount.cs similarity index 100% rename from FrEee.Core/Objects/Technology/Mount.cs rename to FrEee.Core.Domain/Objects/Technology/Mount.cs diff --git a/FrEee.Core/Objects/Technology/MountedComponentTemplate.cs b/FrEee.Core.Domain/Objects/Technology/MountedComponentTemplate.cs similarity index 100% rename from FrEee.Core/Objects/Technology/MountedComponentTemplate.cs rename to FrEee.Core.Domain/Objects/Technology/MountedComponentTemplate.cs diff --git a/FrEee.Core/Objects/Technology/MountedComponentTemplateContainerPopulator.cs b/FrEee.Core.Domain/Objects/Technology/MountedComponentTemplateContainerPopulator.cs similarity index 100% rename from FrEee.Core/Objects/Technology/MountedComponentTemplateContainerPopulator.cs rename to FrEee.Core.Domain/Objects/Technology/MountedComponentTemplateContainerPopulator.cs diff --git a/FrEee.Core/Objects/Technology/SeekingWeaponInfo.cs b/FrEee.Core.Domain/Objects/Technology/SeekingWeaponInfo.cs similarity index 100% rename from FrEee.Core/Objects/Technology/SeekingWeaponInfo.cs rename to FrEee.Core.Domain/Objects/Technology/SeekingWeaponInfo.cs diff --git a/FrEee.Core/Objects/Technology/Technology.cs b/FrEee.Core.Domain/Objects/Technology/Technology.cs similarity index 95% rename from FrEee.Core/Objects/Technology/Technology.cs rename to FrEee.Core.Domain/Objects/Technology/Technology.cs index 77b035a3f..61edcb9f9 100644 --- a/FrEee.Core/Objects/Technology/Technology.cs +++ b/FrEee.Core.Domain/Objects/Technology/Technology.cs @@ -307,18 +307,18 @@ public void Dispose() public int GetBaseLevelCost(int level) { - if (Galaxy.Current.TechnologyCost == TechnologyCost.Low) + if (Galaxy.Current.GameSetup.TechnologyCost == TechnologyCost.Low) return LevelCost * level; - else if (Galaxy.Current.TechnologyCost == TechnologyCost.Medium) + else if (Galaxy.Current.GameSetup.TechnologyCost == TechnologyCost.Medium) { if (Math.Abs(level) == 1) return LevelCost * level; else return LevelCost * level * level / 2; } - else if (Galaxy.Current.TechnologyCost == TechnologyCost.High) + else if (Galaxy.Current.GameSetup.TechnologyCost == TechnologyCost.High) return LevelCost * level * level; - throw new Exception("Invalid technology cost for galaxy: " + Galaxy.Current.TechnologyCost); + throw new Exception("Invalid technology cost for galaxy: " + Galaxy.Current.GameSetup.TechnologyCost); } /// @@ -338,10 +338,10 @@ public IEnumerable GetExpectedResults(Empire emp) public int GetLevelCost(int level, Empire emp) { var baseCost = GetBaseLevelCost(level); - if (Galaxy.Current.TechnologyUniqueness == 0) + if (Galaxy.Current.GameSetup.TechnologyUniqueness == 0) return baseCost; var playerRatio = emp.OtherPlayersTechLevels[this]?.Count(x => x >= level) ?? 0; - var uniquenessFactor = Math.Pow(2, Galaxy.Current.TechnologyUniqueness * playerRatio); + var uniquenessFactor = Math.Pow(2, Galaxy.Current.GameSetup.TechnologyUniqueness * playerRatio); return (int)(GetBaseLevelCost(level) * uniquenessFactor); } diff --git a/FrEee.Core/Objects/Technology/TechnologyCost.cs b/FrEee.Core.Domain/Objects/Technology/TechnologyCost.cs similarity index 100% rename from FrEee.Core/Objects/Technology/TechnologyCost.cs rename to FrEee.Core.Domain/Objects/Technology/TechnologyCost.cs diff --git a/FrEee.Core/Objects/Technology/TechnologyRequirement.cs b/FrEee.Core.Domain/Objects/Technology/TechnologyRequirement.cs similarity index 100% rename from FrEee.Core/Objects/Technology/TechnologyRequirement.cs rename to FrEee.Core.Domain/Objects/Technology/TechnologyRequirement.cs diff --git a/FrEee.Core/Objects/Technology/WarheadWeaponInfo.cs b/FrEee.Core.Domain/Objects/Technology/WarheadWeaponInfo.cs similarity index 100% rename from FrEee.Core/Objects/Technology/WarheadWeaponInfo.cs rename to FrEee.Core.Domain/Objects/Technology/WarheadWeaponInfo.cs diff --git a/FrEee.Core/Objects/Technology/WeaponInfo.cs b/FrEee.Core.Domain/Objects/Technology/WeaponInfo.cs similarity index 100% rename from FrEee.Core/Objects/Technology/WeaponInfo.cs rename to FrEee.Core.Domain/Objects/Technology/WeaponInfo.cs diff --git a/FrEee.Core/Objects/Vehicles/Base.cs b/FrEee.Core.Domain/Objects/Vehicles/Base.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/Base.cs rename to FrEee.Core.Domain/Objects/Vehicles/Base.cs diff --git a/FrEee.Core/Objects/Vehicles/Design.cs b/FrEee.Core.Domain/Objects/Vehicles/Design.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/Design.cs rename to FrEee.Core.Domain/Objects/Vehicles/Design.cs diff --git a/FrEee.Core/Objects/Vehicles/Drone.cs b/FrEee.Core.Domain/Objects/Vehicles/Drone.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/Drone.cs rename to FrEee.Core.Domain/Objects/Vehicles/Drone.cs diff --git a/FrEee.Core/Objects/Vehicles/Fighter.cs b/FrEee.Core.Domain/Objects/Vehicles/Fighter.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/Fighter.cs rename to FrEee.Core.Domain/Objects/Vehicles/Fighter.cs diff --git a/FrEee.Core/Objects/Vehicles/IDesign.cs b/FrEee.Core.Domain/Objects/Vehicles/IDesign.cs similarity index 99% rename from FrEee.Core/Objects/Vehicles/IDesign.cs rename to FrEee.Core.Domain/Objects/Vehicles/IDesign.cs index 27bc2546f..fe08ddcef 100644 --- a/FrEee.Core/Objects/Vehicles/IDesign.cs +++ b/FrEee.Core.Domain/Objects/Vehicles/IDesign.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using FrEee.Objects.Civilization.Construction; using FrEee.Objects.Commands; -using FrEee.Serialization; using FrEee.Objects.GameState; using FrEee.Modding.Abilities; diff --git a/FrEee.Core/Objects/Vehicles/IUnit.cs b/FrEee.Core.Domain/Objects/Vehicles/IUnit.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/IUnit.cs rename to FrEee.Core.Domain/Objects/Vehicles/IUnit.cs diff --git a/FrEee.Core/Objects/Vehicles/IVehicle.cs b/FrEee.Core.Domain/Objects/Vehicles/IVehicle.cs similarity index 97% rename from FrEee.Core/Objects/Vehicles/IVehicle.cs rename to FrEee.Core.Domain/Objects/Vehicles/IVehicle.cs index 17033bb51..788dcc7df 100644 --- a/FrEee.Core/Objects/Vehicles/IVehicle.cs +++ b/FrEee.Core.Domain/Objects/Vehicles/IVehicle.cs @@ -6,9 +6,9 @@ using FrEee.Utility; using System.Collections.Generic; using FrEee.Utility; -using FrEee.Serialization; using FrEee.Processes.Combat; using FrEee.Modding.Abilities; +using FrEee.Objects.GameState; namespace FrEee.Objects.Vehicles; diff --git a/FrEee.Core/Objects/Vehicles/MajorSpaceVehicle.cs b/FrEee.Core.Domain/Objects/Vehicles/MajorSpaceVehicle.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/MajorSpaceVehicle.cs rename to FrEee.Core.Domain/Objects/Vehicles/MajorSpaceVehicle.cs diff --git a/FrEee.Core/Objects/Vehicles/Mine.cs b/FrEee.Core.Domain/Objects/Vehicles/Mine.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/Mine.cs rename to FrEee.Core.Domain/Objects/Vehicles/Mine.cs diff --git a/FrEee.Core/Objects/Vehicles/Satellite.cs b/FrEee.Core.Domain/Objects/Vehicles/Satellite.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/Satellite.cs rename to FrEee.Core.Domain/Objects/Vehicles/Satellite.cs diff --git a/FrEee.Core/Objects/Vehicles/Ship.cs b/FrEee.Core.Domain/Objects/Vehicles/Ship.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/Ship.cs rename to FrEee.Core.Domain/Objects/Vehicles/Ship.cs diff --git a/FrEee.Core/Objects/Vehicles/SpaceVehicle.cs b/FrEee.Core.Domain/Objects/Vehicles/SpaceVehicle.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/SpaceVehicle.cs rename to FrEee.Core.Domain/Objects/Vehicles/SpaceVehicle.cs diff --git a/FrEee.Core/Objects/Vehicles/Troop.cs b/FrEee.Core.Domain/Objects/Vehicles/Troop.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/Troop.cs rename to FrEee.Core.Domain/Objects/Vehicles/Troop.cs diff --git a/FrEee.Core/Objects/Vehicles/Vehicle.cs b/FrEee.Core.Domain/Objects/Vehicles/Vehicle.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/Vehicle.cs rename to FrEee.Core.Domain/Objects/Vehicles/Vehicle.cs diff --git a/FrEee.Core/Objects/Vehicles/VehicleTypes.cs b/FrEee.Core.Domain/Objects/Vehicles/VehicleTypes.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/VehicleTypes.cs rename to FrEee.Core.Domain/Objects/Vehicles/VehicleTypes.cs diff --git a/FrEee.Core/Objects/Vehicles/WeaponPlatform.cs b/FrEee.Core.Domain/Objects/Vehicles/WeaponPlatform.cs similarity index 100% rename from FrEee.Core/Objects/Vehicles/WeaponPlatform.cs rename to FrEee.Core.Domain/Objects/Vehicles/WeaponPlatform.cs diff --git a/FrEee.Core/Objects/VictoryConditions/IVictoryCondition.cs b/FrEee.Core.Domain/Objects/VictoryConditions/IVictoryCondition.cs similarity index 100% rename from FrEee.Core/Objects/VictoryConditions/IVictoryCondition.cs rename to FrEee.Core.Domain/Objects/VictoryConditions/IVictoryCondition.cs diff --git a/FrEee.Core/Objects/VictoryConditions/MajorEmpireEliminationVictoryCondition.cs b/FrEee.Core.Domain/Objects/VictoryConditions/MajorEmpireEliminationVictoryCondition.cs similarity index 100% rename from FrEee.Core/Objects/VictoryConditions/MajorEmpireEliminationVictoryCondition.cs rename to FrEee.Core.Domain/Objects/VictoryConditions/MajorEmpireEliminationVictoryCondition.cs diff --git a/FrEee.Core/Objects/VictoryConditions/PeaceVictoryCondition.cs b/FrEee.Core.Domain/Objects/VictoryConditions/PeaceVictoryCondition.cs similarity index 100% rename from FrEee.Core/Objects/VictoryConditions/PeaceVictoryCondition.cs rename to FrEee.Core.Domain/Objects/VictoryConditions/PeaceVictoryCondition.cs diff --git a/FrEee.Core/Objects/VictoryConditions/ScorePercentageVictoryCondition.cs b/FrEee.Core.Domain/Objects/VictoryConditions/ScorePercentageVictoryCondition.cs similarity index 100% rename from FrEee.Core/Objects/VictoryConditions/ScorePercentageVictoryCondition.cs rename to FrEee.Core.Domain/Objects/VictoryConditions/ScorePercentageVictoryCondition.cs diff --git a/FrEee.Core/Objects/VictoryConditions/ScoreVictoryCondition.cs b/FrEee.Core.Domain/Objects/VictoryConditions/ScoreVictoryCondition.cs similarity index 100% rename from FrEee.Core/Objects/VictoryConditions/ScoreVictoryCondition.cs rename to FrEee.Core.Domain/Objects/VictoryConditions/ScoreVictoryCondition.cs diff --git a/FrEee.Core/Objects/VictoryConditions/SurvivalVictoryCondition.cs b/FrEee.Core.Domain/Objects/VictoryConditions/SurvivalVictoryCondition.cs similarity index 100% rename from FrEee.Core/Objects/VictoryConditions/SurvivalVictoryCondition.cs rename to FrEee.Core.Domain/Objects/VictoryConditions/SurvivalVictoryCondition.cs diff --git a/FrEee.Core/Objects/VictoryConditions/TechnologyVictoryCondition.cs b/FrEee.Core.Domain/Objects/VictoryConditions/TechnologyVictoryCondition.cs similarity index 100% rename from FrEee.Core/Objects/VictoryConditions/TechnologyVictoryCondition.cs rename to FrEee.Core.Domain/Objects/VictoryConditions/TechnologyVictoryCondition.cs diff --git a/FrEee.Core/Objects/VictoryConditions/TotalEliminationVictoryCondition.cs b/FrEee.Core.Domain/Objects/VictoryConditions/TotalEliminationVictoryCondition.cs similarity index 100% rename from FrEee.Core/Objects/VictoryConditions/TotalEliminationVictoryCondition.cs rename to FrEee.Core.Domain/Objects/VictoryConditions/TotalEliminationVictoryCondition.cs diff --git a/FrEee.Core/Processes/AI/AI.cs b/FrEee.Core.Domain/Processes/AI/AI.cs similarity index 100% rename from FrEee.Core/Processes/AI/AI.cs rename to FrEee.Core.Domain/Processes/AI/AI.cs diff --git a/FrEee.Core/Processes/AI/CSAI.cs b/FrEee.Core.Domain/Processes/AI/CSAI.cs similarity index 100% rename from FrEee.Core/Processes/AI/CSAI.cs rename to FrEee.Core.Domain/Processes/AI/CSAI.cs diff --git a/FrEee.Core/Processes/AI/PythonAI.cs b/FrEee.Core.Domain/Processes/AI/PythonAI.cs similarity index 100% rename from FrEee.Core/Processes/AI/PythonAI.cs rename to FrEee.Core.Domain/Processes/AI/PythonAI.cs diff --git a/FrEee.Core/Processes/Combat/BeamWeaponDisplayEffect.cs b/FrEee.Core.Domain/Processes/Combat/BeamWeaponDisplayEffect.cs similarity index 100% rename from FrEee.Core/Processes/Combat/BeamWeaponDisplayEffect.cs rename to FrEee.Core.Domain/Processes/Combat/BeamWeaponDisplayEffect.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/Battle_Space.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/Battle_Space.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/Battle_Space.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/Battle_Space.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/CombatPlanet.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/CombatPlanet.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/CombatPlanet.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/CombatPlanet.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/CombatReplayLog.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/CombatReplayLog.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/CombatReplayLog.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/CombatReplayLog.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/CombatSeeker.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/CombatSeeker.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/CombatSeeker.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/CombatSeeker.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/CombatShot.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/CombatShot.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/CombatShot.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/CombatShot.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/CombatVehicle.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/CombatVehicle.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/CombatVehicle.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/CombatVehicle.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/CombatWeapon.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/CombatWeapon.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/CombatWeapon.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/CombatWeapon.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/ControlledCombatObject.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/ControlledCombatObject.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/ControlledCombatObject.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/ControlledCombatObject.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/StrategyBlocks.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/StrategyBlocks.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/StrategyBlocks.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/StrategyBlocks.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/StrategyObject.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/StrategyObject.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/StrategyObject.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/StrategyObject.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/Tactics/Tactic.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/Tactics/Tactic.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/Tactics/Tactic.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/Tactics/Tactic.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/Tactics/TacticBlock.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/Tactics/TacticBlock.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/Tactics/TacticBlock.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/Tactics/TacticBlock.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/Tactics/TacticNode.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/Tactics/TacticNode.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/Tactics/TacticNode.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/Tactics/TacticNode.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/combatObjects.cs b/FrEee.Core.Domain/Processes/Combat/Combat2/combatObjects.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/combatObjects.cs rename to FrEee.Core.Domain/Processes/Combat/Combat2/combatObjects.cs diff --git a/FrEee.Core/Processes/Combat/Combat2/lib/FixMath.dll b/FrEee.Core.Domain/Processes/Combat/Combat2/lib/FixMath.dll similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/lib/FixMath.dll rename to FrEee.Core.Domain/Processes/Combat/Combat2/lib/FixMath.dll diff --git a/FrEee.Core/Processes/Combat/Combat2/lib/FixMath.pdb b/FrEee.Core.Domain/Processes/Combat/Combat2/lib/FixMath.pdb similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/lib/FixMath.pdb rename to FrEee.Core.Domain/Processes/Combat/Combat2/lib/FixMath.pdb diff --git a/FrEee.Core/Processes/Combat/Combat2/lib/NewtMath.dll b/FrEee.Core.Domain/Processes/Combat/Combat2/lib/NewtMath.dll similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/lib/NewtMath.dll rename to FrEee.Core.Domain/Processes/Combat/Combat2/lib/NewtMath.dll diff --git a/FrEee.Core/Processes/Combat/Combat2/lib/NewtMath.pdb b/FrEee.Core.Domain/Processes/Combat/Combat2/lib/NewtMath.pdb similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/lib/NewtMath.pdb rename to FrEee.Core.Domain/Processes/Combat/Combat2/lib/NewtMath.pdb diff --git a/FrEee.Core/Processes/Combat/Combat2/lib/nunit.framework.dll b/FrEee.Core.Domain/Processes/Combat/Combat2/lib/nunit.framework.dll similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/lib/nunit.framework.dll rename to FrEee.Core.Domain/Processes/Combat/Combat2/lib/nunit.framework.dll diff --git a/FrEee.Core/Processes/Combat/Combat2/lib/nunit.framework.xml b/FrEee.Core.Domain/Processes/Combat/Combat2/lib/nunit.framework.xml similarity index 100% rename from FrEee.Core/Processes/Combat/Combat2/lib/nunit.framework.xml rename to FrEee.Core.Domain/Processes/Combat/Combat2/lib/nunit.framework.xml diff --git a/FrEee.Core/Processes/Combat/Grid/Battle.cs b/FrEee.Core.Domain/Processes/Combat/Grid/Battle.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/Battle.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/Battle.cs diff --git a/FrEee.Core/Processes/Combat/Grid/BattleEvent.cs b/FrEee.Core.Domain/Processes/Combat/Grid/BattleEvent.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/BattleEvent.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/BattleEvent.cs diff --git a/FrEee.Core/Processes/Combat/Grid/CombatantAppearsEvent.cs b/FrEee.Core.Domain/Processes/Combat/Grid/CombatantAppearsEvent.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/CombatantAppearsEvent.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/CombatantAppearsEvent.cs diff --git a/FrEee.Core/Processes/Combat/Grid/CombatantDestroyedEvent.cs b/FrEee.Core.Domain/Processes/Combat/Grid/CombatantDestroyedEvent.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/CombatantDestroyedEvent.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/CombatantDestroyedEvent.cs diff --git a/FrEee.Core/Processes/Combat/Grid/CombatantDisappearsEvent.cs b/FrEee.Core.Domain/Processes/Combat/Grid/CombatantDisappearsEvent.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/CombatantDisappearsEvent.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/CombatantDisappearsEvent.cs diff --git a/FrEee.Core/Processes/Combat/Grid/CombatantLaunchedEvent.cs b/FrEee.Core.Domain/Processes/Combat/Grid/CombatantLaunchedEvent.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/CombatantLaunchedEvent.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/CombatantLaunchedEvent.cs diff --git a/FrEee.Core/Processes/Combat/Grid/CombatantMovesEvent.cs b/FrEee.Core.Domain/Processes/Combat/Grid/CombatantMovesEvent.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/CombatantMovesEvent.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/CombatantMovesEvent.cs diff --git a/FrEee.Core/Processes/Combat/Grid/CombatantsCollideEvent.cs b/FrEee.Core.Domain/Processes/Combat/Grid/CombatantsCollideEvent.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/CombatantsCollideEvent.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/CombatantsCollideEvent.cs diff --git a/FrEee.Core/Processes/Combat/Grid/Extensions.cs b/FrEee.Core.Domain/Processes/Combat/Grid/Extensions.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/Extensions.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/Extensions.cs diff --git a/FrEee.Core/Processes/Combat/Grid/GroundBattle.cs b/FrEee.Core.Domain/Processes/Combat/Grid/GroundBattle.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/GroundBattle.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/GroundBattle.cs diff --git a/FrEee.Core/Processes/Combat/Grid/IBattleEvent.cs b/FrEee.Core.Domain/Processes/Combat/Grid/IBattleEvent.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/IBattleEvent.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/IBattleEvent.cs diff --git a/FrEee.Core/Processes/Combat/Grid/SpaceBattle.cs b/FrEee.Core.Domain/Processes/Combat/Grid/SpaceBattle.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/SpaceBattle.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/SpaceBattle.cs diff --git a/FrEee.Core/Processes/Combat/Grid/WeaponFiresEvent.cs b/FrEee.Core.Domain/Processes/Combat/Grid/WeaponFiresEvent.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Grid/WeaponFiresEvent.cs rename to FrEee.Core.Domain/Processes/Combat/Grid/WeaponFiresEvent.cs diff --git a/FrEee.Core/Processes/Combat/Hit.cs b/FrEee.Core.Domain/Processes/Combat/Hit.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Hit.cs rename to FrEee.Core.Domain/Processes/Combat/Hit.cs diff --git a/FrEee.Core/Processes/Combat/IBattle.cs b/FrEee.Core.Domain/Processes/Combat/IBattle.cs similarity index 100% rename from FrEee.Core/Processes/Combat/IBattle.cs rename to FrEee.Core.Domain/Processes/Combat/IBattle.cs diff --git a/FrEee.Core/Processes/Combat/ICombatSpaceObject.cs b/FrEee.Core.Domain/Processes/Combat/ICombatSpaceObject.cs similarity index 100% rename from FrEee.Core/Processes/Combat/ICombatSpaceObject.cs rename to FrEee.Core.Domain/Processes/Combat/ICombatSpaceObject.cs diff --git a/FrEee.Core/Processes/Combat/ICombatant.cs b/FrEee.Core.Domain/Processes/Combat/ICombatant.cs similarity index 100% rename from FrEee.Core/Processes/Combat/ICombatant.cs rename to FrEee.Core.Domain/Processes/Combat/ICombatant.cs diff --git a/FrEee.Core/Processes/Combat/IDamageable.cs b/FrEee.Core.Domain/Processes/Combat/IDamageable.cs similarity index 98% rename from FrEee.Core/Processes/Combat/IDamageable.cs rename to FrEee.Core.Domain/Processes/Combat/IDamageable.cs index b704332a2..d8e442dd5 100644 --- a/FrEee.Core/Processes/Combat/IDamageable.cs +++ b/FrEee.Core.Domain/Processes/Combat/IDamageable.cs @@ -1,4 +1,4 @@ -using FrEee.Serialization; +using FrEee.Objects.GameState; using FrEee.Utility; using FrEee.Utility; namespace FrEee.Processes.Combat; diff --git a/FrEee.Core/Processes/Combat/ITargetable.cs b/FrEee.Core.Domain/Processes/Combat/ITargetable.cs similarity index 100% rename from FrEee.Core/Processes/Combat/ITargetable.cs rename to FrEee.Core.Domain/Processes/Combat/ITargetable.cs diff --git a/FrEee.Core/Processes/Combat/ProjectileWeaponDisplayEffect.cs b/FrEee.Core.Domain/Processes/Combat/ProjectileWeaponDisplayEffect.cs similarity index 100% rename from FrEee.Core/Processes/Combat/ProjectileWeaponDisplayEffect.cs rename to FrEee.Core.Domain/Processes/Combat/ProjectileWeaponDisplayEffect.cs diff --git a/FrEee.Core/Processes/Combat/Seeker.cs b/FrEee.Core.Domain/Processes/Combat/Seeker.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Seeker.cs rename to FrEee.Core.Domain/Processes/Combat/Seeker.cs diff --git a/FrEee.Core/Processes/Combat/SeekerWeaponDisplayEffect.cs b/FrEee.Core.Domain/Processes/Combat/SeekerWeaponDisplayEffect.cs similarity index 100% rename from FrEee.Core/Processes/Combat/SeekerWeaponDisplayEffect.cs rename to FrEee.Core.Domain/Processes/Combat/SeekerWeaponDisplayEffect.cs diff --git a/FrEee.Core/Processes/Combat/Shot.cs b/FrEee.Core.Domain/Processes/Combat/Shot.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Shot.cs rename to FrEee.Core.Domain/Processes/Combat/Shot.cs diff --git a/FrEee.Core/Processes/Combat/Simple/Battle.cs b/FrEee.Core.Domain/Processes/Combat/Simple/Battle.cs similarity index 100% rename from FrEee.Core/Processes/Combat/Simple/Battle.cs rename to FrEee.Core.Domain/Processes/Combat/Simple/Battle.cs diff --git a/FrEee.Core/Processes/Combat/WeaponDisplayEffect.cs b/FrEee.Core.Domain/Processes/Combat/WeaponDisplayEffect.cs similarity index 100% rename from FrEee.Core/Processes/Combat/WeaponDisplayEffect.cs rename to FrEee.Core.Domain/Processes/Combat/WeaponDisplayEffect.cs diff --git a/FrEee.Core/Processes/Combat/WeaponTargets.cs b/FrEee.Core.Domain/Processes/Combat/WeaponTargets.cs similarity index 100% rename from FrEee.Core/Processes/Combat/WeaponTargets.cs rename to FrEee.Core.Domain/Processes/Combat/WeaponTargets.cs diff --git a/FrEee.Core/Processes/Combat/WeaponTypes.cs b/FrEee.Core.Domain/Processes/Combat/WeaponTypes.cs similarity index 100% rename from FrEee.Core/Processes/Combat/WeaponTypes.cs rename to FrEee.Core.Domain/Processes/Combat/WeaponTypes.cs diff --git a/FrEee.Core/Processes/Setup/EmpirePlacement.cs b/FrEee.Core.Domain/Processes/Setup/EmpirePlacement.cs similarity index 100% rename from FrEee.Core/Processes/Setup/EmpirePlacement.cs rename to FrEee.Core.Domain/Processes/Setup/EmpirePlacement.cs diff --git a/FrEee.Core/Processes/Setup/EmpireTemplate.cs b/FrEee.Core.Domain/Processes/Setup/EmpireTemplate.cs similarity index 100% rename from FrEee.Core/Processes/Setup/EmpireTemplate.cs rename to FrEee.Core.Domain/Processes/Setup/EmpireTemplate.cs diff --git a/FrEee.Core/Processes/Setup/GameSetup.cs b/FrEee.Core.Domain/Processes/Setup/GameSetup.cs similarity index 94% rename from FrEee.Core/Processes/Setup/GameSetup.cs rename to FrEee.Core.Domain/Processes/Setup/GameSetup.cs index d58b03d2d..f2a584001 100644 --- a/FrEee.Core/Processes/Setup/GameSetup.cs +++ b/FrEee.Core.Domain/Processes/Setup/GameSetup.cs @@ -272,40 +272,6 @@ public void PopulateGalaxy(Galaxy gal, PRNG dice) foreach (var tname in ForbiddenTechnologyNames.Distinct()) Mod.Current.Technologies.Single(t => t.Name == tname).Dispose(); - // set omniscient view and all systems seen flags - gal.OmniscientView = OmniscientView; - gal.AllSystemsExploredFromStart = AllSystemsExplored; - - // set up mining models and resource stuff - gal.StandardMiningModel = StandardMiningModel; - gal.RemoteMiningModel = RemoteMiningModel; - gal.MinPlanetValue = MinPlanetValue; - gal.MinSpawnedPlanetValue = MinSpawnedPlanetValue; - gal.MaxSpawnedPlanetValue = MaxSpawnedPlanetValue; - gal.MaxPlanetValue = MaxPlanetValue; - gal.MinAsteroidValue = MinAsteroidValue; - gal.MinSpawnedAsteroidValue = MinSpawnedAsteroidValue; - gal.MaxSpawnedAsteroidValue = MaxSpawnedAsteroidValue; - - // set score display setting - gal.ScoreDisplay = ScoreDisplay; - - // set up victory conditions - foreach (var vc in VictoryConditions) - gal.VictoryConditions.Add(vc); - gal.VictoryDelay = VictoryDelay; - - // set up misc. game options - gal.TechnologyCost = TechnologyCost; - gal.TechnologyUniqueness = TechnologyUniqueness; - gal.IsHumansVsAI = IsHumansVsAI; - gal.AllowedTrades = AllowedTrades; - gal.IsSurrenderAllowed = IsSurrenderAllowed; - gal.IsIntelligenceAllowed = IsIntelligenceAllowed; - gal.CanColonizeOnlyBreathable = CanColonizeOnlyBreathable; - gal.CanColonizeOnlyHomeworldSurface = CanColonizeOnlyHomeworldSurface; - gal.WarpPointPlacementStrategy = WarpPointPlacementStrategy; - // create player empires foreach (var et in EmpireTemplates) { diff --git a/FrEee.Core/Processes/Setup/ScoreDisplay.cs b/FrEee.Core.Domain/Processes/Setup/ScoreDisplay.cs similarity index 100% rename from FrEee.Core/Processes/Setup/ScoreDisplay.cs rename to FrEee.Core.Domain/Processes/Setup/ScoreDisplay.cs diff --git a/FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/ClusteredStarSystemPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/ClusteredStarSystemPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/ClusteredStarSystemPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/ClusteredStarSystemPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/DiffuseStarSystemPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/DiffuseStarSystemPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/DiffuseStarSystemPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/DiffuseStarSystemPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/GridStarSystemPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/GridStarSystemPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/GridStarSystemPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/GridStarSystemPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/IStarSystemPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/IStarSystemPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/IStarSystemPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/IStarSystemPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/RandomStarSystemPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/RandomStarSystemPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/RandomStarSystemPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/RandomStarSystemPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/SpiralStarSystemPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/SpiralStarSystemPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/StarSystemPlacementStrategies/SpiralStarSystemPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/StarSystemPlacementStrategies/SpiralStarSystemPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/StartingTechnologyLevel.cs b/FrEee.Core.Domain/Processes/Setup/StartingTechnologyLevel.cs similarity index 100% rename from FrEee.Core/Processes/Setup/StartingTechnologyLevel.cs rename to FrEee.Core.Domain/Processes/Setup/StartingTechnologyLevel.cs diff --git a/FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/CenterWarpPointPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/CenterWarpPointPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/CenterWarpPointPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/CenterWarpPointPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/EdgeAlignedWarpPointPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/EdgeAlignedWarpPointPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/EdgeAlignedWarpPointPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/EdgeAlignedWarpPointPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/PlanetWarpPointPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/PlanetWarpPointPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/PlanetWarpPointPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/PlanetWarpPointPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/RandomAlignedWarpPointPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/RandomAlignedWarpPointPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/RandomAlignedWarpPointPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/RandomAlignedWarpPointPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/RandomWarpPointPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/RandomWarpPointPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/RandomWarpPointPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/RandomWarpPointPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/StarWarpPointPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/StarWarpPointPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/StarWarpPointPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/StarWarpPointPlacementStrategy.cs diff --git a/FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/WarpPointPlacementStrategy.cs b/FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/WarpPointPlacementStrategy.cs similarity index 100% rename from FrEee.Core/Processes/Setup/WarpPointPlacementStrategies/WarpPointPlacementStrategy.cs rename to FrEee.Core.Domain/Processes/Setup/WarpPointPlacementStrategies/WarpPointPlacementStrategy.cs diff --git a/FrEee.Core/Processes/TurnProcessor.cs b/FrEee.Core.Domain/Processes/TurnProcessor.cs similarity index 97% rename from FrEee.Core/Processes/TurnProcessor.cs rename to FrEee.Core.Domain/Processes/TurnProcessor.cs index 54205929e..ee25a8e04 100644 --- a/FrEee.Core/Processes/TurnProcessor.cs +++ b/FrEee.Core.Domain/Processes/TurnProcessor.cs @@ -93,7 +93,7 @@ public IEnumerable ProcessTurn(Galaxy galaxy, bool safeMode, Status stat if (RandomHelper.PerMilleChance(galaxy.EventFrequency * galaxy.Empires.Where(e => !e.IsDefeated).Count(), dice)) { // trigger a new event - var templates = Mod.Current.EventTemplates.Where(t => t.Severity <= galaxy.MaximumEventSeverity); + var templates = Mod.Current.EventTemplates.Where(t => t.Severity <= galaxy.GameSetup.MaximumEventSeverity); if (templates.Any()) { var template = templates.PickRandom(dice); @@ -241,7 +241,7 @@ public IEnumerable ProcessTurn(Galaxy galaxy, bool safeMode, Status stat if (amount > 0 && adjustedValue[mined][r] == 0) { // resource was mined here, but hasn't been adjusted yet - adjustedValue[mined][r] = galaxy.RemoteMiningModel.GetDecay(kvp.Value[r], mined.ResourceValue[r]); + adjustedValue[mined][r] = galaxy.GameSetup.RemoteMiningModel.GetDecay(kvp.Value[r], mined.ResourceValue[r]); mined.ResourceValue[r] -= adjustedValue[mined][r]; } } @@ -645,9 +645,9 @@ public IEnumerable ProcessTurn(Galaxy galaxy, bool safeMode, Status stat } // check for victory/defeat - foreach (var vc in galaxy.VictoryConditions) + foreach (var vc in galaxy.GameSetup.VictoryConditions) { - if (vc is TotalEliminationVictoryCondition || galaxy.TurnNumber > galaxy.VictoryDelay) + if (vc is TotalEliminationVictoryCondition || galaxy.TurnNumber > galaxy.GameSetup.VictoryDelay) { // find winners var winners = new List(); @@ -746,7 +746,7 @@ private static void ProcessColonyIncome(Galaxy galaxy, Colony c) incomeWithoutValue += income[Resource.Intelligence] * Resource.Research; foreach (var kvp in incomeWithoutValue) { - p.ResourceValue[kvp.Key] -= galaxy.StandardMiningModel.GetDecay(kvp.Value, p.ResourceValue[kvp.Key]); + p.ResourceValue[kvp.Key] -= galaxy.GameSetup.StandardMiningModel.GetDecay(kvp.Value, p.ResourceValue[kvp.Key]); } } @@ -807,18 +807,18 @@ private static void ProcessResourceValueChange(Galaxy galaxy, Planet p) { foreach (var r in Resource.All.Where(r => r.HasValue)) { - bool wasFull = p.ResourceValue[r] == galaxy.MaxPlanetValue; - bool wasEmpty = p.ResourceValue[r] == galaxy.MinPlanetValue; + bool wasFull = p.ResourceValue[r] == galaxy.GameSetup.MaxPlanetValue; + bool wasEmpty = p.ResourceValue[r] == galaxy.GameSetup.MinPlanetValue; var modifier = p.GetAbilityValue("Planet - Change {0} Value".F(r.Name)).ToInt() + p.GetAbilityValue("Sector - Change {0} Value".F(r.Name)).ToInt() + p.GetAbilityValue("System - Change {0} Value".F(r.Name)).ToInt() + p.GetAbilityValue("Empire - Change {0} Value".F(r.Name)).ToInt(); p.ResourceValue[r] += modifier; - p.ResourceValue[r] = p.ResourceValue[r].LimitToRange(galaxy.MinPlanetValue, galaxy.MaxPlanetValue); - if (!wasFull && p.ResourceValue[r] == galaxy.MaxPlanetValue && p.Owner != null) + p.ResourceValue[r] = p.ResourceValue[r].LimitToRange(galaxy.GameSetup.MinPlanetValue, galaxy.GameSetup.MaxPlanetValue); + if (!wasFull && p.ResourceValue[r] == galaxy.GameSetup.MaxPlanetValue && p.Owner != null) p.Owner.RecordLog(p, "{0}'s {1} have been completely replenished. Its value is at the absolute maximum.".F(p, r), LogMessageType.Generic); - if (!wasEmpty && p.ResourceValue[r] == galaxy.MinPlanetValue && p.Owner != null) + if (!wasEmpty && p.ResourceValue[r] == galaxy.GameSetup.MinPlanetValue && p.Owner != null) p.Owner.RecordLog(p, "{0} has been stripped dry of {1}. Its value is at the bare minimum.".F(p, r), LogMessageType.Generic); } } diff --git a/FrEee.Core/Properties/DataSources/FrEee.Game.Space.Planet.datasource b/FrEee.Core.Domain/Properties/DataSources/FrEee.Game.Space.Planet.datasource similarity index 100% rename from FrEee.Core/Properties/DataSources/FrEee.Game.Space.Planet.datasource rename to FrEee.Core.Domain/Properties/DataSources/FrEee.Game.Space.Planet.datasource diff --git a/FrEee.Core/Properties/Resources.Designer.cs b/FrEee.Core.Domain/Properties/Resources.Designer.cs similarity index 100% rename from FrEee.Core/Properties/Resources.Designer.cs rename to FrEee.Core.Domain/Properties/Resources.Designer.cs diff --git a/FrEee.Core/Properties/Resources.resources b/FrEee.Core.Domain/Properties/Resources.resources similarity index 100% rename from FrEee.Core/Properties/Resources.resources rename to FrEee.Core.Domain/Properties/Resources.resources diff --git a/FrEee.Core/Properties/Resources.resx b/FrEee.Core.Domain/Properties/Resources.resx similarity index 100% rename from FrEee.Core/Properties/Resources.resx rename to FrEee.Core.Domain/Properties/Resources.resx diff --git a/FrEee.Core/Properties/Settings.Designer.cs b/FrEee.Core.Domain/Properties/Settings.Designer.cs similarity index 100% rename from FrEee.Core/Properties/Settings.Designer.cs rename to FrEee.Core.Domain/Properties/Settings.Designer.cs diff --git a/FrEee.Core/Properties/Settings.settings b/FrEee.Core.Domain/Properties/Settings.settings similarity index 100% rename from FrEee.Core/Properties/Settings.settings rename to FrEee.Core.Domain/Properties/Settings.settings diff --git a/FrEee.Core/Serialization/DataReference.cs b/FrEee.Core.Domain/Serialization/DataReference.cs similarity index 100% rename from FrEee.Core/Serialization/DataReference.cs rename to FrEee.Core.Domain/Serialization/DataReference.cs diff --git a/FrEee.Core/Serialization/DataScalar.cs b/FrEee.Core.Domain/Serialization/DataScalar.cs similarity index 100% rename from FrEee.Core/Serialization/DataScalar.cs rename to FrEee.Core.Domain/Serialization/DataScalar.cs diff --git a/FrEee.Core/Serialization/JsonSerializer.cs b/FrEee.Core.Domain/Serialization/JsonSerializer.cs similarity index 100% rename from FrEee.Core/Serialization/JsonSerializer.cs rename to FrEee.Core.Domain/Serialization/JsonSerializer.cs diff --git a/FrEee.Core/Serialization/LegacySerializer.cs b/FrEee.Core.Domain/Serialization/LegacySerializer.cs similarity index 100% rename from FrEee.Core/Serialization/LegacySerializer.cs rename to FrEee.Core.Domain/Serialization/LegacySerializer.cs diff --git a/FrEee.Core/Serialization/ObjectGraphParser.cs b/FrEee.Core.Domain/Serialization/ObjectGraphParser.cs similarity index 100% rename from FrEee.Core/Serialization/ObjectGraphParser.cs rename to FrEee.Core.Domain/Serialization/ObjectGraphParser.cs diff --git a/FrEee.Core/Serialization/Serializer.cs b/FrEee.Core.Domain/Serialization/Serializer.cs similarity index 100% rename from FrEee.Core/Serialization/Serializer.cs rename to FrEee.Core.Domain/Serialization/Serializer.cs diff --git a/FrEee.Core/Serialization/SimpleDataObject.cs b/FrEee.Core.Domain/Serialization/SimpleDataObject.cs similarity index 100% rename from FrEee.Core/Serialization/SimpleDataObject.cs rename to FrEee.Core.Domain/Serialization/SimpleDataObject.cs diff --git a/FrEee.Core/Serialization/Stringifiers/DoubleLiteralFormulaStringifier.cs b/FrEee.Core.Domain/Serialization/Stringifiers/DoubleLiteralFormulaStringifier.cs similarity index 100% rename from FrEee.Core/Serialization/Stringifiers/DoubleLiteralFormulaStringifier.cs rename to FrEee.Core.Domain/Serialization/Stringifiers/DoubleLiteralFormulaStringifier.cs diff --git a/FrEee.Core/Serialization/Stringifiers/IntLiteralFormulaStringifier.cs b/FrEee.Core.Domain/Serialization/Stringifiers/IntLiteralFormulaStringifier.cs similarity index 100% rename from FrEee.Core/Serialization/Stringifiers/IntLiteralFormulaStringifier.cs rename to FrEee.Core.Domain/Serialization/Stringifiers/IntLiteralFormulaStringifier.cs diff --git a/FrEee.Core/Serialization/Stringifiers/PopulationModifierStringifier.cs b/FrEee.Core.Domain/Serialization/Stringifiers/PopulationModifierStringifier.cs similarity index 100% rename from FrEee.Core/Serialization/Stringifiers/PopulationModifierStringifier.cs rename to FrEee.Core.Domain/Serialization/Stringifiers/PopulationModifierStringifier.cs diff --git a/FrEee.Core/Serialization/Stringifiers/ResourceQuantityStringifier.cs b/FrEee.Core.Domain/Serialization/Stringifiers/ResourceQuantityStringifier.cs similarity index 100% rename from FrEee.Core/Serialization/Stringifiers/ResourceQuantityStringifier.cs rename to FrEee.Core.Domain/Serialization/Stringifiers/ResourceQuantityStringifier.cs diff --git a/FrEee.Core/Serialization/Stringifiers/StringLiteralFormulaStringifier.cs b/FrEee.Core.Domain/Serialization/Stringifiers/StringLiteralFormulaStringifier.cs similarity index 100% rename from FrEee.Core/Serialization/Stringifiers/StringLiteralFormulaStringifier.cs rename to FrEee.Core.Domain/Serialization/Stringifiers/StringLiteralFormulaStringifier.cs diff --git a/FrEee.Core/Utility/ClientSideCache.cs b/FrEee.Core.Domain/Utility/ClientSideCache.cs similarity index 100% rename from FrEee.Core/Utility/ClientSideCache.cs rename to FrEee.Core.Domain/Utility/ClientSideCache.cs diff --git a/FrEee.Core/Utility/ConnectivityGraph.cs b/FrEee.Core.Domain/Utility/ConnectivityGraph.cs similarity index 100% rename from FrEee.Core/Utility/ConnectivityGraph.cs rename to FrEee.Core.Domain/Utility/ConnectivityGraph.cs diff --git a/FrEee.Core/Utility/IReference.cs b/FrEee.Core.Domain/Utility/IReference.cs similarity index 100% rename from FrEee.Core/Utility/IReference.cs rename to FrEee.Core.Domain/Utility/IReference.cs diff --git a/FrEee.Core/Utility/Library.cs b/FrEee.Core.Domain/Utility/Library.cs similarity index 100% rename from FrEee.Core/Utility/Library.cs rename to FrEee.Core.Domain/Utility/Library.cs diff --git a/FrEee.Core/Utility/MiningModel.cs b/FrEee.Core.Domain/Utility/MiningModel.cs similarity index 100% rename from FrEee.Core/Utility/MiningModel.cs rename to FrEee.Core.Domain/Utility/MiningModel.cs diff --git a/FrEee.Core/Utility/Pathfinder.cs b/FrEee.Core.Domain/Utility/Pathfinder.cs similarity index 100% rename from FrEee.Core/Utility/Pathfinder.cs rename to FrEee.Core.Domain/Utility/Pathfinder.cs diff --git a/FrEee.Core/Utility/Pictures.cs b/FrEee.Core.Domain/Utility/Pictures.cs similarity index 100% rename from FrEee.Core/Utility/Pictures.cs rename to FrEee.Core.Domain/Utility/Pictures.cs diff --git a/FrEee.Core/Utility/Progress.cs b/FrEee.Core.Domain/Utility/Progress.cs similarity index 100% rename from FrEee.Core/Utility/Progress.cs rename to FrEee.Core.Domain/Utility/Progress.cs diff --git a/FrEee.Core/Utility/ReferenceKeyedDictionary.cs b/FrEee.Core.Domain/Utility/ReferenceKeyedDictionary.cs similarity index 100% rename from FrEee.Core/Utility/ReferenceKeyedDictionary.cs rename to FrEee.Core.Domain/Utility/ReferenceKeyedDictionary.cs diff --git a/FrEee.Core/Utility/ReferenceList.cs b/FrEee.Core.Domain/Utility/ReferenceList.cs similarity index 100% rename from FrEee.Core/Utility/ReferenceList.cs rename to FrEee.Core.Domain/Utility/ReferenceList.cs diff --git a/FrEee.Core/Utility/ReferenceSet.cs b/FrEee.Core.Domain/Utility/ReferenceSet.cs similarity index 100% rename from FrEee.Core/Utility/ReferenceSet.cs rename to FrEee.Core.Domain/Utility/ReferenceSet.cs diff --git a/FrEee.Core/Utility/Resource.cs b/FrEee.Core.Domain/Utility/Resource.cs similarity index 100% rename from FrEee.Core/Utility/Resource.cs rename to FrEee.Core.Domain/Utility/Resource.cs diff --git a/FrEee.Core/Utility/ResourceProgress.cs b/FrEee.Core.Domain/Utility/ResourceProgress.cs similarity index 100% rename from FrEee.Core/Utility/ResourceProgress.cs rename to FrEee.Core.Domain/Utility/ResourceProgress.cs diff --git a/FrEee.Core/Utility/ResourceQuantity.cs b/FrEee.Core.Domain/Utility/ResourceQuantity.cs similarity index 100% rename from FrEee.Core/Utility/ResourceQuantity.cs rename to FrEee.Core.Domain/Utility/ResourceQuantity.cs diff --git a/FrEee.Core/xbuild.sh b/FrEee.Core.Domain/xbuild.sh similarity index 100% rename from FrEee.Core/xbuild.sh rename to FrEee.Core.Domain/xbuild.sh diff --git a/FrEee.Core/Objects/GameState/Galaxy.cs b/FrEee.Core/Objects/GameState/Galaxy.cs deleted file mode 100644 index 54cfe19c2..000000000 --- a/FrEee.Core/Objects/GameState/Galaxy.cs +++ /dev/null @@ -1,1312 +0,0 @@ -using FrEee.Objects.Civilization; -using FrEee.Objects.Civilization.Diplomacy.Clauses; -using FrEee.Processes.Combat.Grid; -using FrEee.Objects.Commands; -using FrEee.Objects.Events; -using FrEee.Objects.LogMessages; -using FrEee.Modding; -using FrEee.Utility; -using FrEee.Serialization; -using FrEee.Extensions; -using Microsoft.Scripting.Utils; -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using FrEee.Objects.Civilization.Construction; -using FrEee.Objects.Vehicles; -using FrEee.Objects.Civilization.Orders; -using FrEee.Objects.VictoryConditions; -using FrEee.Objects.Space; -using FrEee.Objects.Civilization.Diplomacy; -using FrEee.Objects.Technology; -using FrEee.Extensions; -using FrEee.Utility; -using FrEee.Serialization; -using FrEee.Processes.Combat; -using FrEee.Modding.Abilities; -using FrEee.Processes.Setup; -using FrEee.Processes.Setup.WarpPointPlacementStrategies; - -namespace FrEee.Objects.GameState; - -/// -/// Prevents IDs from being assigned to objects when calling AssignIDs. -/// TODO - move to utility namespace? -/// -public class DoNotAssignIDAttribute : Attribute -{ - public DoNotAssignIDAttribute(bool recurse = true) - { - Recurse = recurse; - } - - /// - /// Should the "don't assign ID" rule be recursive? - /// - public bool Recurse { get; private set; } -} - -/// -/// A galaxy in which the game is played. -/// -[Serializable] -public class Galaxy : ICommonAbilityObject -{ - public Galaxy() - { - Current = this; - if (Mod.Current != null) - ModPath = Mod.Current.RootPath; - StarSystemLocations = new List>(); - Empires = new List(); - Name = "Unnamed"; - TurnNumber = 1; - referrables = new Dictionary(); - VictoryConditions = new List(); - AbilityCache = new SafeDictionary>(); - CommonAbilityCache = new SafeDictionary, IEnumerable>(); - SharedAbilityCache = new SafeDictionary, IEnumerable>(); - GivenTreatyClauseCache = new SafeDictionary>(); - ReceivedTreatyClauseCache = new SafeDictionary>(); - Battles = new HashSet(); - ScriptNotes = new DynamicDictionary(); - /*if (Mod.Current != null) - { - foreach (var q in Mod.Current.Objects.OfType()) - AssignID(q); - }*/ - } - - /// - /// The current galaxy. Shouldn't change except at loading a game or turn processing. - /// - public static Galaxy? Current { get; set; } - - public AbilityTargets AbilityTarget - { - get { return AbilityTargets.Galaxy; } - } - - /// - /// Allowed trades in this game. - /// - public AllowedTrades AllowedTrades { get; set; } - - /// - /// Should players have sensor data for all systems from the get-go? - /// - public bool AllSystemsExploredFromStart { get; set; } - - /// - /// The battles which have taken place this turn. - /// - public ICollection Battles { get; private set; } - - public bool CanColonizeOnlyBreathable { get; set; } - - public bool CanColonizeOnlyHomeworldSurface { get; set; } - - public IEnumerable Children - { - get { return StarSystemLocations.Select(l => l.Item); } - } - - public string CommandFileName - { - get - { - if (PlayerNumber > 0) - return Name + "_" + TurnNumber + "_" + PlayerNumber + FrEeeConstants.PlayerCommandsSaveGameExtension; - else - throw new InvalidOperationException("The game host does not have a command file."); - } - } - - /// - /// The empire whose turn it is. - /// - public Empire CurrentEmpire { get; set; } - - /// - /// The current tick in turn processing. 0 = start of turn, 1 = end of turn. - /// - public double CurrentTick { get; set; } - - /// - /// The empires participating in the game. - /// - public IList Empires { get; private set; } - - /// - /// Per mille chance of a random event occurring, per turn, per player. - /// - public double EventFrequency { get; set; } - - public string GameFileName - { - get - { - if (PlayerNumber > 0) - return Name + "_" + TurnNumber + "_" + PlayerNumber + FrEeeConstants.SaveGameExtension; - else - return Name + "_" + TurnNumber + FrEeeConstants.SaveGameExtension; - } - } - - public int Height - { - get; - set; - } - - public IEnumerable IntrinsicAbilities - { - // TODO - galaxy wide abilities? - get { yield break; } - } - - /// - /// Is the ability cache enabled? - /// Always enabled on the client side; only when a flag is set on the server side. - /// - public bool IsAbilityCacheEnabled - { - get - { - return Empire.Current != null || isAbilityCacheEnabled; - } - } - - public bool IsAnalysisAllowed { get; set; } - - /// - /// Is this a "humans vs. AI" game? - /// - public bool IsHumansVsAI { get; set; } - - public bool IsIntelligenceAllowed { get; set; } - - /// - /// Is this a single player game? If so, autoprocess the turn after the player takes his turn. - /// - public bool IsSinglePlayer { get; set; } - - public bool IsSurrenderAllowed { get; set; } - - /// - /// The maximum event severity in this game. - /// - public EventSeverity MaximumEventSeverity { get; set; } - - public int MaxPlanetValue { get; set; } - - public int MaxSpawnedAsteroidValue { get; set; } - - public int MaxSpawnedPlanetValue { get; set; } - - public int MaxX - { - get { return StarSystemLocations.MaxOrDefault(ssl => ssl.Location.X); } - } - - public int MaxY - { - get { return StarSystemLocations.MaxOrDefault(ssl => ssl.Location.Y); } - } - - public int MinAsteroidValue { get; set; } - - public int MinPlanetValue { get; set; } - - public int MinSpawnedAsteroidValue { get; set; } - - public int MinSpawnedPlanetValue { get; set; } - - public int MinX - { - get { return StarSystemLocations.MinOrDefault(ssl => ssl.Location.X); } - } - - public int MinY - { - get { return StarSystemLocations.MinOrDefault(ssl => ssl.Location.Y); } - } - - private string modPath; - - /// - /// The mod being played. - /// - [SerializationPriority(1)] - [ForceSerializationWhenDefaultValue] - public string ModPath - { - get => modPath; - set - { - if (Mod.Current == null || Mod.Current.RootPath != value) - Mod.Load(value); - modPath = value; - } - } - - /// - /// The game name. - /// - public string Name { get; set; } - - /// - /// The next tick size, for ship movement. - /// - public double NextTickSize { get; internal set; } - - /// - /// Should players have an omniscient view of all explored systems? - /// Does not prevent cloaking from working; this is just basic sight. - /// Also does not give battle reports for other empires' battles. - /// - public bool OmniscientView { get; set; } - - public IEnumerable Parents - { - get - { - yield break; - } - } - - /// - /// Events which have been warned of and are pending execution. - /// - public ICollection PendingEvents { get; private set; } = new List(); - - /// - /// The current player number (1 is the first player, 0 is the game host). - /// - public int PlayerNumber - { - get { return Empires.IndexOf(CurrentEmpire) + 1; } - } - - public IEnumerable Referrables { get { return referrables.Values; } } - - /// - /// Model to use for remote mining. - /// - public MiningModel RemoteMiningModel { get; set; } - - /// - /// Who can view empire scores? - /// - public ScoreDisplay ScoreDisplay { get; set; } - - /// - /// Notes that mod scripts can play with. - /// - public DynamicDictionary ScriptNotes { get; private set; } - - /// - /// Model to use for standard planetary mining. - /// - public MiningModel StandardMiningModel { get; set; } - - /// - /// The current stardate. Advances 0.1 years per turn. - /// - public string Stardate - { - get - { - return TurnNumber.ToStardate(); - } - } - - /// - /// The locations of the star systems in the galaxy. - /// - public ICollection> StarSystemLocations { get; private set; } - - /// - /// Technology research cost formula. - /// Low = Level * BaseCost - /// Medium = BaseCost for level 1, Level ^ 2 * BaseCost / 2 otherwise - /// Hight = Level ^ 2 * BaseCost - /// - public TechnologyCost TechnologyCost { get; set; } - - /// - /// Zero means normal tech cost; positive values make researching techs that other players know already harder; negative makes it easier. - /// - public int TechnologyUniqueness { get; set; } - - /// - /// Current time equals turn number plus tick minus 1. - /// - public double Timestamp { get { return TurnNumber + CurrentTick - 1; } } - - /// - /// The current turn number. - /// - public int TurnNumber { get; set; } - - /// - /// Number of turns of uninterrupted galactic peace (Non-Aggression or better between all surviving empires). - /// - public int TurnsOfPeace - { - get - { - // TODO - treaties - return 0; - } - } - - /// - /// Vertical space occupied by star systems. - /// - public int UsedHeight - { - get - { - if (!StarSystemLocations.Any()) - return 0; - return StarSystemLocations.Max(ssl => ssl.Location.Y) - StarSystemLocations.Min(ssl => ssl.Location.Y) + 1; - } - } - - /// - /// Horizontal space occuped by star systems. - /// - public int UsedWidth - { - get - { - if (!StarSystemLocations.Any()) - return 0; - return StarSystemLocations.Max(ssl => ssl.Location.X) - StarSystemLocations.Min(ssl => ssl.Location.X) + 1; - } - } - - /// - /// Game victory conditions. - /// - public IList VictoryConditions { get; private set; } - - /// - /// Delay in turns before victory conditions take effect. - /// - public int VictoryDelay { get; set; } - - public WarpPointPlacementStrategy WarpPointPlacementStrategy { get; set; } - - public int Width - { - get; - set; - } - - /// - /// Cache of abilities belonging to game objects. - /// - [DoNotSerialize] - internal SafeDictionary> AbilityCache { get; private set; } - - /// - /// Cache of abilities belonging to common game objects that can have different abilities for each empire. - /// - [DoNotSerialize] - internal SafeDictionary, IEnumerable> CommonAbilityCache { get; private set; } - - /// - /// Cache of treaty clauses given by empires. - /// - [DoNotSerialize] - internal SafeDictionary> GivenTreatyClauseCache { get; set; } - - /// - /// Cache of treaty clauses received by empires. - /// - [DoNotSerialize] - internal SafeDictionary> ReceivedTreatyClauseCache { get; set; } - - /// - /// Anything in the game that can be referenced from the client side - /// using a Reference object instead of passing whole objects around. - /// Stuff needs to be registered to be found though! - /// - [SerializationPriority(2)] - internal IDictionary referrables { get; set; } - - /// - /// Cache of abilities that are shared to empires from other objects due to treaties. - /// - [DoNotSerialize] - internal SafeDictionary, IEnumerable> SharedAbilityCache { get; private set; } - - /// - /// Serialized string value of the galaxy at the beginning of the turn. - /// - [DoNotSerialize] - internal string StringValue - { - get - { - if (stringValue == null) - StringValue = SaveToString(false); - return stringValue; - } - set - { - stringValue = value; - } - } - - private bool isAbilityCacheEnabled; - - private IDictionary lastBattleTimestamps = new SafeDictionary(); - - private string stringValue; - - public static string GetEmpireCommandsSavePath(string gameName, int turnNumber, int empireNumber) - { - return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Savegame", string.Format("{0}_{1}_{2:d4}{3}", gameName, turnNumber, empireNumber, FrEeeConstants.PlayerCommandsSaveGameExtension)); - } - - public static string GetGameSavePath(string gameName, int turnNumber, int empireNumber) - { - return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Savegame", empireNumber < 1 ? - string.Format("{0}_{1}{2}", gameName, turnNumber, FrEeeConstants.SaveGameExtension) : - string.Format("{0}_{1}_{2:d4}{3}", gameName, turnNumber, empireNumber, FrEeeConstants.SaveGameExtension)); - } - - /// - /// Initializes a new game. Sets Galaxy.Current. - /// - /// if there is no mod loaded. - /// A status object to report status back to the GUI. - /// How much progress should we report back to the GUI when we're done initializing the galaxy? 1.0 means all done with everything that needs to be done. - public static void Initialize(GameSetup gsu, PRNG dice, Status status = null, double desiredProgress = 1.0) - { - if (Mod.Current == null) - throw new InvalidOperationException("Cannot initialize a galaxy without a mod. Load a mod into Mod.Current first."); - - if (dice == null) - dice = new PRNG(DateTime.Now.Millisecond + 1000 * DateTime.Now.Second + 60000 * DateTime.Now.Minute); - - var startProgress = status == null ? 0d : status.Progress; - var progressPerStep = (desiredProgress - startProgress) / 4d; - - // create the game - if (Current == null) - { - var galtemp = gsu.GalaxyTemplate; - galtemp.GameSetup = gsu; - Current = galtemp.Instantiate(status, startProgress + progressPerStep, dice); - } - if (status != null) - status.Message = "Populating galaxy"; - gsu.PopulateGalaxy(Current, dice); - Current.SaveTechLevelsForUniqueness(); - if (status != null) - status.Progress += progressPerStep; - - // set single player flag - Current.IsSinglePlayer = gsu.IsSinglePlayer; - - // run init script - if (status != null) - status.Message = "Executing script"; - PythonScriptEngine.RunScript(Mod.Current.GameInitScript); - if (status != null) - status.Progress += progressPerStep; - - // save the game - if (status != null) - status.Message = "Saving game"; - SaveAll(status, desiredProgress); - } - - /// - /// Loads a savegame from the Savegame folder. - /// Note that if it was renamed, it might have different game name, turn number, player number, etc. than the filename indicates. - /// - /// - public static void Load(string filename) - { - var fs = new FileStream(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), FrEeeConstants.SaveGameDirectory, filename), FileMode.Open); - Current = Serializer.Deserialize(fs); - if (Current.ModPath == null) - Mod.Load(null); // skipped in deserialization because it is null but the mod needs to be loaded! - if (Empire.Current != null) - { - // load library of designs, strategies, etc. - Library.Load(); - } - fs.Close(); - fs.Dispose(); - Current.PopulatePropertyValues(); - } - - /// - /// Loads a host savegame from the Savegame folder. - /// - /// - /// - public static void Load(string gameName, int turnNumber) - { - Load(gameName + "_" + turnNumber + FrEeeConstants.SaveGameExtension); - } - - /// - /// Loads a player savegame from the Savegame folder. - /// - /// - /// - /// - public static void Load(string gameName, int turnNumber, int playerNumber) - { - Load(gameName + "_" + turnNumber + "_" + playerNumber.ToString("d4") + FrEeeConstants.SaveGameExtension); - } - - /// - /// Loads from a string in memory. - /// - /// - public static void LoadFromString(string serializedData) - { - Current = Serializer.DeserializeFromString(serializedData); - //Current.SpaceObjectIDCheck("after loading from memory"); - - - if (Current.ModPath == null) - Mod.Load(null); // skipped in deserialization because it is null but the mod needs to be loaded! - - if (Empire.Current != null) - { - // initialize IronPython galaxy on load - Current.StringValue = serializedData; - var formula = new ComputedFormula("Galaxy.Current.TurnNumber", null, true); - var turn = formula.Value; - - // load library of designs, strategies, etc. - Library.Load(); - } - - Current.PopulatePropertyValues(); - } - - /// - /// Populates property values specified by . - /// - private void PopulatePropertyValues() - { - // TODO: cache list of properties to populate when deserializing? - // enumerate all referrables - foreach (var referrable in Referrables) - { - // find referrable's properties - var props = referrable.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - foreach (var prop in props) - { - // search property's attributes for PopulateAttribute - foreach (var att in prop.GetCustomAttributes()) - { - if (att.GetType().IsGenericType && att.GetType().GetGenericTypeDefinition() == typeof(PopulateAttribute<>)) - { - // found PopulateAttribute - // create populator - var populatorType = att.GetType().GetGenericArguments()[0]; - var populator = (IPopulator)populatorType.Instantiate(); - - // get value from populator and save it into the referrable's property - prop.SetValue(referrable, populator.Populate(referrable)); - } - } - } - } - } - - /// - /// Saves all empires' tech levels in the other empires for uniqueness calculations. - /// - internal void SaveTechLevelsForUniqueness() - { - if (Current.TechnologyUniqueness != 0) - { - foreach (var emp in Current.Empires) - { - emp.OtherPlayersTechLevels.Clear(); - foreach (var emp2 in Current.Empires.ExceptSingle(emp)) - { - foreach (var tech in Mod.Current.Technologies) - { - if (emp.OtherPlayersTechLevels[tech] == null) - emp.OtherPlayersTechLevels[tech] = new List(); - emp.OtherPlayersTechLevels[tech].Add(emp2.ResearchedTechnologies[tech]); - } - } - } - } - } - - /// - /// Saves the master view and all players' views of the galaxy, unless single player, in which case only the first player's view is saved. - /// - /// if CurrentEmpire is not null. - public static void SaveAll(Status status = null, double desiredProgress = 1d) - { - if (Current.CurrentEmpire != null) - throw new InvalidOperationException("Can only save player galaxy views from the master galaxy view."); - - var progressPerSaveLoad = (desiredProgress - (status == null ? 0d : status.Progress)) / (Current.IsSinglePlayer ? 3 : Current.Empires.Count + 2); - //Current.SpaceObjectIDCheck("before saving"); - - // save master view - if (status != null) - status.Message = "Saving game (host)"; - var gamname = Current.Save(); - if (status != null) - status.Progress += progressPerSaveLoad; - //Current.SpaceObjectIDCheck("after saving master view to disk"); - - // save player views - for (int i = 0; i < Current.Empires.Count; i++) - { - Load(gamname); - if (Current.Empires[i].IsPlayerEmpire) - { - if (status != null) - status.Message = "Saving game (player " + (i + 1) + ")"; - Current.CurrentEmpire = Current.Empires[i]; - Current.Redact(); - //Current.SpaceObjectIDCheck("after creating player view for " + Current.Empires[i]); - Current.Save(false); // already asssigned IDs in the redact phase - if (status != null) - status.Progress += progressPerSaveLoad; - } - } - - // TODO - only reload master view if we really need to - if (status != null) - status.Message = "Saving game"; - Load(gamname); - if (status != null) - status.Progress += progressPerSaveLoad; - - //Current.SpaceObjectIDCheck("after reloading master view"); - } - - /// - /// Assigns an ID to an object. - /// Will dispose of an object that has a negative ID if it hasn't already been disposed of. - /// - /// The object. - /// The ID, or 0 to generate a new ID (unless the ID is already valid). - /// The new ID. - public long AssignID(IReferrable r, long id = 0) - { - if (r.ID < 0 || r.IsDisposed) - { - if (!r.IsDisposed) - r.Dispose(); - return r.ID; - } - - if (r.HasValidID()) - return r.ID; // no need to reassign ID - else if (referrables.ContainsKey(r.ID)) - { - // HACK - already exists, just log an error but don't overwrite anything - // we need to fix start combatants having the same IDs as the real objects... - Console.Error.WriteLine("The galaxy thinks that " + referrables[r.ID] + " has the ID " + r.ID + " but " + r + " claims to have that ID as well."); - return r.ID; - } - - var oldid = r.ID; - long newid = oldid <= 0 ? id : oldid; - - while (newid <= 0 || referrables.ContainsKey(newid)) - { - newid = RandomHelper.Range(1L, long.MaxValue); - } - r.ID = newid; - referrables.Add(newid, r); - - // clean up old IDs - if (oldid > 0 && referrables.ContainsKey(oldid) && oldid != newid) - referrables.Remove(oldid); - - return newid; - } - - /// - /// Assigns IDs to referrable objects in the galaxy and purges disposed objects. - /// Doesn't assign IDs to objects via DoNotAssignID properties, or to memories (or sub-objects of them). - /// - public void CleanGameState() - { - var parser = new ObjectGraphParser(); - bool canAssign = true; - foreach (var kvp in referrables.ToArray()) - { - if (kvp.Value.IsDisposed) - referrables.Remove(kvp.Key); - } - parser.Property += (pname, o, val) => - { - var prop = o.GetType().FindProperty(pname); - var isMemory = val is IFoggable && (val as IFoggable).IsMemory; - canAssign = !prop.HasAttribute() && !isMemory; - if (isMemory) - return false; // no recursion! - if (prop.GetAttributes().Any(a => a.Recurse)) - return false; // no recursion! - else - return true; - }; - var colls = new List(); - parser.StartObject += o => - { - if (o is IReferrable && canAssign) - { - var r = (IReferrable)o; - AssignID(r); - } - if (o is IEnumerable) - { - colls.Add((IEnumerable)o); - } - }; - parser.EndObject += o => - { - if (o is IEnumerable) - { - colls.Remove((IEnumerable)o); - } - }; - parser.Parse(this); - foreach (var l in StarSystemLocations.ToArray()) - { - if (l.Item == null) - StarSystemLocations.Remove(l); - else - { - foreach (var l2 in l.Item.SpaceObjectLocations.ToArray()) - { - if (l2.Item == null || l2.Item.IsDisposed) - l.Item.SpaceObjectLocations.Remove(l2); - } - } - } - } - - public void ComputeNextTickSize() - { - var objs = FindSpaceObjects().Where(obj => obj.Orders.Any()); - objs = objs.Where(obj => !obj.IsMemory); - if (objs.Where(v => v.TimeToNextMove > 0).Any() && CurrentTick < 1.0) - { - // HACK - why are objects getting zero time to next move?! - var nextTickSize = objs.Where(v => v.TimeToNextMove > 0).Min(v => v.TimeToNextMove); - NextTickSize = Math.Min(1.0 - CurrentTick, nextTickSize); - } - else if (objs.Any()) - { - NextTickSize = objs.Min(v => v.TimePerMove); - } - else - NextTickSize = double.PositiveInfinity; - } - - /// - /// Creates a new empire. - /// - /// - public Empire CreateNewEmpire() - { - var emp = new Empire(); - emp.Name = "Randomly Generated Empire"; // TODO - load from EmpireNames.txt / EmpireTypes.txt - - // TODO - assign AI and primary race to empire - Empires.Add(emp); - return emp; - } - - /// - /// Disables the server side ability cache. - /// - public void DisableAbilityCache() - { - isAbilityCacheEnabled = false; - AbilityCache.Clear(); - CommonAbilityCache.Clear(); - SharedAbilityCache.Clear(); - } - - /// - /// Enables the server side ability cache. - /// - public void EnableAbilityCache() - { - isAbilityCacheEnabled = true; - } - - /// - /// Finds referrable objects in the galaxy. - /// - /// - /// - /// - public IEnumerable Find(Func condition = null) where T : IReferrable - { - if (condition == null) - condition = t => true; - return Referrables.OfType().Where(r => condition(r)); - } - - /// - /// Searches for space objects matching criteria. - /// - /// The type of space object. - /// The criteria. - /// The matching space objects. - public IEnumerable FindSpaceObjects(Func criteria = null) - { - return StarSystemLocations.SelectMany(l => l.Item.FindSpaceObjects(criteria)); - } - - public IEnumerable GetContainedAbilityObjects(Empire emp) - { - return StarSystemLocations.Select(ssl => ssl.Item).Concat(StarSystemLocations.SelectMany(ssl => ssl.Item.GetContainedAbilityObjects(emp))); - } - - public string GetEmpireCommandsSavePath(Empire emp) - { - return GetEmpireCommandsSavePath(Name, TurnNumber, Empires.IndexOf(emp) + 1); - } - - public string GetGameSavePath(Empire emp = null) - { - if (emp == null) - emp = CurrentEmpire; - return GetGameSavePath(Name, TurnNumber, emp == null ? 0 : Empires.IndexOf(emp) + 1); - } - - public IReferrable GetReferrable(long key) - { - if (!referrables.ContainsKey(key)) - return null; - return referrables[key]; - } - - /// - /// Finds the real version of a fake referrable. - /// - /// - /// The fake referrable. - /// - public T GetReferrable(T fakeobj) - where T : IReferrable - { - return (T)GetReferrable(fakeobj.ID); - } - - /// - /// Loads player commands into the current game state. - /// If this is the host view, commands will be loaded for all players. - /// If this is the player view, commands will be immediately executed so as to provide the player with a fresh game state. - /// - /// Player empires which did not submit commands and are not defeated. - public IEnumerable LoadCommands() - { - // whose commands are we loading? - var emps = new List(); - if (CurrentEmpire == null) - emps.AddRange(Empires); - else - emps.Add(CurrentEmpire); - - var noCmds = new List(); - - foreach (var emp in emps) - { - var plrfile = GetEmpireCommandsSavePath(emp); - if (File.Exists(plrfile)) - { - var fs = new FileStream(plrfile, FileMode.Open); - var cmds = DeserializeCommands(fs); - LoadCommands(emp, cmds); - fs.Close(); fs.Dispose(); - } - else if (emp.IsPlayerEmpire) - noCmds.Add(emp); - } - - if (CurrentEmpire != null) - { - foreach (var cmd in CurrentEmpire.Commands) - { - if (cmd.Executor == null) - CurrentEmpire.Log.Add(CurrentEmpire.CreateLogMessage($"{cmd} cannot be issued because its executor does not exist. Probably a bug...", LogMessageType.Error)); - else if (cmd.Issuer != cmd.Executor.Owner && cmd.Issuer != cmd.Executor) - CurrentEmpire.Log.Add(CurrentEmpire.CreateLogMessage("We cannot issue commands to " + cmd.Executor + " because it does not belong to us!", LogMessageType.Error)); - else - cmd.Execute(); - } - } - - return noCmds; - } - - /// - /// Only public for unit tests. You should probably call ProcessTurn instead. - /// - public void MoveShips() - { - var vlist = FindSpaceObjects().Where(sobj => sobj.Container == null && !sobj.IsMemory).Shuffle(); - foreach (var v in vlist) - { - // mark system explored if not already - var sys = v.StarSystem; - if (sys == null) - continue; // space object is dead, or not done being built - - if (CurrentTick == 0d && !v.Orders.OfType().Any()) - v.DealWithMines(); - - bool didStuff = v.ExecuteOrders(); - sys.MarkAsExploredBy(v.Owner); - - // update memory sight after movement - if (didStuff) - { - v.UpdateEmpireMemories(); - if (v.StarSystem != null && v.Owner != null) - { - foreach (var sobj in v.StarSystem.FindSpaceObjects().Where(sobj => sobj != v && !sobj.IsMemory && v.Owner.CanSee(sobj)).ToArray()) - v.Owner.UpdateMemory(sobj); - } - - // replenish shields after moving (who knows, we might be out of supplies, or about to hit a minefield) - v.ReplenishShields(); - } - - // check for battles - var sector = v.Sector; - if (v.Owner != null && // unowned objects can't pick fights - sector != null && // can't fight nowhere - sector.SpaceObjects.OfType().Any( - sobj => - (sobj.IsHostileTo(v.Owner) && sobj.Weapons.Any() || v.IsHostileTo(sobj.Owner) && v.Weapons.Any()) // any enemies? - && (sobj.Owner.CanSee(v) || v.Owner.CanSee(sobj)) // enemies are visible? - && (!lastBattleTimestamps.ContainsKey(sector) || lastBattleTimestamps[sector] < Timestamp - (v.StrategicSpeed == 0 ? 1d : 1d / v.StrategicSpeed)))) // have we fought here too recently? - { - // resolve the battle - var battle = new SpaceBattle(sector); - battle.Resolve(); - Battles.Add(battle); - foreach (var emp in battle.Empires) - emp.Log.Add(battle.CreateLogMessage(battle.NameFor(emp), LogMessageType.Battle)); - lastBattleTimestamps[sector] = Current.Timestamp; - } - } - } - - public Sector PickRandomSector(PRNG prng = null) - { - return StarSystemLocations.PickRandom(prng).Item.PickRandomSector(prng); - } - - /// - /// Removes any space objects, etc. that the current empire cannot see. - /// - public void Redact() - { - // save off empire scores first, before data is removed - foreach (var emp in Empires) - { - emp.Scores[TurnNumber] = emp.ComputeScore(Empire.Current); - } - - // the galaxy data itself - if (Empire.Current != null) - ScriptNotes.Clear(); - - // redact sub objects - var parser = new ObjectGraphParser(); - parser.StartObject += redactParser_StartObject; - parser.Parse(this); - - // clean up redacted objects that are not IFoggable - foreach (var x in StarSystemLocations.Where(x => x.Item.IsDisposed).ToArray()) - StarSystemLocations.Remove(x); - - // delete memories since they've been copied to "physical" objects already - foreach (var kvp in Empire.Current.Memory.ToArray()) - { - kvp.Value.Dispose(); - Empire.Current.Memory.Remove(kvp); - } - } - - public void Save(Stream stream, bool assignIDs = true) - { - if (assignIDs) - CleanGameState(); - foreach (var kvp in referrables.Where(kvp => kvp.Value.IsDisposed).ToArray()) - referrables.Remove(kvp); - Serializer.Serialize(this, stream); - } - - /// - /// Saves the game to an appropriately named file in the Savegame folder. - /// Files are named GameName_TurnNumber_PlayerNumber.gam for players (PlayerNumber is 1-indexed) - /// and GameName_TurnNumber.gam for the host. - /// - /// The filename saved to without the folder name (which is Savegame). - public string Save(bool assignIDs = true) - { - if (assignIDs) - CleanGameState(); - foreach (var kvp in referrables.Where(kvp => kvp.Value.ID < 0).ToArray()) - referrables.Remove(kvp); - string filename; - if (CurrentEmpire == null) - filename = Name + "_" + TurnNumber + ".gam"; - else - filename = Name + "_" + TurnNumber + "_" + (Empires.IndexOf(CurrentEmpire) + 1).ToString("d4") + ".gam"; - if (!Directory.Exists(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), FrEeeConstants.SaveGameDirectory))) - Directory.CreateDirectory(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), FrEeeConstants.SaveGameDirectory)); - var fs = new FileStream(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), FrEeeConstants.SaveGameDirectory, filename), FileMode.Create); - Serializer.Serialize(this, fs); - fs.Close(); fs.Dispose(); - return filename; - } - - /// - /// Saves the player's commands to an appropriately named file in the Savegame folder. - /// Files are named GameName_TurnNumber_PlayerNumber.plr. (PlayerNumber is 1-indexed and padded to 4 digits with zeroes) - /// This doesn't make sense for the host view, so an exception will be thrown if there is no current empire. - /// - /// The filename saved to without the folder name (which is Savegame). - /// if there is no current empire. - public string SaveCommands() - { - CleanGameState(); - if (CurrentEmpire == null) - throw new InvalidOperationException("Can't save commands without a current empire."); - foreach (var c in Empire.Current.Commands.OfType().ToArray()) - Empire.Current.Commands.Remove(c); - Empire.Current.Commands.Add(new SetPlayerInfoCommand(Empire.Current) { PlayerInfo = Empire.Current.PlayerInfo }); - if (!Directory.Exists(FrEeeConstants.SaveGameDirectory)) - Directory.CreateDirectory(FrEeeConstants.SaveGameDirectory); - var filename = GetEmpireCommandsSavePath(CurrentEmpire); - var fs = new FileStream(filename, FileMode.Create); - SerializeCommands(fs); - fs.Close(); fs.Dispose(); - - // save library of designs, commands, etc. - Library.Save(); - - return filename; - } - - public string SaveToString(bool assignIDs = true) - { - if (assignIDs) - CleanGameState(); - return Serializer.SerializeToString(this); - } - - public override string ToString() - { - if (CurrentEmpire == null) - return Name; - return Name + " - " + CurrentEmpire.Name + " - " + CurrentEmpire.LeaderName + " - " + Stardate; - } - - public void UnassignID(long id) - { - if (referrables.ContainsKey(id)) - { - var r = referrables[id]; - r.ID = -1; - referrables.Remove(id); - } - } - - public void UnassignID(IReferrable r) - { - if (r == null || r.ID < 0) - return; // nothing to do - if (referrables.ContainsKey(r.ID)) - { - if (referrables[r.ID] == r) - referrables.Remove(r.ID); - else - { - var galaxyThinksTheIDIs = referrables.SingleOrDefault(kvp => kvp.Value == r); - referrables.Remove(galaxyThinksTheIDIs); - } - } - else if (referrables.Values.Contains(r)) - { - try - { - referrables.Remove(referrables.Single(kvp => kvp.Value == r)); - } - catch (InvalidOperationException ex) - { - // HACK - why is the item not being found? sequence contains no matching element? it's right there! - Console.Error.WriteLine(ex); - } - } - //r.ID = -1; - } - - internal void SpaceObjectIDCheck(string when) - { - foreach (var sobj in FindSpaceObjects().ToArray()) - { - if (!referrables.ContainsKey(sobj.ID)) - AssignID(sobj); - if (sobj.ID > 0) - { - var r = referrables[sobj.ID]; - if (r != sobj) - { - // HACK - assume the space object that's actually in space is "real" - referrables[sobj.ID] = sobj; - Console.Error.WriteLine("Space object identity mismatch " + when + " for ID=" + sobj.ID + ". " + sobj + " is actually in space so it is replacing " + r + " in the referrables collection."); - } - } - } - } - - /// - /// Deserializes the player's commands. - /// - /// - /// - private static IList DeserializeCommands(Stream stream) - { - var cmds = Serializer.Deserialize>(stream); - - // check for client safety - foreach (var cmd in cmds.Where(cmd => cmd != null)) - { - cmd.CheckForClientSafety(); - } - - return cmds; - } - - internal void LoadCommands(Empire emp, IList cmds) - { - cmds = cmds.Where(cmd => cmd != null).Distinct().ToList(); // HACK - why would we have null/duplicate commands in a plr file?! - emp.Commands.Clear(); - var idmap = new Dictionary(); - foreach (var cmd in cmds) - { - if (cmd.NewReferrables.Any(r => r.IsDisposed)) - { - emp.Log.Add(new GenericLogMessage("Command \"" + cmd + "\" contained a reference to deleted object \"" + cmd.NewReferrables.First(r => r.IsDisposed) + "\" and will be ignored. This may be a game bug.")); - continue; - } - emp.Commands.Add(cmd); - foreach (var r in cmd.NewReferrables) - { - var clientid = r.ID; - var serverid = AssignID(r); - if (idmap.ContainsKey(clientid)) - { - if (idmap[clientid] != serverid) - throw new InvalidOperationException($"Adding {r} with ID {serverid} to client ID {clientid} for {emp} when that client ID is already mapped to server ID {idmap[clientid]}."); - // else do nothing - } - else - idmap.Add(clientid, serverid); - } - } - foreach (var cmd in cmds) - cmd.ReplaceClientIDs(idmap); // convert client IDs to server IDs - } - - private void redactParser_StartObject(object o) - { - if (o is IReferrable) - AssignID(o as IReferrable); - if (o is IFoggable obj && o is IReferrable r) - { - if (!obj.IsMemory) - { - var id = r.ID; - var vis = obj.CheckVisibility(CurrentEmpire); - if (vis < Visibility.Fogged) - obj.Dispose(); - if (vis == Visibility.Fogged && CurrentEmpire.Memory.ContainsKey(id)) - { - var mem = (IReferrable)CurrentEmpire.Memory[id]; - mem.CopyToExceptID(r, IDCopyBehavior.PreserveDestination); // memory sight! - if (mem is ILocated l1 && r is ILocated l2) - l2.Sector = l1.Sector; // hack to copy location just now without always copying it when an object is copied - obj.IsMemory = true; - } - obj.Redact(Empire.Current); - } - else - { - // memories are only visible to the empire which is seeing them! - // well unless we add some sort of intel project to see them or something... - if (!CurrentEmpire.Memory.Values.Contains(obj)) - obj.Dispose(); - } - } - //SpaceObjectIDCheck("when redacting " + o); - } - - /// - /// Serializes the player's commands. - /// - /// if no current empire - /// - private void SerializeCommands(Stream stream) - { - if (CurrentEmpire == null) - throw new InvalidOperationException("Can't serialize commands if there is no current empire."); - - Serializer.Serialize(CurrentEmpire.Commands, stream); - } - - /// - /// Disposes of any space objects that aren't in space, under construction, or part of the mod definition. - /// - private void SpaceObjectCleanup() - { - foreach (var sobj in Referrables.OfType().ToArray()) - { - bool dispose = true; - if (sobj.Sector != null) - dispose = false; // save space objects that are in space - else if (this is IUnit u && u.FindContainer() != null) // save units that are in cargo - dispose = false; - else if (Mod.Current.StellarObjectTemplates.Contains(sobj as StellarObject)) - dispose = false; // save stellar objects that are part of the mod templates - else if (Referrables.OfType().Any(q => q.Orders.Any(o => o.Item == sobj as IConstructable))) - dispose = false; // save constructable space objects under construction - if (dispose) - sobj.Dispose(); - } - } - - // TODO - replace all those duplicate properties with a reference to the game setup - /* -/// -/// The game setup used to create this galaxy. -/// -public GameSetup GameSetup { get; set; } -*/ -} diff --git a/FrEee.Tests/FrEee.Tests.csproj b/FrEee.Tests/FrEee.Tests.csproj index 1e6f49b88..021bb4995 100644 --- a/FrEee.Tests/FrEee.Tests.csproj +++ b/FrEee.Tests/FrEee.Tests.csproj @@ -12,8 +12,9 @@ + - + diff --git a/FrEee.Tests/Objects/Technology/TechnologyTest.cs b/FrEee.Tests/Objects/Technology/TechnologyTest.cs index 39f6c654d..cfb8fa557 100644 --- a/FrEee.Tests/Objects/Technology/TechnologyTest.cs +++ b/FrEee.Tests/Objects/Technology/TechnologyTest.cs @@ -119,7 +119,7 @@ public void QueuedResearch() public void TestInit() { new Galaxy(); - Galaxy.Current.TechnologyCost = TechnologyCost.Low; + Galaxy.Current.GameSetup.TechnologyCost = TechnologyCost.Low; emp = new Empire(); Galaxy.Current.Empires.Add(emp); } diff --git a/FrEee.Tests/Processes/Combat/DamageTypesTest.cs b/FrEee.Tests/Processes/Combat/DamageTypesTest.cs index 176cecd70..202005ee1 100644 --- a/FrEee.Tests/Processes/Combat/DamageTypesTest.cs +++ b/FrEee.Tests/Processes/Combat/DamageTypesTest.cs @@ -5,7 +5,6 @@ using NUnit.Framework; using System; using System.Linq; -using FrEee.Serialization; using FrEee.Objects.GameState; using FrEee.Processes.Combat; diff --git a/FrEee.UI.Blazor/FrEee.UI.Blazor.csproj b/FrEee.UI.Blazor/FrEee.UI.Blazor.csproj index a9b8c97d9..aae9ef0b8 100644 --- a/FrEee.UI.Blazor/FrEee.UI.Blazor.csproj +++ b/FrEee.UI.Blazor/FrEee.UI.Blazor.csproj @@ -19,8 +19,9 @@ + - + diff --git a/FrEee.UI.WinForms/Forms/ActivateAbilityForm.cs b/FrEee.UI.WinForms/Forms/ActivateAbilityForm.cs index 1d62e1f7b..ace7d4e8d 100644 --- a/FrEee.UI.WinForms/Forms/ActivateAbilityForm.cs +++ b/FrEee.UI.WinForms/Forms/ActivateAbilityForm.cs @@ -9,7 +9,6 @@ using System.Linq; using System.Windows.Forms; using FrEee.Objects.Technology; -using FrEee.Serialization; using FrEee.Objects.GameState; using FrEee.Objects.Civilization.Orders; using FrEee.Extensions; diff --git a/FrEee.UI.WinForms/Forms/MainGameForm.cs b/FrEee.UI.WinForms/Forms/MainGameForm.cs index 970082851..072560c2e 100644 --- a/FrEee.UI.WinForms/Forms/MainGameForm.cs +++ b/FrEee.UI.WinForms/Forms/MainGameForm.cs @@ -1515,9 +1515,9 @@ private void starSystemView_SectorClicked(StarSystemView sender, Sector sector) if (sector != null) { var suitablePlanets = sector.SpaceObjects.OfType().Where(p => p.Colony == null && v.Abilities().Any(a => a.Rule.Matches("Colonize Planet - " + p.Surface))); - if (Galaxy.Current.CanColonizeOnlyBreathable) + if (Galaxy.Current.GameSetup.CanColonizeOnlyBreathable) suitablePlanets = suitablePlanets.Where(p => p.Atmosphere == Empire.Current.PrimaryRace.NativeAtmosphere); - if (Galaxy.Current.CanColonizeOnlyHomeworldSurface) + if (Galaxy.Current.GameSetup.CanColonizeOnlyHomeworldSurface) suitablePlanets = suitablePlanets.Where(p => p.Surface == Empire.Current.PrimaryRace.NativeSurface); if (suitablePlanets.Any()) { diff --git a/FrEee.UI.WinForms/FrEee.UI.WinForms.csproj b/FrEee.UI.WinForms/FrEee.UI.WinForms.csproj index dd5b5f6fd..90c3f5116 100644 --- a/FrEee.UI.WinForms/FrEee.UI.WinForms.csproj +++ b/FrEee.UI.WinForms/FrEee.UI.WinForms.csproj @@ -16,8 +16,9 @@ + - + diff --git a/FrEee.sln b/FrEee.sln index 246107b54..a3ed87e80 100644 --- a/FrEee.sln +++ b/FrEee.sln @@ -20,7 +20,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrEee.UI.WinForms", "FrEee. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrEee.Core.Utility", "FrEee.Core.Utility\FrEee.Core.Utility.csproj", "{84246F9D-DD31-4E8B-BA70-1006FA551083}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrEee.Core", "FrEee.Core\FrEee.Core.csproj", "{ECA7A08B-992A-43EC-8D98-2AE887897343}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrEee.Core.Domain", "FrEee.Core.Domain\FrEee.Core.Domain.csproj", "{ECA7A08B-992A-43EC-8D98-2AE887897343}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution