X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=KancolleSniffer%2FItemInfo.cs;h=26c1010f4e9fa28306e4e9a0dc35bde017780d92;hb=0f851268f62e920be8db871c611184384c95781d;hp=cbdc4d5cc8e39ca1d7b6c214ac3685a9c2965243;hpb=d4c043f8c193542bd8049e7e894433ee8d68c11f;p=kancollesniffer%2FKancolleSniffer.git diff --git a/KancolleSniffer/ItemInfo.cs b/KancolleSniffer/ItemInfo.cs index cbdc4d5..26c1010 100644 --- a/KancolleSniffer/ItemInfo.cs +++ b/KancolleSniffer/ItemInfo.cs @@ -21,6 +21,7 @@ namespace KancolleSniffer { public class ItemSpec { + public static bool IncreaceLandPowerTp = false; public int Id; public string Name; public int Type; @@ -31,6 +32,8 @@ namespace KancolleSniffer public int AntiSubmarine; public int Torpedo; public int Bomber; + public int Interception; + public int AntiBomber; public ItemSpec() { @@ -49,6 +52,9 @@ namespace KancolleSniffer case 8: // 艦攻 case 11: // 水爆 case 45: // 水戦 + case 56: // 噴式戦闘機 + case 57: // 噴式戦闘爆撃機 + case 58: // 噴式攻撃機 return true; } return false; @@ -92,13 +98,21 @@ namespace KancolleSniffer case 26: // 対潜哨戒機 case 41: // 大艇 case 45: + case 56: + case 57: + case 58: + case 59: // 噴式偵察機 return true; } return false; } } - public int RealAntiSubmarine + public bool IsDiveBomber => Type == 7 || Type == 11 || Type == 57; + + public bool IsTorpedoBomber => Type == 8 || Type == 58; + + public int EffectiveAntiSubmarine { get { @@ -148,10 +162,14 @@ namespace KancolleSniffer return 5.0; case 68: // 大発動艇 return 8.0; - case 166: // 大発動艇(八九式中戦車&陸戦隊) + case 193: // 特大発動艇 return 8.0; + case 166: // 大発動艇(八九式中戦車&陸戦隊) + return IncreaceLandPowerTp ? 13.0 : 8.0; case 167: // 特二式内火艇 - return 2.0; + return IncreaceLandPowerTp ? 7.0 : 2.0; + case 230: // 特大発動艇+戦車第11連隊 + return 8.0; case 145: // 戦闘糧食 return 1.0; case 150: // 秋刀魚の缶詰 @@ -162,6 +180,22 @@ namespace KancolleSniffer } } + public double AirDefenceBonus + { + get + { + switch (Type) + { + case 9: + return LoS <= 7 ? 1.2 : 1.3; + case 10: + case 41: + return LoS <= 7 ? 1.1 : LoS <= 8 ? 1.13 : 1.16; + } + return 1; + } + } + public Color Color { get @@ -186,6 +220,7 @@ namespace KancolleSniffer case 9: // 艦偵 return Color.FromArgb(254, 191, 0); case 10: // 水上機 + case 43: // 水上戦闘機 return Color.FromArgb(142, 203, 152); case 11: // 電探 return Color.FromArgb(231, 153, 53); @@ -234,7 +269,17 @@ namespace KancolleSniffer case 35: // 補給物資 return Color.FromArgb(90, 200, 155); case 37: // 陸上攻撃機 - return Color.FromArgb(33, 194, 89); + case 38: // 局地戦闘機 + case 44: // 陸軍戦闘機 + return Color.FromArgb(57, 182, 78); + case 39: // 噴式景雲改 + case 40: // 橘花改 + return Color.FromArgb(72, 178, 141); + case 42: // 潜水艦機材 + return Color.FromArgb(158, 187, 226); + case 45: // 夜間戦闘機 + case 46: // 夜間攻撃機 + return Color.FromArgb(128, 121, 161); default: return SystemColors.Control; } @@ -248,7 +293,7 @@ namespace KancolleSniffer public ItemSpec Spec { get; set; } = new ItemSpec(); public int Level { get; set; } public int Alv { get; set; } - public ShipStatus Ship { get; set; } + public ShipStatus Holder { get; set; } public ItemStatus() { @@ -257,7 +302,7 @@ namespace KancolleSniffer public ItemStatus(int id) { - Id = id == 0 ? -1 : id; + Id = id; } private readonly double[] _alvBonusMin = @@ -272,26 +317,74 @@ namespace KancolleSniffer Sqrt(9.9), Sqrt(12.0) }; - private readonly Dictionary _alvTypeBonus = new Dictionary + private int[] AlvTypeBonusTable { - {06, new[] {0, 0, 2, 5, 9, 14, 14, 22}}, // 艦戦 - {07, new[] {0, 0, 0, 0, 0, 0, 0, 0}}, // 艦爆 - {08, new[] {0, 0, 0, 0, 0, 0, 0, 0}}, // 艦攻 - {11, new[] {0, 0, 1, 1, 1, 3, 3, 6}}, // 水爆 - {45, new[] {0, 0, 2, 5, 9, 14, 14, 22}} // 水戦 - }; + get + { + switch (Spec.Type) + { + case 6: // 艦戦 + case 45: // 水戦 + case 48: // 局地戦闘機 + case 56: // 噴式戦闘機 + return new[] {0, 0, 2, 5, 9, 14, 14, 22}; + case 7: // 艦爆 + case 8: // 艦攻 + case 47: // 陸攻 + case 57: // 噴式戦闘爆撃機 + case 58: // 噴式攻撃機 + return new[] {0, 0, 0, 0, 0, 0, 0, 0}; + case 11: // 水爆 + return new[] {0, 0, 1, 1, 1, 3, 3, 6}; + default: + return null; + } + } + } public double[] AlvBonus { get { - int[] table; - if (!_alvTypeBonus.TryGetValue(Spec.Type, out table)) + var table = AlvTypeBonusTable; + if (table == null) return new[] {0.0, 0.0}; return new[] {table[Alv] + _alvBonusMin[Alv], table[Alv] + _alvBonusMax[Alv]}; } } + public double[] AlvBonusInBase + { + get + { + switch (Spec.Type) + { + case 9: // 艦偵 + case 10: // 水偵 + case 41: // 大艇 + return new[] {_alvBonusMin[Alv], _alvBonusMax[Alv]}; + default: + return AlvBonus; + } + } + } + + public double FighterPowerLevelBonus + { + get + { + switch (Spec.Type) + { + case 6: // 艦戦 + case 45: // 水戦 + return 0.2 * Level; + case 7: // 改修可能なのは爆戦のみ + return 0.25 * Level; + } + return 0; + } + } + public double LoSLevelBonus { get @@ -360,6 +453,8 @@ namespace KancolleSniffer } } + public double BomberLevelBonus => Spec.Type == 11 /* 水爆 */ ? 0.2 * Level : 0; + public double NightBattleLevelBonus { get @@ -383,6 +478,56 @@ namespace KancolleSniffer } } } + + public double EffectiveAntiAirForShip + { + get + { + switch (Spec.IconType) + { + case 15: // 機銃 + return 6 * Spec.AntiAir + 4 * Sqrt(Level); + case 16: // 高角砲 + return 4 * Spec.AntiAir + 3 * Sqrt(Level); + case 11: // 電探 + return 3 * Spec.AntiAir; + case 30: // 高射装置 + return 4 * Spec.AntiAir; + } + return 0; + } + } + + public double EffectiveAntiAirForFleet + { + get + { + switch (Spec.IconType) + { + case 1: + case 2: + case 3: // 主砲 + case 4: // 副砲 + case 6: // 艦戦 + case 7: // 艦爆 + case 15: // 機銃 + return 0.2 * Spec.AntiAir; + case 11: // 電探 + return 0.4 * Spec.AntiAir + 1.5 * Sqrt(Level); + case 12: // 三式弾 + return 0.6 * Spec.AntiAir; + case 16: // 高角砲 + return 0.35 * Spec.AntiAir + 3 * Sqrt(Level); + case 30: // 高射装置 + return 0.35 * Spec.AntiAir; + default: + if (Spec.Type == 10) // 水偵 + return 0.2 * Spec.AntiAir; + break; + } + return 0; + } + } } public class ItemInfo @@ -401,7 +546,7 @@ namespace KancolleSniffer public int NowShips { - get { return _nowShips; } + get => _nowShips; set { if (MaxShips != 0) @@ -417,7 +562,7 @@ namespace KancolleSniffer public int NowEquips { - get { return _nowEquips; } + get => _nowEquips; private set { if (MaxEquips != 0) @@ -440,7 +585,10 @@ namespace KancolleSniffer public void InspectBasic(dynamic json) { MaxShips = (int)json.api_max_chara; + var check = MaxEquips == 0; MaxEquips = (int)json.api_max_slotitem; + if (check) + RingEquips = NowEquips >= MaxEquips - MarginEquips; } public void InspectMaster(dynamic json) @@ -450,21 +598,24 @@ namespace KancolleSniffer dict[(int)entry.api_id] = entry.api_name; foreach (var entry in json.api_mst_slotitem) { + var type = (int)entry.api_type[2]; _itemSpecs[(int)entry.api_id] = new ItemSpec { Id = (int)entry.api_id, Name = (string)entry.api_name, - Type = (int)entry.api_type[2], - TypeName = dict[(int)entry.api_type[2]], + Type = type, + TypeName = dict.TryGetValue(type, out var typeName) ? typeName : "不明", IconType = (int)entry.api_type[3], AntiAir = (int)entry.api_tyku, LoS = (int)entry.api_saku, AntiSubmarine = (int)entry.api_tais, Torpedo = (int)entry.api_raig, - Bomber = (int)entry.api_baku + Bomber = (int)entry.api_baku, + Interception = type == 48 ? (int)entry.api_houk : 0, // 局地戦闘機は回避の値が迎撃 + AntiBomber = type == 48 ? (int)entry.api_houm : 0 // 〃命中の値が対爆 }; } - _itemSpecs[-1] = new ItemSpec(); + _itemSpecs[-1] = _itemSpecs[0] = new ItemSpec(); foreach (var entry in json.api_mst_useitem) _useItemName[(int)entry.api_id] = entry.api_name; } @@ -518,7 +669,7 @@ namespace KancolleSniffer InspectSlotItem(json.api_after_slot); if (!json.api_use_slot_id()) return; - DeleteItems(((int[])json.api_use_slot_id)); + DeleteItems((int[])json.api_use_slot_id); } public void DeleteItems(ItemStatus[] items) @@ -535,36 +686,23 @@ namespace KancolleSniffer } } - public void CountNewItems(int[] ids) - { - foreach (var id in ids.Where(id => id != -1 && !_itemInfo.ContainsKey(id))) - { - _itemInfo[id] = new ItemStatus(id); - NowEquips++; - } - } - - public string GetName(int id) => _itemInfo[id].Spec.Name; - - public int GetItemId(int id) => _itemInfo[id].Spec.Id; - public ItemSpec GetSpecByItemId(int id) => _itemSpecs[id]; - public ItemStatus GetStatus(int id) => _itemInfo[id]; + public string GetName(int id) => GetStatus(id).Spec.Name; - public ItemStatus[] GetItemListWithOwner(ShipStatus[] shipList) + public ItemStatus GetStatus(int id) { - foreach (var e in _itemInfo) - e.Value.Ship = new ShipStatus(); - foreach (var s in shipList) - { - foreach (var id in s.Slot) - _itemInfo[id.Id].Ship = s; - _itemInfo[s.SlotEx.Id].Ship = s; - } - return (from e in _itemInfo where e.Key != -1 select e.Value).ToArray(); + return _itemInfo.TryGetValue(id, out var item) ? item : new ItemStatus(id); + } + + public void ClearHolder() + { + foreach (var item in _itemInfo.Values) + item.Holder = new ShipStatus(); } + public ItemStatus[] ItemList => (from e in _itemInfo where e.Key != -1 select e.Value).ToArray(); + public string GetUseItemName(int id) => _useItemName[id]; } } \ No newline at end of file