poi-plugin-brainoff 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,490 +1,490 @@
1
- 'use strict';
2
-
3
- // KanColle Phase 2 (2024-2026) combat constants & lookup tables
4
-
5
- const CAPS = {
6
- AIR: 170,
7
- ASW: 170,
8
- TORPEDO: 180,
9
- DAY_SHELL: 220,
10
- NIGHT: 360,
11
- };
12
-
13
- // Ship Type IDs (api_stype)
14
- const STYPE = {
15
- DE: 1, // 海防舰
16
- DD: 2, // 驱逐舰
17
- CL: 3, // 轻巡洋舰
18
- CLT: 4, // 重雷装巡洋舰
19
- CA: 5, // 重巡洋舰
20
- CAV: 6, // 航空巡洋舰
21
- CVL: 7, // 轻空母
22
- FBB: 8, // 巡洋战舰/高速战舰
23
- BB: 9, // 战舰
24
- BBV: 10, // 航空战舰
25
- CV: 11, // 正规空母
26
- XBB: 12, // 超弩级战舰
27
- SS: 13, // 潜艇
28
- SSV: 14, // 潜水空母
29
- AP: 15, // 补给舰(敌)
30
- AV: 16, // 水上机母舰
31
- LHA: 17, // 扬陆舰
32
- CVB: 18, // 装甲空母
33
- AR: 19, // 工作舰
34
- AS: 20, // 潜水母舰
35
- CT: 21, // 练习巡洋舰
36
- AO: 22, // 补给舰
37
- };
38
-
39
- const STYPE_CODE = {
40
- 1: 'DE', 2: 'DD', 3: 'CL', 4: 'CLT', 5: 'CA', 6: 'CAV',
41
- 7: 'CVL', 8: 'FBB', 9: 'BB', 10: 'BBV', 11: 'CV', 12: 'BB',
42
- 13: 'SS', 14: 'SSV', 15: 'AO', 16: 'AV', 17: 'LHA', 18: 'CVB',
43
- 19: 'AR', 20: 'AS', 21: 'CT', 22: 'AO',
44
- };
45
-
46
- const STYPE_ZH = {
47
- 1: '海防', 2: '驱逐', 3: '轻巡', 4: '雷巡', 5: '重巡', 6: '航巡',
48
- 7: '轻母', 8: '战巡', 9: '战舰', 10: '航战', 11: '正航', 12: '战舰',
49
- 13: '潜艇', 14: '潜母', 15: '补给', 16: '水母', 17: '扬陆', 18: '装母',
50
- 19: '工作', 20: '潜补', 21: '练巡', 22: '补给',
51
- };
52
-
53
- // Equipment Type IDs (api_type[2])
54
- const ETYPE = {
55
- SMALL_GUN: 1,
56
- MEDIUM_GUN: 2,
57
- LARGE_GUN: 3,
58
- SECONDARY_GUN: 4,
59
- TORPEDO: 5,
60
- FIGHTER: 6,
61
- DIVE_BOMBER: 7,
62
- TORP_BOMBER: 8,
63
- CARRIER_RECON: 9,
64
- SEAPLANE_RECON: 10,
65
- SEAPLANE_BOMBER: 11,
66
- SMALL_RADAR: 12,
67
- LARGE_RADAR: 13,
68
- SONAR: 14,
69
- DEPTH_CHARGE: 15, // both DCP and DC share type[2]=15 (distinguished by icon or subtype/id)
70
- TURBINE: 17,
71
- TYPE3_SHELL: 18,
72
- AP_SHELL: 19,
73
- AA_GUN: 21,
74
- MIDGET_SUB: 22,
75
- DAMCON: 23,
76
- LANDING_CRAFT: 24,
77
- AUTOGYRO: 25,
78
- ASW_PATROL: 26,
79
- BULGE_M: 27,
80
- BULGE_L: 28,
81
- SEARCHLIGHT: 29,
82
- DRUM: 30,
83
- REPAIR_FACILITY: 31,
84
- SS_TORP: 32,
85
- STAR_SHELL: 33,
86
- COMMAND_FACILITY: 34,
87
- SCAMP: 35,
88
- AAFD: 36,
89
- ANTI_GROUND_ROCKET: 37,
90
- LOOKOUT: 39,
91
- LARGE_SONAR: 40,
92
- FLYING_BOAT: 41,
93
- LARGE_SEARCHLIGHT: 42,
94
- RATION: 43,
95
- SEAPLANE_FIGHTER: 45,
96
- AMP_TANK: 46,
97
- SUB_RADAR: 51,
98
- SMOKE_GENERATOR: 54,
99
- JET_FIGHTER: 56,
100
- JET_FIGHTER_BOMBER: 57,
101
- LARGE_RADAR_2: 93,
102
- CARRIER_RECON_2: 94,
103
- };
104
-
105
- // Armor-penetrating Depth Charges (zh.kcwiki「防御力计算」: sqrt(asw - 2) + (DE ? 1 : 0))
106
- const PURE_DC_IDS = new Set([226, 227, 377, 378, 439, 472, 488]); // 九五式爆雷, 二式爆雷, RUR-4A, 対潜短魚雷, Hedgehog, Mk.32, 二式爆雷改二
107
- // ASW Synergy classification (en.kancollewiki.net/Combat/Anti-Submarine_Warfare#ASW_Synergy):
108
- // Kept separate from PURE_DC_IDS armor-penetration!
109
- // - RUR-4A (377) & Mk.32 (472) act as Depth Charge Projectors (DCP / 投射機) for synergy.
110
- // - Mortars (346, 347) are NEITHER DC nor DCP for the new set (DCP+DC 1.1, small sonar+DCP+DC), but they are an old-set partner:
111
- // sonar + mortar = 1.15 (wikiwiki「対潜攻撃」/ zh 反潜三件套 旧型套装「任意[声呐系] + 任意[爆雷系]/任意[喷进炮]」, Wave 51; en lists no
112
- // mortar synergy). zh's small sonar + DC = 1.15 × 1.15 = 1.3225 is NOT followed (en / ja 1.15).
113
- const ASW_SYNERGY_DC_IDS = new Set([226, 227, 378, 439, 488]); // 九五式爆雷, 二式爆雷, 対潜短魚雷(試作初期型), Hedgehog, 二式爆雷改二
114
- const ASW_SYNERGY_DCP_IDS = new Set([44, 45, 287, 288, 377, 472, 569]); // 九四式, 三式, 三式集中, 試製15cm9連装, RUR-4A, Mk.32, 三式爆雷投射機改
115
- // 九五式爆雷 (226), 二式爆雷 (227), 二式爆雷改二 (488) do NOT gain day shelling FP (0.75√★) or ASW accuracy (1.3√★) improvement (en Improvement)
116
- const NO_SHELL_ASW_IMPROV_DC_IDS = new Set([226, 227, 488]);
117
- // Passive Sonars (not active sonar for Sanma, still sonar for ASW)
118
- const PASSIVE_SONAR_IDS = new Set([46, 132, 149]); // 九三式, 零式, 四式水中听音机
119
- // Late-model Submarine Torpedoes (后期型舰首鱼雷, eligible for dedicated Submarine Cut-Ins)
120
- const LATE_SUB_TORP_IDS = new Set([213, 214, 383, 441, 443, 457, 461, 512]);
121
- // Anti-Installation Dive Bombers (対地艦爆, verified against en.kancollewiki.net/Combat/Anti-Installation & api_start2)
122
- // Carriers carrying >=1 active (planes > 0) dive bomber in this set CAN target installations during day shelling even alongside normal DBs.
123
- const ANTI_INSTALL_DB_IDS = new Set([64, 148, 233, 277, 305, 306, 319, 320, 391, 392, 420, 421, 474, 541, 544, 550, 551, 552, 578, 587]);
124
- // Fighter-Bombers (爆戦, type2=7 Dive Bombers that qualify for +0.25*★ AA in Fighter Power; regular DBs with AA>0 do NOT!)
125
- // Note: per en Improvement, Fighter-Bombers (incl. 447/487, whose 0.2*★ is ASW-only) do NOT gain aerial/day-shelling +0.2*★ dive-bomb improvement.
126
- const FIGHTER_BOMBER_IDS = new Set([60, 154, 219, 233, 277, 316, 447, 474, 475, 476, 487, 557, 558]);
127
- const AIR_IMPROV_FB_IDS = new Set(); // Kept empty (exported for backward compatibility): 447/487 have '-' in Dive Bomb column on en Improvement
128
- // Secondary Guns with linear improvement FP scaling (en Improvement / wikiwiki「改修工廠」):
129
- // 0.3*★: 15.5cm Triple Secondary (12, 234, 463), 15.2cm Triple (247), 5inch Twin Concentrated Secondary (467)
130
- // 0.2*★: High-Angle Secondary Guns (icon === 16, EXCEPT 135 90mm Single HA which is Default sqrt(★)!) & 15cm Single Secondary (565)
131
- // Standard sqrt(★): OTO 152mm (134), 90mm Single HA (135), 15.2cm Single (11) — en Improvement "Default" row lists only 15.2cm
132
- // Single and OTO among the secondaries (wikiwiki「改修工廠」likewise).
133
- // Wave 51: 15cm Twin (77) and 10.2cm Triple (566) moved from sqrt(★) to 0.3*★ (en Improvement linear table: secondaries 0.2 for
134
- // FP <= 3, 0.3 for FP >= 5; both have FP 4, not covered by either row -> 0.3 "?" per wikiwiki).
135
- const SEC_GUN_LINEAR_03_IDS = new Set([12, 234, 247, 463, 467, 77, 566]);
136
- const SEC_GUN_LINEAR_02_IDS = new Set([10, 66, 71, 130, 160, 172, 220, 275, 358, 430, 464, 524, 556, 565]);
137
- const SEC_GUN_SQRT_EXEMPT_IDS = new Set([135]);
138
- const NORTHERN_CAMO_ID = 268; // 北方迷彩(+北方装備): +3 Armor & post-cap Evasion bonus in World 3 (3-1..3-5)
139
- // Anti-Installation rocket / mortar / landing craft / amphibious tank IDs (verified against en.kancollewiki.net/Combat/Anti-Installation Table A1 & A2)
140
- const WG42_ID = 126;
141
- const TYPE4_ROCKET_ID = 348; // 艦載型 四式20cm対地噴進砲
142
- const TYPE4_ROCKET_CONC_ID = 349; // 四式20cm対地噴進砲 集中配備
143
- const MORTAR_ID = 346; // 二式12cm迫撃砲改
144
- const MORTAR_CONC_ID = 347; // 二式12cm迫撃砲改 集中配備
145
- // A1 Soft-Skinned groups:
146
- const TOKU_DAIHATSU_IDS = new Set([193, 482, 514]); // Group b (x1.15): 特大発, 特大発+III号(北非), 特大発+III号J
147
- const DAIHATSU_TANK_IDS = new Set([166, 449, 482, 514]); // Group c1 single (x1.5): 八九式, 一式砲戦車, III号(北非), III号J
148
- const DAIHATSU_C1_EXTRA_IDS = new Set([494, 495]); // Group c1* multiple-only (x1.3 when c1+c1* >= 2): チハ, チハ改
149
- const DAIHATSU_C2_IDS = new Set([436]); // Group c2 (x1.5 / x1.3): II号戦車(北非)
150
- const DAIHATSU_C3_IDS = new Set([576]); // Group c3 (x1.5 / x1.3): R35&フランス兵
151
- const DAIHATSU_D_IDS = new Set([355, 495, 514]); // Group d (x1.1): M4A1 DD, チハ改, III号J
152
- const DAIHATSU_11TH_REG_ID = 230; // 特大発動艇+戦車第11連隊
153
- const DAIHATSU_M4A1_ID = 355; // M4A1 DD
154
- const DAIHATSU_AB_BOAT_ID = 408; // 装甲艇(AB艇)
155
- const DAIHATSU_ARMED_ID = 409; // 武装大発
156
- const DAIHATSU_PANZER2_ID = 436; // 大発動艇(II号戦車/北アフリカ仕様)
157
- const DAIHATSU_TYPE1_ID = 449; // 特大発動艇+一式砲戦車
158
- const DAIHATSU_PANZER3_ID = 482; // 特大発動艇+III号戦車(北アフリカ仕様)
159
- const DAIHATSU_CHIHA_ID = 494; // 特大発動艇+チハ
160
- const DAIHATSU_CHIHA_KAI_ID = 495; // 特大発動艇+チハ改
161
- const DAIHATSU_PANZER3J_ID = 514; // 特大発動艇+III号戦車J型
162
- const DAIHATSU_R35_ID = 576; // 大発動艇(R35&フランス兵)
163
- const KAMI_TANK_ID = 167; // 特二式内火艇 (Group f)
164
- const KATSU_TANK_ID = 525; // 特四式内火艇 (Group a + A214)
165
- const KATSU_TANK_KAI_ID = 526; // 特四式内火艇改 (Group a + f* + A214 + A215)
166
- const AMP_TANK_IDS = new Set([167, 525, 526]); // All amphibious vehicles
167
- const AB_SYNERGY_G1_IDS = new Set([68, 193, 166, 449, 436, 525, 526, 576]);
168
- const AB_SYNERGY_G2_IDS = new Set([230, 482, 494, 495, 514, 167]);
169
-
170
- // Formations: 1=单纵, 2=复纵, 3=轮型, 4=梯形, 5=单横, 6=警戒
171
- // Verified against zh.kcwiki / wikiwiki.jp (nightEva: 1.0/1.0/1.0/1.3/1.2)
172
- // ASW evasion (wikiwiki「命中と回避について」回避項(対潜) / zh.kcwiki「命中与回避」反潜战的回避项, both identical):
173
- // pre-cap formation mod aswEva: 単縦/複縦/輪形 1.0, 梯形 1.3, 単横 1.1;
174
- // post-cap 回避項(対潜) = (基本回避項(キャップ後) - 燃料補正) × 梯形陣回避補正 aswEvaPost (1.4, echelon defender only).
175
- // Divergence: en.kancollewiki only lists a single pre-cap 1.4 for echelon; the jp/zh two-stage model is followed.
176
- // Echelon shelling evasion: 1.4, but 1.45 against an attacker in Double Line (wikiwiki「命中と回避について」; zh 1.45, en 1.4) —
177
- // applied in combat.js doDayShellAttack (ECHELON_SHELL_EVA_VS_DOUBLE_LINE), Wave 51.
178
- const ECHELON_SHELL_EVA_VS_DOUBLE_LINE = 1.45;
179
- const FORMATIONS = {
180
- 1: { id: 1, name: '单纵阵', shell: 1.0, torp: 1.0, asw: 0.6, night: 1.0, fleetAA: 1.0, shellAcc: 1.0, shellEva: 1.0, torpAcc: 1.0, torpEva: 1.0, aswAcc: 1.0, aswEva: 1.0, nightAcc: 1.0, nightEva: 1.0, flagProtect: 0.45 },
181
- 2: { id: 2, name: '复纵阵', shell: 0.8, torp: 0.8, asw: 0.8, night: 1.0, fleetAA: 1.2, shellAcc: 1.2, shellEva: 1.0, torpAcc: 0.8, torpEva: 1.0, aswAcc: 1.2, aswEva: 1.0, nightAcc: 0.9, nightEva: 1.0, flagProtect: 0.60 },
182
- 3: { id: 3, name: '轮型阵', shell: 0.7, torp: 0.7, asw: 1.2, night: 1.0, fleetAA: 1.6, shellAcc: 1.0, shellEva: 1.1, torpAcc: 0.4, torpEva: 1.1, aswAcc: 1.0, aswEva: 1.0, nightAcc: 0.7, nightEva: 1.0, flagProtect: 0.75 },
183
- 4: { id: 4, name: '梯形阵', shell: 0.75, torp: 0.6, asw: 1.1, night: 1.0, fleetAA: 1.0, shellAcc: 1.2, shellEva: 1.4, torpAcc: 0.72, torpEva: 1.3, aswAcc: 1.2, aswEva: 1.3, aswEvaPost: 1.4, nightAcc: 0.9, nightEva: 1.3, flagProtect: 0.60 },
184
- 5: { id: 5, name: '单横阵', shell: 0.6, torp: 0.6, asw: 1.3, night: 1.0, fleetAA: 1.0, shellAcc: 1.2, shellEva: 1.3, torpAcc: 0.3, torpEva: 1.4, aswAcc: 1.2, aswEva: 1.1, nightAcc: 0.8, nightEva: 1.2, flagProtect: 0.60 },
185
- 6: { id: 6, name: '警戒阵', shell: 1.0, torp: 1.0, asw: 0.6, night: 1.0, fleetAA: 1.1, shellAcc: 1.0, shellEva: 1.0, torpAcc: 1.0, torpEva: 1.0, aswAcc: 1.0, aswEva: 1.0, nightAcc: 1.0, nightEva: 1.0, flagProtect: 0.60, isVanguard: true },
186
- };
187
-
188
- // Phase L wave L2 (design_lbas §3.2, ADDENDUM A3): enemy COMBINED-fleet formations (ids 11-14), a SEPARATE table so that
189
- // FORMATIONS (ids 1-6, validated by pvp.js / server.js) is unchanged. Resolved by combat.simulateBattle only when
190
- // options.enemyEscort is present. Each entry has per-fleet formation objects (`main` / `escort`) with the same field names
191
- // as FORMATIONS, so the existing attack functions can take them as atkForm / defForm unchanged.
192
- // Sources: en "Combined Fleet" §Formation Selection (Dmg / Acc / Eva per phase, AA, FS columns; Divinity_123 2021/2023 data),
193
- // en "Accuracy, Evasion and Criticals" Mod_formation tables (accuracy rows "Combined Fleet Cruising Formation 1-4", evasion rows
194
- // of the same name), en "Damage Calculations" §Formation (combined table), en "Shooting Order and Targeting" §Combined Fleets FP,
195
- // wikiwiki「対空砲火」敵連合艦隊 (fleet-AA formation modifier 第三警戒 1.5 / 第一警戒 1.1).
196
- // "?" = the wikis mark the value unknown / uncertain; 1.0 (or the stated fallback) is used and the "?" is kept here:
197
- // - torp (damage) of the MAIN fleet is "-" on en (only the escort fires torpedoes there); the escort value is used "?"
198
- // (wikiwiki「連合艦隊」: some abyssal main-fleet ships do fire opening torpedoes).
199
- // - night damage of both fleets "?" -> 1.0. CF1 night acc / eva "?", CF2 night eva "?" -> 1.0.
200
- // - ASW acc: CF1 "1.2~1.25?" (Combined Fleet page) vs 1.25 (Accuracy page) -> 1.25 "?"; CF2-4 "?" -> 1.0.
201
- // - ASW eva: Accuracy page CF1 / CF3 / CF4 = 1.0, CF2 "?" -> 1.0.
202
- // - shelling eva CF1 "1.1~1.2?" -> 1.1 "?" (losing value 1.2); torpedo eva CF2 "?" -> 1.0; torpedo acc CF3 "0.4?".
203
- // - flagProtect: en FS table CF2 60%, CF4 60%, CF1 "?", CF3 "?" -> 0.60 "?" for CF1 / CF3 (losing alternative for CF3:
204
- // the single-fleet Diamond 75%, by the en note "Similar to Diamond"). Inherited by the escort flagship at night (en).
205
- function cfFleetForm(id, name, f) {
206
- return {
207
- id, name, shell: f.shell, torp: f.torp, asw: f.asw, night: 1.0, fleetAA: f.fleetAA,
208
- shellAcc: f.shellAcc, shellEva: f.shellEva, torpAcc: f.torpAcc, torpEva: f.torpEva,
209
- aswAcc: f.aswAcc, aswEva: f.aswEva, nightAcc: f.nightAcc, nightEva: f.nightEva,
210
- flagProtect: f.flagProtect, isCombined: true,
211
- };
212
- }
213
- function cfFormation(id, name, f) {
214
- return { id, name, fleetAA: f.fleetAA, flagProtect: f.flagProtect, main: cfFleetForm(id, name, f), escort: cfFleetForm(id, name, f) };
215
- }
216
- const ENEMY_CF_FORMATIONS = {
217
- 11: cfFormation(11, '第一警戒航行序列', { shell: 0.8, torp: 0.7, asw: 1.3, fleetAA: 1.1, shellAcc: 0.9, shellEva: 1.1, torpAcc: 0.75, torpEva: 1.0, aswAcc: 1.25, aswEva: 1.0, nightAcc: 1.0, nightEva: 1.0, flagProtect: 0.60 }),
218
- 12: cfFormation(12, '第二警戒航行序列', { shell: 1.0, torp: 0.9, asw: 1.1, fleetAA: 1.0, shellAcc: 1.0, shellEva: 1.3, torpAcc: 1.0, torpEva: 1.0, aswAcc: 1.0, aswEva: 1.0, nightAcc: 0.9, nightEva: 1.0, flagProtect: 0.60 }),
219
- 13: cfFormation(13, '第三警戒航行序列', { shell: 0.7, torp: 0.6, asw: 1.0, fleetAA: 1.5, shellAcc: 0.8, shellEva: 1.1, torpAcc: 0.4, torpEva: 1.0, aswAcc: 1.0, aswEva: 1.0, nightAcc: 0.7, nightEva: 1.1, flagProtect: 0.60 }),
220
- 14: cfFormation(14, '第四警戒航行序列', { shell: 1.1, torp: 1.0, asw: 0.7, fleetAA: 1.0, shellAcc: 1.1, shellEva: 1.0, torpAcc: 1.2, torpEva: 1.0, aswAcc: 1.0, aswEva: 1.0, nightAcc: 1.0, nightEva: 1.0, flagProtect: 0.60 }),
221
- };
222
-
223
- // Player SINGLE fleet vs enemy COMBINED fleet (6v12) battle constants (wave L2, design_lbas §3.3).
224
- const CF_BATTLE = {
225
- // Mod_CF (additive, pre-cap, inside the basic attack power): en "Damage Calculations" tab "Single vs Combined":
226
- // Vs Main Fleet: Allies +5 / Enemy (main) +10; Vs Escort: Allies +5 / Enemy (escort) -5; Torpedo: Allies +10 / Enemy +10.
227
- // Airstrike: en tab "Airstrike vs Combined": Allies -10 vs the main fleet, -20 vs the escort (inside Type x (... + 25 + Mod_CF)).
228
- // ASW and night attacks have no Mod_CF (en formulas; wikiwiki「連合艦隊」「昼の対潜攻撃、夜戦(対潜除く)、航空戦は通常艦隊と全く同じ」).
229
- pow: { shellAlly: 5, shellEnemy: { main: 10, escort: -5 }, torp: 10, airAlly: { main: -10, escort: -20 } },
230
- // Base accuracy (en "Accuracy, Evasion and Criticals", fleet-type base accuracy tables, Divinity_123):
231
- // shelling: player single -> combined 80; abyssal combined main -> single 90, combined escort -> single 75.
232
- // torpedo: player single -> combined 50; abyssal combined main / escort -> single "?" -> the abyssal single value 85 "?".
233
- // airstrike: player single -> abyssal main 115 / abyssal escort 80; abyssal airstrikes keep the existing 95 (unchanged
234
- // model; en lists abyssal -> "Player Main" 110, not applied to single-fleet battles either).
235
- // DE shelling base 77 (single fleet) has no combined-fleet value -> 80 for every ally ship "?".
236
- acc: { shellAlly: 80, shellEnemy: { main: 90, escort: 75 }, torpAlly: 50, torpEnemy: 85, airAlly: { main: 115, escort: 80 } },
237
- // Enemy combined-fleet AA (wikiwiki「対空砲火」敵連合艦隊; en "Aerial Combat" Mod_CF): proportional
238
- // floor(AdjAA x Mod_CF / 400 x planes), fixed floor((AdjAA + FleetAA) x Mod_CF x K x 0.75 / 8); Mod_CF main 0.8, escort 0.48;
239
- // fleet AA = floor(formation fleetAA x sum over all 12 ships) x 2. (en's extra bullet "0.8 if in Single Fleets vs Combined
240
- // Fleets" is read as the enemy main-fleet value; no modifier is applied to the player's single-fleet AA "?" — ww silent.)
241
- aaModCF: { main: 0.8, escort: 0.48 },
242
- // Fleet selection before the target pick (en "Shooting Order and Targeting" §Combined Fleets, Divinity_123 2022):
243
- // shelling where both fleets can be targeted 61% main / 39% escort; closing torpedo 35% / 65%; airstrike, OASW and opening
244
- // torpedo: no fleet selection (uniform over all surviving ships). FS-protection defenders: airstrike / OASW "All",
245
- // opening torpedo / shelling / closing torpedo "Main only". (LBAS 45 / 55 main-only lives in lbas.js, wave L1.)
246
- selectMain: { shellBoth: 0.61, closingTorp: 0.35 },
247
- // Player echelon vs a combined fleet (en Accuracy page "Echelon vs Combined Fleet": torpedo acc 0.6, night acc 0.8?;
248
- // evasion "Echelon (vs combined)": shelling 1.2, torpedo 1.3, ASW 1.3, night 1.1).
249
- echelonVsCF: { torpAcc: 0.6, nightAcc: 0.8, shellEva: 1.2, torpEva: 1.3, aswEva: 1.3, nightEva: 1.1 },
250
- // Night opponent (D34; en "Combined Fleet" §Combined Fleet Night Battle and wikiwiki「連合艦隊」味方通常艦隊・敵連合艦隊 agree):
251
- // escort score = (escort flagship alive ? 1 : 0) + per escort ship (not chuuha or worse 1 / chuuha 0.7 / taiha or sunk 0);
252
- // score >= 3 -> night vs the escort, < 3 -> vs the main fleet; main fleet all sunk -> escort. ww 未確定事項 (flagship
253
- // chuuha +1 / taiha +0.7?, 5+ escorts alive = escort unconditionally?, PT / submarine scores) are not modelled "?".
254
- nightScore: { threshold: 3, healthy: 1, chuuha: 0.7, flagAlive: 1 },
255
- };
256
-
257
- // Supply depot (集積地棲姫, installType 'depot') post-cap bonuses (design_lbas §3.4): en "Combat/Anti-Installation" §Post-Cap
258
- // Bonuses, table C (Supply Depot Princesses). [single, additional multiplier when the count reaches 2] like table A1.
259
- // Applied after the cap in day shelling and night attacks (not in carrier night air attacks: en notes the modifiers work
260
- // there only for Supply Depot Princess C Vacation Mode). Values marked "?" on en keep their "?" (Cc3).
261
- // Landing Forces 1.85 / 1.45 / 1.2 for 1 / 2 / 3 equipped: read as cumulative (x1.85, then x1.45 for the 2nd, x1.2 for the 3rd)
262
- // "?" — en gives only the per-count row (alternative: a single value per count).
263
- // Improvement: [1 + avg landing-craft star/50 + avg Ka-Tsu star/50]^N, N = 1 + (any group A item) + (any group B item) "?"
264
- // (en "+1 to N for each unique group A and B"); Ka-Mi: 1 + avg star/30.
265
- // Airstrike vs depots (en "Airstrike And Land-Base Bonus" Mod_Inst, Divinity_123 2024): x1.5 or x2.4 at 50% / 50%.
266
- const DEPOT_POSTCAP = {
267
- wg: [1.25, 1.3], rocket: [1.2, 1.4], mortar: [1.15, 1.2],
268
- ca: 1.7, // any landing craft / Ka-Tsu / landing force
269
- cbIds: new Set([193, 482, 514, 496, 499]), cb: 1.2,
270
- cc1Ids: new Set([166, 449, 482, 514, 496, 499]), cc1: 1.3,
271
- cc1StarExtraIds: new Set([494, 495, 497, 498]), cc1Star: 1.6, // Cc1*: count(Cc1 + these) >= 2
272
- cc2Ids: new Set([436]), cc2: [1.3, 1.6],
273
- cc3Ids: new Set([576]), cc3: [1.3, 1.6], // "?" on en
274
- cdIds: new Set([355, 495, 514, 498, 499]), cd: 1.2,
275
- ceIds: new Set([408, 409]), ce: 1.5,
276
- ceStarExtraIds: new Set([525, 526]), ceStar: 1.1, // Ce*: count(Ce + Ka-Tsu / Ka-Tsu Kai) >= 2
277
- cfId: 167, cf: 1.7, cfStarKaiId: 526, cfStar: 1.5, // Cf*: count(Ka-Mi) + 2 x count(Ka-Tsu Kai) >= 2 (en footnote)
278
- forces: [1.85, 1.45, 1.2], landingForceType2: 52,
279
- groupAIds: new Set([166, 449, 482, 514, 496, 499]), groupBIds: new Set([436, 576]),
280
- airstrike: [1.5, 2.4],
281
- };
282
-
283
- // Vanguard defender hit-rate multipliers by slot position (1..6, normal maps)
284
- const VANGUARD_DEF_HIT_MULT = {
285
- // Shelling/night: verified against zh.kcwiki / wikiwiki.jp normal-map Vanguard table
286
- shell: {
287
- dd: [0.95, 0.95, 0.80, 0.80, 0.69, 0.64],
288
- other: [0.95, 0.95, 0.95, 0.95, 0.86, 0.86],
289
- },
290
- // Torpedo: verified against zh.kcwiki「命中与回避」雷击警戒阵补正表 (normal maps)
291
- torp: {
292
- dd: [0.90, 0.90, 0.65, 0.58, 0.50, 0.42],
293
- other: [0.90, 0.90, 0.77, 0.67, 0.64, 0.55],
294
- },
295
- };
296
-
297
- // Proficiency accuracy & crit rate rank tables (rank 0..7, zh.kcwiki / en.kancollewiki.net)
298
- // Acc_prof = floor(sqrt(0.1 * avgExp)) + PROF_ACC_MOD[rank] -> [0, 1, 2, 4, 5, 6, 8, 12]
299
- // Crit_prof (slot) = floor((slot0 ? 0.8 : 0.6) * PROF_CRIT_RANK_CONST[rank]) -> slot0: 8, other: 6 at rank 7
300
- const PROF_AIRSTRIKE_ACC = [0, 1, 2, 4, 5, 6, 8, 12];
301
- const PROF_AIRSTRIKE_CRIT_RATE = [0, 1, 2, 3, 4, 5, 7, 10];
302
- const PROF_CRIT_RANK_CONST = [0, 1, 2, 3, 4, 5, 7, 10];
303
- const PROF_ACC_MOD = [0, 0, 1, 2, 3, 4, 6, 9];
304
-
305
- // Special equipment IDs
306
- const DAMCON_IDS = { TEAM: 42, GODDESS: 43 }; // 应急修理要员 / 应急修理女神
307
- const TORP_SQD_LOOKOUT_ID = 412; // 水雷战队 熟练瞭望员
308
- const GUN_D2_ID = 267; // 12.7cm连装炮D型改二
309
- const GUN_D3_ID = 366; // 12.7cm连装炮D型改三
310
- const TURBINE_ID = 33; // 改良型舰本式涡轮机
311
- const ENH_BOILER_ID = 34; // 强化型舰本式锅炉
312
- const NEW_BOILER_ID = 87; // 新型高温高压锅炉
313
- const GUN_46CM_IDS = new Set([9, 117, 276]); // 46cm三连装炮系 (fleetAA mult 0.25)
314
-
315
- // Normal abyssal submarines that CANNOT fire opening torpedoes (only elite/flagship/princess/oni can)
316
- const ABYSSAL_NO_OPEN_TORP_SUB_IDS = new Set([1530, 1531, 1570]);
317
-
318
- // Engagement: 1=同航(45%), 2=反航(30%), 3=T优(15%), 4=T劣(10%)
319
- const ENGAGEMENTS = [
320
- { id: 1, name: '同航战', mod: 1.0, prob: 0.45 },
321
- { id: 2, name: '反航战', mod: 0.8, prob: 0.30 },
322
- { id: 3, name: 'T字有利', mod: 1.2, prob: 0.15 },
323
- { id: 4, name: 'T字不利', mod: 0.6, prob: 0.10 },
324
- ];
325
-
326
- // Proficiency tables (rank 0..7)
327
- // Critical damage bonus per slot (wikiwiki「艦載機熟練度」: slot0 = floor(sqrt(exp)+C)/100, other = floor(sqrt(exp)+C)/200).
328
- // Rank 0 (exp 0..9) uses midpoint exp≈4.5 -> floor(sqrt(4.5))=2 (+0.02 slot0 / +0.01 other), matching live crits 1795294918737 & 1795634568341.
329
- const PROF_INTERNAL_MID = [0, 17, 32, 47, 62, 77, 92, 110];
330
- const PROF_FIGHTER_BONUS = [0, 0, 2, 5, 9, 14, 14, 22];
331
- const PROF_SPB_BONUS = [0, 0, 1, 1, 1, 3, 3, 6];
332
- const PROF_CRIT_BONUS_OTHER = [0.01, 0.025, 0.035, 0.045, 0.055, 0.065, 0.080, 0.100];
333
- const PROF_CRIT_BONUS_SLOT1 = [0.02, 0.05, 0.07, 0.09, 0.11, 0.13, 0.16, 0.20];
334
-
335
- // Air State constants: AS+=1, AS=2, AP=3, AD=4, AI=5
336
- const AIR_STATES = {
337
- 1: { code: 'AS+', name: '制空确保', C: 1 },
338
- 2: { code: 'AS', name: '航空优势', C: 3 },
339
- 3: { code: 'AP', name: '航空均势', C: 5 },
340
- 4: { code: 'AD', name: '航空劣势', C: 7 },
341
- 5: { code: 'AI', name: '制空丧失', C: 10 },
342
- };
343
-
344
- // LoS Formula 33 equipment weights (Cl) and improvement factors (Cm)
345
- const LOS_WEIGHT = {
346
- [ETYPE.DIVE_BOMBER]: { cl: 0.6, cm: 0 },
347
- [ETYPE.TORP_BOMBER]: { cl: 0.8, cm: 0 },
348
- [ETYPE.CARRIER_RECON]: { cl: 1.0, cm: 1.2 },
349
- [ETYPE.CARRIER_RECON_2]: { cl: 1.0, cm: 1.2 },
350
- [ETYPE.SEAPLANE_RECON]: { cl: 1.2, cm: 1.2 },
351
- // Seaplane bomber ★ LoS 1.15√★ (zh 战斗 §索敌, wikiwiki「改修工廠」; en Improvement lists 1.1 = losing value) — Wave 51
352
- [ETYPE.SEAPLANE_BOMBER]: { cl: 1.1, cm: 1.15 },
353
- [ETYPE.SMALL_RADAR]: { cl: 0.6, cm: 1.25 },
354
- [ETYPE.LARGE_RADAR]: { cl: 0.6, cm: 1.4 },
355
- [ETYPE.LARGE_RADAR_2]: { cl: 0.6, cm: 1.4 },
356
- // Large Flying Boat: equipment factor 0.6 (default), improvement factor 1.2√★ (en Improvement LoS column「(Large) Carrier Recons / Large Flying Boats 1.2」,
357
- // wikiwiki「改修工廠」「大型飛行艇」の索敵上昇量は水偵と同じ1.2√★)
358
- [ETYPE.FLYING_BOAT]: { cl: 0.6, cm: 1.2 },
359
- // Liaison aircraft (type 26): default factor 0.6, ★ LoS 1√★ (en Improvement LoS column「1 Liaison」, rotorcraft 0) — Wave 51
360
- [ETYPE.ASW_PATROL]: { cl: 0.6, cm: 1.0 },
361
- };
362
-
363
- // AAR (対空射撃回避 / anti-air resistance) [加重対空補正 AAR_ship, 艦隊防空補正 AAR_fleet] (wikiwiki「対空砲火」対空射撃回避 table,
364
- // copied 2026-12-01; en Aerial_Combat §Anti-Air Resistance / Jet Assault for the jets; zh 航空战 §对空射击回避 identical). Used by the
365
- // LBAS Stage 2 (lbas.js) and the fleet Stage 2 / jet assault (combat.js). Abyssal planes are never listed (1 / 1).
366
- // Planes not listed: 1.0 / 1.0. Ho229 fleet value: EN "0.4?" (WW 0.4).
367
- const AAR_PLANES = new Map([
368
- // carrier torpedo bombers
369
- [143, [0.6, 1]], [144, [0.6, 1]], [93, [0.6, 1]], [94, [0.6, 1]], [374, [0.6, 1]], [545, [0.6, 1]], [466, [0.6, 1]],
370
- [343, [0.6, 1]], [570, [0.6, 0.7]], [559, [0.6, 1]], [481, [0.6, 1]],
371
- // carrier dive bombers / fighter-bombers
372
- [99, [0.6, 1]], [100, [0.6, 0.7]], [319, [0.6, 1]], [320, [0.6, 1]], [557, [0.6, 1]], [558, [0.6, 0.7]], [154, [0.6, 0.7]],
373
- [487, [0.6, 1]], [474, [0.6, 1]], [475, [0.6, 1]], [476, [0.6, 1]],
374
- // jet fighter-bombers / flying-wing jet
375
- [199, [0.5, 0.7]], [200, [0.5, 0.5]], [561, [0.4, 0.4]],
376
- // seaplane bombers
377
- [79, [0.6, 1]], [80, [0.6, 1]], [81, [0.6, 0.7]], [237, [0.6, 0.7]], [322, [0.5, 0.7]], [490, [0.5, 0.7]], [323, [0.5, 0.5]],
378
- [208, [0.6, 1]],
379
- // ASW patrol (Hayabusa III Kai Skilled/20th)
380
- [491, [0.6, 1]],
381
- // land-based attackers
382
- [170, [0.6, 1]], [504, [0.6, 1]], [388, [0.6, 1]], [224, [0.6, 0.7]], [404, [0.6, 1]], [444, [0.6, 1]], [484, [0.6, 1]],
383
- [453, [0.6, 1]], [454, [0.6, 0.7]], [405, [0.6, 1]], [406, [0.6, 1]], [433, [0.6, 1]], [479, [0.6, 0.7]],
384
- ]);
385
- const getPlaneAAR = (id) => AAR_PLANES.get(Number(id)) || [1, 1];
386
-
387
- // Unconditional OASW ship master IDs (excl. unremodeled Jervis 519, Samuel B. Roberts 561, Heywood L.E. 941, Richard P. Leary 942 per wiki)
388
- const UNCONDITIONAL_OASW_IDS = new Set([
389
- 141, // 五十铃改二
390
- 478, // 龙田改二
391
- 394, // Jervis改
392
- 562, // Johnston
393
- 689, // Johnston改
394
- 596, // Fletcher
395
- 692, // Fletcher改
396
- 628, // Fletcher改 Mod.2
397
- 629, // Fletcher Mk.II
398
- 726, // Heywood L.E.改
399
- 737, // Richard P. Leary改
400
- 681, // Samuel B. Roberts改
401
- 920, // Samuel B. Roberts Mk.II
402
- 893, // Janus改
403
- 906, // Javelin改 (wikiwiki「対潜先制爆雷攻撃」発動条件: 「J級改」= Jervis改/Janus改/Javelin改 は無条件)
404
- 624, // 夕张改二丁
405
- 1040, // 吹雪改三護(六式)
406
- 1062, // Visby
407
- 1067, // Visby改
408
- ]);
409
-
410
- const UNCONDITIONAL_OASW_NAME_RE = /五十[铃鈴]改二|[龙龍]田改二|Johnston|Fletcher|Samuel B\.?\s*Roberts(改| Mk\.II)|Jervis改|Janus改|Javelin改|夕[张張]改二丁|Heywood L\.?E\.?改|Richard P\.?\s*Leary改|吹雪改三[護护]|Visby/;
411
-
412
- module.exports = {
413
- CAPS,
414
- STYPE,
415
- STYPE_CODE,
416
- STYPE_ZH,
417
- ETYPE,
418
- PURE_DC_IDS,
419
- ASW_SYNERGY_DC_IDS,
420
- ASW_SYNERGY_DCP_IDS,
421
- NO_SHELL_ASW_IMPROV_DC_IDS,
422
- PASSIVE_SONAR_IDS,
423
- LATE_SUB_TORP_IDS,
424
- ANTI_INSTALL_DB_IDS,
425
- FIGHTER_BOMBER_IDS,
426
- AIR_IMPROV_FB_IDS,
427
- SEC_GUN_LINEAR_03_IDS,
428
- SEC_GUN_LINEAR_02_IDS,
429
- SEC_GUN_SQRT_EXEMPT_IDS,
430
- NORTHERN_CAMO_ID,
431
- WG42_ID,
432
- TYPE4_ROCKET_ID,
433
- TYPE4_ROCKET_CONC_ID,
434
- MORTAR_ID,
435
- MORTAR_CONC_ID,
436
- TOKU_DAIHATSU_IDS,
437
- DAIHATSU_TANK_IDS,
438
- DAIHATSU_C1_EXTRA_IDS,
439
- DAIHATSU_C2_IDS,
440
- DAIHATSU_C3_IDS,
441
- DAIHATSU_D_IDS,
442
- DAIHATSU_11TH_REG_ID,
443
- DAIHATSU_M4A1_ID,
444
- DAIHATSU_AB_BOAT_ID,
445
- DAIHATSU_ARMED_ID,
446
- DAIHATSU_PANZER2_ID,
447
- DAIHATSU_TYPE1_ID,
448
- DAIHATSU_PANZER3_ID,
449
- DAIHATSU_CHIHA_ID,
450
- DAIHATSU_CHIHA_KAI_ID,
451
- DAIHATSU_PANZER3J_ID,
452
- DAIHATSU_R35_ID,
453
- KAMI_TANK_ID,
454
- KATSU_TANK_ID,
455
- KATSU_TANK_KAI_ID,
456
- AMP_TANK_IDS,
457
- AB_SYNERGY_G1_IDS,
458
- AB_SYNERGY_G2_IDS,
459
- FORMATIONS,
460
- VANGUARD_DEF_HIT_MULT,
461
- ENEMY_CF_FORMATIONS,
462
- CF_BATTLE,
463
- DEPOT_POSTCAP,
464
- ENGAGEMENTS,
465
- PROF_INTERNAL_MID,
466
- PROF_FIGHTER_BONUS,
467
- PROF_SPB_BONUS,
468
- PROF_CRIT_BONUS_OTHER,
469
- PROF_CRIT_BONUS_SLOT1,
470
- PROF_AIRSTRIKE_ACC,
471
- PROF_AIRSTRIKE_CRIT_RATE,
472
- PROF_CRIT_RANK_CONST,
473
- PROF_ACC_MOD,
474
- DAMCON_IDS,
475
- TORP_SQD_LOOKOUT_ID,
476
- GUN_D2_ID,
477
- GUN_D3_ID,
478
- TURBINE_ID,
479
- ENH_BOILER_ID,
480
- NEW_BOILER_ID,
481
- GUN_46CM_IDS,
482
- ABYSSAL_NO_OPEN_TORP_SUB_IDS,
483
- AIR_STATES,
484
- LOS_WEIGHT,
485
- UNCONDITIONAL_OASW_IDS,
486
- UNCONDITIONAL_OASW_NAME_RE,
487
- AAR_PLANES,
488
- getPlaneAAR,
489
- ECHELON_SHELL_EVA_VS_DOUBLE_LINE,
490
- };
1
+ 'use strict';
2
+
3
+ // KanColle Phase 2 (2024-2026) combat constants & lookup tables
4
+
5
+ const CAPS = {
6
+ AIR: 170,
7
+ ASW: 170,
8
+ TORPEDO: 180,
9
+ DAY_SHELL: 220,
10
+ NIGHT: 360,
11
+ };
12
+
13
+ // Ship Type IDs (api_stype)
14
+ const STYPE = {
15
+ DE: 1, // 海防舰
16
+ DD: 2, // 驱逐舰
17
+ CL: 3, // 轻巡洋舰
18
+ CLT: 4, // 重雷装巡洋舰
19
+ CA: 5, // 重巡洋舰
20
+ CAV: 6, // 航空巡洋舰
21
+ CVL: 7, // 轻空母
22
+ FBB: 8, // 巡洋战舰/高速战舰
23
+ BB: 9, // 战舰
24
+ BBV: 10, // 航空战舰
25
+ CV: 11, // 正规空母
26
+ XBB: 12, // 超弩级战舰
27
+ SS: 13, // 潜艇
28
+ SSV: 14, // 潜水空母
29
+ AP: 15, // 补给舰(敌)
30
+ AV: 16, // 水上机母舰
31
+ LHA: 17, // 扬陆舰
32
+ CVB: 18, // 装甲空母
33
+ AR: 19, // 工作舰
34
+ AS: 20, // 潜水母舰
35
+ CT: 21, // 练习巡洋舰
36
+ AO: 22, // 补给舰
37
+ };
38
+
39
+ const STYPE_CODE = {
40
+ 1: 'DE', 2: 'DD', 3: 'CL', 4: 'CLT', 5: 'CA', 6: 'CAV',
41
+ 7: 'CVL', 8: 'FBB', 9: 'BB', 10: 'BBV', 11: 'CV', 12: 'BB',
42
+ 13: 'SS', 14: 'SSV', 15: 'AO', 16: 'AV', 17: 'LHA', 18: 'CVB',
43
+ 19: 'AR', 20: 'AS', 21: 'CT', 22: 'AO',
44
+ };
45
+
46
+ const STYPE_ZH = {
47
+ 1: '海防', 2: '驱逐', 3: '轻巡', 4: '雷巡', 5: '重巡', 6: '航巡',
48
+ 7: '轻母', 8: '战巡', 9: '战舰', 10: '航战', 11: '正航', 12: '战舰',
49
+ 13: '潜艇', 14: '潜母', 15: '补给', 16: '水母', 17: '扬陆', 18: '装母',
50
+ 19: '工作', 20: '潜补', 21: '练巡', 22: '补给',
51
+ };
52
+
53
+ // Equipment Type IDs (api_type[2])
54
+ const ETYPE = {
55
+ SMALL_GUN: 1,
56
+ MEDIUM_GUN: 2,
57
+ LARGE_GUN: 3,
58
+ SECONDARY_GUN: 4,
59
+ TORPEDO: 5,
60
+ FIGHTER: 6,
61
+ DIVE_BOMBER: 7,
62
+ TORP_BOMBER: 8,
63
+ CARRIER_RECON: 9,
64
+ SEAPLANE_RECON: 10,
65
+ SEAPLANE_BOMBER: 11,
66
+ SMALL_RADAR: 12,
67
+ LARGE_RADAR: 13,
68
+ SONAR: 14,
69
+ DEPTH_CHARGE: 15, // both DCP and DC share type[2]=15 (distinguished by icon or subtype/id)
70
+ TURBINE: 17,
71
+ TYPE3_SHELL: 18,
72
+ AP_SHELL: 19,
73
+ AA_GUN: 21,
74
+ MIDGET_SUB: 22,
75
+ DAMCON: 23,
76
+ LANDING_CRAFT: 24,
77
+ AUTOGYRO: 25,
78
+ ASW_PATROL: 26,
79
+ BULGE_M: 27,
80
+ BULGE_L: 28,
81
+ SEARCHLIGHT: 29,
82
+ DRUM: 30,
83
+ REPAIR_FACILITY: 31,
84
+ SS_TORP: 32,
85
+ STAR_SHELL: 33,
86
+ COMMAND_FACILITY: 34,
87
+ SCAMP: 35,
88
+ AAFD: 36,
89
+ ANTI_GROUND_ROCKET: 37,
90
+ LOOKOUT: 39,
91
+ LARGE_SONAR: 40,
92
+ FLYING_BOAT: 41,
93
+ LARGE_SEARCHLIGHT: 42,
94
+ RATION: 43,
95
+ SEAPLANE_FIGHTER: 45,
96
+ AMP_TANK: 46,
97
+ SUB_RADAR: 51,
98
+ SMOKE_GENERATOR: 54,
99
+ JET_FIGHTER: 56,
100
+ JET_FIGHTER_BOMBER: 57,
101
+ LARGE_RADAR_2: 93,
102
+ CARRIER_RECON_2: 94,
103
+ };
104
+
105
+ // Armor-penetrating Depth Charges (zh.kcwiki「防御力计算」: sqrt(asw - 2) + (DE ? 1 : 0))
106
+ const PURE_DC_IDS = new Set([226, 227, 377, 378, 439, 472, 488]); // 九五式爆雷, 二式爆雷, RUR-4A, 対潜短魚雷, Hedgehog, Mk.32, 二式爆雷改二
107
+ // ASW Synergy classification (en.kancollewiki.net/Combat/Anti-Submarine_Warfare#ASW_Synergy):
108
+ // Kept separate from PURE_DC_IDS armor-penetration!
109
+ // - RUR-4A (377) & Mk.32 (472) act as Depth Charge Projectors (DCP / 投射機) for synergy.
110
+ // - Mortars (346, 347) are NEITHER DC nor DCP for the new set (DCP+DC 1.1, small sonar+DCP+DC), but they are an old-set partner:
111
+ // sonar + mortar = 1.15 (wikiwiki「対潜攻撃」/ zh 反潜三件套 旧型套装「任意[声呐系] + 任意[爆雷系]/任意[喷进炮]」, Wave 51; en lists no
112
+ // mortar synergy). zh's small sonar + DC = 1.15 × 1.15 = 1.3225 is NOT followed (en / ja 1.15).
113
+ const ASW_SYNERGY_DC_IDS = new Set([226, 227, 378, 439, 488]); // 九五式爆雷, 二式爆雷, 対潜短魚雷(試作初期型), Hedgehog, 二式爆雷改二
114
+ const ASW_SYNERGY_DCP_IDS = new Set([44, 45, 287, 288, 377, 472, 569]); // 九四式, 三式, 三式集中, 試製15cm9連装, RUR-4A, Mk.32, 三式爆雷投射機改
115
+ // 九五式爆雷 (226), 二式爆雷 (227), 二式爆雷改二 (488) do NOT gain day shelling FP (0.75√★) or ASW accuracy (1.3√★) improvement (en Improvement)
116
+ const NO_SHELL_ASW_IMPROV_DC_IDS = new Set([226, 227, 488]);
117
+ // Passive Sonars (not active sonar for Sanma, still sonar for ASW)
118
+ const PASSIVE_SONAR_IDS = new Set([46, 132, 149]); // 九三式, 零式, 四式水中听音机
119
+ // Late-model Submarine Torpedoes (后期型舰首鱼雷, eligible for dedicated Submarine Cut-Ins)
120
+ const LATE_SUB_TORP_IDS = new Set([213, 214, 383, 441, 443, 457, 461, 512]);
121
+ // Anti-Installation Dive Bombers (対地艦爆, verified against en.kancollewiki.net/Combat/Anti-Installation & api_start2)
122
+ // Carriers carrying >=1 active (planes > 0) dive bomber in this set CAN target installations during day shelling even alongside normal DBs.
123
+ const ANTI_INSTALL_DB_IDS = new Set([64, 148, 233, 277, 305, 306, 319, 320, 391, 392, 420, 421, 474, 541, 544, 550, 551, 552, 578, 587]);
124
+ // Fighter-Bombers (爆戦, type2=7 Dive Bombers that qualify for +0.25*★ AA in Fighter Power; regular DBs with AA>0 do NOT!)
125
+ // Note: per en Improvement, Fighter-Bombers (incl. 447/487, whose 0.2*★ is ASW-only) do NOT gain aerial/day-shelling +0.2*★ dive-bomb improvement.
126
+ const FIGHTER_BOMBER_IDS = new Set([60, 154, 219, 233, 277, 316, 447, 474, 475, 476, 487, 557, 558]);
127
+ const AIR_IMPROV_FB_IDS = new Set(); // Kept empty (exported for backward compatibility): 447/487 have '-' in Dive Bomb column on en Improvement
128
+ // Secondary Guns with linear improvement FP scaling (en Improvement / wikiwiki「改修工廠」):
129
+ // 0.3*★: 15.5cm Triple Secondary (12, 234, 463), 15.2cm Triple (247), 5inch Twin Concentrated Secondary (467)
130
+ // 0.2*★: High-Angle Secondary Guns (icon === 16, EXCEPT 135 90mm Single HA which is Default sqrt(★)!) & 15cm Single Secondary (565)
131
+ // Standard sqrt(★): OTO 152mm (134), 90mm Single HA (135), 15.2cm Single (11) — en Improvement "Default" row lists only 15.2cm
132
+ // Single and OTO among the secondaries (wikiwiki「改修工廠」likewise).
133
+ // Wave 51: 15cm Twin (77) and 10.2cm Triple (566) moved from sqrt(★) to 0.3*★ (en Improvement linear table: secondaries 0.2 for
134
+ // FP <= 3, 0.3 for FP >= 5; both have FP 4, not covered by either row -> 0.3 "?" per wikiwiki).
135
+ const SEC_GUN_LINEAR_03_IDS = new Set([12, 234, 247, 463, 467, 77, 566]);
136
+ const SEC_GUN_LINEAR_02_IDS = new Set([10, 66, 71, 130, 160, 172, 220, 275, 358, 430, 464, 524, 556, 565]);
137
+ const SEC_GUN_SQRT_EXEMPT_IDS = new Set([135]);
138
+ const NORTHERN_CAMO_ID = 268; // 北方迷彩(+北方装備): +3 Armor & post-cap Evasion bonus in World 3 (3-1..3-5)
139
+ // Anti-Installation rocket / mortar / landing craft / amphibious tank IDs (verified against en.kancollewiki.net/Combat/Anti-Installation Table A1 & A2)
140
+ const WG42_ID = 126;
141
+ const TYPE4_ROCKET_ID = 348; // 艦載型 四式20cm対地噴進砲
142
+ const TYPE4_ROCKET_CONC_ID = 349; // 四式20cm対地噴進砲 集中配備
143
+ const MORTAR_ID = 346; // 二式12cm迫撃砲改
144
+ const MORTAR_CONC_ID = 347; // 二式12cm迫撃砲改 集中配備
145
+ // A1 Soft-Skinned groups:
146
+ const TOKU_DAIHATSU_IDS = new Set([193, 482, 514]); // Group b (x1.15): 特大発, 特大発+III号(北非), 特大発+III号J
147
+ const DAIHATSU_TANK_IDS = new Set([166, 449, 482, 514]); // Group c1 single (x1.5): 八九式, 一式砲戦車, III号(北非), III号J
148
+ const DAIHATSU_C1_EXTRA_IDS = new Set([494, 495]); // Group c1* multiple-only (x1.3 when c1+c1* >= 2): チハ, チハ改
149
+ const DAIHATSU_C2_IDS = new Set([436]); // Group c2 (x1.5 / x1.3): II号戦車(北非)
150
+ const DAIHATSU_C3_IDS = new Set([576]); // Group c3 (x1.5 / x1.3): R35&フランス兵
151
+ const DAIHATSU_D_IDS = new Set([355, 495, 514]); // Group d (x1.1): M4A1 DD, チハ改, III号J
152
+ const DAIHATSU_11TH_REG_ID = 230; // 特大発動艇+戦車第11連隊
153
+ const DAIHATSU_M4A1_ID = 355; // M4A1 DD
154
+ const DAIHATSU_AB_BOAT_ID = 408; // 装甲艇(AB艇)
155
+ const DAIHATSU_ARMED_ID = 409; // 武装大発
156
+ const DAIHATSU_PANZER2_ID = 436; // 大発動艇(II号戦車/北アフリカ仕様)
157
+ const DAIHATSU_TYPE1_ID = 449; // 特大発動艇+一式砲戦車
158
+ const DAIHATSU_PANZER3_ID = 482; // 特大発動艇+III号戦車(北アフリカ仕様)
159
+ const DAIHATSU_CHIHA_ID = 494; // 特大発動艇+チハ
160
+ const DAIHATSU_CHIHA_KAI_ID = 495; // 特大発動艇+チハ改
161
+ const DAIHATSU_PANZER3J_ID = 514; // 特大発動艇+III号戦車J型
162
+ const DAIHATSU_R35_ID = 576; // 大発動艇(R35&フランス兵)
163
+ const KAMI_TANK_ID = 167; // 特二式内火艇 (Group f)
164
+ const KATSU_TANK_ID = 525; // 特四式内火艇 (Group a + A214)
165
+ const KATSU_TANK_KAI_ID = 526; // 特四式内火艇改 (Group a + f* + A214 + A215)
166
+ const AMP_TANK_IDS = new Set([167, 525, 526]); // All amphibious vehicles
167
+ const AB_SYNERGY_G1_IDS = new Set([68, 193, 166, 449, 436, 525, 526, 576]);
168
+ const AB_SYNERGY_G2_IDS = new Set([230, 482, 494, 495, 514, 167]);
169
+
170
+ // Formations: 1=单纵, 2=复纵, 3=轮型, 4=梯形, 5=单横, 6=警戒
171
+ // Verified against zh.kcwiki / wikiwiki.jp (nightEva: 1.0/1.0/1.0/1.3/1.2)
172
+ // ASW evasion (wikiwiki「命中と回避について」回避項(対潜) / zh.kcwiki「命中与回避」反潜战的回避项, both identical):
173
+ // pre-cap formation mod aswEva: 単縦/複縦/輪形 1.0, 梯形 1.3, 単横 1.1;
174
+ // post-cap 回避項(対潜) = (基本回避項(キャップ後) - 燃料補正) × 梯形陣回避補正 aswEvaPost (1.4, echelon defender only).
175
+ // Divergence: en.kancollewiki only lists a single pre-cap 1.4 for echelon; the jp/zh two-stage model is followed.
176
+ // Echelon shelling evasion: 1.4, but 1.45 against an attacker in Double Line (wikiwiki「命中と回避について」; zh 1.45, en 1.4) —
177
+ // applied in combat.js doDayShellAttack (ECHELON_SHELL_EVA_VS_DOUBLE_LINE), Wave 51.
178
+ const ECHELON_SHELL_EVA_VS_DOUBLE_LINE = 1.45;
179
+ const FORMATIONS = {
180
+ 1: { id: 1, name: '单纵阵', shell: 1.0, torp: 1.0, asw: 0.6, night: 1.0, fleetAA: 1.0, shellAcc: 1.0, shellEva: 1.0, torpAcc: 1.0, torpEva: 1.0, aswAcc: 1.0, aswEva: 1.0, nightAcc: 1.0, nightEva: 1.0, flagProtect: 0.45 },
181
+ 2: { id: 2, name: '复纵阵', shell: 0.8, torp: 0.8, asw: 0.8, night: 1.0, fleetAA: 1.2, shellAcc: 1.2, shellEva: 1.0, torpAcc: 0.8, torpEva: 1.0, aswAcc: 1.2, aswEva: 1.0, nightAcc: 0.9, nightEva: 1.0, flagProtect: 0.60 },
182
+ 3: { id: 3, name: '轮型阵', shell: 0.7, torp: 0.7, asw: 1.2, night: 1.0, fleetAA: 1.6, shellAcc: 1.0, shellEva: 1.1, torpAcc: 0.4, torpEva: 1.1, aswAcc: 1.0, aswEva: 1.0, nightAcc: 0.7, nightEva: 1.0, flagProtect: 0.75 },
183
+ 4: { id: 4, name: '梯形阵', shell: 0.75, torp: 0.6, asw: 1.1, night: 1.0, fleetAA: 1.0, shellAcc: 1.2, shellEva: 1.4, torpAcc: 0.72, torpEva: 1.3, aswAcc: 1.2, aswEva: 1.3, aswEvaPost: 1.4, nightAcc: 0.9, nightEva: 1.3, flagProtect: 0.60 },
184
+ 5: { id: 5, name: '单横阵', shell: 0.6, torp: 0.6, asw: 1.3, night: 1.0, fleetAA: 1.0, shellAcc: 1.2, shellEva: 1.3, torpAcc: 0.3, torpEva: 1.4, aswAcc: 1.2, aswEva: 1.1, nightAcc: 0.8, nightEva: 1.2, flagProtect: 0.60 },
185
+ 6: { id: 6, name: '警戒阵', shell: 1.0, torp: 1.0, asw: 0.6, night: 1.0, fleetAA: 1.1, shellAcc: 1.0, shellEva: 1.0, torpAcc: 1.0, torpEva: 1.0, aswAcc: 1.0, aswEva: 1.0, nightAcc: 1.0, nightEva: 1.0, flagProtect: 0.60, isVanguard: true },
186
+ };
187
+
188
+ // Phase L wave L2 (design_lbas §3.2, ADDENDUM A3): enemy COMBINED-fleet formations (ids 11-14), a SEPARATE table so that
189
+ // FORMATIONS (ids 1-6, validated by pvp.js / server.js) is unchanged. Resolved by combat.simulateBattle only when
190
+ // options.enemyEscort is present. Each entry has per-fleet formation objects (`main` / `escort`) with the same field names
191
+ // as FORMATIONS, so the existing attack functions can take them as atkForm / defForm unchanged.
192
+ // Sources: en "Combined Fleet" §Formation Selection (Dmg / Acc / Eva per phase, AA, FS columns; Divinity_123 2021/2023 data),
193
+ // en "Accuracy, Evasion and Criticals" Mod_formation tables (accuracy rows "Combined Fleet Cruising Formation 1-4", evasion rows
194
+ // of the same name), en "Damage Calculations" §Formation (combined table), en "Shooting Order and Targeting" §Combined Fleets FP,
195
+ // wikiwiki「対空砲火」敵連合艦隊 (fleet-AA formation modifier 第三警戒 1.5 / 第一警戒 1.1).
196
+ // "?" = the wikis mark the value unknown / uncertain; 1.0 (or the stated fallback) is used and the "?" is kept here:
197
+ // - torp (damage) of the MAIN fleet is "-" on en (only the escort fires torpedoes there); the escort value is used "?"
198
+ // (wikiwiki「連合艦隊」: some abyssal main-fleet ships do fire opening torpedoes).
199
+ // - night damage of both fleets "?" -> 1.0. CF1 night acc / eva "?", CF2 night eva "?" -> 1.0.
200
+ // - ASW acc: CF1 "1.2~1.25?" (Combined Fleet page) vs 1.25 (Accuracy page) -> 1.25 "?"; CF2-4 "?" -> 1.0.
201
+ // - ASW eva: Accuracy page CF1 / CF3 / CF4 = 1.0, CF2 "?" -> 1.0.
202
+ // - shelling eva CF1 "1.1~1.2?" -> 1.1 "?" (losing value 1.2); torpedo eva CF2 "?" -> 1.0; torpedo acc CF3 "0.4?".
203
+ // - flagProtect: en FS table CF2 60%, CF4 60%, CF1 "?", CF3 "?" -> 0.60 "?" for CF1 / CF3 (losing alternative for CF3:
204
+ // the single-fleet Diamond 75%, by the en note "Similar to Diamond"). Inherited by the escort flagship at night (en).
205
+ function cfFleetForm(id, name, f) {
206
+ return {
207
+ id, name, shell: f.shell, torp: f.torp, asw: f.asw, night: 1.0, fleetAA: f.fleetAA,
208
+ shellAcc: f.shellAcc, shellEva: f.shellEva, torpAcc: f.torpAcc, torpEva: f.torpEva,
209
+ aswAcc: f.aswAcc, aswEva: f.aswEva, nightAcc: f.nightAcc, nightEva: f.nightEva,
210
+ flagProtect: f.flagProtect, isCombined: true,
211
+ };
212
+ }
213
+ function cfFormation(id, name, f) {
214
+ return { id, name, fleetAA: f.fleetAA, flagProtect: f.flagProtect, main: cfFleetForm(id, name, f), escort: cfFleetForm(id, name, f) };
215
+ }
216
+ const ENEMY_CF_FORMATIONS = {
217
+ 11: cfFormation(11, '第一警戒航行序列', { shell: 0.8, torp: 0.7, asw: 1.3, fleetAA: 1.1, shellAcc: 0.9, shellEva: 1.1, torpAcc: 0.75, torpEva: 1.0, aswAcc: 1.25, aswEva: 1.0, nightAcc: 1.0, nightEva: 1.0, flagProtect: 0.60 }),
218
+ 12: cfFormation(12, '第二警戒航行序列', { shell: 1.0, torp: 0.9, asw: 1.1, fleetAA: 1.0, shellAcc: 1.0, shellEva: 1.3, torpAcc: 1.0, torpEva: 1.0, aswAcc: 1.0, aswEva: 1.0, nightAcc: 0.9, nightEva: 1.0, flagProtect: 0.60 }),
219
+ 13: cfFormation(13, '第三警戒航行序列', { shell: 0.7, torp: 0.6, asw: 1.0, fleetAA: 1.5, shellAcc: 0.8, shellEva: 1.1, torpAcc: 0.4, torpEva: 1.0, aswAcc: 1.0, aswEva: 1.0, nightAcc: 0.7, nightEva: 1.1, flagProtect: 0.60 }),
220
+ 14: cfFormation(14, '第四警戒航行序列', { shell: 1.1, torp: 1.0, asw: 0.7, fleetAA: 1.0, shellAcc: 1.1, shellEva: 1.0, torpAcc: 1.2, torpEva: 1.0, aswAcc: 1.0, aswEva: 1.0, nightAcc: 1.0, nightEva: 1.0, flagProtect: 0.60 }),
221
+ };
222
+
223
+ // Player SINGLE fleet vs enemy COMBINED fleet (6v12) battle constants (wave L2, design_lbas §3.3).
224
+ const CF_BATTLE = {
225
+ // Mod_CF (additive, pre-cap, inside the basic attack power): en "Damage Calculations" tab "Single vs Combined":
226
+ // Vs Main Fleet: Allies +5 / Enemy (main) +10; Vs Escort: Allies +5 / Enemy (escort) -5; Torpedo: Allies +10 / Enemy +10.
227
+ // Airstrike: en tab "Airstrike vs Combined": Allies -10 vs the main fleet, -20 vs the escort (inside Type x (... + 25 + Mod_CF)).
228
+ // ASW and night attacks have no Mod_CF (en formulas; wikiwiki「連合艦隊」「昼の対潜攻撃、夜戦(対潜除く)、航空戦は通常艦隊と全く同じ」).
229
+ pow: { shellAlly: 5, shellEnemy: { main: 10, escort: -5 }, torp: 10, airAlly: { main: -10, escort: -20 } },
230
+ // Base accuracy (en "Accuracy, Evasion and Criticals", fleet-type base accuracy tables, Divinity_123):
231
+ // shelling: player single -> combined 80; abyssal combined main -> single 90, combined escort -> single 75.
232
+ // torpedo: player single -> combined 50; abyssal combined main / escort -> single "?" -> the abyssal single value 85 "?".
233
+ // airstrike: player single -> abyssal main 115 / abyssal escort 80; abyssal airstrikes keep the existing 95 (unchanged
234
+ // model; en lists abyssal -> "Player Main" 110, not applied to single-fleet battles either).
235
+ // DE shelling base 77 (single fleet) has no combined-fleet value -> 80 for every ally ship "?".
236
+ acc: { shellAlly: 80, shellEnemy: { main: 90, escort: 75 }, torpAlly: 50, torpEnemy: 85, airAlly: { main: 115, escort: 80 } },
237
+ // Enemy combined-fleet AA (wikiwiki「対空砲火」敵連合艦隊; en "Aerial Combat" Mod_CF): proportional
238
+ // floor(AdjAA x Mod_CF / 400 x planes), fixed floor((AdjAA + FleetAA) x Mod_CF x K x 0.75 / 8); Mod_CF main 0.8, escort 0.48;
239
+ // fleet AA = floor(formation fleetAA x sum over all 12 ships) x 2. (en's extra bullet "0.8 if in Single Fleets vs Combined
240
+ // Fleets" is read as the enemy main-fleet value; no modifier is applied to the player's single-fleet AA "?" — ww silent.)
241
+ aaModCF: { main: 0.8, escort: 0.48 },
242
+ // Fleet selection before the target pick (en "Shooting Order and Targeting" §Combined Fleets, Divinity_123 2022):
243
+ // shelling where both fleets can be targeted 61% main / 39% escort; closing torpedo 35% / 65%; airstrike, OASW and opening
244
+ // torpedo: no fleet selection (uniform over all surviving ships). FS-protection defenders: airstrike / OASW "All",
245
+ // opening torpedo / shelling / closing torpedo "Main only". (LBAS 45 / 55 main-only lives in lbas.js, wave L1.)
246
+ selectMain: { shellBoth: 0.61, closingTorp: 0.35 },
247
+ // Player echelon vs a combined fleet (en Accuracy page "Echelon vs Combined Fleet": torpedo acc 0.6, night acc 0.8?;
248
+ // evasion "Echelon (vs combined)": shelling 1.2, torpedo 1.3, ASW 1.3, night 1.1).
249
+ echelonVsCF: { torpAcc: 0.6, nightAcc: 0.8, shellEva: 1.2, torpEva: 1.3, aswEva: 1.3, nightEva: 1.1 },
250
+ // Night opponent (D34; en "Combined Fleet" §Combined Fleet Night Battle and wikiwiki「連合艦隊」味方通常艦隊・敵連合艦隊 agree):
251
+ // escort score = (escort flagship alive ? 1 : 0) + per escort ship (not chuuha or worse 1 / chuuha 0.7 / taiha or sunk 0);
252
+ // score >= 3 -> night vs the escort, < 3 -> vs the main fleet; main fleet all sunk -> escort. ww 未確定事項 (flagship
253
+ // chuuha +1 / taiha +0.7?, 5+ escorts alive = escort unconditionally?, PT / submarine scores) are not modelled "?".
254
+ nightScore: { threshold: 3, healthy: 1, chuuha: 0.7, flagAlive: 1 },
255
+ };
256
+
257
+ // Supply depot (集積地棲姫, installType 'depot') post-cap bonuses (design_lbas §3.4): en "Combat/Anti-Installation" §Post-Cap
258
+ // Bonuses, table C (Supply Depot Princesses). [single, additional multiplier when the count reaches 2] like table A1.
259
+ // Applied after the cap in day shelling and night attacks (not in carrier night air attacks: en notes the modifiers work
260
+ // there only for Supply Depot Princess C Vacation Mode). Values marked "?" on en keep their "?" (Cc3).
261
+ // Landing Forces 1.85 / 1.45 / 1.2 for 1 / 2 / 3 equipped: read as cumulative (x1.85, then x1.45 for the 2nd, x1.2 for the 3rd)
262
+ // "?" — en gives only the per-count row (alternative: a single value per count).
263
+ // Improvement: [1 + avg landing-craft star/50 + avg Ka-Tsu star/50]^N, N = 1 + (any group A item) + (any group B item) "?"
264
+ // (en "+1 to N for each unique group A and B"); Ka-Mi: 1 + avg star/30.
265
+ // Airstrike vs depots (en "Airstrike And Land-Base Bonus" Mod_Inst, Divinity_123 2024): x1.5 or x2.4 at 50% / 50%.
266
+ const DEPOT_POSTCAP = {
267
+ wg: [1.25, 1.3], rocket: [1.2, 1.4], mortar: [1.15, 1.2],
268
+ ca: 1.7, // any landing craft / Ka-Tsu / landing force
269
+ cbIds: new Set([193, 482, 514, 496, 499]), cb: 1.2,
270
+ cc1Ids: new Set([166, 449, 482, 514, 496, 499]), cc1: 1.3,
271
+ cc1StarExtraIds: new Set([494, 495, 497, 498]), cc1Star: 1.6, // Cc1*: count(Cc1 + these) >= 2
272
+ cc2Ids: new Set([436]), cc2: [1.3, 1.6],
273
+ cc3Ids: new Set([576]), cc3: [1.3, 1.6], // "?" on en
274
+ cdIds: new Set([355, 495, 514, 498, 499]), cd: 1.2,
275
+ ceIds: new Set([408, 409]), ce: 1.5,
276
+ ceStarExtraIds: new Set([525, 526]), ceStar: 1.1, // Ce*: count(Ce + Ka-Tsu / Ka-Tsu Kai) >= 2
277
+ cfId: 167, cf: 1.7, cfStarKaiId: 526, cfStar: 1.5, // Cf*: count(Ka-Mi) + 2 x count(Ka-Tsu Kai) >= 2 (en footnote)
278
+ forces: [1.85, 1.45, 1.2], landingForceType2: 52,
279
+ groupAIds: new Set([166, 449, 482, 514, 496, 499]), groupBIds: new Set([436, 576]),
280
+ airstrike: [1.5, 2.4],
281
+ };
282
+
283
+ // Vanguard defender hit-rate multipliers by slot position (1..6, normal maps)
284
+ const VANGUARD_DEF_HIT_MULT = {
285
+ // Shelling/night: verified against zh.kcwiki / wikiwiki.jp normal-map Vanguard table
286
+ shell: {
287
+ dd: [0.95, 0.95, 0.80, 0.80, 0.69, 0.64],
288
+ other: [0.95, 0.95, 0.95, 0.95, 0.86, 0.86],
289
+ },
290
+ // Torpedo: verified against zh.kcwiki「命中与回避」雷击警戒阵补正表 (normal maps)
291
+ torp: {
292
+ dd: [0.90, 0.90, 0.65, 0.58, 0.50, 0.42],
293
+ other: [0.90, 0.90, 0.77, 0.67, 0.64, 0.55],
294
+ },
295
+ };
296
+
297
+ // Proficiency accuracy & crit rate rank tables (rank 0..7, zh.kcwiki / en.kancollewiki.net)
298
+ // Acc_prof = floor(sqrt(0.1 * avgExp)) + PROF_ACC_MOD[rank] -> [0, 1, 2, 4, 5, 6, 8, 12]
299
+ // Crit_prof (slot) = floor((slot0 ? 0.8 : 0.6) * PROF_CRIT_RANK_CONST[rank]) -> slot0: 8, other: 6 at rank 7
300
+ const PROF_AIRSTRIKE_ACC = [0, 1, 2, 4, 5, 6, 8, 12];
301
+ const PROF_AIRSTRIKE_CRIT_RATE = [0, 1, 2, 3, 4, 5, 7, 10];
302
+ const PROF_CRIT_RANK_CONST = [0, 1, 2, 3, 4, 5, 7, 10];
303
+ const PROF_ACC_MOD = [0, 0, 1, 2, 3, 4, 6, 9];
304
+
305
+ // Special equipment IDs
306
+ const DAMCON_IDS = { TEAM: 42, GODDESS: 43 }; // 应急修理要员 / 应急修理女神
307
+ const TORP_SQD_LOOKOUT_ID = 412; // 水雷战队 熟练瞭望员
308
+ const GUN_D2_ID = 267; // 12.7cm连装炮D型改二
309
+ const GUN_D3_ID = 366; // 12.7cm连装炮D型改三
310
+ const TURBINE_ID = 33; // 改良型舰本式涡轮机
311
+ const ENH_BOILER_ID = 34; // 强化型舰本式锅炉
312
+ const NEW_BOILER_ID = 87; // 新型高温高压锅炉
313
+ const GUN_46CM_IDS = new Set([9, 117, 276]); // 46cm三连装炮系 (fleetAA mult 0.25)
314
+
315
+ // Normal abyssal submarines that CANNOT fire opening torpedoes (only elite/flagship/princess/oni can)
316
+ const ABYSSAL_NO_OPEN_TORP_SUB_IDS = new Set([1530, 1531, 1570]);
317
+
318
+ // Engagement: 1=同航(45%), 2=反航(30%), 3=T优(15%), 4=T劣(10%)
319
+ const ENGAGEMENTS = [
320
+ { id: 1, name: '同航战', mod: 1.0, prob: 0.45 },
321
+ { id: 2, name: '反航战', mod: 0.8, prob: 0.30 },
322
+ { id: 3, name: 'T字有利', mod: 1.2, prob: 0.15 },
323
+ { id: 4, name: 'T字不利', mod: 0.6, prob: 0.10 },
324
+ ];
325
+
326
+ // Proficiency tables (rank 0..7)
327
+ // Critical damage bonus per slot (wikiwiki「艦載機熟練度」: slot0 = floor(sqrt(exp)+C)/100, other = floor(sqrt(exp)+C)/200).
328
+ // Rank 0 (exp 0..9) uses midpoint exp≈4.5 -> floor(sqrt(4.5))=2 (+0.02 slot0 / +0.01 other), matching live crits 1795294918737 & 1795634568341.
329
+ const PROF_INTERNAL_MID = [0, 17, 32, 47, 62, 77, 92, 110];
330
+ const PROF_FIGHTER_BONUS = [0, 0, 2, 5, 9, 14, 14, 22];
331
+ const PROF_SPB_BONUS = [0, 0, 1, 1, 1, 3, 3, 6];
332
+ const PROF_CRIT_BONUS_OTHER = [0.01, 0.025, 0.035, 0.045, 0.055, 0.065, 0.080, 0.100];
333
+ const PROF_CRIT_BONUS_SLOT1 = [0.02, 0.05, 0.07, 0.09, 0.11, 0.13, 0.16, 0.20];
334
+
335
+ // Air State constants: AS+=1, AS=2, AP=3, AD=4, AI=5
336
+ const AIR_STATES = {
337
+ 1: { code: 'AS+', name: '制空确保', C: 1 },
338
+ 2: { code: 'AS', name: '航空优势', C: 3 },
339
+ 3: { code: 'AP', name: '航空均势', C: 5 },
340
+ 4: { code: 'AD', name: '航空劣势', C: 7 },
341
+ 5: { code: 'AI', name: '制空丧失', C: 10 },
342
+ };
343
+
344
+ // LoS Formula 33 equipment weights (Cl) and improvement factors (Cm)
345
+ const LOS_WEIGHT = {
346
+ [ETYPE.DIVE_BOMBER]: { cl: 0.6, cm: 0 },
347
+ [ETYPE.TORP_BOMBER]: { cl: 0.8, cm: 0 },
348
+ [ETYPE.CARRIER_RECON]: { cl: 1.0, cm: 1.2 },
349
+ [ETYPE.CARRIER_RECON_2]: { cl: 1.0, cm: 1.2 },
350
+ [ETYPE.SEAPLANE_RECON]: { cl: 1.2, cm: 1.2 },
351
+ // Seaplane bomber ★ LoS 1.15√★ (zh 战斗 §索敌, wikiwiki「改修工廠」; en Improvement lists 1.1 = losing value) — Wave 51
352
+ [ETYPE.SEAPLANE_BOMBER]: { cl: 1.1, cm: 1.15 },
353
+ [ETYPE.SMALL_RADAR]: { cl: 0.6, cm: 1.25 },
354
+ [ETYPE.LARGE_RADAR]: { cl: 0.6, cm: 1.4 },
355
+ [ETYPE.LARGE_RADAR_2]: { cl: 0.6, cm: 1.4 },
356
+ // Large Flying Boat: equipment factor 0.6 (default), improvement factor 1.2√★ (en Improvement LoS column「(Large) Carrier Recons / Large Flying Boats 1.2」,
357
+ // wikiwiki「改修工廠」「大型飛行艇」の索敵上昇量は水偵と同じ1.2√★)
358
+ [ETYPE.FLYING_BOAT]: { cl: 0.6, cm: 1.2 },
359
+ // Liaison aircraft (type 26): default factor 0.6, ★ LoS 1√★ (en Improvement LoS column「1 Liaison」, rotorcraft 0) — Wave 51
360
+ [ETYPE.ASW_PATROL]: { cl: 0.6, cm: 1.0 },
361
+ };
362
+
363
+ // AAR (対空射撃回避 / anti-air resistance) [加重対空補正 AAR_ship, 艦隊防空補正 AAR_fleet] (wikiwiki「対空砲火」対空射撃回避 table,
364
+ // copied 2026-12-01; en Aerial_Combat §Anti-Air Resistance / Jet Assault for the jets; zh 航空战 §对空射击回避 identical). Used by the
365
+ // LBAS Stage 2 (lbas.js) and the fleet Stage 2 / jet assault (combat.js). Abyssal planes are never listed (1 / 1).
366
+ // Planes not listed: 1.0 / 1.0. Ho229 fleet value: EN "0.4?" (WW 0.4).
367
+ const AAR_PLANES = new Map([
368
+ // carrier torpedo bombers
369
+ [143, [0.6, 1]], [144, [0.6, 1]], [93, [0.6, 1]], [94, [0.6, 1]], [374, [0.6, 1]], [545, [0.6, 1]], [466, [0.6, 1]],
370
+ [343, [0.6, 1]], [570, [0.6, 0.7]], [559, [0.6, 1]], [481, [0.6, 1]],
371
+ // carrier dive bombers / fighter-bombers
372
+ [99, [0.6, 1]], [100, [0.6, 0.7]], [319, [0.6, 1]], [320, [0.6, 1]], [557, [0.6, 1]], [558, [0.6, 0.7]], [154, [0.6, 0.7]],
373
+ [487, [0.6, 1]], [474, [0.6, 1]], [475, [0.6, 1]], [476, [0.6, 1]],
374
+ // jet fighter-bombers / flying-wing jet
375
+ [199, [0.5, 0.7]], [200, [0.5, 0.5]], [561, [0.4, 0.4]],
376
+ // seaplane bombers
377
+ [79, [0.6, 1]], [80, [0.6, 1]], [81, [0.6, 0.7]], [237, [0.6, 0.7]], [322, [0.5, 0.7]], [490, [0.5, 0.7]], [323, [0.5, 0.5]],
378
+ [208, [0.6, 1]],
379
+ // ASW patrol (Hayabusa III Kai Skilled/20th)
380
+ [491, [0.6, 1]],
381
+ // land-based attackers
382
+ [170, [0.6, 1]], [504, [0.6, 1]], [388, [0.6, 1]], [224, [0.6, 0.7]], [404, [0.6, 1]], [444, [0.6, 1]], [484, [0.6, 1]],
383
+ [453, [0.6, 1]], [454, [0.6, 0.7]], [405, [0.6, 1]], [406, [0.6, 1]], [433, [0.6, 1]], [479, [0.6, 0.7]],
384
+ ]);
385
+ const getPlaneAAR = (id) => AAR_PLANES.get(Number(id)) || [1, 1];
386
+
387
+ // Unconditional OASW ship master IDs (excl. unremodeled Jervis 519, Samuel B. Roberts 561, Heywood L.E. 941, Richard P. Leary 942 per wiki)
388
+ const UNCONDITIONAL_OASW_IDS = new Set([
389
+ 141, // 五十铃改二
390
+ 478, // 龙田改二
391
+ 394, // Jervis改
392
+ 562, // Johnston
393
+ 689, // Johnston改
394
+ 596, // Fletcher
395
+ 692, // Fletcher改
396
+ 628, // Fletcher改 Mod.2
397
+ 629, // Fletcher Mk.II
398
+ 726, // Heywood L.E.改
399
+ 737, // Richard P. Leary改
400
+ 681, // Samuel B. Roberts改
401
+ 920, // Samuel B. Roberts Mk.II
402
+ 893, // Janus改
403
+ 906, // Javelin改 (wikiwiki「対潜先制爆雷攻撃」発動条件: 「J級改」= Jervis改/Janus改/Javelin改 は無条件)
404
+ 624, // 夕张改二丁
405
+ 1040, // 吹雪改三護(六式)
406
+ 1062, // Visby
407
+ 1067, // Visby改
408
+ ]);
409
+
410
+ const UNCONDITIONAL_OASW_NAME_RE = /五十[铃鈴]改二|[龙龍]田改二|Johnston|Fletcher|Samuel B\.?\s*Roberts(改| Mk\.II)|Jervis改|Janus改|Javelin改|夕[张張]改二丁|Heywood L\.?E\.?改|Richard P\.?\s*Leary改|吹雪改三[護护]|Visby/;
411
+
412
+ module.exports = {
413
+ CAPS,
414
+ STYPE,
415
+ STYPE_CODE,
416
+ STYPE_ZH,
417
+ ETYPE,
418
+ PURE_DC_IDS,
419
+ ASW_SYNERGY_DC_IDS,
420
+ ASW_SYNERGY_DCP_IDS,
421
+ NO_SHELL_ASW_IMPROV_DC_IDS,
422
+ PASSIVE_SONAR_IDS,
423
+ LATE_SUB_TORP_IDS,
424
+ ANTI_INSTALL_DB_IDS,
425
+ FIGHTER_BOMBER_IDS,
426
+ AIR_IMPROV_FB_IDS,
427
+ SEC_GUN_LINEAR_03_IDS,
428
+ SEC_GUN_LINEAR_02_IDS,
429
+ SEC_GUN_SQRT_EXEMPT_IDS,
430
+ NORTHERN_CAMO_ID,
431
+ WG42_ID,
432
+ TYPE4_ROCKET_ID,
433
+ TYPE4_ROCKET_CONC_ID,
434
+ MORTAR_ID,
435
+ MORTAR_CONC_ID,
436
+ TOKU_DAIHATSU_IDS,
437
+ DAIHATSU_TANK_IDS,
438
+ DAIHATSU_C1_EXTRA_IDS,
439
+ DAIHATSU_C2_IDS,
440
+ DAIHATSU_C3_IDS,
441
+ DAIHATSU_D_IDS,
442
+ DAIHATSU_11TH_REG_ID,
443
+ DAIHATSU_M4A1_ID,
444
+ DAIHATSU_AB_BOAT_ID,
445
+ DAIHATSU_ARMED_ID,
446
+ DAIHATSU_PANZER2_ID,
447
+ DAIHATSU_TYPE1_ID,
448
+ DAIHATSU_PANZER3_ID,
449
+ DAIHATSU_CHIHA_ID,
450
+ DAIHATSU_CHIHA_KAI_ID,
451
+ DAIHATSU_PANZER3J_ID,
452
+ DAIHATSU_R35_ID,
453
+ KAMI_TANK_ID,
454
+ KATSU_TANK_ID,
455
+ KATSU_TANK_KAI_ID,
456
+ AMP_TANK_IDS,
457
+ AB_SYNERGY_G1_IDS,
458
+ AB_SYNERGY_G2_IDS,
459
+ FORMATIONS,
460
+ VANGUARD_DEF_HIT_MULT,
461
+ ENEMY_CF_FORMATIONS,
462
+ CF_BATTLE,
463
+ DEPOT_POSTCAP,
464
+ ENGAGEMENTS,
465
+ PROF_INTERNAL_MID,
466
+ PROF_FIGHTER_BONUS,
467
+ PROF_SPB_BONUS,
468
+ PROF_CRIT_BONUS_OTHER,
469
+ PROF_CRIT_BONUS_SLOT1,
470
+ PROF_AIRSTRIKE_ACC,
471
+ PROF_AIRSTRIKE_CRIT_RATE,
472
+ PROF_CRIT_RANK_CONST,
473
+ PROF_ACC_MOD,
474
+ DAMCON_IDS,
475
+ TORP_SQD_LOOKOUT_ID,
476
+ GUN_D2_ID,
477
+ GUN_D3_ID,
478
+ TURBINE_ID,
479
+ ENH_BOILER_ID,
480
+ NEW_BOILER_ID,
481
+ GUN_46CM_IDS,
482
+ ABYSSAL_NO_OPEN_TORP_SUB_IDS,
483
+ AIR_STATES,
484
+ LOS_WEIGHT,
485
+ UNCONDITIONAL_OASW_IDS,
486
+ UNCONDITIONAL_OASW_NAME_RE,
487
+ AAR_PLANES,
488
+ getPlaneAAR,
489
+ ECHELON_SHELL_EVA_VS_DOUBLE_LINE,
490
+ };