Inheritance: Livet.NotificationObject
Esempio n. 1
0
        public static void CheckDamageControl(this ShipData ship)
        {
            if (ship.NowHP > 0)
            {
                return;
            }

            // ダメコンによる回復処理。同一戦闘で2度目が発生する事はないという前提……
            var damageControl = ship.FirstDamageControlOrNull();

            if (damageControl == null)
            {
                return;
            }

            ship.IsUsedDamecon = true;
            if (damageControl.IsDamecon())
            {
                ship.NowHP = (int)Math.Floor(ship.MaxHP * 0.2);
            }
            else
            {
                ship.NowHP = ship.MaxHP;
            }
        }
Esempio n. 2
0
 public static bool HasScout(this ShipData data)
 {
     return(data.Slots
            .Where(x => x.Source.Type == SlotItemType.水上偵察機 ||
                   x.Source.Type == SlotItemType.水上爆撃機)
            .Any(x => 0 < x.Current));
 }
Esempio n. 3
0
 private static ShipSlotData FirstDamageControlOrNull(this ShipData ship)
 {
     // ダメコン優先度: 拡張スロット>インデックス順
     if (ship.ExSlot.IsDamecon() || ship.ExSlot.IsMegami())
     {
         return(ship.ExSlot);
     }
     return(ship.Slots?.FirstOrDefault(x => x.IsDamecon() || x.IsMegami()));
 }
Esempio n. 4
0
        public static int LateModelTorpedoCount(this ShipData data)
        {
            var LateModelTorpedos = new int[]
            {
                213,                 // 後期型艦首魚雷(6門)
                214,                 // 熟練聴音員+後期型艦首魚雷(6門)
            };

            return(data.Slots.Count(x => LateModelTorpedos.Contains(x.Source.Id))
                   + (LateModelTorpedos.Contains(data.ExSlot?.Source.Id ?? 0) ? 1 : 0));
        }
Esempio n. 5
0
        public static int SubmarineRaderCount(this ShipData data)
        {
            var SubmarineRaders = new int[]
            {
                210,                 // 潜水艦搭載電探&水防式望遠鏡
                211,                 // 潜水艦搭載電探&逆探(E27)
            };

            return(data.Slots.Count(x => SubmarineRaders.Contains(x.Source.Id))
                   + (SubmarineRaders.Contains(data.ExSlot?.Source.Id ?? 0) ? 1 : 0));
        }
Esempio n. 6
0
        private void UpdateBattleRank(bool combined = false)
        {
            int    HPnow  = this.FirstFleet.Ships.Sum(ship => ship.NowHP < 0 ? 0 : ship.NowHP);
            double HPsum  = hp_sum ?? this.FirstFleet.Ships.Sum(ship => ship.MaxHP);
            int    EHPnow = this.Enemies.Ships.Sum(ship => ship.NowHP < 0 ? 0 : ship.NowHP);
            double EHPsum = enemy_hp_sum ?? this.Enemies.Ships.Sum(ship => ship.MaxHP);

            if (combined)
            {
                HPnow += this.SecondFleet.Ships.Sum(ship => ship.NowHP < 0 ? 0 : ship.NowHP);
                if (!hp_sum.HasValue)
                {
                    HPsum += this.SecondFleet.Ships.Sum(ship => ship.MaxHP);
                }
            }
            double   HPlose     = (HPsum - HPnow) / HPsum;
            double   EHPlose    = (EHPsum - EHPnow) / EHPsum;
            int      EShipCount = this.Enemies.Ships.Count();
            int      ESunkCount = this.Enemies.Ships.Count(ship => ship.NowHP <= 0);
            ShipData EFlagShip  = this.Enemies.Ships.First();

            if (ESunkCount == EShipCount)
            {
                if (HPlose != 0)
                {
                    this.RankPrediction = BattleRank.S;
                }
                else
                {
                    this.RankPrediction = BattleRank.SS;
                }
            }
            else if (ESunkCount > (EShipCount - (EShipCount <= 4 ? 1 : 0)) / 2)
            {
                this.RankPrediction = BattleRank.A;
            }
            else if (EFlagShip != null && EFlagShip.NowHP <= 0)
            {
                this.RankPrediction = BattleRank.B;
            }
            else if (EHPlose > 2.5 * HPlose)
            {
                this.RankPrediction = BattleRank.B;
            }
            else if (EHPlose <= 0.05)
            {
                this.RankPrediction = BattleRank.D;
            }
            else
            {
                this.RankPrediction = BattleRank.C;
            }
        }
Esempio n. 7
0
 private static ShipSlotData FirstDameconOrNull(this ShipData ship)
 {
     return(ship?.Slots?.FirstOrDefault(x => x?.Source?.Id == 42 || x?.Source?.Id == 43));
 }
Esempio n. 8
0
 private static bool HasMegami(this ShipData ship)
 {
     return(ship?.ExSlot?.Source?.Id == 43 ||
            ship?.FirstDameconOrNull()?.Source?.Id == 43);
 }
Esempio n. 9
0
 public static int Count(this ShipData data, Type2 type2)
 {
     return(data.Slots.Count(x => x.Type2 == type2));
 }
Esempio n. 10
0
 public static bool IsInEvacuationOrTow(this ShipData data) =>
 data.Situation.HasFlag(ShipSituation.Evacuation) || data.Situation.HasFlag(ShipSituation.Tow);