OSDN Git Service

日向改二の先制対潜判定を実装する
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Sun, 2 May 2021 06:16:12 +0000 (15:16 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Sun, 2 May 2021 06:16:12 +0000 (15:16 +0900)
KancolleSniffer.Test/ShipStatusTest.cs
KancolleSniffer/Model/ItemSpec.cs
KancolleSniffer/Model/ShipStatus.cs

index cb501c6..e729666 100644 (file)
@@ -141,6 +141,30 @@ namespace KancolleSniffer.Test
             }\r
         };\r
 \r
+        private static readonly ItemStatus S51J = new ItemStatus\r
+        {\r
+            Id = 1,\r
+            Spec = new ItemSpec\r
+            {\r
+                Id = 326,\r
+                Name = "S-51J",\r
+                Type = 25,\r
+                IconType = 44\r
+            }\r
+        };\r
+\r
+        private static readonly ItemStatus S51J改 = new ItemStatus\r
+        {\r
+            Id = 1,\r
+            Spec = new ItemSpec\r
+            {\r
+                Id = 327,\r
+                Name = "S-51J改",\r
+                Type = 25,\r
+                IconType = 44\r
+            }\r
+        };\r
+\r
         [TestClass]\r
         public class OpeningSubmarineAttack\r
         {\r
@@ -404,6 +428,29 @@ namespace KancolleSniffer.Test
                 };\r
                 Assert.IsFalse(ship.CanOpeningAntiSubmarineAttack);\r
             }\r
+\r
+            [TestMethod]\r
+            public void 日向改二()\r
+            {\r
+                var ship = new ShipStatus\r
+                {\r
+                    Spec = new ShipSpec {Name = "日向改二"},\r
+                    Slot = new ItemStatus[0]\r
+                };\r
+                Assert.IsFalse(ship.CanOpeningAntiSubmarineAttack);\r
+\r
+                ship.Slot = new[] {カ号観測機};\r
+                Assert.IsFalse(ship.CanOpeningAntiSubmarineAttack);\r
+\r
+                ship.Slot = new[] {カ号観測機, カ号観測機};\r
+                Assert.IsTrue(ship.CanOpeningAntiSubmarineAttack);\r
+\r
+                ship.Slot = new[] {S51J};\r
+                Assert.IsTrue(ship.CanOpeningAntiSubmarineAttack);\r
+\r
+                ship.Slot = new[] {S51J改};\r
+                Assert.IsTrue(ship.CanOpeningAntiSubmarineAttack);\r
+            }\r
         }\r
 \r
         [TestClass]\r
index 96953b2..3753da3 100644 (file)
@@ -156,6 +156,10 @@ namespace KancolleSniffer.Model
 \r
         public bool IsNightRecon => Id == 102;\r
 \r
+        public bool IsAutoGiro => Type == 25;\r
+\r
+        public bool IsHelicopter => IconType == 44;\r
+\r
         public double ContactTriggerRate\r
         {\r
             get\r
index e053577..955c948 100644 (file)
@@ -292,6 +292,9 @@ namespace KancolleSniffer.Model
                         return HaveSonar &&\r
                                specs.Any(spec => spec.IsTorpedoBomber && spec.AntiSubmarine >= 7 ||\r
                                                  spec.IsArmyAircraft);\r
+                    case "日向改二":\r
+                        return Slot.Count(item => item.Spec.IsAutoGiro) >= 2 ||\r
+                               Slot.Count(item => item.Spec.IsHelicopter) >= 1;\r
                     default:\r
                         if (HaveSonar && AntiSubmarine >= 100)\r
                             return true;\r