コード例 #1
0
        internal string GetStatusMessage()
        {
            var message = new StringBuilder();

            if (Ships.Any(a => a.HitCount > 0))
            {
                message.AppendLine($"{Name} current status:");

                var hitShips = Ships.Where(w => w.HitCount > 0 && !w.IsSunk).ToList();
                foreach (var item in hitShips)
                {
                    var plural = item.HitCount > 1 ? "s" : string.Empty;
                    message.AppendLine($"{item.Name} : {item.HitCount} hit{plural}");
                }

                var sunkShips = Ships.Where(w => w.IsSunk).ToList();
                foreach (var item in sunkShips)
                {
                    message.AppendLine($"{item.Name} : Sunk");
                }

                message.AppendLine($"Received {GameBoard.Squares.Count(c => c.IsHit)} hit shot");
                message.AppendLine($"Received {GameBoard.Squares.Count(c => c.IsMiss)} missed shot");
            }

            return(message.ToString());
        }
コード例 #2
0
ファイル: HomeportFleet.cs プロジェクト: lyu0912/ing
 private FleetState CheckFleetState()
 {
     if (Ships.AsList().Count == 0)
     {
         return(FleetState.Empty);
     }
     if (Expedition != null)
     {
         return(FleetState.Expedition);
     }
     if (ships.Any(s => s.IsRepairing))
     {
         return(FleetState.Repairing);
     }
     if (Ships.Any(s => s.HP.DamageState >= ShipDamageState.HeavilyDamaged))
     {
         return(FleetState.Damaged);
     }
     if (Ships.Any(s => !s.Fuel.IsMaximum || !s.Bullet.IsMaximum))
     {
         return(FleetState.Insufficient);
     }
     if (Ships.Any(s => s.Morale < 40))
     {
         return(FleetState.Fatigued);
     }
     if (owner.CombinedFleet > 0 && (Id == 1 || Id == 2))
     {
         return(FleetState.Combined);
     }
     return(FleetState.Ready);
 }
コード例 #3
0
 public bool IsShield(ShipInfo ship)
 {
     lock (Types)
         if (Types.Any(_ => _.ID == ship.ShipCargoType))
         {
             return(true);
         }
     lock (Ships)
         if (Ships.Any(_ => _.ID == ship.MMSI))
         {
             return(true);
         }
     return(false);
 }
コード例 #4
0
ファイル: Fleet.cs プロジェクト: sandisks/Projects
        public void UpdateStatus()
        {
            LowCondition   = false;
            HeavilyDamaged = false;
            NeedCharge     = false;
            Repairing      = false;
            foreach (var ship in Ships)
            {
                LowCondition   |= ship.Condition < 40;
                HeavilyDamaged |= !ship.IsEscaped && ship.DamageControl == null && ship != Ships.FirstOrDefault() && ship.HP.Current * 4 <= ship.HP.Max;
                NeedCharge     |= !(ship.Fuel.IsMax && ship.Bull.IsMax);
                Repairing      |= ship.IsRepairing;
            }
#pragma warning disable CC0014
            if (InSortie)
            {
                Status = HeavilyDamaged ? FleetStatus.Warning : FleetStatus.InSortie;
            }
            else if (MissionState != FleetMissionState.None)
            {
                Status = FleetStatus.InMission;
            }
            else if (NeedCharge || HeavilyDamaged || LowCondition || Repairing || CanHomeportRepairing)
            {
                Status = FleetStatus.NotReady;
            }
            else
            {
                Status = FleetStatus.Ready;
            }
#pragma warning restore CC0014
            AirFightPower = Ships.Where(x => !x.IsEscaped).Aggregate(new AirFightPower(), (x, y) => x + y.AirFightPower);
            if (Ships.Any())
            {
                mincondition = Ships.Min(x => x.Condition);
            }
            else
            {
                mincondition = 49;
                Status       = FleetStatus.Empty;
            }
            OnPropertyChanged(nameof(AirFightPower));
            OnPropertyChanged(nameof(LevelSum));
            OnPropertyChanged(nameof(LevelAverage));
            OnPropertyChanged(nameof(LoSInMap));
            OnPropertyChanged(nameof(ChargeCost));
            OnPropertyChanged(nameof(RepairCost));
            OnPropertyChanged(nameof(CanHomeportRepairing));
            OnPropertyChanged(nameof(Speed));
        }
コード例 #5
0
 public bool HasPilot(string name)
 {
     return(Ships.Any(n => n.Instance.PilotInfo.PilotName == name));
 }
コード例 #6
0
ファイル: GlobalModel.cs プロジェクト: Kreyl/nute
 public bool IsShipGate(byte gateId)
 {
     return(Ships.Any(s => s.PhysicalGateID.Contains(gateId)));
 }