OSDN Git Service

制空値のボーナスをItemInfoで計算する
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Fri, 9 Oct 2015 15:44:55 +0000 (00:44 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Sat, 17 Oct 2015 06:18:06 +0000 (15:18 +0900)
KancolleSniffer/ItemInfo.cs
KancolleSniffer/ShipInfo.cs

index ca898bd..6eb7bf7 100644 (file)
@@ -196,6 +196,27 @@ namespace KancolleSniffer
             Spec = new ItemSpec();\r
             Ship = new ShipStatus();\r
         }\r
+\r
+        public int AlvBonus\r
+        {\r
+            get\r
+            {\r
+                if (Alv != 7)\r
+                    return 0;\r
+                switch (Spec.Type)\r
+                {\r
+                    case 6: // 艦戦\r
+                        return 25;\r
+                    case 7: // 艦爆\r
+                        return 3;\r
+                    case 8: // 艦攻\r
+                        return 3;\r
+                    case 11: // 水爆\r
+                        return 9;\r
+                }\r
+                return 0;\r
+            }\r
+        }\r
     }\r
 \r
     public class ItemInfo\r
index 23c18dc..6864ea3 100644 (file)
@@ -442,14 +442,6 @@ namespace KancolleSniffer
                 select new ChargeStatus(flag.Fuel != 0 ? flag.Fuel : others.Fuel + 5,\r
                     flag.Bull != 0 ? flag.Bull : others.Bull + 5)).ToArray();\r
 \r
-        private readonly Dictionary<int, int> _alvBonus = new Dictionary<int, int>\r
-        {\r
-            {6, 25}, // 艦戦\r
-            {7, 3}, // 艦爆\r
-            {8, 3}, // 艦攻\r
-            {11, 9}  // 水爆\r
-        };\r
-\r
         public int GetFighterPower(int fleet, bool withBonus)\r
             => GetShipStatuses(fleet).Where(s => !s.Escaped).SelectMany(ship =>\r
                 ship.Slot.Zip(ship.OnSlot, (slot, onslot) =>\r
@@ -457,9 +449,7 @@ namespace KancolleSniffer
                     var item = _itemInfo.GetStatus(slot);\r
                     if (!item.Spec.CanAirCombat)\r
                         return 0;\r
-                    var bonus = 0;\r
-                    if (onslot != 0 && item.Alv == 7 && withBonus)\r
-                        _alvBonus.TryGetValue(item.Spec.Type, out bonus);\r
+                    var bonus = onslot != 0 && withBonus ? item.AlvBonus : 0;\r
                     return (int)Floor(item.Spec.AntiAir * Sqrt(onslot)) + bonus;\r
                 })).Sum();\r
 \r