fleethub-core 1.10.13 → 1.10.16

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.
@@ -8,38 +8,44 @@ export function parse_ship_conditions(value: ShipConditions): ShipConditions;
8
8
  /**
9
9
  */
10
10
  export function set_panic_hook(): void;
11
- export interface HitRate {
12
- normal: number;
13
- critical: number;
14
- total: number;
15
- }
16
-
17
- export interface HitRateParams {
18
- accuracy_term: number;
19
- evasion_term: number;
20
- target_morale_mod: number;
21
- critical_rate_constant: number;
22
- critical_percentage_bonus: number;
23
- hit_percentage_bonus: number;
24
- }
11
+ export type GearVecInput = GearInput[];
25
12
 
26
- export interface NodeAttackAnalyzerShipConfig extends NightFleetConditions {
27
- formation?: Formation;
13
+ export interface GearInput {
14
+ gear_id: number;
15
+ types: GearTypeIdArray;
16
+ firepower: number;
17
+ torpedo: number;
18
+ anti_air: number;
19
+ armor: number;
20
+ evasion: number;
21
+ asw: number;
22
+ los: number;
23
+ bombing: number;
24
+ accuracy: number;
25
+ range: number;
26
+ radius: number;
27
+ stars: number;
28
+ ace: number;
28
29
  }
29
30
 
30
- export interface NodeAttackAnalyzerConfig {
31
- air_state?: AirState;
32
- engagement?: Engagement;
33
- node_state?: NodeState;
34
- left?: NodeAttackAnalyzerShipConfig;
35
- right?: NodeAttackAnalyzerShipConfig;
31
+ export interface ShipInput {
32
+ ship_id: number;
33
+ ctype: number;
34
+ stype: number;
35
+ yomi: string;
36
36
  }
37
37
 
38
- export interface NodeAttackAnalysis {
39
- left: AttackAnalysis;
40
- right: AttackAnalysis;
41
- shelling_fleet_cutin: FleetCutinReport<ShellingStyle>[];
42
- night_fleet_cutin: FleetCutinReport<NightAttackStyle>[];
38
+ export interface EBonuses {
39
+ firepower: number;
40
+ torpedo: number;
41
+ anti_air: number;
42
+ armor: number;
43
+ evasion: number;
44
+ asw: number;
45
+ los: number;
46
+ bombing: number;
47
+ accuracy: number;
48
+ range: number;
43
49
  }
44
50
 
45
51
  export interface ContactAnalysis {
@@ -56,91 +62,94 @@ export interface DayContactChance {
56
62
  total: number;
57
63
  }
58
64
 
59
- export interface GearState {
60
- id?: string;
61
- gear_id: number;
62
- exp?: number;
63
- stars?: number;
64
- }
65
-
66
- export interface GearVecState {
67
- g1?: GearState;
68
- g2?: GearState;
69
- g3?: GearState;
70
- g4?: GearState;
71
- g5?: GearState;
72
- gx?: GearState;
73
- }
74
-
75
- export interface SlotSizeVecState {
76
- ss1?: number;
77
- ss2?: number;
78
- ss3?: number;
79
- ss4?: number;
80
- ss5?: number;
81
- }
82
-
83
- export interface ShipState extends GearVecState, SlotSizeVecState {
65
+ export interface OrgState {
84
66
  id?: string;
85
- ship_id: number;
86
- level?: number;
87
- current_hp?: number;
88
- morale?: number;
89
- ammo?: number;
90
- fuel?: number;
91
- max_hp_mod?: number;
92
- firepower_mod?: number;
93
- torpedo_mod?: number;
94
- armor_mod?: number;
95
- anti_air_mod?: number;
96
- evasion_mod?: number;
97
- asw_mod?: number;
98
- los_mod?: number;
99
- luck_mod?: number;
100
- day_gunfit_accuracy?: number;
101
- night_gunfit_accuracy?: number;
102
- custom_power_mods?: CustomPowerModifiers;
67
+ f1?: FleetState;
68
+ f2?: FleetState;
69
+ f3?: FleetState;
70
+ f4?: FleetState;
71
+ a1?: AirSquadronState;
72
+ a2?: AirSquadronState;
73
+ a3?: AirSquadronState;
74
+ hq_level?: number;
75
+ org_type?: OrgType;
76
+ sortie?: FleetKey;
77
+ route_sup?: FleetKey;
78
+ boss_sup?: FleetKey;
103
79
  }
104
80
 
105
- export type ShipKey = "s1" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7";
106
-
107
- export type SpeedGroup = "A" | "B1" | "B2" | "C";
108
-
109
- export interface EquippabilityRule {
110
- ship: CompiledEvaler;
111
- keys?: string[];
112
- include?: string;
113
- exclude?: string;
114
- }
81
+ export type FleetKey = "f1" | "f2" | "f3" | "f4";
115
82
 
116
- export interface MasterEquippability {
117
- equip_stype: EquipStype[];
118
- equip_exslot: number[];
119
- equip_ship: MstEquipShip[];
120
- equip_exslot_ship: MstEquipExslotShip[];
121
- rules: EquippabilityRule[];
83
+ export interface HitRate {
84
+ normal: number;
85
+ critical: number;
86
+ total: number;
122
87
  }
123
88
 
124
- export interface MstEquipExslotShip {
125
- api_slotitem_id: number;
126
- api_ship_ids: number[];
89
+ export interface HitRateParams {
90
+ accuracy_term: number;
91
+ evasion_term: number;
92
+ target_morale_mod: number;
93
+ critical_rate_constant: number;
94
+ critical_percentage_bonus: number;
95
+ hit_percentage_bonus: number;
127
96
  }
128
97
 
129
- export interface MstEquipShip {
130
- api_ship_id: number;
131
- api_equip_type: number[];
98
+ export interface DamageReport {
99
+ miss_damage_min: number;
100
+ miss_damage_max: number;
101
+ normal_damage_min: number;
102
+ normal_damage_max: number;
103
+ critical_damage_min: number;
104
+ critical_damage_max: number;
105
+ normal_scratch_rate: number;
106
+ critical_scratch_rate: number;
107
+ damage_density: Histogram<number, number>;
108
+ damage_state_density: Histogram<DamageState, number>;
132
109
  }
133
110
 
134
- export interface EquipStype {
135
- id: number;
136
- equip_type: number[];
111
+ export interface AttackAnalysis {
112
+ attacker_is_player: boolean;
113
+ attacker_ship_id: number;
114
+ target_ship_id: number;
115
+ historical_params: HistoricalParams;
116
+ day: ActionReport<DayPhaseAttackStyle>;
117
+ night: ActionReport<NightPhaseAttackStyle>;
118
+ closing_torpedo: ActionReport<TorpedoAttackStyle>;
119
+ opening_asw: ActionReport<AswAttackStyle>;
120
+ support_shelling: ActionReport<SupportShellingStyle>;
137
121
  }
138
122
 
139
- export interface ActionReport<T> {
140
- data: Record<string, AttackReport<T>>;
141
- damage_state_density: Histogram<DamageState, number> | null;
142
- is_active: boolean;
143
- }
123
+ export type GearAttr =
124
+ | "Unknown"
125
+ | "HighAngleMount"
126
+ | "NightFighter"
127
+ | "NightAttacker"
128
+ | "HeavyBomber"
129
+ | "NightRecon"
130
+ | "MainGun"
131
+ | "Radar"
132
+ | "SurfaceRadar"
133
+ | "AirRadar"
134
+ | "DepthChargeProjector"
135
+ | "SynergisticDepthCharge"
136
+ | "AntiSubMortar"
137
+ | "AntiSubWeapon"
138
+ | "ApDepthCharge"
139
+ | "AntiSubAircraft"
140
+ | "LateModelBowTorpedo"
141
+ | "Seaplane"
142
+ | "CbAircraft"
143
+ | "LbAircraft"
144
+ | "JetAircraft"
145
+ | "Fighter"
146
+ | "Recon"
147
+ | "ObservationSeaplane"
148
+ | "CbFighterBomber"
149
+ | "AntiInstDiveBomber"
150
+ | "CbSwordfish"
151
+ | "SemiNightPlane"
152
+ | "HighAltitudeInterceptor";
144
153
 
145
154
  export type ShipCategory =
146
155
  | "Battleship"
@@ -179,49 +188,201 @@ export type ShipType =
179
188
 
180
189
  export type SlotSizeVec = (number | null)[];
181
190
 
182
- export type GearTypeIdArray = [number, number, number, number, number];
191
+ export type SingleFormation =
192
+ | "LineAhead"
193
+ | "DoubleLine"
194
+ | "Diamond"
195
+ | "Echelon"
196
+ | "LineAbreast"
197
+ | "Vanguard";
183
198
 
184
- export interface BattleConditions {
185
- org_type: OrgType;
186
- role: Role;
187
- ship_index: number;
188
- fleet_len: number;
189
- formation: Formation;
190
- fleet_los_mod: number | null;
191
- night_conditions: NightFleetConditions;
192
- }
199
+ export type CombinedFormation =
200
+ | "Cruising1"
201
+ | "Cruising2"
202
+ | "Cruising3"
203
+ | "Cruising4";
193
204
 
194
- export interface NightConditions {
195
- player?: NightFleetConditions;
196
- enemy?: NightFleetConditions;
205
+ export type Formation = SingleFormation | CombinedFormation;
206
+
207
+ export type NodeId = string;
208
+
209
+ export interface NodeState {
210
+ map?: number;
211
+ node?: NodeId;
212
+ phase?: number;
213
+ debuff?: boolean;
214
+ disable_historical_mod?: boolean;
197
215
  }
198
216
 
199
- export interface NightFleetConditions {
200
- night_contact_rank?: ContactRank | null;
201
- starshell_index?: number | null;
202
- searchlight_index?: number | null;
203
- activates_large_searchlight?: boolean;
217
+ export interface EquippabilityRule {
218
+ ship: CompiledEvaler;
219
+ keys?: string[];
220
+ include?: string;
221
+ exclude?: string;
204
222
  }
205
223
 
206
- export interface FleetState {
207
- id?: string;
208
- len?: number;
209
- s1?: ShipState;
210
- s2?: ShipState;
211
- s3?: ShipState;
212
- s4?: ShipState;
213
- s5?: ShipState;
214
- s6?: ShipState;
215
- s7?: ShipState;
224
+ export interface MasterEquippability {
225
+ equip_stype: EquipStype[];
226
+ equip_exslot: number[];
227
+ equip_ship: MstEquipShip[];
228
+ equip_exslot_ship: MstEquipExslotShip[];
229
+ rules: EquippabilityRule[];
230
+ }
231
+
232
+ export interface MstEquipExslotShip {
233
+ api_slotitem_id: number;
234
+ api_ship_ids: number[];
235
+ }
236
+
237
+ export interface MstEquipShip {
238
+ api_ship_id: number;
239
+ api_equip_type: number[];
240
+ }
241
+
242
+ export interface EquipStype {
243
+ id: number;
244
+ equip_type: number[];
245
+ }
246
+
247
+ export interface BattleConditions {
248
+ org_type: OrgType;
249
+ role: Role;
250
+ ship_index: number;
251
+ fleet_len: number;
252
+ formation: Formation;
253
+ fleet_los_mod: number | null;
254
+ night_conditions: NightFleetConditions;
255
+ }
256
+
257
+ export interface NightConditions {
258
+ player?: NightFleetConditions;
259
+ enemy?: NightFleetConditions;
260
+ }
261
+
262
+ export interface NightFleetConditions {
263
+ night_contact_rank?: ContactRank | null;
264
+ starshell_index?: number | null;
265
+ searchlight_index?: number | null;
266
+ activates_large_searchlight?: boolean;
267
+ }
268
+
269
+ export interface GearState {
270
+ id?: string;
271
+ gear_id: number;
272
+ exp?: number;
273
+ stars?: number;
274
+ }
275
+
276
+ export interface GearVecState {
277
+ g1?: GearState;
278
+ g2?: GearState;
279
+ g3?: GearState;
280
+ g4?: GearState;
281
+ g5?: GearState;
282
+ gx?: GearState;
283
+ }
284
+
285
+ export interface MoveShipPayload {
286
+ current: [string, string, ShipKey];
287
+ target: [string | null, string, ShipKey];
216
288
  }
217
289
 
290
+ export type DayCutin =
291
+ | "Zuiun"
292
+ | "AirSea"
293
+ | "MainMain"
294
+ | "MainAp"
295
+ | "MainRadar"
296
+ | "MainSec"
297
+ | "DoubleAttack"
298
+ | "FBA"
299
+ | "BBA"
300
+ | "BA";
301
+
302
+ export type NightCutin =
303
+ | "MainTorpRadar"
304
+ | "TorpLookoutRadar"
305
+ | "TorpTsloTorp"
306
+ | "TorpTsloDrum"
307
+ | "DoubleAttack"
308
+ | "TorpTorpMain"
309
+ | "TorpTorpTorp"
310
+ | "MainMainSec"
311
+ | "MainMainMain"
312
+ | "SubTorpTorp"
313
+ | "SubRadarTorp"
314
+ | "Cvci1_25"
315
+ | "Cvci1_20"
316
+ | "Cvci1_18"
317
+ | "Photobomber";
318
+
319
+ export type FleetCutin =
320
+ | "NelsonTouch"
321
+ | "NagatoClassCutin"
322
+ | "ColoradoClassCutin"
323
+ | "KongouClassCutin"
324
+ | "Yamato2ShipCutin"
325
+ | "Yamato3ShipCutin";
326
+
327
+ export type DayCutinLike = DayCutin | FleetCutin;
328
+
329
+ export type NightCutinLike = NightCutin | FleetCutin;
330
+
218
331
  export type MoraleState = "Sparkle" | "Normal" | "Orange" | "Red";
219
332
 
220
- export type Role = "Main" | "Escort";
333
+ export interface SlotSizeVecState {
334
+ ss1?: number;
335
+ ss2?: number;
336
+ ss3?: number;
337
+ ss4?: number;
338
+ ss5?: number;
339
+ }
221
340
 
222
- export type Side = "Player" | "Enemy";
341
+ export interface ShipState extends GearVecState, SlotSizeVecState {
342
+ id?: string;
343
+ ship_id: number;
344
+ level?: number;
345
+ current_hp?: number;
346
+ morale?: number;
347
+ ammo?: number;
348
+ fuel?: number;
349
+ max_hp_mod?: number;
350
+ firepower_mod?: number;
351
+ torpedo_mod?: number;
352
+ armor_mod?: number;
353
+ anti_air_mod?: number;
354
+ evasion_mod?: number;
355
+ asw_mod?: number;
356
+ los_mod?: number;
357
+ luck_mod?: number;
358
+ day_gunfit_accuracy?: number;
359
+ night_gunfit_accuracy?: number;
360
+ custom_power_mods?: CustomPowerModifiers;
361
+ }
223
362
 
224
- export type Align = "Left" | "Right";
363
+ export type ShipKey = "s1" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7";
364
+
365
+ export type SpeedGroup = "A" | "B1" | "B2" | "C";
366
+
367
+ export type CompiledEvaler = string;
368
+
369
+ export interface SupportShellingSimulatorParams {
370
+ attacker_formation?: Formation;
371
+ target_formation?: Formation;
372
+ engagement: Engagement;
373
+ }
374
+
375
+ export interface SimulatorResult {
376
+ items: SimulatorResultItem[];
377
+ sunk_vec: [number, number, number][];
378
+ }
379
+
380
+ export interface SimulatorResultItem {
381
+ id: string;
382
+ fleet_type: FleetType;
383
+ index: number;
384
+ damage_state_map: Record<DamageState, number>;
385
+ }
225
386
 
226
387
  export interface MasterShip {
227
388
  ship_id: number;
@@ -257,6 +418,39 @@ export interface MasterShip {
257
418
 
258
419
  export type StatInterval = [number | null, number | null];
259
420
 
421
+ export interface ActionReport<T> {
422
+ data: Record<string, AttackReport<T>>;
423
+ damage_state_density: Histogram<DamageState, number> | null;
424
+ is_active: boolean;
425
+ }
426
+
427
+ export type AirWaveType = "Jet" | "LandBase" | "Carrier";
428
+
429
+ export type AswAttackType = "DepthCharge" | "Aerial";
430
+
431
+ export type ShellingType = "Normal" | "Aerial";
432
+
433
+ export type NightAttackType = "Normal" | "Swordfish" | "Aerial";
434
+
435
+ export type SupportShellingType = ShellingType;
436
+
437
+ export type AttackType =
438
+ | { t: "Asw"; c: AswAttackType }
439
+ | { t: "Shelling"; c: ShellingType }
440
+ | { t: "Night"; c: NightAttackType }
441
+ | { t: "Torpedo" }
442
+ | { t: "SupportShelling"; c: SupportShellingType };
443
+
444
+ export type DayPhaseAttackType =
445
+ | { t: "Shelling"; c: ShellingType }
446
+ | { t: "Asw"; c: AswAttackType };
447
+
448
+ export type NightPhaseAttackType =
449
+ | { t: "Night"; c: NightAttackType }
450
+ | { t: "Asw"; c: AswAttackType };
451
+
452
+ export type TorpedoAttackType = null;
453
+
260
454
  export interface FormationCombatModifiersDef {
261
455
  power_mod?: number;
262
456
  accuracy_mod?: number;
@@ -328,108 +522,23 @@ export interface BattleDefinitions {
328
522
  historical_bonuses: HistoricalBonusDef[];
329
523
  }
330
524
 
331
- export type DayCutin =
332
- | "Zuiun"
333
- | "AirSea"
334
- | "MainMain"
335
- | "MainAp"
336
- | "MainRadar"
337
- | "MainSec"
338
- | "DoubleAttack"
339
- | "FBA"
340
- | "BBA"
341
- | "BA";
342
-
343
- export type NightCutin =
344
- | "MainTorpRadar"
345
- | "TorpLookoutRadar"
346
- | "TorpTsloTorp"
347
- | "TorpTsloDrum"
348
- | "DoubleAttack"
349
- | "TorpTorpMain"
350
- | "TorpTorpTorp"
351
- | "MainMainSec"
352
- | "MainMainMain"
353
- | "SubTorpTorp"
354
- | "SubRadarTorp"
355
- | "Cvci1_25"
356
- | "Cvci1_20"
357
- | "Cvci1_18"
358
- | "Photobomber";
359
-
360
- export type FleetCutin =
361
- | "NelsonTouch"
362
- | "NagatoClassCutin"
363
- | "ColoradoClassCutin"
364
- | "KongouClassCutin"
365
- | "Yamato2ShipCutin"
366
- | "Yamato3ShipCutin";
525
+ export interface FleetState {
526
+ id?: string;
527
+ len?: number;
528
+ s1?: ShipState;
529
+ s2?: ShipState;
530
+ s3?: ShipState;
531
+ s4?: ShipState;
532
+ s5?: ShipState;
533
+ s6?: ShipState;
534
+ s7?: ShipState;
535
+ }
367
536
 
368
- export type DayCutinLike = DayCutin | FleetCutin;
537
+ export type Role = "Main" | "Escort";
369
538
 
370
- export type NightCutinLike = NightCutin | FleetCutin;
539
+ export type Side = "Player" | "Enemy";
371
540
 
372
- export interface MoveShipPayload {
373
- current: [string, string, ShipKey];
374
- target: [string | null, string, ShipKey];
375
- }
376
-
377
- export interface AttackReport<T> {
378
- style: T;
379
- proc_rate: number | null;
380
- attack_power: AttackPower | null;
381
- attack_power_params: AttackPowerParams | null;
382
- hits: number;
383
- hit_rate: HitRate | null;
384
- hit_rate_params: HitRateParams | null;
385
- damage: DamageReport | null;
386
- }
387
-
388
- export type AirWaveType = "Jet" | "LandBase" | "Carrier";
389
-
390
- export type ContactRank = "Rank1" | "Rank2" | "Rank3";
391
-
392
- export type DamageState = "Normal" | "Shouha" | "Chuuha" | "Taiha" | "Sunk";
393
-
394
- export interface SimulatorResult {
395
- items: SimulatorResultItem[];
396
- sunk_vec: [number, number, number][];
397
- }
398
-
399
- export interface SimulatorResultItem {
400
- id: string;
401
- fleet_type: FleetType;
402
- index: number;
403
- damage_state_map: Record<DamageState, number>;
404
- }
405
-
406
- export type FhResult<T> = { Ok: T } | { Err: string };
407
-
408
- export interface MasterGear {
409
- gear_id: number;
410
- name: string;
411
- types: GearTypeIdArray;
412
- special_type?: number;
413
- max_hp?: number;
414
- firepower?: number;
415
- armor?: number;
416
- torpedo?: number;
417
- anti_air?: number;
418
- speed?: number;
419
- bombing?: number;
420
- asw?: number;
421
- los?: number;
422
- luck?: number;
423
- accuracy?: number;
424
- evasion?: number;
425
- range?: number;
426
- radius?: number;
427
- cost?: number;
428
- improvable?: boolean;
429
- ship_anti_air_resist?: number;
430
- fleet_anti_air_resist?: number;
431
- historical_aircraft_group?: number;
432
- }
541
+ export type Align = "Left" | "Right";
433
542
 
434
543
  export interface AttackPower {
435
544
  precap: number;
@@ -456,6 +565,29 @@ export interface AttackPowerParams {
456
565
  custom_mods: CustomPowerModifiers;
457
566
  }
458
567
 
568
+ export interface NightContactChance {
569
+ rank1: number;
570
+ rank2: number;
571
+ rank3: number;
572
+ }
573
+
574
+ export interface CompNightCutinAnalysis {
575
+ night_contact_chance: NightContactChance;
576
+ ships: ShipNightCutinAnalysis[];
577
+ }
578
+
579
+ export interface ShipNightCutinAnalysis {
580
+ ship_id: number;
581
+ index: number;
582
+ normal: NightCutinActionReport;
583
+ chuuha: NightCutinActionReport;
584
+ }
585
+
586
+ export interface NightCutinActionReport
587
+ extends ActionReport<NightPhaseAttackStyle> {
588
+ cutin_term: number | null;
589
+ }
590
+
459
591
  export type AirSquadronMode = "Sortie" | "AirDefense";
460
592
 
461
593
  export interface AirSquadronState extends GearVecState, SlotSizeVecState {
@@ -472,7 +604,32 @@ export type AirState =
472
604
 
473
605
  export type AirStateRank = "Rank0" | "Rank1" | "Rank2" | "Rank3";
474
606
 
475
- export type Engagement = "GreenT" | "Parallel" | "HeadOn" | "RedT";
607
+ export interface AttackPowerModifier {
608
+ a?: number;
609
+ b?: number;
610
+ }
611
+
612
+ export interface SpecialEnemyModifiers {
613
+ precap_general_mod: AttackPowerModifier;
614
+ stype_mod: AttackPowerModifier;
615
+ landing_craft_synergy_mod: AttackPowerModifier;
616
+ toku_daihatsu_tank_mod: AttackPowerModifier;
617
+ m4a1dd_mod: AttackPowerModifier;
618
+ honi_mod: AttackPowerModifier;
619
+ postcap_general_mod: AttackPowerModifier;
620
+ pt_mod: AttackPowerModifier | null;
621
+ }
622
+
623
+ export interface CustomPowerModifiers {
624
+ precap_mod?: AttackPowerModifier;
625
+ postcap_mod?: AttackPowerModifier;
626
+ basic_power_mod?: AttackPowerModifier;
627
+ historical_mod?: AttackPowerModifier;
628
+ }
629
+
630
+ export type ContactRank = "Rank1" | "Rank2" | "Rank3";
631
+
632
+ export type DamageState = "Normal" | "Shouha" | "Chuuha" | "Taiha" | "Sunk";
476
633
 
477
634
  export type GearType =
478
635
  | "Unknown"
@@ -550,62 +707,12 @@ export type GearCategory =
550
707
  | "LandBased"
551
708
  | "Misc";
552
709
 
553
- export type ShipAttr =
554
- | "Unknown"
555
- | "Abyssal"
556
- | "NightCarrier"
557
- | "Installation"
558
- | "RoyalNavy"
559
- | "Kai2"
560
- | "TurbineSpeedBonus"
561
- | "Pillbox"
562
- | "IsolatedIsland"
563
- | "HarbourSummerPrincess"
564
- | "SupplyDepot"
565
- | "NewSupplyDepot"
566
- | "PtImp"
567
- | "BattleshipSummerPrincess"
568
- | "HeavyCruiserSummerPrincess"
569
- | "AnchorageWaterDemonVacationMode"
570
- | "FrenchBattleshipPrincess"
571
- | "DockPrincess";
572
-
573
710
  export interface ShipConditions extends ShipPosition {
574
711
  formation?: Formation;
575
712
  amagiri_index?: number | null;
576
713
  }
577
714
 
578
- export interface AttackPowerModifier {
579
- a?: number;
580
- b?: number;
581
- }
582
-
583
- export interface SpecialEnemyModifiers {
584
- precap_general_mod: AttackPowerModifier;
585
- stype_mod: AttackPowerModifier;
586
- landing_craft_synergy_mod: AttackPowerModifier;
587
- toku_daihatsu_tank_mod: AttackPowerModifier;
588
- m4a1dd_mod: AttackPowerModifier;
589
- honi_mod: AttackPowerModifier;
590
- postcap_general_mod: AttackPowerModifier;
591
- pt_mod: AttackPowerModifier;
592
- }
593
-
594
- export interface CustomPowerModifiers {
595
- precap_mod?: AttackPowerModifier;
596
- postcap_mod?: AttackPowerModifier;
597
- basic_power_mod?: AttackPowerModifier;
598
- historical_mod?: AttackPowerModifier;
599
- }
600
-
601
- export interface ShipPosition {
602
- org_type?: OrgType;
603
- fleet_type?: FleetType;
604
- fleet_len?: number;
605
- index?: number;
606
- }
607
-
608
- export type CompiledEvaler = string;
715
+ export type FhResult<T> = { Ok: T } | { Err: string };
609
716
 
610
717
  export interface MasterData extends MasterBattleDefinitions {
611
718
  created_at: number;
@@ -642,279 +749,65 @@ export interface MasterIBonuses {
642
749
  night_accuracy: MasterIBonusRule[];
643
750
  defense_power: MasterIBonusRule[];
644
751
  contact_selection: MasterIBonusRule[];
645
- fighter_power: MasterIBonusRule[];
646
- ship_anti_air: MasterIBonusRule[];
647
- fleet_anti_air: MasterIBonusRule[];
648
- elos: MasterIBonusRule[];
649
- }
650
-
651
- export interface MasterIBonusRule {
652
- expr: CompiledEvaler;
653
- formula: CompiledEvaler;
654
- }
655
-
656
- export interface NightContactChance {
657
- rank1: number;
658
- rank2: number;
659
- rank3: number;
660
- }
661
-
662
- export interface CompNightCutinAnalysis {
663
- night_contact_chance: NightContactChance;
664
- ships: ShipNightCutinAnalysis[];
665
- }
666
-
667
- export interface ShipNightCutinAnalysis {
668
- ship_id: number;
669
- index: number;
670
- normal: NightCutinActionReport;
671
- chuuha: NightCutinActionReport;
672
- }
673
-
674
- export interface NightCutinActionReport
675
- extends ActionReport<NightPhaseAttackStyle> {
676
- cutin_term: number | null;
677
- }
678
-
679
- export interface FleetCutinReport<T> {
680
- cutin: FleetCutin;
681
- rate: number | null;
682
- formation: Formation;
683
- attacks: FleetCutinAttackReport<T>[];
684
- }
685
-
686
- export interface FleetCutinAttackReport<T> extends AttackReport<T> {
687
- index: number;
688
- ship_id: number;
689
- power_mod: number;
690
- }
691
-
692
- export type AswAttackType = "DepthCharge" | "Aerial";
693
-
694
- export type ShellingType = "Normal" | "Aerial";
695
-
696
- export type NightAttackType = "Normal" | "Swordfish" | "Aerial";
697
-
698
- export type SupportShellingType = ShellingType;
699
-
700
- export type AttackType =
701
- | { t: "Asw"; c: AswAttackType }
702
- | { t: "Shelling"; c: ShellingType }
703
- | { t: "Night"; c: NightAttackType }
704
- | { t: "Torpedo" }
705
- | { t: "SupportShelling"; c: SupportShellingType };
706
-
707
- export type DayPhaseAttackType =
708
- | { t: "Shelling"; c: ShellingType }
709
- | { t: "Asw"; c: AswAttackType };
710
-
711
- export type NightPhaseAttackType =
712
- | { t: "Night"; c: NightAttackType }
713
- | { t: "Asw"; c: AswAttackType };
714
-
715
- export type TorpedoAttackType = null;
716
-
717
- export type GearAttr =
718
- | "Unknown"
719
- | "Abyssal"
720
- | "HighAngleMount"
721
- | "NightFighter"
722
- | "NightAttacker"
723
- | "HeavyBomber"
724
- | "NightRecon"
725
- | "MainGun"
726
- | "Radar"
727
- | "SurfaceRadar"
728
- | "AirRadar"
729
- | "DepthChargeProjector"
730
- | "SynergisticDepthCharge"
731
- | "AntiSubMortar"
732
- | "AntiSubWeapon"
733
- | "ApDepthCharge"
734
- | "AntiSubAircraft"
735
- | "LateModelBowTorpedo"
736
- | "Seaplane"
737
- | "CbAircraft"
738
- | "LbAircraft"
739
- | "JetAircraft"
740
- | "Fighter"
741
- | "Recon"
742
- | "ObservationSeaplane"
743
- | "CbFighterBomber"
744
- | "AntiInstDiveBomber"
745
- | "CbSwordfish"
746
- | "SemiNightPlane"
747
- | "HighAltitudeInterceptor";
748
-
749
- export interface ShipMeta {
750
- id: string;
751
- ship_id: number;
752
- }
753
-
754
- export interface FleetMeta {
755
- id: string;
756
- len: number;
757
- ships: [string, ShipMeta | null][];
758
- }
759
-
760
- export interface CompMeta {
761
- fleets: Record<FleetType, FleetMeta>;
762
- }
763
-
764
- export type OrgType =
765
- | "Single"
766
- | "CarrierTaskForce"
767
- | "SurfaceTaskForce"
768
- | "TransportEscort"
769
- | "EnemySingle"
770
- | "EnemyCombined";
771
-
772
- export type SpecialEnemyType =
773
- | "None"
774
- | "SoftSkinned"
775
- | "Pillbox"
776
- | "IsolatedIsland"
777
- | "SupplyDepot"
778
- | "NewSupplyDepot"
779
- | "HarbourSummerPrincess"
780
- | "PtImp"
781
- | "BattleshipSummerPrincess"
782
- | "HeavyCruiserSummerPrincess"
783
- | "FrenchBattleshipPrincess"
784
- | "AnchorageWaterDemonVacationMode"
785
- | "DockPrincess";
786
-
787
- export interface SupportShellingSimulatorParams {
788
- attacker_formation?: Formation;
789
- target_formation?: Formation;
790
- engagement: Engagement;
791
- }
792
-
793
- export interface MasterBattleDefinitions {
794
- formation: NestedFormationDef[];
795
- anti_air_cutin: AntiAirCutinDef[];
796
- day_cutin: DayCutinDef[];
797
- night_cutin: NightCutinDef[];
798
- historical_bonuses?: HistoricalBonusDef[];
799
- }
800
-
801
- export interface ShipAnalyzerConfig {
802
- air_state?: AirState;
803
- engagement?: Engagement;
804
- left?: AttackAnalyzerShipConfig;
805
- right?: AttackAnalyzerShipConfig;
806
- }
807
-
808
- export interface CompDayCutinAnalysis {
809
- rank3_air_state: AirState;
810
- rank2_air_state: AirState;
811
- main_fleet_los_mod: number | null;
812
- escort_fleet_los_mod: number | null;
813
- ships: ShipDayCutinAnalysis[];
814
- }
815
-
816
- export interface ShipDayCutinAnalysis {
817
- ship_id: number;
818
- role: Role;
819
- index: number;
820
- rank3: DayCutinReport;
821
- rank2: DayCutinReport;
822
- }
823
-
824
- export interface DayCutinReport extends ActionReport<DayPhaseAttackStyle> {
825
- observation_term: number | null;
826
- }
827
-
828
- export interface AttackAnalysis {
829
- attacker_is_player: boolean;
830
- attacker_ship_id: number;
831
- target_ship_id: number;
832
- historical_params: HistoricalParams;
833
- day: ActionReport<DayPhaseAttackStyle>;
834
- night: ActionReport<NightPhaseAttackStyle>;
835
- closing_torpedo: ActionReport<TorpedoAttackStyle>;
836
- opening_asw: ActionReport<AswAttackStyle>;
837
- support_shelling: ActionReport<SupportShellingStyle>;
838
- }
839
-
840
- export type FleetType = "Main" | "Escort" | "RouteSup" | "BossSup";
841
-
842
- export interface OrgState {
843
- id?: string;
844
- f1?: FleetState;
845
- f2?: FleetState;
846
- f3?: FleetState;
847
- f4?: FleetState;
848
- a1?: AirSquadronState;
849
- a2?: AirSquadronState;
850
- a3?: AirSquadronState;
851
- hq_level?: number;
852
- org_type?: OrgType;
853
- sortie?: FleetKey;
854
- route_sup?: FleetKey;
855
- boss_sup?: FleetKey;
856
- }
857
-
858
- export type FleetKey = "f1" | "f2" | "f3" | "f4";
859
-
860
- export type Histogram<K extends keyof any, V> = Partial<Record<K, V>>;
861
-
862
- export type GearVecInput = GearInput[];
863
-
864
- export interface GearInput {
865
- gear_id: number;
866
- types: GearTypeIdArray;
867
- firepower: number;
868
- torpedo: number;
869
- anti_air: number;
870
- armor: number;
871
- evasion: number;
872
- asw: number;
873
- los: number;
874
- bombing: number;
875
- accuracy: number;
876
- range: number;
877
- radius: number;
878
- stars: number;
879
- ace: number;
752
+ fighter_power: MasterIBonusRule[];
753
+ ship_anti_air: MasterIBonusRule[];
754
+ fleet_anti_air: MasterIBonusRule[];
755
+ elos: MasterIBonusRule[];
880
756
  }
881
757
 
882
- export interface ShipInput {
883
- ship_id: number;
884
- ctype: number;
885
- stype: number;
886
- yomi: string;
758
+ export interface MasterIBonusRule {
759
+ expr: CompiledEvaler;
760
+ formula: CompiledEvaler;
887
761
  }
888
762
 
889
- export interface EBonuses {
890
- firepower: number;
891
- torpedo: number;
892
- anti_air: number;
893
- armor: number;
894
- evasion: number;
895
- asw: number;
896
- los: number;
897
- bombing: number;
898
- accuracy: number;
899
- range: number;
763
+ export interface MasterGear {
764
+ gear_id: number;
765
+ name: string;
766
+ types: GearTypeIdArray;
767
+ special_type?: number;
768
+ max_hp?: number;
769
+ firepower?: number;
770
+ armor?: number;
771
+ torpedo?: number;
772
+ anti_air?: number;
773
+ speed?: number;
774
+ bombing?: number;
775
+ asw?: number;
776
+ los?: number;
777
+ luck?: number;
778
+ accuracy?: number;
779
+ evasion?: number;
780
+ range?: number;
781
+ radius?: number;
782
+ cost?: number;
783
+ improvable?: boolean;
784
+ ship_anti_air_resist?: number;
785
+ fleet_anti_air_resist?: number;
786
+ historical_aircraft_group?: number;
900
787
  }
901
788
 
902
- export interface CompAntiAirAnalysis {
903
- fleet_adjusted_anti_air: number;
904
- ships: AntiAirReport[];
905
- anti_air_cutin_chance: [number, number][];
789
+ export interface ShipAnalyzerConfig {
790
+ air_state?: AirState;
791
+ engagement?: Engagement;
792
+ left?: AttackAnalyzerShipConfig;
793
+ right?: AttackAnalyzerShipConfig;
906
794
  }
907
795
 
908
- export interface AntiAirReport {
909
- ship_id: number;
910
- role: Role;
911
- index: number;
912
- adjusted_anti_air: number | null;
913
- proportional_shotdown_rate: number | null;
914
- fixed_shotdown_number: number | null;
915
- guaranteed: number | null;
916
- anti_air_cutin_chance: [number, number][];
917
- anti_air_propellant_barrage_chance: number | null;
796
+ export interface AttackReport<T> {
797
+ style: T;
798
+ proc_rate: number | null;
799
+ attack_power: AttackPower | null;
800
+ attack_power_params: AttackPowerParams | null;
801
+ hits: number;
802
+ hit_rate: HitRate | null;
803
+ hit_rate_params: HitRateParams | null;
804
+ damage: DamageReport | null;
805
+ }
806
+
807
+ export interface AttackAnalyzerShipConfig
808
+ extends ShipConditions,
809
+ NightFleetConditions {
810
+ fleet_los_mod?: number | null;
918
811
  }
919
812
 
920
813
  export interface ShellingStyle {
@@ -954,17 +847,94 @@ export interface SupportShellingStyle {
954
847
  attack_type: SupportShellingType;
955
848
  }
956
849
 
957
- export interface DamageReport {
958
- miss_damage_min: number;
959
- miss_damage_max: number;
960
- normal_damage_min: number;
961
- normal_damage_max: number;
962
- critical_damage_min: number;
963
- critical_damage_max: number;
964
- normal_scratch_rate: number;
965
- critical_scratch_rate: number;
966
- damage_density: Histogram<number, number>;
967
- damage_state_density: Histogram<DamageState, number>;
850
+ export interface ShipMeta {
851
+ id: string;
852
+ ship_id: number;
853
+ }
854
+
855
+ export interface FleetMeta {
856
+ id: string;
857
+ len: number;
858
+ ships: [string, ShipMeta | null][];
859
+ }
860
+
861
+ export interface CompMeta {
862
+ fleets: Record<FleetType, FleetMeta>;
863
+ }
864
+
865
+ export type ShipAttr =
866
+ | "Unknown"
867
+ | "NightCarrier"
868
+ | "Installation"
869
+ | "RoyalNavy"
870
+ | "Kai2"
871
+ | "TurbineSpeedBonus"
872
+ | "Pillbox"
873
+ | "IsolatedIsland"
874
+ | "HarbourSummerPrincess"
875
+ | "SupplyDepot"
876
+ | "NewSupplyDepot"
877
+ | "PtImp"
878
+ | "BattleshipSummerPrincess"
879
+ | "HeavyCruiserSummerPrincess"
880
+ | "AnchorageWaterDemonVacationMode"
881
+ | "FrenchBattleshipPrincess"
882
+ | "DockPrincess";
883
+
884
+ export type SpecialEnemyType =
885
+ | "None"
886
+ | "SoftSkinned"
887
+ | "Pillbox"
888
+ | "IsolatedIsland"
889
+ | "SupplyDepot"
890
+ | "NewSupplyDepot"
891
+ | "HarbourSummerPrincess"
892
+ | "PtImp"
893
+ | "BattleshipSummerPrincess"
894
+ | "HeavyCruiserSummerPrincess"
895
+ | "FrenchBattleshipPrincess"
896
+ | "AnchorageWaterDemonVacationMode"
897
+ | "DockPrincess";
898
+
899
+ export interface MasterBattleDefinitions {
900
+ formation: NestedFormationDef[];
901
+ anti_air_cutin: AntiAirCutinDef[];
902
+ day_cutin: DayCutinDef[];
903
+ night_cutin: NightCutinDef[];
904
+ historical_bonuses?: HistoricalBonusDef[];
905
+ }
906
+
907
+ export interface FleetCutinReport<T> {
908
+ cutin: FleetCutin;
909
+ rate: number | null;
910
+ formation: Formation;
911
+ attacks: FleetCutinAttackReport<T>[];
912
+ }
913
+
914
+ export interface FleetCutinAttackReport<T> extends AttackReport<T> {
915
+ index: number;
916
+ ship_id: number;
917
+ power_mod: number;
918
+ }
919
+
920
+ export interface CompDayCutinAnalysis {
921
+ rank3_air_state: AirState;
922
+ rank2_air_state: AirState;
923
+ main_fleet_los_mod: number | null;
924
+ escort_fleet_los_mod: number | null;
925
+ ships: ShipDayCutinAnalysis[];
926
+ }
927
+
928
+ export interface ShipDayCutinAnalysis {
929
+ ship_id: number;
930
+ role: Role;
931
+ index: number;
932
+ rank3: DayCutinReport;
933
+ rank2: DayCutinReport;
934
+ }
935
+
936
+ export interface DayCutinReport extends ActionReport<DayPhaseAttackStyle> {
937
+ observation_term: number | null;
968
938
  }
969
939
 
970
940
  export interface CompAnalyzerConfig {
@@ -994,38 +964,66 @@ export interface CompAnalysis {
994
964
  anti_air: CompAntiAirAnalysis;
995
965
  }
996
966
 
997
- export interface AttackAnalyzerShipConfig
998
- extends ShipConditions,
999
- NightFleetConditions {
1000
- fleet_los_mod?: number | null;
967
+ export type Engagement = "GreenT" | "Parallel" | "HeadOn" | "RedT";
968
+
969
+ export type FleetType = "Main" | "Escort" | "RouteSup" | "BossSup";
970
+
971
+ export interface ShipPosition {
972
+ org_type?: OrgType;
973
+ fleet_type?: FleetType;
974
+ fleet_len?: number;
975
+ index?: number;
1001
976
  }
1002
977
 
1003
- export type SingleFormation =
1004
- | "LineAhead"
1005
- | "DoubleLine"
1006
- | "Diamond"
1007
- | "Echelon"
1008
- | "LineAbreast"
1009
- | "Vanguard";
978
+ export type Histogram<K extends keyof any, V> = Partial<Record<K, V>>;
1010
979
 
1011
- export type CombinedFormation =
1012
- | "Cruising1"
1013
- | "Cruising2"
1014
- | "Cruising3"
1015
- | "Cruising4";
980
+ export type GearTypeIdArray = [number, number, number, number, number];
1016
981
 
1017
- export type Formation = SingleFormation | CombinedFormation;
982
+ export interface NodeAttackAnalyzerShipConfig extends NightFleetConditions {
983
+ formation?: Formation;
984
+ }
1018
985
 
1019
- export type NodeId = string;
986
+ export interface NodeAttackAnalyzerConfig {
987
+ air_state?: AirState;
988
+ engagement?: Engagement;
989
+ node_state?: NodeState;
990
+ left?: NodeAttackAnalyzerShipConfig;
991
+ right?: NodeAttackAnalyzerShipConfig;
992
+ }
1020
993
 
1021
- export interface NodeState {
1022
- map?: number;
1023
- node?: NodeId;
1024
- phase?: number;
1025
- debuff?: boolean;
1026
- disable_historical_mod?: boolean;
994
+ export interface NodeAttackAnalysis {
995
+ left: AttackAnalysis;
996
+ right: AttackAnalysis;
997
+ shelling_fleet_cutin: FleetCutinReport<ShellingStyle>[];
998
+ night_fleet_cutin: FleetCutinReport<NightAttackStyle>[];
999
+ }
1000
+
1001
+ export interface CompAntiAirAnalysis {
1002
+ fleet_adjusted_anti_air: number;
1003
+ ships: AntiAirReport[];
1004
+ anti_air_cutin_chance: [number, number][];
1005
+ }
1006
+
1007
+ export interface AntiAirReport {
1008
+ ship_id: number;
1009
+ role: Role;
1010
+ index: number;
1011
+ adjusted_anti_air: number | null;
1012
+ proportional_shotdown_rate: number | null;
1013
+ fixed_shotdown_number: number | null;
1014
+ guaranteed: number | null;
1015
+ anti_air_cutin_chance: [number, number][];
1016
+ anti_air_propellant_barrage_chance: number | null;
1027
1017
  }
1028
1018
 
1019
+ export type OrgType =
1020
+ | "Single"
1021
+ | "CarrierTaskForce"
1022
+ | "SurfaceTaskForce"
1023
+ | "TransportEscort"
1024
+ | "EnemySingle"
1025
+ | "EnemyCombined";
1026
+
1029
1027
  /**
1030
1028
  */
1031
1029
  export class AirSquadron {