コード例 #1
0
        public PlayerShip GetBestShipForRole(ShipRoles role, DamageTypes tankTypes)
        {
            var methodName = "GetBestShipForRole";

            LogTrace(methodName, "{0} {1}", role, (int)tankTypes);

            var shipsMatchingRole = PlayerShips.Where(ship => ship.ShipRole == role).OrderByDescending(ship => ship.TankTypes.GetMatchingBitCount(tankTypes));

            if (shipsMatchingRole.Count() == 0)
            {
                LogMessage(methodName, LogSeverityTypes.Standard, "Error: Could find no ships matching role \"{0}\".", role);
                return(null);
            }

            //First try to find a ship matching perfectly.
            var bestTankMatch = shipsMatchingRole.FirstOrDefault();

            LogMessage(methodName, LogSeverityTypes.Standard, "Found ship \"{0}\" matching role \"{1}\" closest matching requested tank types.", bestTankMatch.ShipName, role);
            return(bestTankMatch);
        }
コード例 #2
0
 public ShipClass(int id, Factions faction, string designation, int offense, int defense, int crippledOffense, int crippledDefense,
                  int command, int dateAvailable, float salvageValue, float cost, float fighterFactors, float crippledFighterFactors,
                  float heavyFighterFactors, float crippledHeavyFighterFactors, int droneFactors, ShipRoles shipRoles)
 {
     Id                          = id;
     Faction                     = faction;
     Designation                 = designation;
     Offense                     = offense;
     Defense                     = defense;
     CrippledOffense             = crippledOffense;
     CrippledDefense             = crippledDefense;
     Command                     = command;
     DateAvailable               = dateAvailable;
     SalvageValue                = salvageValue;
     Cost                        = cost;
     FighterFactors              = fighterFactors;
     CrippledFighterFactors      = crippledFighterFactors;
     HeavyFighterFactors         = heavyFighterFactors;
     CrippledHeavyFighterFactors = crippledHeavyFighterFactors;
     DroneBombardmentFactor      = droneFactors;
     ShipRoles                   = shipRoles;
     BuildFactorsStrings();
 }
コード例 #3
0
 public PlayerShip GetBestShipForRole(ShipRoles role)
 {
     return(GetBestShipForRole(role, DamageTypes.All));
 }