From: Kazuhiro Fujieda Date: Tue, 21 Apr 2015 10:31:52 +0000 (+0900) Subject: 艦隊ごとの装備一覧に砲撃火力と対潜火力を表示する X-Git-Tag: v4.8~2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=21e95ff39a31134b2827a9d6fe637bbeed359d7c;p=kancollesniffer%2FKancolleSniffer.git 艦隊ごとの装備一覧に砲撃火力と対潜火力を表示する --- diff --git a/KancolleSniffer/EquipPanel.cs b/KancolleSniffer/EquipPanel.cs index cbc893c..b218250 100644 --- a/KancolleSniffer/EquipPanel.cs +++ b/KancolleSniffer/EquipPanel.cs @@ -37,6 +37,7 @@ namespace KancolleSniffer public int Id { get; set; } public string Equip { get; set; } public Color Color { get; set; } + public string Spec { get; set; } public EquipColumn() { @@ -57,7 +58,7 @@ namespace KancolleSniffer private void CreateEquipList(Sniffer sniffer) { var list = new List(); - var fn = new[] { "第一艦隊", "第二艦隊", "第三艦隊", "第四艦隊" }; + var fn = new[] {"第一艦隊", "第二艦隊", "第三艦隊", "第四艦隊"}; for (var f = 0; f < fn.Length; f++) { var drumTotal = 0; @@ -87,7 +88,14 @@ namespace KancolleSniffer if (drum != 0) drumShips++; drumTotal += drum; - ships.Add(new EquipColumn { Ship = s.Name, Id = s.Id }); + var rfp = s.RealFirepower; + var ras = s.RealAntiSubmarine; + ships.Add(new EquipColumn + { + Ship = s.Name, + Id = s.Id, + Spec = (rfp == 0 ? "" : "ç ²" + rfp) + (ras == 0 ? "" : " 潜" + ras) + }); ships.AddRange(equips); } list.Add(new EquipColumn @@ -122,7 +130,8 @@ namespace KancolleSniffer new ShipLabel {Location = new Point(1, 2), AutoSize = true}, new ShipLabel {Location = new Point(10, 2), AutoSize = true}, new ShipLabel {Location = new Point(40, 2), AutoSize = true}, - new ShipLabel {Location = new Point(37, 2), Size = new Size(4, LabelHeight - 2)} + new ShipLabel {Location = new Point(37, 2), Size = new Size(4, LabelHeight - 2)}, + new ShipLabel {Location = new Point(217, 2), AutoSize = true, AnchorRight = true} }; _labelList.Add(labels); _panelList.Add(lbp); @@ -157,6 +166,7 @@ namespace KancolleSniffer labels[2].Text = e.Equip; labels[3].Visible = e.Equip != ""; labels[3].BackColor = e.Color; + labels[4].Text = e.Spec; lbp.Visible = true; } diff --git a/KancolleSniffer/ItemInfo.cs b/KancolleSniffer/ItemInfo.cs index e134f70..c7e0aa1 100644 --- a/KancolleSniffer/ItemInfo.cs +++ b/KancolleSniffer/ItemInfo.cs @@ -32,6 +32,9 @@ namespace KancolleSniffer public int IconType; public int AntiAir; public int LoS; + public int AntiSubmarine; + public int Torpedo; + public int Bomber; public ItemSpec() { @@ -100,6 +103,25 @@ namespace KancolleSniffer } } + public bool IsSonar + { + get + { + return Type == 14 || // ソナー + Type == 40; // 大型ソナー + } + } + + public bool IsDepthCharge + { + get { return Type == 15; } + } + + public bool IsReconSeaplane + { + get { return Type == 10; } + } + public Color Color { get @@ -282,7 +304,10 @@ namespace KancolleSniffer TypeName = dict[(int)entry.api_type[2]], IconType = (int)entry.api_type[3], AntiAir = (int)entry.api_tyku, - LoS = (int)entry.api_saku + LoS = (int)entry.api_saku, + AntiSubmarine = (int)entry.api_tais, + Torpedo = (int)entry.api_raig, + Bomber = (int)entry.api_baku }; } _itemSpecs[-1] = new ItemSpec(); diff --git a/KancolleSniffer/ShipInfo.cs b/KancolleSniffer/ShipInfo.cs index 95d17d2..3e8d328 100644 --- a/KancolleSniffer/ShipInfo.cs +++ b/KancolleSniffer/ShipInfo.cs @@ -24,6 +24,7 @@ namespace KancolleSniffer { public class ShipStatus { + private readonly ItemInfo _itemInfo; public int Id { get; set; } public int Fleet { get; set; } // ShipListだけで使う public ShipSpec Spec { get; set; } @@ -43,14 +44,17 @@ namespace KancolleSniffer public int[] OnSlot { get; set; } public int[] Slot { get; set; } public int LoS { get; set; } + public int Firepower { get; set; } + public int AntiSubmarine { get; set; } public Damage DamageLevel { get { return CalcDamage(NowHp, MaxHp); } } - public ShipStatus() + public ShipStatus(ItemInfo itemInfo = null) { + _itemInfo = itemInfo; Id = -1; Spec = new ShipSpec(); OnSlot = new int[0]; @@ -97,6 +101,59 @@ namespace KancolleSniffer fuel = (int)(Spec.FuelMax * 0.2 * 0.16 * damage); steal = (int)(Spec.FuelMax * 0.2 * 0.3 * damage); } + + public int RealFirepower + { + get + { + if (Spec.IsSubmarine) + return 0; + if (!Spec.IsAircraftCarrier) + return Firepower + 5; + var specs = (from id in Slot + let spec = _itemInfo.ItemDict[id].Spec + where spec.IsAircraft + select new {torpedo = spec.Torpedo, bomber = spec.Bomber}).ToArray(); + var torpedo = specs.Sum(s => s.torpedo); + var bomber = specs.Sum(s => s.bomber); + if (torpedo == 0 && bomber == 0) + return 0; + return (int)((Firepower + torpedo) * 1.5 + bomber * 2 + 55); + } + } + + public int RealAntiSubmarine + { + get + { + if (!Spec.IsAntiSubmarine) + return 0; + if (Spec.IsAircraftCarrier && RealFirepower == 0) // 砲撃戦に参加しない + return 0; + var sonar = 0; + var dc = 0; + var aircraft = 0; + var all = 0; + var vanilla = AntiSubmarine; + foreach (var spec in Slot.Select(id => _itemInfo.ItemDict[id].Spec)) + { + vanilla -= spec.AntiSubmarine; + if (spec.IsReconSeaplane) // 水偵は除外 + continue; + if (spec.IsSonar) + sonar += spec.AntiSubmarine; + else if (spec.IsDepthCharge) + dc += spec.AntiSubmarine; + else if (spec.IsAircraft) + aircraft += spec.AntiSubmarine; + all += spec.AntiSubmarine; + } + if (vanilla == 0 && aircraft == 0) // 素対潜0で航空機なしは対潜攻撃なし + return 0; + var bonus = sonar > 0 && dc > 0 ? 1.15 : 1.0; + return (int)(bonus * (vanilla / 5 + all * 2 + (aircraft > 0 ? 10 : 25))); + } + } } public struct ChargeStatus @@ -215,7 +272,7 @@ namespace KancolleSniffer { foreach (var entry in json) { - _shipInfo[(int)entry.api_id] = new ShipStatus + _shipInfo[(int)entry.api_id] = new ShipStatus(_itemInfo) { Id = (int)entry.api_id, Spec = _shipMaster[(int)entry.api_ship_id], @@ -228,7 +285,9 @@ namespace KancolleSniffer Bull = (int)entry.api_bull, OnSlot = (int[])entry.api_onslot, Slot = (int[])entry.api_slot, - LoS = (int)entry.api_sakuteki[0] + LoS = (int)entry.api_sakuteki[0], + Firepower = (int)entry.api_karyoku[0], + AntiSubmarine = (int)entry.api_taisen[0] }; _itemInfo.CountNewItems((int[])entry.api_slot); } @@ -356,7 +415,8 @@ namespace KancolleSniffer public ShipStatus[] GetShipStatuses(int fleet) { return - (from id in _decks[fleet] where id != -1 + (from id in _decks[fleet] + where id != -1 select _escapedShips.Contains(id) ? new ShipStatus() : _shipInfo[id]).ToArray(); } diff --git a/KancolleSniffer/ShipMaster.cs b/KancolleSniffer/ShipMaster.cs index c1b00bf..832134d 100644 --- a/KancolleSniffer/ShipMaster.cs +++ b/KancolleSniffer/ShipMaster.cs @@ -76,9 +76,11 @@ namespace KancolleSniffer public int ShipType { get; set; } public string ShipTypeName { get; set; } - public bool IsSubmarine + public ShipSpec() { - get { return ShipType == 13 || ShipType == 14; } + Id = -1; + Name = ""; + MaxEq = new int[0]; } public double RepairWeight @@ -101,6 +103,7 @@ namespace KancolleSniffer case 7: // 軽空母 case 8: // 高速戦艦 case 20: // 潜水母艦 + case 21: // 練習巡洋艦 return 1.5; case 9: // 低速戦艦 case 10: // 航空戦艦 @@ -113,11 +116,35 @@ namespace KancolleSniffer } } - public ShipSpec() + public bool IsSubmarine { - Id = -1; - Name = ""; - MaxEq = new int[0]; + get { return ShipType == 13 || ShipType == 14; } + } + + public bool IsAircraftCarrier + { + get { return ShipType == 7 || ShipType == 11 || ShipType == 18; } + } + + public bool IsAntiSubmarine + { + get + { + switch (ShipType) + { + case 2: // 駆逐 + case 3: // 軽巡 + case 4: // 雷巡 + case 6: // 航巡 + case 7: // 軽空 + case 10: // 航戦 + case 16: // 水母 + case 17: // 揚陸艦 + case 21: // ç·´å·¡ + return true; + } + return false; + } } } } \ No newline at end of file