OSDN Git Service

最近実装された出撃任務を複数遂行中にすると一部がカウントされないのを直す
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Fri, 5 Jul 2019 11:04:06 +0000 (20:04 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Sat, 6 Jul 2019 09:14:13 +0000 (18:14 +0900)
KancolleSniffer.Test/QuestCounterTest.cs
KancolleSniffer/Model/QuestCounter.cs

index 20ac8b4..6058f8e 100644 (file)
@@ -1153,6 +1153,51 @@ namespace KancolleSniffer.Test
         }\r
 \r
         /// <summary>\r
+        /// 280と854以降を同時に遂行していると854以降がカウントされないことがある\r
+        /// </summary>\r
+        [TestMethod]\r
+        public void BattleResult_280_854()\r
+        {\r
+            _questInfo.InspectQuestList(CreateQuestList(new[] {280, 854}));\r
+\r
+            _battleInfo.InjectResultStatus(\r
+                ShipStatusList(1, 1, 1, 1, 1, 1), new ShipStatus[0],\r
+                new ShipStatus[0], new ShipStatus[0]);\r
+\r
+            _questCounter.InspectMapNext(Js(new\r
+            {\r
+                api_maparea_id = 2,\r
+                api_mapinfo_no = 4,\r
+                api_event_id = 5\r
+            }));\r
+            _questCounter.InspectBattleResult(Js(new {api_win_rank = "S"}));\r
+            PAssert.That(() => _questInfo.Quests[1].Count.NowArray[0] == 1);\r
+        }\r
+\r
+        /// <summary>\r
+        /// 888と893以降を同時に遂行していると893以降がカウントされないことがある\r
+        /// </summary>\r
+        [TestMethod]\r
+        public void BattleResult_888_893()\r
+        {\r
+            _questInfo.InspectQuestList(CreateQuestList(new []{888, 893}));\r
+\r
+            _battleInfo.InjectResultStatus(\r
+                ShipStatusList(1, 1, 1, 1, 1, 1), new ShipStatus[0],\r
+                new ShipStatus[0], new ShipStatus[0]);\r
+\r
+            _questCounter.InspectMapNext(Js(new\r
+            {\r
+                api_maparea_id = 7,\r
+                api_mapinfo_no = 1,\r
+                api_event_id = 5\r
+\r
+            }));\r
+            _questCounter.InspectBattleResult(Js(new {api_win_rank = "S"}));\r
+            PAssert.That(() => _questInfo.Quests[1].Count.NowArray[1] == 1);\r
+        }\r
+\r
+        /// <summary>\r
         /// 302: 大規模演習\r
         /// 303: 「演習」で練度向上!\r
         /// 304: 「演習」で他提督を圧倒せよ!\r
index b662e9f..f28d1a7 100644 (file)
@@ -307,25 +307,25 @@ namespace KancolleSniffer.Model
                         }\r
                         break;\r
                     case 280:\r
-                        if (!(_boss && rank.S))\r
-                            return;\r
-                        if (!(specs.Types.Count(type => type == 1 || type == 2) >= 3 &&\r
-                              specs.Types.Any(type => new[] {3, 4, 7, 21}.Contains(type))))\r
-                            return;\r
-                        switch (_map)\r
+                        if (_boss && rank.S &&\r
+                            specs.Types.Count(type => type == 1 || type == 2) >= 3 &&\r
+                            specs.Types.Intersect(new[] {3, 4, 7, 21}).Any())\r
                         {\r
-                            case 12:\r
-                                IncrementNth(count, 0);\r
-                                break;\r
-                            case 13:\r
-                                IncrementNth(count, 1);\r
-                                break;\r
-                            case 14:\r
-                                IncrementNth(count, 2);\r
-                                break;\r
-                            case 21:\r
-                                IncrementNth(count, 3);\r
-                                break;\r
+                            switch (_map)\r
+                            {\r
+                                case 12:\r
+                                    IncrementNth(count, 0);\r
+                                    break;\r
+                                case 13:\r
+                                    IncrementNth(count, 1);\r
+                                    break;\r
+                                case 14:\r
+                                    IncrementNth(count, 2);\r
+                                    break;\r
+                                case 21:\r
+                                    IncrementNth(count, 3);\r
+                                    break;\r
+                            }\r
                         }\r
                         break;\r
                     case 854:\r
@@ -383,75 +383,77 @@ namespace KancolleSniffer.Model
                         }\r
                         break;\r
                     case 888:\r
-                        if (!_boss || !rank.S)\r
-                            return;\r
-                        var member = new[]\r
-                        {\r
-                            69, 272, 427, // 鳥海\r
-                            61, 264, // 青葉\r
-                            123, 295, 142, // 衣笠\r
-                            59, 262, 416, // 古鷹\r
-                            60, 263, 417, // 加古\r
-                            51, 213, 477, // 天龍\r
-                            115, 293 // 夕張\r
-                        };\r
-                        if (specs.Ids.Intersect(member).Count() < 4)\r
-                            return;\r
-                        switch (_map)\r
+                        if (_boss && rank.S &&\r
+                            specs.Ids.Intersect(new[]\r
+                            {\r
+                                69, 272, 427, // 鳥海\r
+                                61, 264, // 青葉\r
+                                123, 295, 142, // 衣笠\r
+                                59, 262, 416, // 古鷹\r
+                                60, 263, 417, // 加古\r
+                                51, 213, 477, // 天龍\r
+                                115, 293 // 夕張\r
+                            }).Count() >= 4)\r
                         {\r
-                            case 51:\r
-                                IncrementNth(count, 0);\r
-                                break;\r
-                            case 53:\r
-                                IncrementNth(count, 1);\r
-                                break;\r
-                            case 54:\r
-                                IncrementNth(count, 2);\r
-                                break;\r
+                            switch (_map)\r
+                            {\r
+                                case 51:\r
+                                    IncrementNth(count, 0);\r
+                                    break;\r
+                                case 53:\r
+                                    IncrementNth(count, 1);\r
+                                    break;\r
+                                case 54:\r
+                                    IncrementNth(count, 2);\r
+                                    break;\r
+                            }\r
                         }\r
                         break;\r
                     case 893:\r
-                        if (!_boss || !rank.S)\r
-                            return;\r
-                        switch (_map)\r
+                        if (_boss && rank.S)\r
                         {\r
-                            case 15:\r
-                                IncrementNth(count, 0);\r
-                                break;\r
-                            case 71:\r
-                                IncrementNth(count, 1);\r
-                                break;\r
-                            case 72:\r
-                                if (_cell == 7)\r
-                                {\r
-                                    IncrementNth(count, 2);\r
+                            switch (_map)\r
+                            {\r
+                                case 15:\r
+                                    IncrementNth(count, 0);\r
                                     break;\r
-                                }\r
-                                IncrementNth(count, 3);\r
-                                break;\r
+                                case 71:\r
+                                    IncrementNth(count, 1);\r
+                                    break;\r
+                                case 72:\r
+                                    if (_cell == 7)\r
+                                    {\r
+                                        IncrementNth(count, 2);\r
+                                        break;\r
+                                    }\r
+                                    IncrementNth(count, 3);\r
+                                    break;\r
+                            }\r
+                            break;\r
                         }\r
-                        break;\r
+                        return;\r
                     case 894:\r
-                        if (!_boss || !rank.S ||\r
-                            !specs.Specs.Any(spec => spec.IsAircraftCarrier))\r
-                            return;\r
-                        switch (_map)\r
+                        if (_boss && rank.S &&\r
+                            specs.Specs.Any(spec => spec.IsAircraftCarrier))\r
                         {\r
-                            case 13:\r
-                                IncrementNth(count, 0);\r
-                                break;\r
-                            case 14:\r
-                                IncrementNth(count, 1);\r
-                                break;\r
-                            case 21:\r
-                                IncrementNth(count, 2);\r
-                                break;\r
-                            case 22:\r
-                                IncrementNth(count, 3);\r
-                                break;\r
-                            case 23:\r
-                                IncrementNth(count, 4);\r
-                                break;\r
+                            switch (_map)\r
+                            {\r
+                                case 13:\r
+                                    IncrementNth(count, 0);\r
+                                    break;\r
+                                case 14:\r
+                                    IncrementNth(count, 1);\r
+                                    break;\r
+                                case 21:\r
+                                    IncrementNth(count, 2);\r
+                                    break;\r
+                                case 22:\r
+                                    IncrementNth(count, 3);\r
+                                    break;\r
+                                case 23:\r
+                                    IncrementNth(count, 4);\r
+                                    break;\r
+                            }\r
                         }\r
                         break;\r
                 }\r