/// <summary>
 /// Initializes a new instance of the <see cref="BaseCreatorEditorSettings" /> struct
 /// when the unit composition is NOT preset.
 /// </summary>
 /// <param name="unitName">Name of the unit.</param>
 /// <param name="isOwnerUser">if set to <c>true</c> [is owner user].</param>
 /// <param name="elementQty">The element qty.</param>
 /// <param name="userRelations">The user relations.</param>
 /// <param name="cmsPerCmd">The CMS per command.</param>
 /// <param name="activeCMs">The active c ms.</param>
 /// <param name="deployDate">The deploy date.</param>
 /// <param name="losTurrets">The LOS turrets.</param>
 /// <param name="missileLaunchers">The missile launchers.</param>
 /// <param name="passiveCMs">The passive c ms.</param>
 /// <param name="shieldGens">The shield gens.</param>
 /// <param name="sensors">The sensors.</param>
 /// <param name="formation">The formation.</param>
 public BaseCreatorEditorSettings(string unitName, bool isOwnerUser, int elementQty, DebugDiploUserRelations userRelations, int cmsPerCmd, int activeCMs,
     GameDate deployDate, DebugLosWeaponLoadout losTurrets, DebugWeaponLoadout missileLaunchers, int passiveCMs, int shieldGens, int sensors,
     DebugBaseFormation formation)
     : base(unitName, isOwnerUser, elementQty, userRelations, cmsPerCmd, activeCMs, deployDate, losTurrets, missileLaunchers, passiveCMs,
         shieldGens, sensors) {
     Formation = formation;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseCreatorEditorSettings" /> struct
 /// when the unit composition is preset.
 /// </summary>
 /// <param name="unitName">Name of the unit.</param>
 /// <param name="isOwnerUser">if set to <c>true</c> [is owner user].</param>
 /// <param name="userRelations">The user relations.</param>
 /// <param name="cmsPerCmd">The CMS per command.</param>
 /// <param name="activeCMs">The active c ms.</param>
 /// <param name="deployDate">The deploy date.</param>
 /// <param name="losTurrets">The LOS turrets.</param>
 /// <param name="missileLaunchers">The missile launchers.</param>
 /// <param name="passiveCMs">The passive c ms.</param>
 /// <param name="shieldGens">The shield gens.</param>
 /// <param name="sensors">The sensors.</param>
 /// <param name="formation">The formation.</param>
 /// <param name="presetHullCats">The preset hull cats.</param>
 public BaseCreatorEditorSettings(string unitName, bool isOwnerUser, DebugDiploUserRelations userRelations, int cmsPerCmd, int activeCMs,
     GameDate deployDate, DebugLosWeaponLoadout losTurrets, DebugWeaponLoadout missileLaunchers, int passiveCMs, int shieldGens, int sensors,
     DebugBaseFormation formation, IList<FacilityHullCategory> presetHullCats)
     : base(unitName, isOwnerUser, userRelations, cmsPerCmd, activeCMs, deployDate, losTurrets, missileLaunchers, passiveCMs, shieldGens,
           sensors) {
     Formation = formation;
     PresetElementHullCategories = presetHullCats;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FleetCreatorEditorSettings" /> struct
 /// when the unit composition is NOT preset.
 /// </summary>
 /// <param name="unitName">Name of the unit.</param>
 /// <param name="isOwnerUser">if set to <c>true</c> [is owner user].</param>
 /// <param name="elementQty">The element qty.</param>
 /// <param name="userRelations">The user relations.</param>
 /// <param name="cmsPerCmd">The CMS per command.</param>
 /// <param name="activeCMs">The active c ms.</param>
 /// <param name="deployDate">The deploy date.</param>
 /// <param name="losTurrets">The LOS turrets.</param>
 /// <param name="missileLaunchers">The missile launchers.</param>
 /// <param name="passiveCMs">The passive c ms.</param>
 /// <param name="shieldGens">The shield gens.</param>
 /// <param name="sensors">The sensors.</param>
 /// <param name="formation">The formation.</param>
 /// <param name="toMove">if set to <c>true</c> [to move].</param>
 /// <param name="findFarthest">if set to <c>true</c> [find farthest].</param>
 /// <param name="toAttack">if set to <c>true</c> [to attack].</param>
 /// <param name="stanceExclusions">The stance exclusions.</param>
 public FleetCreatorEditorSettings(string unitName, bool isOwnerUser, int elementQty, DebugDiploUserRelations userRelations, int cmsPerCmd, int activeCMs,
     GameDate deployDate, DebugLosWeaponLoadout losTurrets, DebugWeaponLoadout missileLaunchers, int passiveCMs, int shieldGens, int sensors,
     DebugFleetFormation formation, bool toMove, bool findFarthest, bool toAttack, DebugShipCombatStanceExclusions stanceExclusions)
     : base(unitName, isOwnerUser, elementQty, userRelations, cmsPerCmd, activeCMs, deployDate, losTurrets, missileLaunchers, passiveCMs,
         shieldGens, sensors) {
     Formation = formation;
     Move = toMove;
     FindFarthest = findFarthest;
     Attack = toAttack;
     StanceExclusions = stanceExclusions;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AUnitCreatorEditorSettings" /> struct
 /// when the unit composition is NOT preset.
 /// </summary>
 /// <param name="unitName">Name of the unit.</param>
 /// <param name="isOwnerUser">if set to <c>true</c> [is owner user].</param>
 /// <param name="elementQty">The element qty.</param>
 /// <param name="userRelations">The user relations.</param>
 /// <param name="cmsPerCmd">The CMS per command.</param>
 /// <param name="activeCMs">The active c ms.</param>
 /// <param name="deployDate">The deploy date.</param>
 /// <param name="losTurrets">The LOS turrets.</param>
 /// <param name="missileLaunchers">The missile launchers.</param>
 /// <param name="passiveCMs">The passive c ms.</param>
 /// <param name="shieldGens">The shield gens.</param>
 /// <param name="sensors">The sensors.</param>
 public AUnitCreatorEditorSettings(string unitName, bool isOwnerUser, int elementQty, DebugDiploUserRelations userRelations, int cmsPerCmd,
     int activeCMs, GameDate deployDate, DebugLosWeaponLoadout losTurrets, DebugWeaponLoadout missileLaunchers, int passiveCMs, int shieldGens,
     int sensors) {
     UnitName = unitName;
     IsOwnerUser = isOwnerUser;
     IsCompositionPreset = false;
     NonPresetElementQty = elementQty;
     DesiredRelationshipWithUser = userRelations;
     CMsPerCommand = cmsPerCmd;
     ActiveCMsPerElement = activeCMs;
     DateToDeploy = deployDate;
     LosTurretsPerElement = losTurrets;
     MissileLaunchersPerElement = missileLaunchers;
     PassiveCMsPerElement = passiveCMs;
     ShieldGeneratorsPerElement = shieldGens;
     SensorsPerElement = sensors;
 }
 private void DetermineLosWeaponQtyAndMix(DebugLosWeaponLoadout loadout, int maxAllowed, out int beams, out int projectiles) {
     switch (loadout) {
         case DebugLosWeaponLoadout.None:
             beams = Constants.Zero;
             projectiles = Constants.Zero;
             break;
         case DebugLosWeaponLoadout.OneBeam:
             beams = maxAllowed > Constants.Zero ? Constants.One : Constants.Zero;
             projectiles = Constants.Zero;
             break;
         case DebugLosWeaponLoadout.OneProjectile:
             beams = Constants.Zero;
             projectiles = maxAllowed > Constants.Zero ? Constants.One : Constants.Zero;
             break;
         case DebugLosWeaponLoadout.OneEach:
             beams = maxAllowed > Constants.Zero ? Constants.One : Constants.Zero;
             projectiles = maxAllowed > Constants.Zero ? Constants.One : Constants.Zero;
             break;
         case DebugLosWeaponLoadout.Random:
             beams = RandomExtended.Range(Constants.Zero, maxAllowed);
             projectiles = RandomExtended.Range(Constants.Zero, maxAllowed - beams);
             break;
         case DebugLosWeaponLoadout.MaxBeam:
             beams = maxAllowed;
             projectiles = Constants.Zero;
             break;
         case DebugLosWeaponLoadout.MaxProjectile:
             beams = Constants.Zero;
             projectiles = maxAllowed;
             break;
         case DebugLosWeaponLoadout.MaxMix:
             beams = Mathf.FloorToInt(maxAllowed / 2F);
             projectiles = maxAllowed - beams;
             break;
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(loadout));
     }
 }
    private IList<string> MakeAndRecordShipDesigns(Player owner, IEnumerable<ShipHullStat> hullStats, DebugLosWeaponLoadout turretLoadout,
    DebugWeaponLoadout missileLoadout, int passiveCMsPerElement, int activeCMsPerElement, int sensorsPerElement,
    int shieldGensPerElement, IEnumerable<ShipCombatStance> stances) {

        D.Assert(sensorsPerElement >= Constants.One, "A minimum of 1 sensor is reqd per element.");

        IList<string> designNames = new List<string>();
        foreach (var hullStat in hullStats) {
            ShipHullCategory hullCategory = hullStat.HullCategory;

            int beamsPerElement;
            int projectilesPerElement;
            DetermineLosWeaponQtyAndMix(turretLoadout, hullCategory.__MaxLOSWeapons(), out beamsPerElement, out projectilesPerElement);

            var weaponStats = _availableBeamWeaponStats.Shuffle().Take(beamsPerElement).ToList();
            weaponStats.AddRange(_availableProjectileWeaponStats.Shuffle().Take(projectilesPerElement));
            int missileWeaponsPerElement = GetWeaponQtyToInstall(missileLoadout, hullCategory.__MaxMissileWeapons());
            weaponStats.AddRange(_availableMissileWeaponStats.Shuffle().Take(missileWeaponsPerElement));

            var passiveCmStats = _availablePassiveCountermeasureStats.Shuffle().Take(passiveCMsPerElement);
            var activeCmStats = _availableActiveCountermeasureStats.Shuffle().Take(activeCMsPerElement);

            List<SensorStat> sensorStats = new List<SensorStat>();
            sensorStats.Add(CreateShortRangeSensorStat());
            if (sensorsPerElement > 1) {
                sensorStats.AddRange(_availableSensorStats.Shuffle().Take(sensorsPerElement - 1));
            }

            var shieldGenStats = _availableShieldGeneratorStats.Shuffle().Take(shieldGensPerElement);
            Priority hqPriority = hullCategory.__HQPriority();    // TEMP, IMPROVE
            ShipCombatStance stance = RandomExtended.Choice(stances);

            string designName = GetUniqueElementDesignName(hullCategory.GetValueName());
            designNames.Add(designName);
            MakeAndRecordElementDesign(designName, owner, hullStat, weaponStats, passiveCmStats, activeCmStats, sensorStats, shieldGenStats,
                hqPriority, stance);
        }
        return designNames;
    }