コード例 #1
0
        /// <summary>
        /// 戦闘終了時に各種データの収集を行います。
        /// </summary>
        private void BattleFinished()
        {
            //敵編成記録
            EnemyFleetRecord.EnemyFleetElement enemyFleetData = EnemyFleetRecord.EnemyFleetElement.CreateFromCurrentState();

            if (enemyFleetData != null)
            {
                RecordManager.Instance.EnemyFleet.Update(enemyFleetData);
            }


            // ロギング
            if (IsPractice)
            {
                Utility.Logger.Add(2,
                                   string.Format("演習 で「{0}」{1}の「{2}」と交戦しました。( ランク: {3}, 提督Exp+{4}, 艦娘Exp+{5} )",
                                                 EnemyAdmiralName, EnemyAdmiralRank, Result.EnemyFleetName, Result.Rank, Result.AdmiralExp, Result.BaseExp));
            }
            else
            {
                Utility.Logger.Add(2,
                                   string.Format("{0}-{1}-{2} で「{3}」と交戦しました。( ランク: {4}, 提督Exp+{5}, 艦娘Exp+{6} )",
                                                 Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, Result.EnemyFleetName, Result.Rank, Result.AdmiralExp, Result.BaseExp));
            }



            //ドロップ艦記録
            if (!IsPractice)
            {
                //checkme: とてもアレな感じ

                int  shipID  = Result.DroppedShipID;
                int  itemID  = Result.DroppedItemID;
                int  eqID    = Result.DroppedEquipmentID;
                bool showLog = Utility.Configuration.Config.Log.ShowSpoiler;

                if (shipID != -1)
                {
                    ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];
                    DroppedShipCount++;

                    var defaultSlot = ship.DefaultSlot;
                    if (defaultSlot != null)
                    {
                        DroppedEquipmentCount += defaultSlot.Count(id => id != -1);
                    }

                    if (showLog)
                    {
                        Utility.Logger.Add(2, string.Format("{0}「{1}」が戦列に加わりました。", ship.ShipTypeName, ship.NameWithClass));
                    }
                }

                if (itemID != -1)
                {
                    if (!DroppedItemCount.ContainsKey(itemID))
                    {
                        DroppedItemCount.Add(itemID, 0);
                    }
                    DroppedItemCount[itemID]++;

                    if (showLog)
                    {
                        var item       = KCDatabase.Instance.UseItems[itemID];
                        var itemmaster = KCDatabase.Instance.MasterUseItems[itemID];
                        Utility.Logger.Add(2, string.Format("アイテム「{0}」を入手しました。( 合計: {1}個 )", itemmaster != null ? itemmaster.Name : ("不明なアイテム - ID:" + itemID), (item != null ? item.Count : 0) + DroppedItemCount[itemID]));
                    }
                }

                if (eqID != -1)
                {
                    EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[eqID];
                    DroppedEquipmentCount++;

                    if (showLog)
                    {
                        Utility.Logger.Add(2, string.Format("{0}「{1}」を入手しました。", eq.CategoryTypeInstance.Name, eq.Name));
                    }
                }


                // 満員判定
                if (shipID == -1 && (
                        KCDatabase.Instance.Admiral.MaxShipCount - (KCDatabase.Instance.Ships.Count + DroppedShipCount) <= 0 ||
                        KCDatabase.Instance.Admiral.MaxEquipmentCount - (KCDatabase.Instance.Equipments.Count + DroppedEquipmentCount) <= 0))
                {
                    shipID = -2;
                }

                RecordManager.Instance.ShipDrop.Add(shipID, itemID, eqID, Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, Compass.MapInfo.EventDifficulty, Compass.EventID == 5, enemyFleetData.FleetID, Result.Rank, KCDatabase.Instance.Admiral.Level);
            }


            //DEBUG

            /*/
             * if ( Utility.Configuration.Config.Log.LogLevel <= 1 && Utility.Configuration.Config.Connection.SaveReceivedData ) {
             *      IEnumerable<int> damages;
             *      switch ( BattleMode & BattleModes.BattlePhaseMask ) {
             *              case BattleModes.Normal:
             *              case BattleModes.AirBattle:
             *              case BattleModes.Practice:
             *              default:
             *                      damages = ( (BattleData)BattleNight ?? BattleDay ).AttackDamages;
             *                      break;
             *              case BattleModes.NightOnly:
             *              case BattleModes.NightDay:
             *                      damages = ( (BattleData)BattleDay ?? BattleNight ).AttackDamages;
             *                      break;
             *      }
             *
             *      damages = damages.Take( 6 ).Where( i => i > 0 );
             *
             *      if ( damages.Count( i => i == damages.Max() ) > 1 ) {
             *              Utility.Logger.Add( 1, "MVP候補が複数存在します。ログを確認してください。" );
             *      }
             * }
             * //*/
        }
コード例 #2
0
        /// <summary>
        /// 戦闘終了時に各種データの収集を行います。
        /// </summary>
        private void BattleFinished()
        {
            //敵編成記録
            EnemyFleetRecord.EnemyFleetElement enemyFleetData = EnemyFleetRecord.EnemyFleetElement.CreateFromCurrentState();

            if (enemyFleetData != null)
            {
                RecordManager.Instance.EnemyFleet.Update(enemyFleetData);
            }


            // ロギング
            if (IsPractice)
            {
                Utility.Logger.Add(2, "", "同", string.Format("「{0}」[{1}]", EnemyAdmiralName, EnemyAdmiralRank),
                                   "的舰队", string.Format("「{0}」", Result.EnemyFleetName),
                                   string.Format("进行了演习。( 结果 : {0}, 提督经验 +{1}, 舰娘经验 +{2} )",
                                                 Result.Rank, Result.AdmiralExp, Result.BaseExp));
            }
            else if (IsBaseAirRaid)
            {
                var initialHPs = BattleDay.Initial.FriendInitialHPs.TakeWhile(hp => hp >= 0);
                var damage     = initialHPs.Zip(BattleDay.ResultHPs.Take(initialHPs.Count()), (initial, result) => initial - result).Sum();

                Utility.Logger.Add(2, "",
                                   string.Format("在 {0}-{1}-{2} 海域,基地受到了空袭。( 受损合计 : {3}, {4} )",
                                                 Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, damage, Constants.GetAirRaidDamage(Compass.AirRaidDamageKind)));
            }
            else
            {
                Utility.Logger.Add(2, "", string.Format("在 {0}-{1}-{2} 海域与",
                                                        Compass.MapAreaID, Compass.MapInfoID, Compass.Destination),
                                   string.Format("「{0}」", Result.EnemyFleetName),
                                   string.Format("进行了战斗。( 结果 : {0}, 提督经验 +{1}, 舰娘经验 +{2} )",
                                                 Result.Rank, Result.AdmiralExp, Result.BaseExp));
            }


            // Level up
            if (!IsBaseAirRaid)
            {
                var exps = Result.ExpList;
                var lvup = Result.LevelUpList;
                for (int i = 0; i < lvup.Length; i++)
                {
                    if (lvup[i].Length >= 2 && i < exps.Length && lvup[i][0] + exps[i] >= lvup[i][1])
                    {
                        var ship      = FirstBattle.Initial.FriendFleet.MembersInstance[i];
                        int increment = Math.Max(lvup[i].Length - 2, 1);

                        Utility.Logger.Add(2, ship.Name, string.Format(" 的等级达到了 Lv. {0} 。", ship.Level + increment));
                    }
                }

                if (IsCombinedBattle)
                {
                    exps = Result.ExpListCombined;
                    lvup = Result.LevelUpListCombined;
                    for (int i = 0; i < lvup.Length; i++)
                    {
                        if (lvup[i].Length >= 2 && i < exps.Length && lvup[i][0] + exps[i] >= lvup[i][1])
                        {
                            var ship      = FirstBattle.Initial.FriendFleetEscort.MembersInstance[i];
                            int increment = Math.Max(lvup[i].Length - 2, 1);

                            Utility.Logger.Add(2, ship.Name, string.Format(" 的等级达到了 Lv. {0} 。", ship.Level + increment));
                        }
                    }
                }
            }



            //ドロップ艦記録
            if (!IsPractice && !IsBaseAirRaid)
            {
                //checkme: とてもアレな感じ

                int  shipID  = Result.DroppedShipID;
                int  itemID  = Result.DroppedItemID;
                int  eqID    = Result.DroppedEquipmentID;
                bool showLog = Utility.Configuration.Config.Log.ShowSpoiler;

                if (itemID != -1)
                {
                    if (!DroppedItemCount.ContainsKey(itemID))
                    {
                        DroppedItemCount.Add(itemID, 0);
                    }
                    DroppedItemCount[itemID]++;

                    if (showLog && shipID == -1)
                    {
                        var item       = KCDatabase.Instance.UseItems[itemID];
                        var itemmaster = KCDatabase.Instance.MasterUseItems[itemID];
                        Utility.Logger.Add(2, "", "获得了", string.Format("「{0}」。", itemmaster?.Name ?? ("不明なアイテム - ID:" + itemID)), string.Format("( 合计 : {0} 个 )", (item?.Count ?? 0) + DroppedItemCount[itemID]));
                    }
                }

                if (shipID != -1)
                {
                    ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];
                    DroppedShipCount++;

                    var defaultSlot = ship.DefaultSlot;
                    if (defaultSlot != null)
                    {
                        DroppedEquipmentCount += defaultSlot.Count(id => id != -1);
                    }

                    if (showLog)
                    {
                        if (itemID != -1)
                        {
                            var item       = KCDatabase.Instance.UseItems[itemID];
                            var itemmaster = KCDatabase.Instance.MasterUseItems[itemID];
                            Utility.Logger.Add(2, string.Format("{0}「{1}」", ship.ShipTypeName, ship.NameWithClass), "加入了队伍。获得了", string.Format("「{0}」。", itemmaster?.Name ?? ("不明なアイテム - ID:" + itemID)), string.Format("( 合计 : {0} 个 )", (item?.Count ?? 0) + DroppedItemCount[itemID]));
                        }
                        else
                        {
                            Utility.Logger.Add(2, string.Format("{0}「{1}」", ship.ShipTypeName, ship.NameWithClass), "加入了队伍。");
                        }
                    }
                }

                if (eqID != -1)
                {
                    EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[eqID];
                    DroppedEquipmentCount++;

                    if (showLog)
                    {
                        Utility.Logger.Add(2, "", "获得了 ", string.Format("{0}「{1}」。", eq.CategoryTypeInstance.Name, eq.Name));
                    }
                }


                // 満員判定
                if (shipID == -1 && (
                        KCDatabase.Instance.Admiral.MaxShipCount - (KCDatabase.Instance.Ships.Count + DroppedShipCount) <= 0 ||
                        KCDatabase.Instance.Admiral.MaxEquipmentCount - (KCDatabase.Instance.Equipments.Count + DroppedEquipmentCount) <= 0))
                {
                    shipID = -2;
                }

                RecordManager.Instance.ShipDrop.Add(shipID, itemID, eqID, Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, Compass.MapInfo.EventDifficulty, Compass.EventID == 5, enemyFleetData.FleetID, Result.Rank, KCDatabase.Instance.Admiral.Level);
            }



            WriteBattleLog();



            /*//DEBUG
             * if (!IsBaseAirRaid && Utility.Configuration.Config.Log.LogLevel <= 1)
             * {
             *      var battle = SecondBattle ?? FirstBattle;
             *
             *      for (int i = 0; i < battle.Initial.EnemyMaxHPs.Length; i++)
             *      {
             *              if (battle.Initial.EnemyMaxHPs[i] > 0 && battle.ResultHPs[BattleIndex.Get(BattleSides.EnemyMain, i)] == 0)
             *                      Utility.Logger.Add(1, "justkill #" + (i + 1));
             *      }
             *
             * int rank = PredictWinRank(out var friend, out var enemy);
             *
             *      // SS -> S
             *      if (Constants.GetWinRank(rank).Substring(0, 1) != Result.Rank)
             *      {
             *              Utility.Logger.Add(1, $"勝利ランク予測が誤っています。予想 {Constants.GetWinRank(rank)} -> 実際 {Result.Rank}");
             *      }
             * }
             * //*/
        }
コード例 #3
0
        /// <summary>
        /// 戦闘終了時に各種データの収集を行います。
        /// </summary>
        private void BattleFinished()
        {
            //敵編成記録
            EnemyFleetRecord.EnemyFleetElement enemyFleetData = EnemyFleetRecord.EnemyFleetElement.CreateFromCurrentState();

            if (enemyFleetData != null)
            {
                RecordManager.Instance.EnemyFleet.Update(enemyFleetData);
            }


            // ロギング
            if (IsPractice)
            {
                Utility.Logger.Add(2,
                                   string.Format("Practiced with {1} {0}'s {2} fleet (Rank: {3}, Admiral exp+{4}, Ship exp+{5}).",
                                                 EnemyAdmiralName, EnemyAdmiralRank, Result.EnemyFleetName, Result.Rank, Result.AdmiralExp, Result.BaseExp));
            }
            else if (IsBaseAirRaid)
            {
                var initialHPs = BattleDay.Initial.FriendInitialHPs.TakeWhile(hp => hp >= 0);
                var damage     = initialHPs.Zip(BattleDay.ResultHPs.Take(initialHPs.Count()), (initial, result) => initial - result).Sum();
                var airraid    = ((BattleBaseAirRaid)BattleDay).BaseAirRaid;

                Utility.Logger.Add(2,
                                   string.Format("Encountered air raid at {0}-{1}-{2} ({3}, Damage taken: {4}, {5}).",
                                                 Compass.MapAreaID, Compass.MapInfoID, Compass.DestinationID,
                                                 Constants.GetAirSuperiority(airraid.IsAvailable ? airraid.AirSuperiority : -1), damage, Constants.GetAirRaidDamage(Compass.AirRaidDamageKind)));
            }
            else
            {
                Utility.Logger.Add(2,
                                   string.Format("Battled with 「{3}」 in {0}-{1}-{2} (Rank: {4}, Admiral exp+{5}, Ship exp+{6}).",
                                                 Compass.MapAreaID, Compass.MapInfoID, Compass.DestinationID, Result.EnemyFleetName, Result.Rank, Result.AdmiralExp, Result.BaseExp));
            }


            // Level up
            if (!IsBaseAirRaid)
            {
                var exps = Result.ExpList;
                var lvup = Result.LevelUpList;
                for (int i = 0; i < lvup.Length; i++)
                {
                    if (lvup[i].Length >= 2 && i < exps.Length && lvup[i][0] + exps[i] >= lvup[i][1])
                    {
                        var ship      = FirstBattle.Initial.FriendFleet.MembersInstance[i];
                        int increment = Math.Max(lvup[i].Length - 2, 1);

                        Utility.Logger.Add(2, string.Format("{0} has leveled up to lv{1}.", ship.Name, ship.Level + increment));
                    }
                }

                if (IsCombinedBattle)
                {
                    exps = Result.ExpListCombined;
                    lvup = Result.LevelUpListCombined;
                    for (int i = 0; i < lvup.Length; i++)
                    {
                        if (lvup[i].Length >= 2 && i < exps.Length && lvup[i][0] + exps[i] >= lvup[i][1])
                        {
                            var ship      = FirstBattle.Initial.FriendFleetEscort.MembersInstance[i];
                            int increment = Math.Max(lvup[i].Length - 2, 1);

                            Utility.Logger.Add(2, string.Format("{0} has leveled up to lv{1}.", ship.Name, ship.Level + increment));
                        }
                    }
                }
            }



            //ドロップ艦記録
            if (!IsPractice && !IsBaseAirRaid)
            {
                //checkme: とてもアレな感じ

                int  shipID  = Result.DroppedShipID;
                int  itemID  = Result.DroppedItemID;
                int  eqID    = Result.DroppedEquipmentID;
                bool showLog = Utility.Configuration.Config.Log.ShowSpoiler;

                if (shipID != -1)
                {
                    ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];
                    DroppedShipCount++;

                    var defaultSlot = ship.DefaultSlot;
                    if (defaultSlot != null)
                    {
                        DroppedEquipmentCount += defaultSlot.Count(id => id != -1);
                    }

                    if (showLog)
                    {
                        Utility.Logger.Add(2, string.Format(LoggerRes.ShipAdded, ship.ShipTypeName, ship.NameWithClass));
                    }
                }

                if (itemID != -1)
                {
                    if (!DroppedItemCount.ContainsKey(itemID))
                    {
                        DroppedItemCount.Add(itemID, 0);
                    }
                    DroppedItemCount[itemID]++;

                    if (showLog)
                    {
                        var item       = KCDatabase.Instance.UseItems[itemID];
                        var itemmaster = KCDatabase.Instance.MasterUseItems[itemID];
                        Utility.Logger.Add(2, string.Format(LoggerRes.ItemObtained, itemmaster?.Name ?? ("Unknown item - ID: " + itemID), (item?.Count ?? 0) + DroppedItemCount[itemID]));
                    }
                }

                if (eqID != -1)
                {
                    EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[eqID];
                    DroppedEquipmentCount++;

                    if (showLog)
                    {
                        Utility.Logger.Add(2, string.Format(LoggerRes.EquipmentObtained, eq.CategoryTypeInstance.Name, eq.Name));
                    }
                }


                // 満員判定
                if (shipID == -1 && (
                        KCDatabase.Instance.Admiral.MaxShipCount - (KCDatabase.Instance.Ships.Count + DroppedShipCount) <= 0 ||
                        KCDatabase.Instance.Admiral.MaxEquipmentCount - (KCDatabase.Instance.Equipments.Count + DroppedEquipmentCount) <= 0))
                {
                    shipID = -2;
                }

                RecordManager.Instance.ShipDrop.Add(shipID, itemID, eqID, Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, Compass.MapInfo.EventDifficulty, Compass.EventID == 5, enemyFleetData.FleetID, Result.Rank, KCDatabase.Instance.Admiral.Level);
            }



            WriteBattleLog();



            /*//DEBUG
             * if (!IsBaseAirRaid && Utility.Configuration.Config.Log.LogLevel <= 1)
             * {
             *      var battle = SecondBattle ?? FirstBattle;
             *
             *      for (int i = 0; i < battle.Initial.EnemyMaxHPs.Length; i++)
             *      {
             *              if (battle.Initial.EnemyMaxHPs[i] > 0 && battle.ResultHPs[BattleIndex.Get(BattleSides.EnemyMain, i)] == 0)
             *                      Utility.Logger.Add(1, "justkill #" + (i + 1));
             *      }
             *
             * int rank = PredictWinRank(out var friend, out var enemy);
             *
             *      // SS -> S
             *      if (Constants.GetWinRank(rank).Substring(0, 1) != Result.Rank)
             *      {
             *              Utility.Logger.Add(1, $"勝利ランク予測が誤っています。予想 {Constants.GetWinRank(rank)} -> 実際 {Result.Rank}");
             *      }
             * }
             * //*/
        }
コード例 #4
0
        /// <summary>
        /// 戦闘終了時に各種データの収集を行います。
        /// </summary>
        private void BattleFinished()
        {
            //敵編成記録
            EnemyFleetRecord.EnemyFleetElement enemyFleetData = EnemyFleetRecord.EnemyFleetElement.CreateFromCurrentState();

            if (enemyFleetData != null)
            {
                RecordManager.Instance.EnemyFleet.Update(enemyFleetData);
            }


            // ロギング
            if (IsPractice)
            {
                Utility.Logger.Add(2,
                                   string.Format("演習 で「{0}」{1}の「{2}」と交戦しました。( ランク: {3}, 提督Exp+{4}, 艦娘Exp+{5} )",
                                                 EnemyAdmiralName, EnemyAdmiralRank, Result.EnemyFleetName, Result.Rank, Result.AdmiralExp, Result.BaseExp));
            }
            else if (IsBaseAirRaid)
            {
                var initialHPs = BattleDay.Initial.FriendInitialHPs.TakeWhile(hp => hp >= 0);
                var damage     = initialHPs.Zip(BattleDay.ResultHPs.Take(initialHPs.Count()), (initial, result) => initial - result).Sum();
                var airraid    = ((BattleBaseAirRaid)BattleDay).BaseAirRaid;

                Utility.Logger.Add(2,
                                   string.Format("{0}-{1}-{2} で基地に空襲を受けました。( {3}, 被ダメージ合計: {4}, {5} )",
                                                 Compass.MapAreaID, Compass.MapInfoID, Compass.Destination,
                                                 Constants.GetAirSuperiority(airraid.IsAvailable ? airraid.AirSuperiority : -1), damage, Constants.GetAirRaidDamage(Compass.AirRaidDamageKind)));
            }
            else
            {
                Utility.Logger.Add(2,
                                   string.Format("{0}-{1}-{2} で「{3}」と交戦しました。( ランク: {4}, 提督Exp+{5}, 艦娘Exp+{6} )",
                                                 Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, Result.EnemyFleetName, Result.Rank, Result.AdmiralExp, Result.BaseExp));
            }


            // Level up
            if (!IsBaseAirRaid)
            {
                var exps = Result.ExpList;
                var lvup = Result.LevelUpList;
                for (int i = 0; i < lvup.Length; i++)
                {
                    if (lvup[i].Length >= 2 && i < exps.Length && lvup[i][0] + exps[i] >= lvup[i][1])
                    {
                        var ship      = FirstBattle.Initial.FriendFleet.MembersInstance[i];
                        int increment = Math.Max(lvup[i].Length - 2, 1);

                        Utility.Logger.Add(2, string.Format("{0} が Lv. {1} になりました。", ship.Name, ship.Level + increment));
                    }
                }

                if (IsCombinedBattle)
                {
                    exps = Result.ExpListCombined;
                    lvup = Result.LevelUpListCombined;
                    for (int i = 0; i < lvup.Length; i++)
                    {
                        if (lvup[i].Length >= 2 && i < exps.Length && lvup[i][0] + exps[i] >= lvup[i][1])
                        {
                            var ship      = FirstBattle.Initial.FriendFleetEscort.MembersInstance[i];
                            int increment = Math.Max(lvup[i].Length - 2, 1);

                            Utility.Logger.Add(2, string.Format("{0} が Lv. {1} になりました。", ship.Name, ship.Level + increment));
                        }
                    }
                }
            }



            //ドロップ艦記録
            if (!IsPractice && !IsBaseAirRaid)
            {
                //checkme: とてもアレな感じ

                int  shipID  = Result.DroppedShipID;
                int  itemID  = Result.DroppedItemID;
                int  eqID    = Result.DroppedEquipmentID;
                bool showLog = Utility.Configuration.Config.Log.ShowSpoiler;

                if (shipID != -1)
                {
                    ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];
                    DroppedShipCount++;

                    var defaultSlot = ship.DefaultSlot;
                    if (defaultSlot != null)
                    {
                        DroppedEquipmentCount += defaultSlot.Count(id => id != -1);
                    }

                    if (showLog)
                    {
                        Utility.Logger.Add(2, string.Format("{0}「{1}」が戦列に加わりました。", ship.ShipTypeName, ship.NameWithClass));
                    }
                }

                if (itemID != -1)
                {
                    if (!DroppedItemCount.ContainsKey(itemID))
                    {
                        DroppedItemCount.Add(itemID, 0);
                    }
                    DroppedItemCount[itemID]++;

                    if (showLog)
                    {
                        var item       = KCDatabase.Instance.UseItems[itemID];
                        var itemmaster = KCDatabase.Instance.MasterUseItems[itemID];
                        Utility.Logger.Add(2, string.Format("アイテム「{0}」を入手しました。( 合計: {1}個 )", itemmaster?.Name ?? ("不明なアイテム - ID:" + itemID), (item?.Count ?? 0) + DroppedItemCount[itemID]));
                    }
                }

                if (eqID != -1)
                {
                    EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[eqID];
                    DroppedEquipmentCount++;

                    if (showLog)
                    {
                        Utility.Logger.Add(2, string.Format("{0}「{1}」を入手しました。", eq.CategoryTypeInstance.Name, eq.Name));
                    }
                }


                // 満員判定
                if (shipID == -1 && (
                        KCDatabase.Instance.Admiral.MaxShipCount - (KCDatabase.Instance.Ships.Count + DroppedShipCount) <= 0 ||
                        KCDatabase.Instance.Admiral.MaxEquipmentCount - (KCDatabase.Instance.Equipments.Count + DroppedEquipmentCount) <= 0))
                {
                    shipID = -2;
                }

                RecordManager.Instance.ShipDrop.Add(shipID, itemID, eqID, Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, Compass.MapInfo.EventDifficulty, Compass.EventID == 5, enemyFleetData.FleetID, Result.Rank, KCDatabase.Instance.Admiral.Level);
            }


            void IncrementSpecialAttack(BattleData bd)
            {
                if (bd == null)
                {
                    return;
                }

                foreach (var phase in bd.GetPhases())
                {
                    foreach (var detail in phase.BattleDetails)
                    {
                        int kind = detail.AttackType;

                        if (detail.AttackerIndex.IsFriend && TracedSpecialAttack.Contains(kind))
                        {
                            if (SpecialAttackCount.ContainsKey(kind))
                            {
                                SpecialAttackCount[kind]++;
                            }
                            else
                            {
                                SpecialAttackCount.Add(kind, 1);
                            }
                        }
                    }
                }
            }

            IncrementSpecialAttack(FirstBattle);
            IncrementSpecialAttack(SecondBattle);



            WriteBattleLog();



            /*//DEBUG
             *          if (!IsBaseAirRaid && Utility.Configuration.Config.Log.LogLevel <= 1)
             *          {
             *                  var battle = SecondBattle ?? FirstBattle;
             *
             *                  for (int i = 0; i < battle.Initial.EnemyMaxHPs.Length; i++)
             *                  {
             *                          if (battle.Initial.EnemyMaxHPs[i] > 0 && battle.ResultHPs[BattleIndex.Get(BattleSides.EnemyMain, i)] == 0)
             *                                  Utility.Logger.Add(1, "justkill #" + (i + 1));
             *                  }
             *
             *          int rank = PredictWinRank(out var friend, out var enemy);
             *
             *                  // SS -> S
             *                  if (Constants.GetWinRank(rank).Substring(0, 1) != Result.Rank)
             *                  {
             *                          Utility.Logger.Add(1, $"勝利ランク予測が誤っています。予想 {Constants.GetWinRank(rank)} -> 実際 {Result.Rank}");
             *                  }
             *          }
             *          //*/
        }
コード例 #5
0
		/// <summary>
		/// 戦闘終了時に各種データの収集を行います。
		/// </summary>
		private void BattleFinished()
		{

			//敵編成記録
			EnemyFleetRecord.EnemyFleetElement enemyFleetData = EnemyFleetRecord.EnemyFleetElement.CreateFromCurrentState();

			if (enemyFleetData != null)
				RecordManager.Instance.EnemyFleet.Update(enemyFleetData);


			// ロギング
			if (IsPractice)
			{
				Utility.Logger.Add(2,
					string.Format("演習 で「{0}」{1}の「{2}」と交戦しました。( ランク: {3}, 提督Exp+{4}, 艦娘Exp+{5} )",
						EnemyAdmiralName, EnemyAdmiralRank, Result.EnemyFleetName, Result.Rank, Result.AdmiralExp, Result.BaseExp));
			}
			else
			{
				Utility.Logger.Add(2,
					string.Format("{0}-{1}-{2} で「{3}」と交戦しました。( ランク: {4}, 提督Exp+{5}, 艦娘Exp+{6} )",
						Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, Result.EnemyFleetName, Result.Rank, Result.AdmiralExp, Result.BaseExp));
			}

			// Level up
			{
				var exps = Result.ExpList;
				var lvup = Result.LevelUpList;
				for (int i = 0; i < lvup.Length; i++)
				{
					if (lvup[i].Length >= 2 && lvup[i][0] + exps[i] >= lvup[i][1])
					{
						var ship = FirstBattle.Initial.FriendFleet.MembersInstance[i];
						int increment = Math.Max(lvup[i].Length - 2, 1);

						Utility.Logger.Add(2, string.Format("{0} が Lv. {1} になりました。", ship.Name, ship.Level + increment));
					}
				}

				if (IsCombinedBattle)
				{
					exps = Result.ExpListCombined;
					lvup = Result.LevelUpListCombined;
					for (int i = 0; i < lvup.Length; i++)
					{
						if (lvup[i].Length >= 2 && lvup[i][0] + exps[i] >= lvup[i][1])
						{
							var ship = FirstBattle.Initial.FriendFleetEscort.MembersInstance[i];
							int increment = Math.Max(lvup[i].Length - 2, 1);

							Utility.Logger.Add(2, string.Format("{0} が Lv. {1} になりました。", ship.Name, ship.Level + increment));
						}
					}
				}
			}



			//ドロップ艦記録
			if (!IsPractice)
			{

				//checkme: とてもアレな感じ

				int shipID = Result.DroppedShipID;
				int itemID = Result.DroppedItemID;
				int eqID = Result.DroppedEquipmentID;
				bool showLog = Utility.Configuration.Config.Log.ShowSpoiler;

				if (shipID != -1)
				{

					ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];
					DroppedShipCount++;

					var defaultSlot = ship.DefaultSlot;
					if (defaultSlot != null)
						DroppedEquipmentCount += defaultSlot.Count(id => id != -1);

					if (showLog)
						Utility.Logger.Add(2, string.Format("{0}「{1}」が戦列に加わりました。", ship.ShipTypeName, ship.NameWithClass));
				}

				if (itemID != -1)
				{

					if (!DroppedItemCount.ContainsKey(itemID))
						DroppedItemCount.Add(itemID, 0);
					DroppedItemCount[itemID]++;

					if (showLog)
					{
						var item = KCDatabase.Instance.UseItems[itemID];
						var itemmaster = KCDatabase.Instance.MasterUseItems[itemID];
						Utility.Logger.Add(2, string.Format("アイテム「{0}」を入手しました。( 合計: {1}個 )", itemmaster?.Name ?? ("不明なアイテム - ID:" + itemID), (item?.Count ?? 0) + DroppedItemCount[itemID]));
					}
				}

				if (eqID != -1)
				{

					EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[eqID];
					DroppedEquipmentCount++;

					if (showLog)
					{
						Utility.Logger.Add(2, string.Format("{0}「{1}」を入手しました。", eq.CategoryTypeInstance.Name, eq.Name));
					}
				}


				// 満員判定
				if (shipID == -1 && (
					KCDatabase.Instance.Admiral.MaxShipCount - (KCDatabase.Instance.Ships.Count + DroppedShipCount) <= 0 ||
					KCDatabase.Instance.Admiral.MaxEquipmentCount - (KCDatabase.Instance.Equipments.Count + DroppedEquipmentCount) <= 0))
				{
					shipID = -2;
				}

				RecordManager.Instance.ShipDrop.Add(shipID, itemID, eqID, Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, Compass.MapInfo.EventDifficulty, Compass.EventID == 5, enemyFleetData.FleetID, Result.Rank, KCDatabase.Instance.Admiral.Level);
			}

			WriteBattleLog();



			//DEBUG
			/*/
			if ( Utility.Configuration.Config.Log.LogLevel <= 1 && Utility.Configuration.Config.Connection.SaveReceivedData ) {
				IEnumerable<int> damages;
				switch ( BattleMode & BattleModes.BattlePhaseMask ) {
					case BattleModes.Normal:
					case BattleModes.AirBattle:
					case BattleModes.Practice:
					default:
						damages = ( (BattleData)BattleNight ?? BattleDay ).AttackDamages;
						break;
					case BattleModes.NightOnly:
					case BattleModes.NightDay:
						damages = ( (BattleData)BattleDay ?? BattleNight ).AttackDamages;
						break;
				}

				damages = damages.Take( 6 ).Where( i => i > 0 );

				if ( damages.Count( i => i == damages.Max() ) > 1 ) {
					Utility.Logger.Add( 1, "MVP候補が複数存在します。ログを確認してください。" );
				}
			}
			//*/

		}