Ejemplo n.º 1
0
 public void UpdateShipStatus(ShipStatus ship)
 {
     ship.NowHp  = NowHp;
     ship.Slot   = _status.Slot;
     ship.SlotEx = _status.SlotEx;
     if (_status.SpecialAttack == ShipStatus.Attack.Fire)
     {
         ship.SpecialAttack = ShipStatus.Attack.Fired;
     }
 }
Ejemplo n.º 2
0
            public void Check(ShipStatus ship)
            {
                var spec = ship.Spec;

                if (spec.NumEquips != -1 || ship.Id <= MaxId)
                {
                    return;
                }
                spec.NumEquips = ship.Slot.Count(item => !item.Empty);
            }
Ejemplo n.º 3
0
 public ChargeStatus(ShipStatus status)
 {
     if (status.Spec.FuelMax == 0)
     {
         FuelRatio = 2.0;
         BullRatio = 2.0;
         return;
     }
     FuelRatio = (double)status.Fuel / status.Spec.FuelMax;
     BullRatio = (double)status.Bull / status.Spec.BullMax;
 }
Ejemplo n.º 4
0
 private static void ConsumeSlotItem(ShipStatus ship, int id)
 {
     if (ship.SlotEx.Spec.Id == id)
     {
         ship.SlotEx = new ItemStatus();
         return;
     }
     for (var i = 0; i < ship.Slot.Count; i++)
     {
         if (ship.Slot[i].Spec.Id == id)
         {
             ship.FreeSlot(i);
             break;
         }
     }
 }
Ejemplo n.º 5
0
        public void SetItemHolder()
        {
            if (AllBase == null)
            {
                return;
            }
            var name = new[] { "第一", "第二", "第三" };

            foreach (var baseInfo in AllBase.Select((data, i) => new { data, i }))
            {
                var areaName = baseInfo.data.AreaName;
                foreach (var airCorps in baseInfo.data.AirCorps.Select((data, i) => new { data, i }))
                {
                    var ship = new ShipStatus
                    {
                        Id   = 10000 + baseInfo.i * 1000 + airCorps.i,
                        Spec = new ShipSpec {
                            Name = areaName + " " + name[airCorps.i] + "航空隊"
                        }
                    };
                    foreach (var plane in airCorps.data.Planes)
                    {
                        if (plane.State != 1)
                        {
                            continue;
                        }
                        _itemInfo.GetStatus(plane.Slot.Id).Holder = ship;
                    }
                }
            }
            if (_relocatingPlanes == null)
            {
                return;
            }
            var relocating = new ShipStatus {
                Id = 1500, Spec = new ShipSpec {
                    Name = "配置転換中"
                }
            };

            foreach (var id in _relocatingPlanes)
            {
                _itemInfo.GetStatus(id).Holder = relocating;
            }
        }
Ejemplo n.º 6
0
        private void FlagshipRecovery(string request, ShipStatus flagship)
        {
            var type = int.Parse(HttpUtility.ParseQueryString(request)["api_recovery_type"] ?? "0");

            switch (type)
            {
            case 0:
                return;

            case 1:
                flagship.NowHp = flagship.MaxHp / 2;
                ConsumeSlotItem(flagship, 42);     // ダメコン
                break;

            case 2:
                flagship.NowHp = flagship.MaxHp;
                ConsumeSlotItem(flagship, 43);     // 女神
                break;
            }
            if (type != 0)
            {
                _shipInfo.SetBadlyDamagedShips();
            }
        }
Ejemplo n.º 7
0
 public ShipStatusPair(ShipStatus assumed, ShipStatus actual)
 {
     Assumed = assumed;
     Actual  = actual;
 }
Ejemplo n.º 8
0
 private TimeSpan RepairTime(ShipStatus ship, int damage) =>
 TimeSpan.FromMinutes(Math.Ceiling(ship.RepairTime.TotalMinutes / (ship.MaxHp - ship.NowHp) * damage));