Example #1
0
        public bool IsValidStartRepair(int ship_mem_id, bool use_repairkit)
        {
            ShipModel shipModel = _ships.Find((ShipModel x) => x.MemId == ship_mem_id);

            if (shipModel == null)
            {
                return(false);
            }
            if (shipModel.TaikyuRate >= 100.0)
            {
                return(false);
            }
            if (shipModel.IsInMission() || shipModel.IsInRepair())
            {
                return(false);
            }
            if (shipModel.IsBling())
            {
                return(false);
            }
            if (shipModel.IsBlingWaitFromEscortDeck())
            {
                return(false);
            }
            MaterialInfo resourcesForRepair = shipModel.GetResourcesForRepair();

            if (base.Material.Fuel < resourcesForRepair.Fuel)
            {
                return(false);
            }
            if (base.Material.Steel < resourcesForRepair.Steel)
            {
                return(false);
            }
            if (use_repairkit && base.Material.RepairKit < 1)
            {
                return(false);
            }
            DeckModelBase deck = shipModel.getDeck();

            if (deck != null)
            {
                if (deck.IsEscortDeckMyself())
                {
                    return(false);
                }
                return(deck.AreaId == MapArea.Id);
            }
            if (shipModel.IsBlingWaitFromDeck() && shipModel.AreaIdBeforeBlingWait == MapArea.Id)
            {
                return(true);
            }
            if (MapArea.Id == 1)
            {
                return(true);
            }
            return(false);
        }