Revision | 5dfd774994b4f0f92ce7319021d03219392741f8 (tree) |
---|---|
Time | 2020-09-26 02:07:28 |
Author | Kazuhiro Fujieda <fujieda@user...> |
Commiter | Kazuhiro Fujieda |
SGレーダー(初期型)の装備ボーナスを索敵スコアの計算から除く
@@ -233,6 +233,18 @@ namespace KancolleSniffer.Test | ||
233 | 233 | } |
234 | 234 | |
235 | 235 | /// <summary> |
236 | + /// SGレーダー(初期型)の装備ボーナスを外して索敵スコアを計算する | |
237 | + /// </summary> | |
238 | + [TestMethod] | |
239 | + public void LineOfSightWithSgRadar() | |
240 | + { | |
241 | + var sniffer = new Sniffer(); | |
242 | + SniffLogFile(sniffer, "lineofsight_004"); | |
243 | + var fleet = sniffer.Fleets[0]; | |
244 | + PAssert.That(() => Abs(fleet.GetLineOfSights(1) - 0.93) < 0.01); | |
245 | + } | |
246 | + | |
247 | + /// <summary> | |
236 | 248 | /// 触接開始率を正しく計算する |
237 | 249 | /// </summary> |
238 | 250 | [TestMethod] |
@@ -1 +1 @@ | ||
1 | -Subproject commit 7877795d0035744d2fba262aac91245267b5bd8b | |
1 | +Subproject commit 57340ec2ceb0ccd27c8f548bc67320e901dd68f2 |
@@ -56,4 +56,5 @@ | ||
56 | 56 | <s:Boolean x:Key="/Default/UserDictionary/Words/=Scrollify/@EntryIndexedValue">True</s:Boolean> |
57 | 57 | <s:Boolean x:Key="/Default/UserDictionary/Words/=Seiran/@EntryIndexedValue">True</s:Boolean> |
58 | 58 | <s:Boolean x:Key="/Default/UserDictionary/Words/=taiha/@EntryIndexedValue">True</s:Boolean> |
59 | - <s:Boolean x:Key="/Default/UserDictionary/Words/=Truncator/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> | |
59 | + <s:Boolean x:Key="/Default/UserDictionary/Words/=Truncator/@EntryIndexedValue">True</s:Boolean> | |
60 | + <s:Boolean x:Key="/Default/UserDictionary/Words/=Yomi/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
@@ -216,20 +216,10 @@ namespace KancolleSniffer.Model | ||
216 | 216 | |
217 | 217 | public double GetLineOfSights(int factor) |
218 | 218 | { |
219 | - var result = 0.0; | |
220 | - var emptyBonus = 6; | |
221 | - foreach (var s in ActualShips.Where(s => !s.Escaped)) | |
222 | - { | |
223 | - emptyBonus--; | |
224 | - var itemLoS = 0; | |
225 | - foreach (var item in s.AllSlot) | |
226 | - { | |
227 | - var spec = item.Spec; | |
228 | - itemLoS += spec.LoS; | |
229 | - result += (spec.LoS + item.LoSLevelBonus) * spec.LoSScaleFactor * factor; | |
230 | - } | |
231 | - result += Sqrt(s.LoS - itemLoS); | |
232 | - } | |
219 | + var actual = ActualShips.Where(s => !s.Escaped).ToArray(); | |
220 | + var emptyBonus = 6 - actual.Length; | |
221 | + var result = actual.Sum(s => | |
222 | + s.AllSlot.Sum(item => item.EffectiveLoS * factor) + Sqrt(s.RawLoS)); | |
233 | 223 | return result > 0 ? result - Ceiling(_getHqLevel() * 0.4) + emptyBonus * 2 : 0.0; |
234 | 224 | } |
235 | 225 |
@@ -82,6 +82,8 @@ namespace KancolleSniffer.Model | ||
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | + public int LoSSgRadarBonus => Id == 315 ? 4 : 0; | |
86 | + | |
85 | 87 | public bool IsAircraft |
86 | 88 | { |
87 | 89 | get |
@@ -134,7 +134,9 @@ namespace KancolleSniffer.Model | ||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - public double LoSLevelBonus | |
137 | + public double EffectiveLoS => (Spec.LoS + LoSLevelBonus) * Spec.LoSScaleFactor; | |
138 | + | |
139 | + private double LoSLevelBonus | |
138 | 140 | { |
139 | 141 | get |
140 | 142 | { |
@@ -39,6 +39,7 @@ namespace KancolleSniffer.Model | ||
39 | 39 | Id = (int)entry.api_id, |
40 | 40 | SortId = entry.api_sort_id() ? (int)entry.api_sort_id : 0, |
41 | 41 | Name = ShipName(entry), |
42 | + Yomi = entry.api_yomi, | |
42 | 43 | FuelMax = entry.api_fuel_max() ? (int)entry.api_fuel_max : 0, |
43 | 44 | BullMax = entry.api_bull_max() ? (int)entry.api_bull_max : 0, |
44 | 45 | SlotNum = (int)entry.api_slot_num, |
@@ -21,6 +21,7 @@ namespace KancolleSniffer.Model | ||
21 | 21 | public int Id { get; set; } |
22 | 22 | public int SortId { get; set; } |
23 | 23 | public string Name { get; set; } |
24 | + public string Yomi { get; set; } | |
24 | 25 | public int FuelMax { get; set; } |
25 | 26 | public int BullMax { get; set; } |
26 | 27 | public int SlotNum { get; set; } |
@@ -149,5 +150,31 @@ namespace KancolleSniffer.Model | ||
149 | 150 | public bool IsRepairShip => ShipType == 19; |
150 | 151 | |
151 | 152 | public bool IsTrainingCruiser => ShipType == 21; |
153 | + | |
154 | + public bool HaveSgRadarBonus | |
155 | + { | |
156 | + get | |
157 | + { | |
158 | + switch (Yomi) | |
159 | + { | |
160 | + case "フレッチャー": | |
161 | + case "ジョンストン": | |
162 | + case "サミュエル・B・ロバーツ": | |
163 | + case "コロラド": | |
164 | + case "サウスダコタ": | |
165 | + case "アイオワ": | |
166 | + case "サラトガ": | |
167 | + case "ホーネット": | |
168 | + case "イントレピッド": | |
169 | + case "ガンビア・ベイ": | |
170 | + case "ヒューストン": | |
171 | + case "ヘレナ": | |
172 | + case "アトランタ": | |
173 | + return true; | |
174 | + default: | |
175 | + return false; | |
176 | + } | |
177 | + } | |
178 | + } | |
152 | 179 | } |
153 | 180 | } |
\ No newline at end of file |
@@ -417,6 +417,9 @@ namespace KancolleSniffer.Model | ||
417 | 417 | |
418 | 418 | public int EffectiveBullMax => Max((int)(Spec.BullMax * (Level >= 100 ? 0.85 : 1.0)), 1); |
419 | 419 | |
420 | + public int RawLoS => | |
421 | + LoS - AllSlot.Sum(item => item.Spec.LoS + (Spec.HaveSgRadarBonus ? item.Spec.LoSSgRadarBonus : 0)); | |
422 | + | |
420 | 423 | public object Clone() |
421 | 424 | { |
422 | 425 | var r = (ShipStatus)MemberwiseClone(); |