Revisión | f94e1367899507548a98846eafbae611c26634a7 (tree) |
---|---|
Tiempo | 2020-02-24 16:46:21 |
Autor | Kazuhiro Fujieda <fujieda@user...> |
Commiter | Kazuhiro Fujieda |
素対潜に装備ボーナスが含まれているのを直す
@@ -616,6 +616,26 @@ namespace KancolleSniffer.Test | ||
616 | 616 | }; |
617 | 617 | Assert.AreEqual("83.8", ship.EffectiveAntiSubmarine.ToString("f1"), "三種コンビネーションにならない"); |
618 | 618 | } |
619 | + | |
620 | + [TestMethod] | |
621 | + public void 装備ボーナス() | |
622 | + { | |
623 | + var ship = new ShipStatus | |
624 | + { | |
625 | + Fleet = new Fleet(null, 0, null), | |
626 | + Firepower = 50, | |
627 | + Spec = new ShipSpec | |
628 | + { | |
629 | + Name = "神風改" | |
630 | + }, | |
631 | + AntiSubmarine = 50 + 10 + 3, | |
632 | + Slot = new[] | |
633 | + { | |
634 | + 三式水中探信儀 | |
635 | + } | |
636 | + }; | |
637 | + Assert.AreEqual(50, ship.ShipAntiSubmarine); | |
638 | + } | |
619 | 639 | } |
620 | 640 | |
621 | 641 | // ReSharper disable once InconsistentNaming |
@@ -635,7 +655,8 @@ namespace KancolleSniffer.Test | ||
635 | 655 | private static readonly ItemStatus A25mm三連装機銃集中配備 = new ItemStatus |
636 | 656 | { |
637 | 657 | Id = 1, |
638 | - Spec = new ItemSpec{ | |
658 | + Spec = new ItemSpec | |
659 | + { | |
639 | 660 | Id = 131, |
640 | 661 | Type = 21, |
641 | 662 | IconType = 15, |
@@ -651,13 +672,13 @@ namespace KancolleSniffer.Test | ||
651 | 672 | [TestInitialize] |
652 | 673 | public void Initialize() |
653 | 674 | { |
654 | - _ship =new ShipStatus | |
675 | + _ship = new ShipStatus | |
655 | 676 | { |
656 | 677 | AntiAir = 93, |
657 | 678 | Lucky = 46, |
658 | 679 | Spec = new ShipSpec |
659 | 680 | { |
660 | - ShipType = 4, | |
681 | + ShipType = 4 | |
661 | 682 | }, |
662 | 683 | Slot = new ItemStatus[0] |
663 | 684 | }; |
@@ -215,7 +215,39 @@ namespace KancolleSniffer.Model | ||
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | - public int ShipAntiSubmarine => AntiSubmarine - Slot.Sum(item => item.Spec.AntiSubmarine); | |
218 | + public int ShipAntiSubmarine => AntiSubmarine - Slot.Sum(item => item.Spec.AntiSubmarine + AntiSubmarineBonus(item.Spec)); | |
219 | + | |
220 | + private int AntiSubmarineBonus(ItemSpec spec) | |
221 | + { | |
222 | + switch (spec.Name) | |
223 | + { | |
224 | + case "四式水中聴音機": | |
225 | + if (Spec.ShipClass == 54) // 秋月型 | |
226 | + return 1; | |
227 | + if (new[] {"五十鈴改二", "那珂改二", "由良改二", "夕張改二", "夕張改二特"}.Any(name => Spec.Name == name)) | |
228 | + return 1; | |
229 | + if (Spec.Name == "夕張改二丁") | |
230 | + return 3; | |
231 | + break; | |
232 | + case "三式水中探信儀": | |
233 | + if (new[] {"神風", "春風", "時雨", "山風", "舞風", "朝霜"}.Any(Spec.Name.StartsWith)) | |
234 | + return 3; | |
235 | + if (new[] {"潮", "雷", "山雲", "磯風", "浜風", "岸波"}.Any(Spec.Name.StartsWith)) | |
236 | + return 2; | |
237 | + break; | |
238 | + case "三式爆雷投射機 集中配備": | |
239 | + if (new[] {"五十鈴改二", "那珂改二", "由良改二"}.Any(name => Spec.Name == name)) | |
240 | + return 1; | |
241 | + break; | |
242 | + case "試製15cm9連装対潜噴進砲": | |
243 | + if (new[] {"五十鈴改二", "那珂改二", "由良改二", "夕張改二"}.Any(name => Spec.Name == name)) | |
244 | + return 2; | |
245 | + if (Spec.Name == "夕張改二丁") | |
246 | + return 3; | |
247 | + break; | |
248 | + } | |
249 | + return 0; | |
250 | + } | |
219 | 251 | |
220 | 252 | public bool CanOpeningAntiSubmarineAttack |
221 | 253 | { |