public CombatShip CreateCombatShip(int team, Color teamColour, int sectorId)
        {
            var unlockedIds = _game.TechTree[team - 1].CompletedTechIds();
            var keys        = new[] { "F", "I", "G", "T" };

            // Get the most advanced ship for any of these keys
            var spec = (from s in Ships
                        where keys.Contains(s.Key) &&
                        (s.DependsOnTechIds == null || s.DependsOnTechIds.All(unlockedIds.Contains)) &&
                        _game.CanLaunchShip(team, s.NumPilots, s.Type)
                        orderby s.Id descending
                        select s).FirstOrDefault();

            if (spec == null)
            {
                return(null);
            }

            return(CreateShip(spec, team, teamColour, sectorId));
        }
Example #2
0
        public void CantLaunchWithNoPilots()
        {
            var result = _game.CanLaunchShip(2, 1, EShipType.Scout);

            result.ShouldBe(false);
        }