fleethub-core 1.12.6 → 1.12.8

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.
@@ -2,56 +2,12 @@
2
2
  /* eslint-disable */
3
3
  export function parse_ship_conditions(value: ShipConditions): ShipConditions;
4
4
  export function set_panic_hook(): void;
5
-
6
- export type CompiledEvaler = string;
7
-
8
- export type AirSquadronMode = "Sortie" | "AirDefense";
9
-
10
- export interface AirSquadronState extends GearVecState, SlotSizeVecState {
11
- id?: string;
12
- mode?: AirSquadronMode;
13
- }
14
-
15
- export type SingleFormation =
16
- | "LineAhead"
17
- | "DoubleLine"
18
- | "Diamond"
19
- | "Echelon"
20
- | "LineAbreast"
21
- | "Vanguard";
22
-
23
- export type CombinedFormation =
24
- | "Cruising1"
25
- | "Cruising2"
26
- | "Cruising3"
27
- | "Cruising4";
28
-
29
- export type Formation = SingleFormation | CombinedFormation;
30
-
31
- export interface MasterGear {
32
- gear_id: number;
33
- name: string;
34
- types: GearTypeIdArray;
35
- special_type?: number;
36
- max_hp?: number;
37
- firepower?: number;
38
- armor?: number;
39
- torpedo?: number;
40
- anti_air?: number;
41
- speed?: number;
42
- bombing?: number;
43
- asw?: number;
44
- los?: number;
45
- luck?: number;
46
- accuracy?: number;
47
- evasion?: number;
48
- range?: number;
49
- radius?: number;
50
- cost?: number;
51
- improvable?: boolean;
52
- ship_anti_air_resist?: number;
53
- fleet_anti_air_resist?: number;
54
- historical_aircraft_group?: number;
5
+ export interface MasterBattleDefinitions {
6
+ formation: NestedFormationDef[];
7
+ anti_air_cutin: AntiAirCutinDef[];
8
+ day_cutin: DayCutinDef[];
9
+ night_cutin: NightCutinDef[];
10
+ historical_bonuses?: HistoricalBonusDef[];
55
11
  }
56
12
 
57
13
  export interface FleetCutinReport<T> {
@@ -67,266 +23,183 @@ export interface FleetCutinAttackReport<T> extends AttackReport<T> {
67
23
  power_mod: number;
68
24
  }
69
25
 
70
- export type AswAttackType = "DepthCharge" | "Aerial";
26
+ export interface ActionReport<T> {
27
+ data: Record<string, AttackReport<T>>;
28
+ damage_state_density: Histogram<DamageState, number> | null;
29
+ is_active: boolean;
30
+ }
71
31
 
72
- export type ShellingType = "Normal" | "Aerial";
32
+ export type SpeedGroup = "A" | "B1" | "B2" | "C";
73
33
 
74
- export type NightAttackType = "Normal" | "Swordfish" | "Aerial";
34
+ export type CompiledEvaler = string;
75
35
 
76
- export type SupportShellingType = ShellingType;
36
+ export interface EquippabilityRule {
37
+ ship: CompiledEvaler;
38
+ keys?: string[];
39
+ include?: string;
40
+ exclude?: string;
41
+ }
77
42
 
78
- export type AttackType =
79
- | { t: "Asw"; c: AswAttackType }
80
- | { t: "Shelling"; c: ShellingType }
81
- | { t: "Night"; c: NightAttackType }
82
- | { t: "Torpedo" }
83
- | { t: "SupportShelling"; c: SupportShellingType };
43
+ export interface MasterEquippability {
44
+ equip_stype: MstStype[];
45
+ equip_exslot: number[];
46
+ equip_ship: Record<number, MstEquipShip>;
47
+ equip_exslot_ship: Record<number, MstEquipExslotShip>;
48
+ rules: EquippabilityRule[];
49
+ }
84
50
 
85
- export type DayPhaseAttackType =
86
- | { t: "Shelling"; c: ShellingType }
87
- | { t: "Asw"; c: AswAttackType };
51
+ export interface MstEquipExslotShip {
52
+ api_ctypes: Record<number, number> | null;
53
+ api_ship_ids: Record<number, number> | null;
54
+ api_stypes: Record<number, number> | null;
55
+ }
88
56
 
89
- export type NightPhaseAttackType =
90
- | { t: "Night"; c: NightAttackType }
91
- | { t: "Asw"; c: AswAttackType };
57
+ export type MstEquipShip = Record<number, MstEquipShipValue>;
92
58
 
93
- export type TorpedoAttackType = null;
59
+ export type MstEquipShipValue = "Null" | { GearIds: number[] };
94
60
 
95
- export type DayCutin =
96
- | "Zuiun"
97
- | "AirSea"
98
- | "MainMain"
99
- | "MainAp"
100
- | "MainRadar"
101
- | "MainSec"
102
- | "DoubleAttack"
103
- | "FBA"
104
- | "BBA"
105
- | "BA";
61
+ export interface MstStype {
62
+ api_id: number;
63
+ api_equip_type: Record<number, number>;
64
+ }
106
65
 
107
- export type NightCutin =
108
- | "MainTorpRadar"
109
- | "TorpLookoutRadar"
110
- | "TorpTsloTorp"
111
- | "TorpTsloDrum"
112
- | "NightZuiun2Radar"
113
- | "NightZuiun2"
114
- | "NightZuiunRadar"
115
- | "NightZuiun"
116
- | "DoubleAttack"
117
- | "TorpTorpMain"
118
- | "TorpTorpTorp"
119
- | "MainMainSec"
120
- | "MainMainMain"
121
- | "SubTorpTorp"
122
- | "SubRadarTorp"
123
- | "Cvci1_25"
124
- | "Cvci1_20"
125
- | "Cvci1_18"
126
- | "Photobomber";
66
+ export type Histogram<K extends keyof any, V> = Partial<Record<K, V>>;
127
67
 
128
- export type FleetCutin =
129
- | "NelsonTouch"
130
- | "NagatoClassCutin"
131
- | "ColoradoClassCutin"
132
- | "KongouClassCutin"
133
- | "Yamato2ShipCutin"
134
- | "Yamato3ShipCutin";
68
+ export type FhResult<T> = { Ok: T } | { Err: string };
135
69
 
136
- export type DayCutinLike = DayCutin | FleetCutin;
70
+ export interface AttackReport<T> {
71
+ style: T;
72
+ proc_rate: number | null;
73
+ attack_power: AttackPower | null;
74
+ attack_power_params: AttackPowerParams | null;
75
+ hits: number;
76
+ hit_rate: HitRate | null;
77
+ hit_rate_params: HitRateParams | null;
78
+ damage: DamageReport | null;
79
+ }
137
80
 
138
- export type NightCutinLike = NightCutin | FleetCutin;
81
+ export interface CompAntiAirAnalysis {
82
+ fleet_adjusted_anti_air: number;
83
+ ships: AntiAirReport[];
84
+ anti_air_cutin_chance: [number, number][];
85
+ }
139
86
 
140
- export type GearType =
141
- | "Unknown"
142
- | "SmallMainGun"
143
- | "MediumMainGun"
144
- | "LargeMainGun"
145
- | "SecondaryGun"
146
- | "Torpedo"
147
- | "CbFighter"
148
- | "CbDiveBomber"
149
- | "CbTorpedoBomber"
150
- | "CbRecon"
151
- | "ReconSeaplane"
152
- | "SeaplaneBomber"
153
- | "SmallRadar"
154
- | "LargeRadar"
155
- | "Sonar"
156
- | "DepthCharge"
157
- | "ExtraArmor"
158
- | "Engine"
159
- | "AntiAirShell"
160
- | "ApShell"
161
- | "VtFuze"
162
- | "AntiAirGun"
163
- | "MidgetSubmarine"
164
- | "EmergencyRepair"
165
- | "LandingCraft"
166
- | "Rotorcraft"
167
- | "AntiSubPatrolAircraft"
168
- | "MediumArmor"
169
- | "LargeArmor"
170
- | "Searchlight"
171
- | "SupplyContainer"
172
- | "ShipRepairFacility"
173
- | "SubmarineTorpedo"
174
- | "Starshell"
175
- | "CommandFacility"
176
- | "AviationPersonnel"
177
- | "AntiAirFireDirector"
178
- | "AntiGroundEquipment"
179
- | "LargeMainGun2"
180
- | "ShipPersonnel"
181
- | "LargeSonar"
182
- | "LargeFlyingBoat"
183
- | "LargeSearchlight"
184
- | "CombatRation"
185
- | "Supplies"
186
- | "SeaplaneFighter"
187
- | "AmphibiousTank"
188
- | "LbAttacker"
189
- | "LbFighter"
190
- | "LbRecon"
191
- | "TransportationMaterial"
192
- | "SubmarineEquipment"
193
- | "LandingForce"
194
- | "LargeLbAircraft"
195
- | "SurfaceEquipment"
196
- | "JetFighter"
197
- | "JetFighterBomber"
198
- | "JetTorpedoBomber"
199
- | "JetRecon"
200
- | "LargeRadar2"
201
- | "CbRecon2"
202
- | "SecondaryGun2";
87
+ export interface AntiAirReport {
88
+ ship_id: number;
89
+ role: Role;
90
+ index: number;
91
+ adjusted_anti_air: number | null;
92
+ proportional_shotdown_rate: number | null;
93
+ fixed_shotdown_number: number | null;
94
+ guaranteed: number | null;
95
+ anti_air_cutin_chance: [number, number][];
96
+ anti_air_propellant_barrage_chance: number | null;
97
+ }
203
98
 
204
- export type GearCategory =
205
- | "Fighter"
206
- | "Bomber"
207
- | "Recon"
208
- | "MainGun"
209
- | "Secondary"
210
- | "Torpedo"
211
- | "AntiSub"
212
- | "Radar"
213
- | "Landing"
214
- | "Ration"
215
- | "LandBased"
216
- | "Misc";
99
+ export type AirWaveType = "Jet" | "LandBase" | "Carrier";
217
100
 
218
- export interface HitRate {
219
- normal: number;
220
- critical: number;
221
- total: number;
101
+ export interface AttackPowerModifier {
102
+ a?: number;
103
+ b?: number;
222
104
  }
223
105
 
224
- export interface HitRateParams {
225
- accuracy_term: number;
226
- evasion_term: number;
227
- target_morale_mod: number;
228
- critical_rate_constant: number;
229
- critical_percentage_bonus: number;
230
- hit_percentage_bonus: number;
106
+ export interface SpecialEnemyModifiers {
107
+ precap_general_mod: AttackPowerModifier;
108
+ stype_mod: AttackPowerModifier;
109
+ landing_craft_synergy_mod: AttackPowerModifier;
110
+ toku_daihatsu_tank_mod: AttackPowerModifier;
111
+ m4a1dd_mod: AttackPowerModifier;
112
+ honi_mod: AttackPowerModifier;
113
+ toku_daihatsu_chiha_mod: AttackPowerModifier;
114
+ toku_daihatsu_chiha_kai_mod: AttackPowerModifier;
115
+ t4_tank_group_mod: AttackPowerModifier;
116
+ t4_tank_kai_mod: AttackPowerModifier;
117
+ postcap_general_mod: AttackPowerModifier;
118
+ pt_mod: AttackPowerModifier | null;
231
119
  }
232
120
 
233
- export interface AttackPower {
234
- precap: number;
235
- is_capped: boolean;
236
- capped: number;
237
- normal: number;
238
- critical: number;
239
- armor_penetration: number;
240
- remaining_ammo_mod: number;
121
+ export interface CustomPowerModifiers {
122
+ precap_mod?: AttackPowerModifier;
123
+ postcap_mod?: AttackPowerModifier;
124
+ basic_power_mod?: AttackPowerModifier;
125
+ historical_mod?: AttackPowerModifier;
241
126
  }
242
127
 
243
- export interface AttackPowerParams {
244
- is_cutin: boolean;
245
- basic: number;
246
- cap: number;
247
- precap_mod: AttackPowerModifier;
248
- postcap_mod: AttackPowerModifier;
249
- ap_shell_mod: number | null;
250
- aerial_power: number | null;
251
- proficiency_critical_mod: number;
252
- armor_penetration: number;
253
- remaining_ammo_mod: number;
254
- balloon_mod: number;
255
- special_enemy_mods: SpecialEnemyModifiers;
256
- historical_mod: AttackPowerModifier;
257
- custom_mods: CustomPowerModifiers;
128
+ export interface FormationCombatModifiersDef {
129
+ power_mod?: number;
130
+ accuracy_mod?: number;
131
+ evasion_mod?: number;
258
132
  }
259
133
 
260
- export interface ActionReport<T> {
261
- data: Record<string, AttackReport<T>>;
262
- damage_state_density: Histogram<DamageState, number> | null;
263
- is_active: boolean;
134
+ export interface FormationDef {
135
+ tag: Formation;
136
+ protection_rate: number | null;
137
+ fleet_anti_air_mod: number;
138
+ shelling: FormationCombatModifiersDef;
139
+ torpedo: FormationCombatModifiersDef;
140
+ asw: FormationCombatModifiersDef;
141
+ night: FormationCombatModifiersDef;
142
+ support_shelling: FormationCombatModifiersDef;
264
143
  }
265
144
 
266
- export type DamageState = "Normal" | "Shouha" | "Chuuha" | "Taiha" | "Sunk";
267
-
268
- export type FleetType = "Main" | "Escort" | "RouteSup" | "BossSup";
145
+ export type NestedFormationDef =
146
+ | FormationDef
147
+ | { top_half: FormationDef; bottom_half: FormationDef };
269
148
 
270
- export type SlotSizeVec = (number | null)[];
149
+ export interface AntiAirCutinDef {
150
+ id: number;
151
+ type_factor: number | null;
152
+ multiplier: number | null;
153
+ guaranteed: number | null;
154
+ sequential: boolean | null;
155
+ }
271
156
 
272
- export interface AttackReport<T> {
273
- style: T;
274
- proc_rate: number | null;
275
- attack_power: AttackPower | null;
276
- attack_power_params: AttackPowerParams | null;
157
+ export interface DayCutinDef {
158
+ tag: DayCutin;
277
159
  hits: number;
278
- hit_rate: HitRate | null;
279
- hit_rate_params: HitRateParams | null;
280
- damage: DamageReport | null;
160
+ type_factor: number | null;
161
+ power_mod: number | null;
162
+ accuracy_mod: number | null;
281
163
  }
282
164
 
283
- export type AirWaveType = "Jet" | "LandBase" | "Carrier";
284
-
285
- export type AirState =
286
- | "AirSupremacy"
287
- | "AirSuperiority"
288
- | "AirParity"
289
- | "AirDenial"
290
- | "AirIncapability";
291
-
292
- export type AirStateRank = "Rank0" | "Rank1" | "Rank2" | "Rank3";
293
-
294
- export interface BattleConditions {
295
- org_type: OrgType;
296
- role: Role;
297
- ship_index: number;
298
- fleet_len: number;
299
- formation: Formation;
300
- fleet_los_mod: number | null;
301
- night_conditions: NightFleetConditions;
165
+ export interface HistoricalBonusDef {
166
+ map?: number;
167
+ node?: CompiledEvaler;
168
+ phase?: number;
169
+ debuff?: boolean;
170
+ ship?: CompiledEvaler;
171
+ enemy?: CompiledEvaler;
172
+ power_mod?: AttackPowerModifier;
173
+ armor_penetration?: number;
174
+ accuracy_mod?: number;
175
+ evasion_mod?: number;
302
176
  }
303
177
 
304
- export interface NightConditions {
305
- player?: NightFleetConditions;
306
- enemy?: NightFleetConditions;
178
+ export interface HistoricalParams {
179
+ power_mod: AttackPowerModifier;
180
+ armor_penetration: number;
181
+ accuracy_mod: number;
182
+ target_evasion_mod: number;
307
183
  }
308
184
 
309
- export interface NightFleetConditions {
310
- night_contact_rank?: ContactRank | null;
311
- starshell_index?: number | null;
312
- searchlight_index?: number | null;
313
- activates_large_searchlight?: boolean;
185
+ export interface NightCutinDef {
186
+ tag: NightCutin;
187
+ hits: number;
188
+ type_factor: number | null;
189
+ power_mod: number | null;
190
+ accuracy_mod: number | null;
314
191
  }
315
192
 
316
- export type Engagement = "GreenT" | "Parallel" | "HeadOn" | "RedT";
317
-
318
- export interface FleetState {
319
- id?: string;
320
- len?: number;
321
- s1?: ShipState;
322
- s2?: ShipState;
323
- s3?: ShipState;
324
- s4?: ShipState;
325
- s5?: ShipState;
326
- s6?: ShipState;
327
- s7?: ShipState;
193
+ export interface BattleDefinitions {
194
+ formation: Record<Formation, NestedFormationDef>;
195
+ anti_air_cutin: Record<number, AntiAirCutinDef>;
196
+ day_cutin: Record<DayCutin, DayCutinDef>;
197
+ night_cutin: Record<NightCutin, NightCutinDef>;
198
+ historical_bonuses: HistoricalBonusDef[];
328
199
  }
329
200
 
201
+ export type ContactRank = "Rank1" | "Rank2" | "Rank3";
202
+
330
203
  export interface GearState {
331
204
  id?: string;
332
205
  gear_id: number;
@@ -343,118 +216,77 @@ export interface GearVecState {
343
216
  gx?: GearState;
344
217
  }
345
218
 
346
- export type NodeId = string;
347
-
348
- export interface NodeState {
349
- map?: number;
350
- node?: NodeId;
351
- phase?: number;
352
- debuff?: boolean;
353
- disable_historical_mod?: boolean;
354
- landing_battle?: boolean;
219
+ export interface MoveShipPayload {
220
+ current: [string, string, ShipKey];
221
+ target: [string | null, string, ShipKey];
355
222
  }
356
223
 
357
- export type OrgType =
358
- | "Single"
359
- | "CarrierTaskForce"
360
- | "SurfaceTaskForce"
361
- | "TransportEscort"
362
- | "EnemySingle"
363
- | "EnemyCombined";
364
-
365
- export interface ShipPosition {
366
- org_type?: OrgType;
367
- fleet_type?: FleetType;
368
- fleet_len?: number;
369
- index?: number;
370
- }
224
+ export type GearVecInput = GearInput[];
371
225
 
372
- export interface SlotSizeVecState {
373
- ss1?: number;
374
- ss2?: number;
375
- ss3?: number;
376
- ss4?: number;
377
- ss5?: number;
226
+ export interface GearInput {
227
+ gear_id: number;
228
+ types: GearTypeIdArray;
229
+ firepower: number;
230
+ torpedo: number;
231
+ anti_air: number;
232
+ armor: number;
233
+ evasion: number;
234
+ asw: number;
235
+ los: number;
236
+ bombing: number;
237
+ accuracy: number;
238
+ range: number;
239
+ radius: number;
240
+ stars: number;
241
+ ace: number;
378
242
  }
379
243
 
380
- export interface ShipState extends GearVecState, SlotSizeVecState {
381
- id?: string;
244
+ export interface ShipInput {
382
245
  ship_id: number;
383
- level?: number;
384
- current_hp?: number;
385
- morale?: number;
386
- ammo?: number;
387
- fuel?: number;
388
- max_hp_mod?: number;
389
- firepower_mod?: number;
390
- torpedo_mod?: number;
391
- armor_mod?: number;
392
- anti_air_mod?: number;
393
- evasion_mod?: number;
394
- asw_mod?: number;
395
- los_mod?: number;
396
- luck_mod?: number;
397
- day_gunfit_accuracy?: number;
398
- night_gunfit_accuracy?: number;
399
- custom_power_mods?: CustomPowerModifiers;
246
+ ctype: number;
247
+ stype: number;
248
+ yomi: string;
400
249
  }
401
250
 
402
- export type ShipKey = "s1" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7";
403
-
404
- export interface MasterData extends MasterBattleDefinitions {
405
- created_at: number;
406
- gears: MasterGear[];
407
- gear_attrs: MasterAttrRule<GearAttr>[];
408
- ships: MasterShip[];
409
- ship_attrs: MasterAttrRule<ShipAttr>[];
410
- ibonuses: MasterIBonuses;
411
- equippability: MasterEquippability;
251
+ export interface EBonuses {
252
+ firepower: number;
253
+ torpedo: number;
254
+ anti_air: number;
255
+ armor: number;
256
+ evasion: number;
257
+ asw: number;
258
+ los: number;
259
+ bombing: number;
260
+ accuracy: number;
261
+ range: number;
412
262
  }
413
263
 
414
- export interface NationalityDef {
415
- id: number;
416
- ctypes: number[];
264
+ export interface SimulatorResult {
265
+ items: SimulatorResultItem[];
266
+ sunk_vec: [number, number, number][];
417
267
  }
418
268
 
419
- export interface MasterAttrRule<T> {
420
- tag: T;
421
- name: string;
422
- expr: CompiledEvaler;
269
+ export interface SimulatorResultItem {
270
+ id: string;
271
+ fleet_type: FleetType;
272
+ index: number;
273
+ damage_state_map: Record<DamageState, number>;
423
274
  }
424
275
 
425
- export interface MasterShip {
426
- ship_id: number;
427
- name: string;
428
- yomi: string;
429
- stype: number;
430
- ctype: number;
431
- nationality?: number;
432
- sort_id?: number;
433
- max_hp: StatInterval;
434
- firepower: StatInterval;
435
- armor: StatInterval;
436
- torpedo: StatInterval;
437
- evasion: StatInterval;
438
- anti_air: StatInterval;
439
- asw: StatInterval;
440
- los: StatInterval;
441
- luck: StatInterval;
442
- torpedo_accuracy?: number;
443
- basic_evasion_term?: number;
444
- speed: number;
445
- range?: number;
446
- fuel?: number;
447
- ammo?: number;
448
- next_id?: number;
449
- next_level?: number;
450
- slotnum: number;
451
- slots: SlotSizeVec;
452
- stock: GearState[];
453
- speed_group?: SpeedGroup;
454
- useful?: boolean;
276
+ export interface HitRate {
277
+ normal: number;
278
+ critical: number;
279
+ total: number;
455
280
  }
456
281
 
457
- export type StatInterval = [number | null, number | null];
282
+ export interface HitRateParams {
283
+ accuracy_term: number;
284
+ evasion_term: number;
285
+ target_morale_mod: number;
286
+ critical_rate_constant: number;
287
+ critical_percentage_bonus: number;
288
+ hit_percentage_bonus: number;
289
+ }
458
290
 
459
291
  export interface AttackAnalyzerShipConfig
460
292
  extends ShipConditions,
@@ -463,140 +295,69 @@ export interface AttackAnalyzerShipConfig
463
295
  fleet_los_mod?: number | null;
464
296
  }
465
297
 
466
- export type GearAttr =
467
- | "Unknown"
468
- | "HighAngleMount"
469
- | "NightFighter"
470
- | "NightAttacker"
471
- | "HeavyBomber"
472
- | "NightRecon"
473
- | "MainGun"
474
- | "Radar"
475
- | "SurfaceRadar"
476
- | "AirRadar"
477
- | "DepthChargeProjector"
478
- | "SynergisticDepthCharge"
479
- | "AntiSubMortar"
480
- | "AntiSubWeapon"
481
- | "ApDepthCharge"
482
- | "AntiSubAircraft"
483
- | "LateModelBowTorpedo"
484
- | "Seaplane"
485
- | "CbAircraft"
486
- | "LbAircraft"
487
- | "JetAircraft"
488
- | "Fighter"
489
- | "Recon"
490
- | "ObservationSeaplane"
491
- | "CbFighterBomber"
492
- | "AntiInstDiveBomber"
493
- | "CbSwordfish"
494
- | "SemiNightPlane"
495
- | "HighAltitudeInterceptor";
298
+ export type AirSquadronMode = "Sortie" | "AirDefense";
496
299
 
497
- export interface MoveShipPayload {
498
- current: [string, string, ShipKey];
499
- target: [string | null, string, ShipKey];
300
+ export interface AirSquadronState extends GearVecState, SlotSizeVecState {
301
+ id?: string;
302
+ mode?: AirSquadronMode;
500
303
  }
501
304
 
502
- export type GearVecInput = GearInput[];
503
-
504
- export interface GearInput {
505
- gear_id: number;
506
- types: GearTypeIdArray;
507
- firepower: number;
508
- torpedo: number;
509
- anti_air: number;
510
- armor: number;
511
- evasion: number;
512
- asw: number;
513
- los: number;
514
- bombing: number;
515
- accuracy: number;
516
- range: number;
517
- radius: number;
518
- stars: number;
519
- ace: number;
305
+ export interface ShellingStyle {
306
+ tag: "ShellingStyle";
307
+ attack_type: ShellingType;
308
+ cutin: DayCutinLike | null;
309
+ power_mod: number;
310
+ accuracy_mod: number;
311
+ hits: number;
520
312
  }
521
313
 
522
- export interface ShipInput {
523
- ship_id: number;
524
- ctype: number;
525
- stype: number;
526
- yomi: string;
314
+ export interface NightAttackStyle {
315
+ tag: "NightAttackStyle";
316
+ attack_type: NightAttackType;
317
+ cutin: NightCutinLike | null;
318
+ power_mod: number;
319
+ accuracy_mod: number;
320
+ hits: number;
527
321
  }
528
322
 
529
- export interface EBonuses {
530
- firepower: number;
531
- torpedo: number;
532
- anti_air: number;
533
- armor: number;
534
- evasion: number;
535
- asw: number;
536
- los: number;
537
- bombing: number;
538
- accuracy: number;
539
- range: number;
323
+ export interface AswAttackStyle {
324
+ tag: "AswAttackStyle";
325
+ attack_type: AswAttackType;
540
326
  }
541
327
 
542
- export interface NodeAttackAnalyzerShipConfig extends NightFleetConditions {
543
- formation?: Formation;
328
+ export interface TorpedoAttackStyle {
329
+ tag: "TorpedoAttackStyle";
330
+ attack_type: TorpedoAttackType;
544
331
  }
545
332
 
546
- export interface NodeAttackAnalyzerConfig {
547
- air_state?: AirState;
548
- engagement?: Engagement;
549
- node_state?: NodeState;
550
- left?: NodeAttackAnalyzerShipConfig;
551
- right?: NodeAttackAnalyzerShipConfig;
552
- }
333
+ export type DayPhaseAttackStyle = ShellingStyle | AswAttackStyle;
553
334
 
554
- export interface NodeAttackAnalysis {
555
- left: AttackAnalysis;
556
- right: AttackAnalysis;
557
- shelling_fleet_cutin: FleetCutinReport<ShellingStyle>[];
558
- night_fleet_cutin: FleetCutinReport<NightAttackStyle>[];
559
- }
335
+ export type NightPhaseAttackStyle = NightAttackStyle | AswAttackStyle;
560
336
 
561
- export interface NightContactChance {
562
- rank1: number;
563
- rank2: number;
564
- rank3: number;
337
+ export interface SupportShellingStyle {
338
+ tag: "SupportShellingStyle";
339
+ attack_type: SupportShellingType;
565
340
  }
566
341
 
567
- export interface CompNightCutinAnalysis {
568
- night_contact_chance: NightContactChance;
569
- ships: ShipNightCutinAnalysis[];
570
- }
342
+ export type DamageState = "Normal" | "Shouha" | "Chuuha" | "Taiha" | "Sunk";
571
343
 
572
- export interface ShipNightCutinAnalysis {
344
+ export type FleetType = "Main" | "Escort" | "RouteSup" | "BossSup";
345
+
346
+ export interface ShipMeta {
347
+ id: string;
573
348
  ship_id: number;
574
- index: number;
575
- normal: NightCutinActionReport;
576
- chuuha: NightCutinActionReport;
577
349
  }
578
350
 
579
- export interface NightCutinActionReport
580
- extends ActionReport<NightPhaseAttackStyle> {
581
- cutin_term: number | null;
351
+ export interface FleetMeta {
352
+ id: string;
353
+ len: number;
354
+ ships: [string, ShipMeta | null][];
582
355
  }
583
356
 
584
- export interface AttackAnalysis {
585
- attacker_is_player: boolean;
586
- attacker_ship_id: number;
587
- target_ship_id: number;
588
- historical_params: HistoricalParams;
589
- day: ActionReport<DayPhaseAttackStyle>;
590
- night: ActionReport<NightPhaseAttackStyle>;
591
- closing_torpedo: ActionReport<TorpedoAttackStyle>;
592
- opening_asw: ActionReport<AswAttackStyle>;
593
- support_shelling: ActionReport<SupportShellingStyle>;
357
+ export interface CompMeta {
358
+ fleets: Record<FleetType, FleetMeta>;
594
359
  }
595
360
 
596
- export type ContactRank = "Rank1" | "Rank2" | "Rank3";
597
-
598
- export type MoraleState = "Sparkle" | "Normal" | "Orange" | "Red";
599
-
600
361
  export interface OrgState {
601
362
  id?: string;
602
363
  f1?: FleetState;
@@ -615,179 +376,96 @@ export interface OrgState {
615
376
 
616
377
  export type FleetKey = "f1" | "f2" | "f3" | "f4";
617
378
 
618
- export type Role = "Main" | "Escort";
619
-
620
- export type ShipAttr =
621
- | "Unknown"
622
- | "NightCarrier"
623
- | "Installation"
624
- | "RoyalNavy"
625
- | "Kai2"
626
- | "TurbineSpeedBonus"
627
- | "NewModelBoilerSpeedBonus"
628
- | "Pillbox"
629
- | "IsolatedIsland"
630
- | "HarbourSummerPrincess"
631
- | "SupplyDepot"
632
- | "NewSupplyDepot"
633
- | "PtImp"
634
- | "BattleshipSummerPrincess"
635
- | "HeavyCruiserSummerPrincess"
636
- | "AnchorageWaterDemonVacationMode"
637
- | "FrenchBattleshipPrincess"
638
- | "DockPrincess"
639
- | "SummerAircraftCarrierDemon";
379
+ export interface SlotSizeVecState {
380
+ ss1?: number;
381
+ ss2?: number;
382
+ ss3?: number;
383
+ ss4?: number;
384
+ ss5?: number;
385
+ }
640
386
 
641
- export interface ShipConditions extends ShipPosition {
642
- formation?: Formation;
643
- amagiri_index?: number | null;
387
+ export interface ShipState extends GearVecState, SlotSizeVecState {
388
+ id?: string;
389
+ ship_id: number;
390
+ level?: number;
391
+ current_hp?: number;
392
+ morale?: number;
393
+ ammo?: number;
394
+ fuel?: number;
395
+ max_hp_mod?: number;
396
+ firepower_mod?: number;
397
+ torpedo_mod?: number;
398
+ armor_mod?: number;
399
+ anti_air_mod?: number;
400
+ evasion_mod?: number;
401
+ asw_mod?: number;
402
+ los_mod?: number;
403
+ luck_mod?: number;
404
+ day_gunfit_accuracy?: number;
405
+ night_gunfit_accuracy?: number;
406
+ custom_power_mods?: CustomPowerModifiers;
644
407
  }
645
408
 
646
- export type ShipCategory =
647
- | "Battleship"
648
- | "AircraftCarrier"
649
- | "HeavyCruiser"
650
- | "LightCruiser"
651
- | "Destroyer"
652
- | "CoastalDefenseShip"
653
- | "Submarine"
654
- | "AuxiliaryShip";
655
-
656
- export type ShipType =
657
- | "Unknown"
658
- | "DE"
659
- | "DD"
660
- | "CL"
661
- | "CLT"
662
- | "CA"
663
- | "CAV"
664
- | "CVL"
665
- | "FBB"
666
- | "BB"
667
- | "BBV"
668
- | "CV"
669
- | "XBB"
670
- | "SS"
671
- | "SSV"
672
- | "AP"
673
- | "AV"
674
- | "LHA"
675
- | "CVB"
676
- | "AR"
677
- | "AS"
678
- | "CT"
679
- | "AO";
409
+ export type ShipKey = "s1" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7";
680
410
 
681
411
  export type Side = "Player" | "Enemy";
682
412
 
683
413
  export type Align = "Left" | "Right";
684
414
 
685
- export type SpecialEnemyType =
686
- | "None"
687
- | "SoftSkinned"
688
- | "Pillbox"
689
- | "IsolatedIsland"
690
- | "SupplyDepot"
691
- | "NewSupplyDepot"
692
- | "HarbourSummerPrincess"
693
- | "PtImp"
694
- | "BattleshipSummerPrincess"
695
- | "HeavyCruiserSummerPrincess"
696
- | "FrenchBattleshipPrincess"
697
- | "AnchorageWaterDemonVacationMode"
698
- | "DockPrincess"
699
- | "SummerAircraftCarrierDemon";
700
-
701
- export type Histogram<K extends keyof any, V> = Partial<Record<K, V>>;
702
-
703
- export interface SimulatorResult {
704
- items: SimulatorResultItem[];
705
- sunk_vec: [number, number, number][];
706
- }
707
-
708
- export interface SimulatorResultItem {
709
- id: string;
710
- fleet_type: FleetType;
711
- index: number;
712
- damage_state_map: Record<DamageState, number>;
713
- }
714
-
715
- export interface MasterBattleDefinitions {
716
- formation: NestedFormationDef[];
717
- anti_air_cutin: AntiAirCutinDef[];
718
- day_cutin: DayCutinDef[];
719
- night_cutin: NightCutinDef[];
720
- historical_bonuses?: HistoricalBonusDef[];
721
- }
722
-
723
- export interface DamageReport {
724
- miss_damage_min: number;
725
- miss_damage_max: number;
726
- normal_damage_min: number;
727
- normal_damage_max: number;
728
- critical_damage_min: number;
729
- critical_damage_max: number;
730
- normal_scratch_rate: number;
731
- critical_scratch_rate: number;
732
- damage_density: Histogram<number, number>;
733
- damage_state_density: Histogram<DamageState, number>;
734
- }
735
-
736
- export interface ContactAnalysis {
737
- single: DayContactChance[] | null;
738
- combined: DayContactChance[] | null;
739
- }
740
-
741
- export interface DayContactChance {
742
- air_state: AirState;
743
- trigger_rate: number;
744
- rank3: number;
745
- rank2: number;
746
- rank1: number;
747
- total: number;
748
- }
749
-
750
- export interface AttackPowerModifier {
751
- a?: number;
752
- b?: number;
415
+ export interface MasterData extends MasterBattleDefinitions {
416
+ created_at: number;
417
+ gears: MasterGear[];
418
+ gear_attrs: MasterAttrRule<GearAttr>[];
419
+ ships: MasterShip[];
420
+ ship_attrs: MasterAttrRule<ShipAttr>[];
421
+ ibonuses: MasterIBonuses;
422
+ equippability: MasterEquippability;
753
423
  }
754
424
 
755
- export interface SpecialEnemyModifiers {
756
- precap_general_mod: AttackPowerModifier;
757
- stype_mod: AttackPowerModifier;
758
- landing_craft_synergy_mod: AttackPowerModifier;
759
- toku_daihatsu_tank_mod: AttackPowerModifier;
760
- m4a1dd_mod: AttackPowerModifier;
761
- honi_mod: AttackPowerModifier;
762
- toku_daihatsu_chiha_mod: AttackPowerModifier;
763
- toku_daihatsu_chiha_kai_mod: AttackPowerModifier;
764
- t4_tank_group_mod: AttackPowerModifier;
765
- t4_tank_kai_mod: AttackPowerModifier;
766
- postcap_general_mod: AttackPowerModifier;
767
- pt_mod: AttackPowerModifier | null;
425
+ export interface NationalityDef {
426
+ id: number;
427
+ ctypes: number[];
768
428
  }
769
429
 
770
- export interface CustomPowerModifiers {
771
- precap_mod?: AttackPowerModifier;
772
- postcap_mod?: AttackPowerModifier;
773
- basic_power_mod?: AttackPowerModifier;
774
- historical_mod?: AttackPowerModifier;
430
+ export interface MasterAttrRule<T> {
431
+ tag: T;
432
+ name: string;
433
+ expr: CompiledEvaler;
775
434
  }
776
435
 
777
- export interface ShipMeta {
778
- id: string;
436
+ export interface MasterShip {
779
437
  ship_id: number;
438
+ name: string;
439
+ yomi: string;
440
+ stype: number;
441
+ ctype: number;
442
+ nationality?: number;
443
+ sort_id?: number;
444
+ max_hp: StatInterval;
445
+ firepower: StatInterval;
446
+ armor: StatInterval;
447
+ torpedo: StatInterval;
448
+ evasion: StatInterval;
449
+ anti_air: StatInterval;
450
+ asw: StatInterval;
451
+ los: StatInterval;
452
+ luck: StatInterval;
453
+ torpedo_accuracy?: number;
454
+ basic_evasion_term?: number;
455
+ speed: number;
456
+ range?: number;
457
+ fuel?: number;
458
+ ammo?: number;
459
+ next_id?: number;
460
+ next_level?: number;
461
+ slotnum: number;
462
+ slots: SlotSizeVec;
463
+ stock: GearState[];
464
+ speed_group?: SpeedGroup;
465
+ useful?: boolean;
780
466
  }
781
467
 
782
- export interface FleetMeta {
783
- id: string;
784
- len: number;
785
- ships: [string, ShipMeta | null][];
786
- }
787
-
788
- export interface CompMeta {
789
- fleets: Record<FleetType, FleetMeta>;
790
- }
468
+ export type StatInterval = [number | null, number | null];
791
469
 
792
470
  export interface MasterIBonuses {
793
471
  shelling_power: MasterIBonusRule[];
@@ -814,35 +492,402 @@ export interface MasterIBonusRule {
814
492
  formula: CompiledEvaler;
815
493
  }
816
494
 
817
- export interface EquippabilityRule {
818
- ship: CompiledEvaler;
819
- keys?: string[];
820
- include?: string;
821
- exclude?: string;
822
- }
823
-
824
- export interface MasterEquippability {
825
- equip_stype: EquipStype[];
826
- equip_exslot: number[];
827
- equip_ship: MstEquipShip[];
828
- equip_exslot_ship: Record<number, MstEquipExslotShip>;
829
- rules: EquippabilityRule[];
830
- }
495
+ export type GearType =
496
+ | "Unknown"
497
+ | "SmallMainGun"
498
+ | "MediumMainGun"
499
+ | "LargeMainGun"
500
+ | "SecondaryGun"
501
+ | "Torpedo"
502
+ | "CbFighter"
503
+ | "CbDiveBomber"
504
+ | "CbTorpedoBomber"
505
+ | "CbRecon"
506
+ | "ReconSeaplane"
507
+ | "SeaplaneBomber"
508
+ | "SmallRadar"
509
+ | "LargeRadar"
510
+ | "Sonar"
511
+ | "DepthCharge"
512
+ | "ExtraArmor"
513
+ | "Engine"
514
+ | "AntiAirShell"
515
+ | "ApShell"
516
+ | "VtFuze"
517
+ | "AntiAirGun"
518
+ | "MidgetSubmarine"
519
+ | "EmergencyRepair"
520
+ | "LandingCraft"
521
+ | "Rotorcraft"
522
+ | "AntiSubPatrolAircraft"
523
+ | "MediumArmor"
524
+ | "LargeArmor"
525
+ | "Searchlight"
526
+ | "SupplyContainer"
527
+ | "ShipRepairFacility"
528
+ | "SubmarineTorpedo"
529
+ | "Starshell"
530
+ | "CommandFacility"
531
+ | "AviationPersonnel"
532
+ | "AntiAirFireDirector"
533
+ | "AntiGroundEquipment"
534
+ | "LargeMainGun2"
535
+ | "ShipPersonnel"
536
+ | "LargeSonar"
537
+ | "LargeFlyingBoat"
538
+ | "LargeSearchlight"
539
+ | "CombatRation"
540
+ | "Supplies"
541
+ | "SeaplaneFighter"
542
+ | "AmphibiousTank"
543
+ | "LbAttacker"
544
+ | "LbFighter"
545
+ | "LbRecon"
546
+ | "TransportationMaterial"
547
+ | "SubmarineEquipment"
548
+ | "LandingForce"
549
+ | "LargeLbAircraft"
550
+ | "SurfaceEquipment"
551
+ | "JetFighter"
552
+ | "JetFighterBomber"
553
+ | "JetTorpedoBomber"
554
+ | "JetRecon"
555
+ | "LargeRadar2"
556
+ | "CbRecon2"
557
+ | "SecondaryGun2";
831
558
 
832
- export interface MstEquipExslotShip {
833
- api_ctypes: Record<number, number> | null;
834
- api_ship_ids: Record<number, number> | null;
835
- api_stypes: Record<number, number> | null;
559
+ export type GearCategory =
560
+ | "Fighter"
561
+ | "Bomber"
562
+ | "Recon"
563
+ | "MainGun"
564
+ | "Secondary"
565
+ | "Torpedo"
566
+ | "AntiSub"
567
+ | "Radar"
568
+ | "Landing"
569
+ | "Ration"
570
+ | "LandBased"
571
+ | "Misc";
572
+
573
+ export type ShipAttr =
574
+ | "Unknown"
575
+ | "NightCarrier"
576
+ | "Installation"
577
+ | "RoyalNavy"
578
+ | "Kai2"
579
+ | "TurbineSpeedBonus"
580
+ | "NewModelBoilerSpeedBonus"
581
+ | "Pillbox"
582
+ | "IsolatedIsland"
583
+ | "HarbourSummerPrincess"
584
+ | "SupplyDepot"
585
+ | "NewSupplyDepot"
586
+ | "PtImp"
587
+ | "BattleshipSummerPrincess"
588
+ | "HeavyCruiserSummerPrincess"
589
+ | "AnchorageWaterDemonVacationMode"
590
+ | "FrenchBattleshipPrincess"
591
+ | "DockPrincess"
592
+ | "SummerAircraftCarrierDemon";
593
+
594
+ export type ShipCategory =
595
+ | "Battleship"
596
+ | "AircraftCarrier"
597
+ | "HeavyCruiser"
598
+ | "LightCruiser"
599
+ | "Destroyer"
600
+ | "CoastalDefenseShip"
601
+ | "Submarine"
602
+ | "AuxiliaryShip";
603
+
604
+ export type ShipType =
605
+ | "Unknown"
606
+ | "DE"
607
+ | "DD"
608
+ | "CL"
609
+ | "CLT"
610
+ | "CA"
611
+ | "CAV"
612
+ | "CVL"
613
+ | "FBB"
614
+ | "BB"
615
+ | "BBV"
616
+ | "CV"
617
+ | "XBB"
618
+ | "SS"
619
+ | "SSV"
620
+ | "AP"
621
+ | "AV"
622
+ | "LHA"
623
+ | "CVB"
624
+ | "AR"
625
+ | "AS"
626
+ | "CT"
627
+ | "AO";
628
+
629
+ export type GearTypeIdArray = [number, number, number, number, number];
630
+
631
+ export interface SupportShellingSimulatorParams {
632
+ attacker_formation?: Formation;
633
+ target_formation?: Formation;
634
+ engagement: Engagement;
635
+ node_state: NodeState;
636
+ }
637
+
638
+ export interface ShipAnalyzerConfig {
639
+ air_state?: AirState;
640
+ engagement?: Engagement;
641
+ left?: AttackAnalyzerShipConfig;
642
+ right?: AttackAnalyzerShipConfig;
643
+ }
644
+
645
+ export type Engagement = "GreenT" | "Parallel" | "HeadOn" | "RedT";
646
+
647
+ export type SingleFormation =
648
+ | "LineAhead"
649
+ | "DoubleLine"
650
+ | "Diamond"
651
+ | "Echelon"
652
+ | "LineAbreast"
653
+ | "Vanguard";
654
+
655
+ export type CombinedFormation =
656
+ | "Cruising1"
657
+ | "Cruising2"
658
+ | "Cruising3"
659
+ | "Cruising4";
660
+
661
+ export type Formation = SingleFormation | CombinedFormation;
662
+
663
+ export type Role = "Main" | "Escort";
664
+
665
+ export interface CompAnalyzerConfig {
666
+ engagement: Engagement;
667
+ formation: Formation;
668
+ anti_air_cutin: number | null;
669
+ ship_anti_air_resist: number;
670
+ fleet_anti_air_resist: number;
671
+ left_night_fleet_conditions: NightFleetConditions;
672
+ right_night_fleet_conditions: NightFleetConditions;
673
+ }
674
+
675
+ export interface CompNightAnalysis {
676
+ night_cutin: CompNightCutinAnalysis;
677
+ fleet_cutin: FleetCutinReport<NightAttackStyle>[];
678
+ }
679
+
680
+ export interface CompDayAnalysis {
681
+ day_cutin: CompDayCutinAnalysis;
682
+ fleet_cutin: FleetCutinReport<ShellingStyle>[];
683
+ }
684
+
685
+ export interface CompAnalysis {
686
+ day: CompDayAnalysis;
687
+ night: CompNightAnalysis;
688
+ contact: ContactAnalysis;
689
+ anti_air: CompAntiAirAnalysis;
690
+ }
691
+
692
+ export interface MasterGear {
693
+ gear_id: number;
694
+ name: string;
695
+ types: GearTypeIdArray;
696
+ special_type?: number;
697
+ max_hp?: number;
698
+ firepower?: number;
699
+ armor?: number;
700
+ torpedo?: number;
701
+ anti_air?: number;
702
+ speed?: number;
703
+ bombing?: number;
704
+ asw?: number;
705
+ los?: number;
706
+ luck?: number;
707
+ accuracy?: number;
708
+ evasion?: number;
709
+ range?: number;
710
+ radius?: number;
711
+ cost?: number;
712
+ improvable?: boolean;
713
+ ship_anti_air_resist?: number;
714
+ fleet_anti_air_resist?: number;
715
+ historical_aircraft_group?: number;
716
+ }
717
+
718
+ export type AirState =
719
+ | "AirSupremacy"
720
+ | "AirSuperiority"
721
+ | "AirParity"
722
+ | "AirDenial"
723
+ | "AirIncapability";
724
+
725
+ export type AirStateRank = "Rank0" | "Rank1" | "Rank2" | "Rank3";
726
+
727
+ export interface BattleConditions {
728
+ org_type: OrgType;
729
+ role: Role;
730
+ ship_index: number;
731
+ fleet_len: number;
732
+ formation: Formation;
733
+ fleet_los_mod: number | null;
734
+ night_conditions: NightFleetConditions;
735
+ }
736
+
737
+ export interface NightConditions {
738
+ player?: NightFleetConditions;
739
+ enemy?: NightFleetConditions;
740
+ }
741
+
742
+ export interface NightFleetConditions {
743
+ night_contact_rank?: ContactRank | null;
744
+ starshell_index?: number | null;
745
+ searchlight_index?: number | null;
746
+ activates_large_searchlight?: boolean;
747
+ }
748
+
749
+ export type OrgType =
750
+ | "Single"
751
+ | "CarrierTaskForce"
752
+ | "SurfaceTaskForce"
753
+ | "TransportEscort"
754
+ | "EnemySingle"
755
+ | "EnemyCombined";
756
+
757
+ export interface ShipPosition {
758
+ org_type?: OrgType;
759
+ fleet_type?: FleetType;
760
+ fleet_len?: number;
761
+ index?: number;
762
+ }
763
+
764
+ export interface AttackPower {
765
+ precap: number;
766
+ is_capped: boolean;
767
+ capped: number;
768
+ normal: number;
769
+ critical: number;
770
+ armor_penetration: number;
771
+ remaining_ammo_mod: number;
772
+ }
773
+
774
+ export interface AttackPowerParams {
775
+ is_cutin: boolean;
776
+ basic: number;
777
+ cap: number;
778
+ precap_mod: AttackPowerModifier;
779
+ postcap_mod: AttackPowerModifier;
780
+ ap_shell_mod: number | null;
781
+ aerial_power: number | null;
782
+ proficiency_critical_mod: number;
783
+ armor_penetration: number;
784
+ remaining_ammo_mod: number;
785
+ balloon_mod: number;
786
+ special_enemy_mods: SpecialEnemyModifiers;
787
+ historical_mod: AttackPowerModifier;
788
+ custom_mods: CustomPowerModifiers;
789
+ }
790
+
791
+ export interface NodeAttackAnalyzerShipConfig extends NightFleetConditions {
792
+ formation?: Formation;
793
+ }
794
+
795
+ export interface NodeAttackAnalyzerConfig {
796
+ air_state?: AirState;
797
+ engagement?: Engagement;
798
+ node_state?: NodeState;
799
+ left?: NodeAttackAnalyzerShipConfig;
800
+ right?: NodeAttackAnalyzerShipConfig;
801
+ }
802
+
803
+ export interface NodeAttackAnalysis {
804
+ left: AttackAnalysis;
805
+ right: AttackAnalysis;
806
+ shelling_fleet_cutin: FleetCutinReport<ShellingStyle>[];
807
+ night_fleet_cutin: FleetCutinReport<NightAttackStyle>[];
808
+ }
809
+
810
+ export interface AttackAnalysis {
811
+ attacker_is_player: boolean;
812
+ attacker_ship_id: number;
813
+ target_ship_id: number;
814
+ historical_params: HistoricalParams;
815
+ day: ActionReport<DayPhaseAttackStyle>;
816
+ night: ActionReport<NightPhaseAttackStyle>;
817
+ closing_torpedo: ActionReport<TorpedoAttackStyle>;
818
+ opening_asw: ActionReport<AswAttackStyle>;
819
+ support_shelling: ActionReport<SupportShellingStyle>;
820
+ }
821
+
822
+ export interface FleetState {
823
+ id?: string;
824
+ len?: number;
825
+ s1?: ShipState;
826
+ s2?: ShipState;
827
+ s3?: ShipState;
828
+ s4?: ShipState;
829
+ s5?: ShipState;
830
+ s6?: ShipState;
831
+ s7?: ShipState;
832
+ }
833
+
834
+ export type GearAttr =
835
+ | "Unknown"
836
+ | "HighAngleMount"
837
+ | "NightFighter"
838
+ | "NightAttacker"
839
+ | "HeavyBomber"
840
+ | "NightRecon"
841
+ | "MainGun"
842
+ | "Radar"
843
+ | "SurfaceRadar"
844
+ | "AirRadar"
845
+ | "DepthChargeProjector"
846
+ | "SynergisticDepthCharge"
847
+ | "AntiSubMortar"
848
+ | "AntiSubWeapon"
849
+ | "ApDepthCharge"
850
+ | "AntiSubAircraft"
851
+ | "LateModelBowTorpedo"
852
+ | "Seaplane"
853
+ | "CbAircraft"
854
+ | "LbAircraft"
855
+ | "JetAircraft"
856
+ | "Fighter"
857
+ | "Recon"
858
+ | "ObservationSeaplane"
859
+ | "CbFighterBomber"
860
+ | "AntiInstDiveBomber"
861
+ | "CbSwordfish"
862
+ | "SemiNightPlane"
863
+ | "HighAltitudeInterceptor";
864
+
865
+ export interface ShipConditions extends ShipPosition {
866
+ formation?: Formation;
867
+ amagiri_index?: number | null;
868
+ }
869
+
870
+ export interface NightContactChance {
871
+ rank1: number;
872
+ rank2: number;
873
+ rank3: number;
874
+ }
875
+
876
+ export interface CompNightCutinAnalysis {
877
+ night_contact_chance: NightContactChance;
878
+ ships: ShipNightCutinAnalysis[];
836
879
  }
837
880
 
838
- export interface MstEquipShip {
839
- api_ship_id: number;
840
- api_equip_type: number[];
881
+ export interface ShipNightCutinAnalysis {
882
+ ship_id: number;
883
+ index: number;
884
+ normal: NightCutinActionReport;
885
+ chuuha: NightCutinActionReport;
841
886
  }
842
887
 
843
- export interface EquipStype {
844
- id: number;
845
- equip_type: number[];
888
+ export interface NightCutinActionReport
889
+ extends ActionReport<NightPhaseAttackStyle> {
890
+ cutin_term: number | null;
846
891
  }
847
892
 
848
893
  export interface CompDayCutinAnalysis {
@@ -865,184 +910,138 @@ export interface DayCutinReport extends ActionReport<DayPhaseAttackStyle> {
865
910
  observation_term: number | null;
866
911
  }
867
912
 
868
- export interface CompAnalyzerConfig {
869
- engagement: Engagement;
870
- formation: Formation;
871
- anti_air_cutin: number | null;
872
- ship_anti_air_resist: number;
873
- fleet_anti_air_resist: number;
874
- left_night_fleet_conditions: NightFleetConditions;
875
- right_night_fleet_conditions: NightFleetConditions;
913
+ export interface DamageReport {
914
+ miss_damage_min: number;
915
+ miss_damage_max: number;
916
+ normal_damage_min: number;
917
+ normal_damage_max: number;
918
+ critical_damage_min: number;
919
+ critical_damage_max: number;
920
+ normal_scratch_rate: number;
921
+ critical_scratch_rate: number;
922
+ damage_density: Histogram<number, number>;
923
+ damage_state_density: Histogram<DamageState, number>;
876
924
  }
877
925
 
878
- export interface CompNightAnalysis {
879
- night_cutin: CompNightCutinAnalysis;
880
- fleet_cutin: FleetCutinReport<NightAttackStyle>[];
926
+ export interface ContactAnalysis {
927
+ single: DayContactChance[] | null;
928
+ combined: DayContactChance[] | null;
881
929
  }
882
930
 
883
- export interface CompDayAnalysis {
884
- day_cutin: CompDayCutinAnalysis;
885
- fleet_cutin: FleetCutinReport<ShellingStyle>[];
931
+ export interface DayContactChance {
932
+ air_state: AirState;
933
+ trigger_rate: number;
934
+ rank3: number;
935
+ rank2: number;
936
+ rank1: number;
937
+ total: number;
886
938
  }
887
939
 
888
- export interface CompAnalysis {
889
- day: CompDayAnalysis;
890
- night: CompNightAnalysis;
891
- contact: ContactAnalysis;
892
- anti_air: CompAntiAirAnalysis;
893
- }
940
+ export type AswAttackType = "DepthCharge" | "Aerial";
894
941
 
895
- export interface CompAntiAirAnalysis {
896
- fleet_adjusted_anti_air: number;
897
- ships: AntiAirReport[];
898
- anti_air_cutin_chance: [number, number][];
899
- }
942
+ export type ShellingType = "Normal" | "Aerial";
900
943
 
901
- export interface AntiAirReport {
902
- ship_id: number;
903
- role: Role;
904
- index: number;
905
- adjusted_anti_air: number | null;
906
- proportional_shotdown_rate: number | null;
907
- fixed_shotdown_number: number | null;
908
- guaranteed: number | null;
909
- anti_air_cutin_chance: [number, number][];
910
- anti_air_propellant_barrage_chance: number | null;
911
- }
944
+ export type NightAttackType = "Normal" | "Swordfish" | "Aerial";
912
945
 
913
- export interface ShellingStyle {
914
- tag: "ShellingStyle";
915
- attack_type: ShellingType;
916
- cutin: DayCutinLike | null;
917
- power_mod: number;
918
- accuracy_mod: number;
919
- hits: number;
920
- }
946
+ export type SupportShellingType = ShellingType;
921
947
 
922
- export interface NightAttackStyle {
923
- tag: "NightAttackStyle";
924
- attack_type: NightAttackType;
925
- cutin: NightCutinLike | null;
926
- power_mod: number;
927
- accuracy_mod: number;
928
- hits: number;
929
- }
948
+ export type AttackType =
949
+ | { t: "Asw"; c: AswAttackType }
950
+ | { t: "Shelling"; c: ShellingType }
951
+ | { t: "Night"; c: NightAttackType }
952
+ | { t: "Torpedo" }
953
+ | { t: "SupportShelling"; c: SupportShellingType };
930
954
 
931
- export interface AswAttackStyle {
932
- tag: "AswAttackStyle";
933
- attack_type: AswAttackType;
934
- }
955
+ export type DayPhaseAttackType =
956
+ | { t: "Shelling"; c: ShellingType }
957
+ | { t: "Asw"; c: AswAttackType };
935
958
 
936
- export interface TorpedoAttackStyle {
937
- tag: "TorpedoAttackStyle";
938
- attack_type: TorpedoAttackType;
939
- }
959
+ export type NightPhaseAttackType =
960
+ | { t: "Night"; c: NightAttackType }
961
+ | { t: "Asw"; c: AswAttackType };
940
962
 
941
- export type DayPhaseAttackStyle = ShellingStyle | AswAttackStyle;
963
+ export type TorpedoAttackType = null;
942
964
 
943
- export type NightPhaseAttackStyle = NightAttackStyle | AswAttackStyle;
965
+ export type DayCutin =
966
+ | "Zuiun"
967
+ | "AirSea"
968
+ | "MainMain"
969
+ | "MainAp"
970
+ | "MainRadar"
971
+ | "MainSec"
972
+ | "DoubleAttack"
973
+ | "FBA"
974
+ | "BBA"
975
+ | "BA";
944
976
 
945
- export interface SupportShellingStyle {
946
- tag: "SupportShellingStyle";
947
- attack_type: SupportShellingType;
948
- }
977
+ export type NightCutin =
978
+ | "MainTorpRadar"
979
+ | "TorpLookoutRadar"
980
+ | "TorpTsloTorp"
981
+ | "TorpTsloDrum"
982
+ | "NightZuiun2Radar"
983
+ | "NightZuiun2"
984
+ | "NightZuiunRadar"
985
+ | "NightZuiun"
986
+ | "DoubleAttack"
987
+ | "TorpTorpMain"
988
+ | "TorpTorpTorp"
989
+ | "MainMainSec"
990
+ | "MainMainMain"
991
+ | "SubTorpTorp"
992
+ | "SubRadarTorp"
993
+ | "Cvci1_25"
994
+ | "Cvci1_20"
995
+ | "Cvci1_18"
996
+ | "Photobomber";
949
997
 
950
- export interface FormationCombatModifiersDef {
951
- power_mod?: number;
952
- accuracy_mod?: number;
953
- evasion_mod?: number;
954
- }
998
+ export type FleetCutin =
999
+ | "NelsonTouch"
1000
+ | "NagatoClassCutin"
1001
+ | "ColoradoClassCutin"
1002
+ | "KongouClassCutin"
1003
+ | "Yamato2ShipCutin"
1004
+ | "Yamato3ShipCutin";
955
1005
 
956
- export interface FormationDef {
957
- tag: Formation;
958
- protection_rate: number | null;
959
- fleet_anti_air_mod: number;
960
- shelling: FormationCombatModifiersDef;
961
- torpedo: FormationCombatModifiersDef;
962
- asw: FormationCombatModifiersDef;
963
- night: FormationCombatModifiersDef;
964
- support_shelling: FormationCombatModifiersDef;
965
- }
1006
+ export type DayCutinLike = DayCutin | FleetCutin;
966
1007
 
967
- export type NestedFormationDef =
968
- | FormationDef
969
- | { top_half: FormationDef; bottom_half: FormationDef };
1008
+ export type NightCutinLike = NightCutin | FleetCutin;
970
1009
 
971
- export interface AntiAirCutinDef {
972
- id: number;
973
- type_factor: number | null;
974
- multiplier: number | null;
975
- guaranteed: number | null;
976
- sequential: boolean | null;
977
- }
1010
+ export type MoraleState = "Sparkle" | "Normal" | "Orange" | "Red";
978
1011
 
979
- export interface DayCutinDef {
980
- tag: DayCutin;
981
- hits: number;
982
- type_factor: number | null;
983
- power_mod: number | null;
984
- accuracy_mod: number | null;
985
- }
1012
+ export type NodeId = string;
986
1013
 
987
- export interface HistoricalBonusDef {
1014
+ export interface NodeState {
988
1015
  map?: number;
989
- node?: CompiledEvaler;
1016
+ node?: NodeId;
990
1017
  phase?: number;
991
1018
  debuff?: boolean;
992
- ship?: CompiledEvaler;
993
- enemy?: CompiledEvaler;
994
- power_mod?: AttackPowerModifier;
995
- armor_penetration?: number;
996
- accuracy_mod?: number;
997
- evasion_mod?: number;
998
- }
999
-
1000
- export interface HistoricalParams {
1001
- power_mod: AttackPowerModifier;
1002
- armor_penetration: number;
1003
- accuracy_mod: number;
1004
- target_evasion_mod: number;
1005
- }
1006
-
1007
- export interface NightCutinDef {
1008
- tag: NightCutin;
1009
- hits: number;
1010
- type_factor: number | null;
1011
- power_mod: number | null;
1012
- accuracy_mod: number | null;
1013
- }
1014
-
1015
- export interface BattleDefinitions {
1016
- formation: Record<Formation, NestedFormationDef>;
1017
- anti_air_cutin: Record<number, AntiAirCutinDef>;
1018
- day_cutin: Record<DayCutin, DayCutinDef>;
1019
- night_cutin: Record<NightCutin, NightCutinDef>;
1020
- historical_bonuses: HistoricalBonusDef[];
1021
- }
1022
-
1023
- export type SpeedGroup = "A" | "B1" | "B2" | "C";
1024
-
1025
- export type GearTypeIdArray = [number, number, number, number, number];
1026
-
1027
- export interface SupportShellingSimulatorParams {
1028
- attacker_formation?: Formation;
1029
- target_formation?: Formation;
1030
- engagement: Engagement;
1031
- node_state: NodeState;
1019
+ disable_historical_mod?: boolean;
1020
+ landing_battle?: boolean;
1032
1021
  }
1033
1022
 
1034
- export type FhResult<T> = { Ok: T } | { Err: string };
1023
+ export type SlotSizeVec = (number | null)[];
1035
1024
 
1036
- export interface ShipAnalyzerConfig {
1037
- air_state?: AirState;
1038
- engagement?: Engagement;
1039
- left?: AttackAnalyzerShipConfig;
1040
- right?: AttackAnalyzerShipConfig;
1041
- }
1025
+ export type SpecialEnemyType =
1026
+ | "None"
1027
+ | "SoftSkinned"
1028
+ | "Pillbox"
1029
+ | "IsolatedIsland"
1030
+ | "SupplyDepot"
1031
+ | "NewSupplyDepot"
1032
+ | "HarbourSummerPrincess"
1033
+ | "PtImp"
1034
+ | "BattleshipSummerPrincess"
1035
+ | "HeavyCruiserSummerPrincess"
1036
+ | "FrenchBattleshipPrincess"
1037
+ | "AnchorageWaterDemonVacationMode"
1038
+ | "DockPrincess"
1039
+ | "SummerAircraftCarrierDemon";
1042
1040
 
1043
1041
  export class AirSquadron {
1044
1042
  private constructor();
1045
1043
  free(): void;
1044
+ [Symbol.dispose](): void;
1046
1045
  get_gear(key: string): Gear | undefined;
1047
1046
  get_slot_size(index: number): number;
1048
1047
  get_max_slot_size(index: number): number;
@@ -1059,6 +1058,7 @@ export class AirSquadron {
1059
1058
  export class Analyzer {
1060
1059
  private constructor();
1061
1060
  free(): void;
1061
+ [Symbol.dispose](): void;
1062
1062
  analyze_ship_attack(
1063
1063
  config: ShipAnalyzerConfig,
1064
1064
  left: Ship,
@@ -1083,6 +1083,7 @@ export class Analyzer {
1083
1083
  export class Comp {
1084
1084
  private constructor();
1085
1085
  free(): void;
1086
+ [Symbol.dispose](): void;
1086
1087
  side(): Side;
1087
1088
  is_combined(): boolean;
1088
1089
  is_player(): boolean;
@@ -1130,6 +1131,7 @@ export class Comp {
1130
1131
  }
1131
1132
  export class FhCore {
1132
1133
  free(): void;
1134
+ [Symbol.dispose](): void;
1133
1135
  constructor(js_master: MasterData);
1134
1136
  create_gear(input?: GearState | null): Gear | undefined;
1135
1137
  create_ship(input?: ShipState | null): Ship | undefined;
@@ -1149,6 +1151,7 @@ export class FhCore {
1149
1151
  export class Fleet {
1150
1152
  private constructor();
1151
1153
  free(): void;
1154
+ [Symbol.dispose](): void;
1152
1155
  meta(): FleetMeta;
1153
1156
  ship_keys(): string[];
1154
1157
  ship_ids(): string[];
@@ -1190,6 +1193,7 @@ export class Fleet {
1190
1193
  export class Gear {
1191
1194
  private constructor();
1192
1195
  free(): void;
1196
+ [Symbol.dispose](): void;
1193
1197
  static default(): Gear;
1194
1198
  has_attr(attr: GearAttr): boolean;
1195
1199
  category(): GearCategory;
@@ -1253,6 +1257,7 @@ export class Gear {
1253
1257
  export class Org {
1254
1258
  private constructor();
1255
1259
  free(): void;
1260
+ [Symbol.dispose](): void;
1256
1261
  first_ship_id(): string | undefined;
1257
1262
  get_ship_mid(fleet_key: FleetKey, ship_key: ShipKey): number | undefined;
1258
1263
  get_ship_eid(fleet_key: FleetKey, ship_key: ShipKey): string | undefined;
@@ -1299,6 +1304,7 @@ export class Org {
1299
1304
  export class Ship {
1300
1305
  private constructor();
1301
1306
  free(): void;
1307
+ [Symbol.dispose](): void;
1302
1308
  state_day_gunfit_accuracy(): number | undefined;
1303
1309
  state_night_gunfit_accuracy(): number | undefined;
1304
1310
  /**