コミットメタ情報

リビジョン71e00264dcb0d72a67af1c1c13d73364f9b5e0fa (tree)
日時2018-06-24 23:50:59
作者Kazuhiro Fujieda <fujieda@user...>
コミッターKazuhiro Fujieda

ログメッセージ

戦艦が伊勢改二だと水上打撃部隊がカウントされないのを直す

変更サマリ

差分

--- a/KancolleSniffer.Test/QuestInfoTest.cs
+++ b/KancolleSniffer.Test/QuestInfoTest.cs
@@ -480,6 +480,9 @@ namespace KancolleSniffer.Test
480480 PAssert.That(() => questInfo.Quests[0].Count.Now == 0, "駆逐軽巡以外");
481481 }
482482
483+ private ShipStatus ShipStatus(int shipType, int shipClass, int specId) =>
484+ new ShipStatus {NowHp = 1, Spec = new ShipSpec {Id = specId, ShipType = shipType, ShipClass = shipClass}};
485+
483486 /// <summary>
484487 /// 257: 「水上打撃部隊」南方へ!
485488 /// </summary>
@@ -490,11 +493,14 @@ namespace KancolleSniffer.Test
490493 var questInfo = new QuestInfo(null, battleInfo, () => new DateTime(2015, 1, 1));
491494 questInfo.InspectQuestList(CreateQuestList(new[] {259}));
492495
493- battleInfo.InjectResultStatus(new[]
496+ var org = new[]
494497 {
495- ShipStatus(3, 183), ShipStatus(9, 276), ShipStatus(10, 411),
496- ShipStatus(10, 412), ShipStatus(5, 193), ShipStatus(5, 194)
497- }, new ShipStatus[0], new ShipStatus[0], new ShipStatus[0]);
498+ ShipStatus(3, 52, 321), ShipStatus(9, 19, 276), ShipStatus(10, 26, 411),
499+ ShipStatus(10, 26, 412), ShipStatus(5, 29, 193), ShipStatus(5, 29, 194)
500+ };
501+ battleInfo.InjectResultStatus(
502+ org.ToArray(), new ShipStatus[0],
503+ new ShipStatus[0], new ShipStatus[0]);
498504 questInfo.InspectMapNext(Js(new
499505 {
500506 api_maparea_id = 5,
@@ -519,14 +525,19 @@ namespace KancolleSniffer.Test
519525 PAssert.That(() => questInfo.Quests[0].Count.Now == 0, "軽巡轟沈");
520526 battleInfo.Result.Friend.Main[0].NowHp = 1;
521527
522- battleInfo.Result.Friend.Main[4].Spec = new ShipSpec {Id = 136, ShipType = 9};
528+ battleInfo.Result.Friend.Main[4] = ShipStatus(9, 37, 136);
523529 questInfo.InspectBattleResult(Js(new {api_win_rank = "S"}));
524530 PAssert.That(() => questInfo.Quests[0].Count.Now == 0, "戦艦4隻");
525- battleInfo.Result.Friend.Main[4].Spec = new ShipSpec {Id = 193, ShipType = 5};
531+ battleInfo.Result.Friend.Main[4] = org[4];
526532
527- battleInfo.Result.Friend.Main[0].Spec = new ShipSpec {Id = 58, ShipType = 4};
533+ battleInfo.Result.Friend.Main[0] = ShipStatus(4, 4, 58);
528534 questInfo.InspectBattleResult(Js(new {api_win_rank = "S"}));
529535 PAssert.That(() => questInfo.Quests[0].Count.Now == 0, "軽巡なし");
536+ battleInfo.Result.Friend.Main[0] = org[0];
537+
538+ battleInfo.Result.Friend.Main[2] = ShipStatus(10, 2, 553);
539+ questInfo.InspectBattleResult(Js(new {api_win_rank = "S"}));
540+ PAssert.That(() => questInfo.Quests[0].Count.Now == 1, "伊勢改二");
530541 }
531542
532543 /// <summary>
--- a/KancolleSniffer/QuestInfo.cs
+++ b/KancolleSniffer/QuestInfo.cs
@@ -606,18 +606,14 @@ namespace KancolleSniffer
606606 if (_map == 51 && _boss && QuestSortie.CompareRank(rank, "S") == 0)
607607 {
608608 var fleet = _battleInfo.Result.Friend.Main.Where(s => s.NowHp > 0).Select(s => s.Spec).ToArray();
609- var senkan = new[]
609+ var ctype = new[]
610610 {
611- 131, 136, // 大和
612- 143, 148, 546, // 武蔵
613- 80, 275, 541, // 長門
614- 81, 276, // 陸奥
615- 26, 286, 411, // 扶桑
616- 27, 287, 412, // 山城
617- 77, 82, // 伊勢
618- 87, 88 // 日向
611+ 2, // 伊勢型
612+ 19, // 長門型
613+ 26, // 扶桑型
614+ 37 // 大和型
619615 };
620- if (fleet.Select(s => s.Id).Intersect(senkan).Count() == 3 &&
616+ if (fleet.Select(s => s.ShipClass).Count(c => ctype.Contains(c)) == 3 &&
621617 fleet.Count(s => s.ShipType == 3) > 0)
622618 {
623619 IncrementCount(q259.Count);
--- a/KancolleSniffer/ShipMaster.cs
+++ b/KancolleSniffer/ShipMaster.cs
@@ -41,7 +41,8 @@ namespace KancolleSniffer
4141 BullMax = entry.api_bull_max() ? (int)entry.api_bull_max : 0,
4242 SlotNum = (int)entry.api_slot_num,
4343 ShipType = (int)entry.api_stype,
44- ShipTypeName = dict[entry.api_stype]
44+ ShipTypeName = dict[entry.api_stype],
45+ ShipClass = entry.api_ctype() ? (int)entry.api_ctype : 0
4546 };
4647 if (entry.api_afterlv())
4748 {
@@ -114,6 +115,7 @@ namespace KancolleSniffer
114115 public int SlotNum { get; set; }
115116 public int[] MaxEq { get; set; }
116117 public int ShipType { get; set; }
118+ public int ShipClass { get; set; }
117119 public string ShipTypeName { get; set; }
118120 public RemodelInfo Remodel { get; } = new RemodelInfo();
119121
旧リポジトリブラウザで表示