戦闘情報を保持するデータの基底です。
Inheritance: ResponseWrapper
        /// <summary>
        /// 索敵結果を設定します。
        /// </summary>
        private void SetSearchingResult( BattleData bd )
        {
            int searchFriend = bd.Searching.SearchingFriend;
            SearchingFriend.Text = Constants.GetSearchingResultShort( searchFriend );
            SearchingFriend.ImageAlign = ContentAlignment.MiddleLeft;
            SearchingFriend.ImageIndex = (int)( searchFriend < 4 ? ResourceManager.EquipmentContent.Seaplane : ResourceManager.EquipmentContent.Radar );
            ToolTipInfo.SetToolTip( SearchingFriend, null );

            int searchEnemy = bd.Searching.SearchingEnemy;
            SearchingEnemy.Text = Constants.GetSearchingResultShort( searchEnemy );
            SearchingEnemy.ImageAlign = ContentAlignment.MiddleLeft;
            SearchingEnemy.ImageIndex = (int)( searchEnemy < 4 ? ResourceManager.EquipmentContent.Seaplane : ResourceManager.EquipmentContent.Radar );
            ToolTipInfo.SetToolTip( SearchingEnemy, null );
        }
 /// <summary>
 /// 陣形・交戦形態を設定します。
 /// </summary>
 private void SetFormation( BattleData bd )
 {
     FormationFriend.Text = Constants.GetFormationShort( bd.Searching.FormationFriend );
     FormationEnemy.Text = Constants.GetFormationShort( bd.Searching.FormationEnemy );
     Formation.Text = Constants.GetEngagementForm( bd.Searching.EngagementForm );
 }
        /// <summary>
        /// 両軍のHPゲージを設定します。
        /// </summary>
        private void SetHPNormal( BattleData bd )
        {
            KCDatabase db = KCDatabase.Instance;
            bool isPractice = ( bd.BattleType & BattleData.BattleTypeFlag.Practice ) != 0;

            var initialHPs = bd.Initial.InitialHPs;
            var maxHPs = bd.Initial.MaxHPs;
            var resultHPs = bd.ResultHPs;
            var attackDamages = bd.AttackDamages;

            for ( int i = 0; i < 12; i++ ) {
                if ( initialHPs[i] != -1 ) {
                    HPBars[i].Value = resultHPs[i];
                    HPBars[i].PrevValue = initialHPs[i];
                    HPBars[i].MaximumValue = maxHPs[i];
                    HPBars[i].BackColor = SystemColors.Control;
                    HPBars[i].Visible = true;
                } else {
                    HPBars[i].Visible = false;
                }
            }

            for ( int i = 0; i < 6; i++ ) {
                if ( initialHPs[i] != -1 ) {
                    ShipData ship = bd.Initial.FriendFleet.MembersInstance[i];

                    ToolTipInfo.SetToolTip( HPBars[i],
                        string.Format( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}",
                            ship.MasterShip.NameWithClass,
                            ship.Level,
                            Math.Max( HPBars[i].PrevValue, 0 ),
                            Math.Max( HPBars[i].Value, 0 ),
                            HPBars[i].MaximumValue,
                            HPBars[i].Value - HPBars[i].PrevValue,
                            Constants.GetDamageState( (double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase ),
                            attackDamages[i]
                            )
                        );
                }
            }

            for ( int i = 0; i < 6; i++ ) {
                if ( initialHPs[i + 6] != -1 ) {
                    ShipDataMaster ship = bd.Initial.EnemyMembersInstance[i];

                    ToolTipInfo.SetToolTip( HPBars[i + 6],
                        string.Format( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]",
                            ship.NameWithClass,
                            bd.Initial.EnemyLevels[i],
                            Math.Max( HPBars[i + 6].PrevValue, 0 ),
                            Math.Max( HPBars[i + 6].Value, 0 ),
                            HPBars[i + 6].MaximumValue,
                            HPBars[i + 6].Value - HPBars[i + 6].PrevValue,
                            Constants.GetDamageState( (double)HPBars[i + 6].Value / HPBars[i + 6].MaximumValue, isPractice, ship.IsLandBase )
                            )
                        );
                }
            }

            HPBars[bd.MVPShipIndex].BackColor = Color.Moccasin;

            FleetCombined.Visible = false;
            for ( int i = 12; i < 18; i++ ) {
                HPBars[i].Visible = false;
            }
        }
        /// <summary>
        /// 損害率と戦績予測を設定します。
        /// </summary>
        private void SetDamageRateNormal( BattleData bd, int[] initialHPs )
        {
            int friendbefore = 0;
            int friendafter = 0;
            double friendrate;
            int enemybefore = 0;
            int enemyafter = 0;
            double enemyrate;

            var resultHPs = bd.ResultHPs;

            for ( int i = 0; i < 6; i++ ) {
                friendbefore += Math.Max( initialHPs[i], 0 );
                friendafter += Math.Max( resultHPs[i], 0 );
                enemybefore += Math.Max( initialHPs[i + 6], 0 );
                enemyafter += Math.Max( resultHPs[i + 6], 0 );
            }

            friendrate = ( (double)( friendbefore - friendafter ) / friendbefore );
            DamageFriend.Text = string.Format( "{0:p1}", friendrate );
            enemyrate = ( (double)( enemybefore - enemyafter ) / enemybefore );
            DamageEnemy.Text = string.Format( "{0:p1}", enemyrate );

            //戦績判定
            {
                int countFriend = bd.Initial.FriendFleet.Members.Count( v => v != -1 );
                int countEnemy = ( bd.Initial.EnemyMembers.Count( v => v != -1 ) );
                int sunkFriend = resultHPs.Take( countFriend ).Count( v => v <= 0 );
                int sunkEnemy = resultHPs.Skip( 6 ).Take( countEnemy ).Count( v => v <= 0 );

                int rank = GetWinRank( countFriend, countEnemy, sunkFriend, sunkEnemy, friendrate, enemyrate, resultHPs[6] <= 0 );

                WinRank.Text = Constants.GetWinRank( rank );
                WinRank.ForeColor = rank >= 4 ? WinRankColor_Win : WinRankColor_Lose;
            }
        }
示例#5
0
		/// <summary>
		/// 前回の戦闘データからパラメータを引き継ぎます。
		/// </summary>
		internal void TakeOverParameters( BattleData prev ) {
			_attackDamages = (int[])prev._attackDamages.Clone();
		}
        /// <summary>
        /// 両軍のHPゲージを設定します。(連合艦隊用)
        /// </summary>
        private void SetHPCombined( BattleData bd )
        {
            KCDatabase db = KCDatabase.Instance;
            bool isPractice = ( bd.BattleType & BattleData.BattleTypeFlag.Practice ) != 0;

            var initialHPs = bd.Initial.InitialHPs;
            var maxHPs = bd.Initial.MaxHPs;
            var resultHPs = bd.ResultHPs;
            var attackDamages = bd.AttackDamages;

            FleetCombined.Visible = true;
            for ( int i = 0; i < 18; i++ ) {
                if ( initialHPs[i] != -1 ) {
                    HPBars[i].Value = resultHPs[i];
                    HPBars[i].PrevValue = initialHPs[i];
                    HPBars[i].MaximumValue = maxHPs[i];
                    HPBars[i].BackColor = SystemColors.Control;
                    HPBars[i].Visible = true;
                } else {
                    HPBars[i].Visible = false;
                }
            }

            for ( int i = 0; i < 6; i++ ) {
                if ( initialHPs[i] != -1 ) {
                    ShipData ship = bd.Initial.FriendFleet.MembersInstance[i];
                    bool isEscaped =  bd.Initial.FriendFleet.EscapedShipList.Contains( ship.MasterID );

                    ToolTipInfo.SetToolTip( HPBars[i],
                        string.Format( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}",
                            ship.MasterShip.NameWithClass,
                            ship.Level,
                            Math.Max( HPBars[i].PrevValue, 0 ),
                            Math.Max( HPBars[i].Value, 0 ),
                            HPBars[i].MaximumValue,
                            HPBars[i].Value - HPBars[i].PrevValue,
                            Constants.GetDamageState( (double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped ),
                            attackDamages[i]
                            )
                        );

                    if ( isEscaped ) HPBars[i].BackColor = Color.Silver;
                    else HPBars[i].BackColor = SystemColors.Control;
                }
            }

            for ( int i = 0; i < 6; i++ ) {
                if ( initialHPs[i + 6] != -1 ) {
                    ShipDataMaster ship = bd.Initial.EnemyMembersInstance[i];

                    ToolTipInfo.SetToolTip( HPBars[i + 6],
                        string.Format( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]",
                            ship.NameWithClass,
                            bd.Initial.EnemyLevels[i],
                            Math.Max( HPBars[i + 6].PrevValue, 0 ),
                            Math.Max( HPBars[i + 6].Value, 0 ),
                            HPBars[i + 6].MaximumValue,
                            HPBars[i + 6].Value - HPBars[i + 6].PrevValue,
                            Constants.GetDamageState( (double)HPBars[i + 6].Value / HPBars[i + 6].MaximumValue, isPractice, ship.IsLandBase )
                            )
                        );
                }
            }

            for ( int i = 0; i < 6; i++ ) {
                if ( initialHPs[i + 12] != -1 ) {
                    ShipData ship = db.Fleet[2].MembersInstance[i];
                    bool isEscaped = db.Fleet[2].EscapedShipList.Contains( ship.MasterID );

                    ToolTipInfo.SetToolTip( HPBars[i + 12],
                        string.Format( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}",
                            ship.MasterShip.NameWithClass,
                            ship.Level,
                            Math.Max( HPBars[i + 12].PrevValue, 0 ),
                            Math.Max( HPBars[i + 12].Value, 0 ),
                            HPBars[i + 12].MaximumValue,
                            HPBars[i + 12].Value - HPBars[i + 12].PrevValue,
                            Constants.GetDamageState( (double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped ),
                            attackDamages[i + 12]
                            )
                        );

                    if ( isEscaped ) HPBars[i + 12].BackColor = Color.Silver;
                    else HPBars[i + 12].BackColor = SystemColors.Control;
                }
            }

            if ( bd.Initial.IsBossDamaged )
                HPBars[6].BackColor = Color.MistyRose;

            foreach ( int i in bd.MVPShipIndexes )
                HPBars[i].BackColor = Color.Moccasin;
            foreach ( int i in bd.MVPShipCombinedIndexes )
                HPBars[12 + i].BackColor = Color.Moccasin;
        }
示例#7
0
        /// <summary>
        /// 勝利ランクを予測します。
        /// </summary>
        /// <param name="friendrate">味方の損害率を出力します。</param>
        /// <param name="enemyrate">敵の損害率を出力します。</param>
        public int PredictWinRank(out double friendrate, out double enemyrate)
        {
            int friendbefore = 0;
            int friendafter  = 0;
            int friendcount  = 0;
            int friendsunk   = 0;

            int enemybefore = 0;
            int enemyafter  = 0;
            int enemycount  = 0;
            int enemysunk   = 0;

            BattleData activeBattle = SecondBattle ?? FirstBattle;
            var        firstInitial = FirstBattle.Initial;

            var friend       = activeBattle.Initial.FriendFleet.MembersWithoutEscaped;
            var friendescort = activeBattle.Initial.FriendFleetEscort?.MembersWithoutEscaped;

            var resultHPs = activeBattle.ResultHPs;



            for (int i = 0; i < firstInitial.FriendInitialHPs.Length; i++)
            {
                int initial = firstInitial.FriendInitialHPs[i];
                if (initial < 0)
                {
                    continue;
                }

                int result = resultHPs[BattleIndex.Get(BattleSides.FriendMain, i)];

                friendbefore += initial;
                friendafter  += Math.Max(result, 0);
                friendcount++;

                if (result <= 0)
                {
                    friendsunk++;
                }
            }

            if (firstInitial.FriendInitialHPsEscort != null)
            {
                for (int i = 0; i < firstInitial.FriendInitialHPsEscort.Length; i++)
                {
                    int initial = firstInitial.FriendInitialHPsEscort[i];
                    if (initial < 0)
                    {
                        continue;
                    }

                    int result = resultHPs[BattleIndex.Get(BattleSides.FriendEscort, i)];

                    friendbefore += initial;
                    friendafter  += Math.Max(result, 0);
                    friendcount++;

                    if (result <= 0)
                    {
                        friendsunk++;
                    }
                }
            }

            for (int i = 0; i < firstInitial.EnemyInitialHPs.Length; i++)
            {
                int initial = firstInitial.EnemyInitialHPs[i];
                if (initial < 0)
                {
                    continue;
                }

                int result = resultHPs[BattleIndex.Get(BattleSides.EnemyMain, i)];

                enemybefore += initial;
                enemyafter  += Math.Max(result, 0);
                enemycount++;

                if (result <= 0)
                {
                    enemysunk++;
                }
            }

            if (firstInitial.EnemyInitialHPsEscort != null)
            {
                for (int i = 0; i < firstInitial.EnemyInitialHPsEscort.Length; i++)
                {
                    int initial = firstInitial.EnemyInitialHPsEscort[i];
                    if (initial < 0)
                    {
                        continue;
                    }

                    int result = resultHPs[BattleIndex.Get(BattleSides.EnemyEscort, i)];

                    enemybefore += initial;
                    enemyafter  += Math.Max(result, 0);
                    enemycount++;

                    if (result <= 0)
                    {
                        enemysunk++;
                    }
                }
            }


            friendrate = (double)(friendbefore - friendafter) / friendbefore;
            enemyrate  = (double)(enemybefore - enemyafter) / enemybefore;


            if ((BattleMode & BattleModes.BattlePhaseMask) == BattleModes.AirRaid ||
                (BattleMode & BattleModes.BattlePhaseMask) == BattleModes.Radar)
            {
                return(GetWinRankAirRaid(friendcount, friendsunk, friendrate));
            }
            else
            {
                return(GetWinRank(friendcount, enemycount, friendsunk, enemysunk, friendrate, enemyrate,
                                  friend[0].HPRate <= 0.25, resultHPs[BattleIndex.EnemyMain1] <= 0));
            }
        }
示例#8
0
 /// <summary>
 /// 前回の戦闘データからパラメータを引き継ぎます。
 /// </summary>
 internal void TakeOverParameters(BattleData prev)
 {
     _attackDamages = (int[])prev._attackDamages.Clone();
 }