fleethub-core 1.3.2 → 1.4.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.
@@ -3,29 +3,86 @@
3
3
  /**
4
4
  */
5
5
  export function set_panic_hook(): void;
6
- export type CompDayCutinRateInfo = {
7
- main: FleetDayCutinRateInfo;
8
- escort: FleetDayCutinRateInfo | null;
9
- };
10
-
11
- export type FleetDayCutinRateInfo = {
12
- fleet_los_mod: number | null;
13
- ships: ShipDayCutinRateInfo[];
14
- };
6
+ export interface EBonuses {
7
+ firepower: number;
8
+ torpedo: number;
9
+ anti_air: number;
10
+ armor: number;
11
+ evasion: number;
12
+ asw: number;
13
+ los: number;
14
+ bombing: number;
15
+ accuracy: number;
16
+ range: number;
17
+ }
15
18
 
16
- export type ShipDayCutinRateInfo = {
19
+ export interface ShipInput {
17
20
  ship_id: number;
18
- air_supremacy: DayCutinRateInfo;
19
- air_superiority: DayCutinRateInfo;
20
- };
21
+ ctype: number;
22
+ stype: number;
23
+ yomi: string;
24
+ }
21
25
 
22
- export type DayCutinRateInfo = {
23
- observation_term: number | null;
24
- rates: [DayCutin | null, number | null][];
25
- total_cutin_rate: number | null;
26
- };
26
+ export interface GearInput {
27
+ gear_id: number;
28
+ types: GearTypeIdArray;
29
+ firepower: number;
30
+ torpedo: number;
31
+ anti_air: number;
32
+ armor: number;
33
+ evasion: number;
34
+ asw: number;
35
+ los: number;
36
+ bombing: number;
37
+ accuracy: number;
38
+ range: number;
39
+ radius: number;
40
+ stars: number;
41
+ ace: number;
42
+ }
43
+
44
+ export type GearVecInput = GearInput[];
45
+
46
+ export type AirStateRank = "Rank0" | "Rank1" | "Rank2" | "Rank3";
47
+
48
+ export type AirState =
49
+ | "AirSupremacy"
50
+ | "AirSuperiority"
51
+ | "AirParity"
52
+ | "AirDenial"
53
+ | "AirIncapability";
54
+
55
+ export interface MasterIBonuses {
56
+ shelling_power: MasterIBonusRule[];
57
+ carrier_shelling_power: MasterIBonusRule[];
58
+ shelling_accuracy: MasterIBonusRule[];
59
+ torpedo_power: MasterIBonusRule[];
60
+ torpedo_accuracy: MasterIBonusRule[];
61
+ torpedo_evasion: MasterIBonusRule[];
62
+ asw_power: MasterIBonusRule[];
63
+ asw_accuracy: MasterIBonusRule[];
64
+ night_power: MasterIBonusRule[];
65
+ night_accuracy: MasterIBonusRule[];
66
+ defense_power: MasterIBonusRule[];
67
+ contact_selection: MasterIBonusRule[];
68
+ fighter_power: MasterIBonusRule[];
69
+ ship_anti_air: MasterIBonusRule[];
70
+ fleet_anti_air: MasterIBonusRule[];
71
+ elos: MasterIBonusRule[];
72
+ }
73
+
74
+ export interface MasterIBonusRule {
75
+ expr: CompiledEvaler;
76
+ formula: CompiledEvaler;
77
+ }
78
+
79
+ export interface NightSituation {
80
+ night_contact_rank: ContactRank | null;
81
+ starshell: boolean;
82
+ searchlight: boolean;
83
+ }
27
84
 
28
- export type DamageInfo = {
85
+ export interface DamageInfo {
29
86
  miss_damage_min: number;
30
87
  miss_damage_max: number;
31
88
  normal_damage_min: number;
@@ -36,9 +93,63 @@ export type DamageInfo = {
36
93
  critical_scratch_rate: number;
37
94
  damage_map: NumMap<number, number>;
38
95
  damage_state_map: NumMap<DamageState, number>;
39
- };
96
+ }
40
97
 
41
- export type NumMap<K, V> = Partial<Record<K, V>>;
98
+ export interface BattleConfig {
99
+ formation: Record<Formation, NestedFormationDef>;
100
+ anti_air_cutin: Record<number, AntiAirCutinDef>;
101
+ day_cutin: Record<DayCutin, DayCutinDef>;
102
+ night_cutin: Record<NightCutin, NightCutinDef>;
103
+ }
104
+
105
+ export interface NightCutinDef {
106
+ tag: NightCutin;
107
+ hits: number;
108
+ chance_denom: number | null;
109
+ power_mod: number | null;
110
+ accuracy_mod: number | null;
111
+ }
112
+
113
+ export interface DayCutinDef {
114
+ tag: DayCutin;
115
+ hits: number;
116
+ chance_denom: number | null;
117
+ power_mod: number | null;
118
+ accuracy_mod: number | null;
119
+ }
120
+
121
+ export interface AntiAirCutinDef {
122
+ id: number;
123
+ chance_numer: number | null;
124
+ multiplier: number | null;
125
+ guaranteed: number | null;
126
+ sequential: boolean | null;
127
+ }
128
+
129
+ export type NestedFormationDef =
130
+ | FormationDef
131
+ | { top_half: FormationDef; bottom_half: FormationDef };
132
+
133
+ export interface FormationDef {
134
+ tag: Formation;
135
+ protection_rate: number | null;
136
+ fleet_anti_air_mod: number;
137
+ shelling: FormationWarfareDef;
138
+ torpedo: FormationWarfareDef;
139
+ asw: FormationWarfareDef;
140
+ night: FormationWarfareDef;
141
+ shelling_support: FormationWarfareDef;
142
+ }
143
+
144
+ export interface FormationWarfareDef {
145
+ power_mod: number | null;
146
+ accuracy_mod: number | null;
147
+ evasion_mod: number | null;
148
+ }
149
+
150
+ export type AirWaveType = "Jet" | "LandBase" | "Carrier";
151
+
152
+ export type AswAttackType = "DepthCharge" | "Aircraft";
42
153
 
43
154
  export type OrgType =
44
155
  | "Single"
@@ -48,130 +159,159 @@ export type OrgType =
48
159
  | "EnemySingle"
49
160
  | "EnemyCombined";
50
161
 
51
- export type ContactRank = "Rank1" | "Rank2" | "Rank3";
162
+ export interface WarfareContext {
163
+ attacker_env: WarfareShipEnvironment;
164
+ target_env: WarfareShipEnvironment;
165
+ engagement: Engagement;
166
+ air_state: AirState;
167
+ custom_mods: CustomModifiers;
168
+ }
52
169
 
53
- export type AirWaveType = "Jet" | "LandBase" | "Carrier";
170
+ export interface WarfareShipEnvironment {
171
+ org_type: OrgType;
172
+ role: Role;
173
+ ship_index: number;
174
+ fleet_len: number;
175
+ formation: Formation;
176
+ fleet_los_mod: number | null;
177
+ }
54
178
 
55
- export type SimulatorResult = {
56
- items: SimulatorResultItem[];
57
- sunk_vec: [number, number, number][];
58
- };
179
+ export interface AttackPower {
180
+ precap: number;
181
+ is_capped: boolean;
182
+ capped: number;
183
+ normal: number;
184
+ critical: number;
185
+ armor_penetration: number;
186
+ remaining_ammo_mod: number;
187
+ }
59
188
 
60
- export type SimulatorResultItem = {
61
- id: string;
62
- role: Role;
63
- index: number;
64
- damage_state_map: Record<DamageState, number>;
65
- };
189
+ export interface AttackPowerParams {
190
+ basic: number;
191
+ cap: number;
192
+ precap_mod: AttackPowerModifier;
193
+ postcap_mod: AttackPowerModifier;
194
+ ap_shell_mod: number | null;
195
+ carrier_power: number | null;
196
+ proficiency_critical_mod: number | null;
197
+ armor_penetration: number;
198
+ remaining_ammo_mod: number;
199
+ special_enemy_mods: SpecialEnemyModifiers;
200
+ custom_mods: CustomModifiers;
201
+ }
66
202
 
67
- export type AswAttackType = "DepthCharge" | "Aircraft";
203
+ export interface CustomModifiers {
204
+ precap_mod: AttackPowerModifier;
205
+ postcap_mod: AttackPowerModifier;
206
+ }
68
207
 
69
- export type MasterData = {
70
- gears: MasterGear[];
71
- gear_attrs: MasterAttrRule[];
72
- ships: MasterShip[];
73
- ship_attrs: MasterAttrRule[];
74
- equippable: MasterEquippable;
75
- ibonuses: MasterIBonuses;
76
- config: BattleConfig;
77
- };
208
+ export interface SpecialEnemyModifiers {
209
+ precap_general_mod: AttackPowerModifier;
210
+ stype_mod: AttackPowerModifier;
211
+ landing_craft_synergy_mod: AttackPowerModifier;
212
+ toku_daihatsu_tank_mod: AttackPowerModifier;
213
+ m4a1dd_mod: AttackPowerModifier;
214
+ honi_mod: AttackPowerModifier;
215
+ postcap_general_mod: AttackPowerModifier;
216
+ pt_mod: AttackPowerModifier;
217
+ }
78
218
 
79
- export type MasterEquippable = {
80
- equip_stype: EquipStype[];
81
- equip_exslot: number[];
82
- equip_ship: MstEquipShip[];
83
- equip_exslot_ship: MstEquipExslotShip[];
84
- };
219
+ export interface AttackPowerModifier {
220
+ a: number;
221
+ b: number;
222
+ }
85
223
 
86
- export type MstEquipExslotShip = {
87
- api_slotitem_id: number;
88
- api_ship_ids: number[];
89
- };
224
+ export type NumMap<K, V> = Partial<Record<K, V>>;
225
+
226
+ export type Role = "Main" | "Escort";
90
227
 
91
- export type MstEquipShip = { api_ship_id: number; api_equip_type: number[] };
228
+ export interface CompMeta {
229
+ fleets: Record<FleetType, FleetMeta>;
230
+ }
92
231
 
93
- export type EquipStype = { id: number; equip_type: number[] };
232
+ export interface FleetMeta {
233
+ id: string;
234
+ len: number;
235
+ ships: [string, ShipMeta | null][];
236
+ }
94
237
 
95
- export type MasterShip = {
238
+ export interface ShipMeta {
239
+ id: string;
96
240
  ship_id: number;
97
- name: string;
98
- yomi: string;
99
- stype: number;
100
- ctype: number;
101
- sort_id?: number;
102
- max_hp: StatInterval;
103
- firepower: StatInterval;
104
- armor: StatInterval;
105
- torpedo: StatInterval;
106
- evasion: StatInterval;
107
- anti_air: StatInterval;
108
- asw: StatInterval;
109
- los: StatInterval;
110
- luck: StatInterval;
111
- speed: number;
112
- range?: number;
113
- fuel?: number;
114
- ammo?: number;
115
- next_id?: number;
116
- next_level?: number;
117
- slotnum: number;
118
- slots: SlotSizeVec;
119
- stock: Array<GearState>;
120
- speed_group?: SpeedGroup;
121
- useful?: boolean;
122
- };
241
+ }
123
242
 
124
- export type StatInterval = [number | null, number | null];
243
+ export interface CompDayCutinRateInfo {
244
+ main: FleetDayCutinRateInfo;
245
+ escort: FleetDayCutinRateInfo | null;
246
+ }
125
247
 
126
- export type MasterIBonuses = {
127
- shelling_power: MasterIBonusRule[];
128
- carrier_shelling_power: MasterIBonusRule[];
129
- shelling_accuracy: MasterIBonusRule[];
130
- torpedo_power: MasterIBonusRule[];
131
- torpedo_accuracy: MasterIBonusRule[];
132
- torpedo_evasion: MasterIBonusRule[];
133
- asw_power: MasterIBonusRule[];
134
- asw_accuracy: MasterIBonusRule[];
135
- night_power: MasterIBonusRule[];
136
- night_accuracy: MasterIBonusRule[];
137
- defense_power: MasterIBonusRule[];
138
- contact_selection: MasterIBonusRule[];
139
- fighter_power: MasterIBonusRule[];
140
- ship_anti_air: MasterIBonusRule[];
141
- fleet_anti_air: MasterIBonusRule[];
142
- elos: MasterIBonusRule[];
143
- };
248
+ export interface FleetDayCutinRateInfo {
249
+ fleet_los_mod: number | null;
250
+ ships: ShipDayCutinRateInfo[];
251
+ }
144
252
 
145
- export type MasterIBonusRule = { expr: string; formula: string };
253
+ export interface ShipDayCutinRateInfo {
254
+ ship_id: number;
255
+ air_supremacy: DayCutinRateInfo;
256
+ air_superiority: DayCutinRateInfo;
257
+ }
146
258
 
147
- export type MasterAttrRule = { tag: string; name: string; expr: string };
259
+ export interface DayCutinRateInfo {
260
+ observation_term: number | null;
261
+ rates: [DayCutin | null, number | null][];
262
+ total_cutin_rate: number | null;
263
+ }
148
264
 
149
- export type MasterVariantDef = { tag: string; id: number; name: string };
265
+ export type ShipType =
266
+ | "Unknown"
267
+ | "DE"
268
+ | "DD"
269
+ | "CL"
270
+ | "CLT"
271
+ | "CA"
272
+ | "CAV"
273
+ | "CVL"
274
+ | "FBB"
275
+ | "BB"
276
+ | "BBV"
277
+ | "CV"
278
+ | "XBB"
279
+ | "SS"
280
+ | "SSV"
281
+ | "AP"
282
+ | "AV"
283
+ | "LHA"
284
+ | "CVB"
285
+ | "AR"
286
+ | "AS"
287
+ | "CT"
288
+ | "AO";
150
289
 
151
- export type MasterGear = {
152
- gear_id: number;
153
- name: string;
154
- types: GearTypeIdArray;
155
- special_type?: number;
156
- max_hp?: number;
157
- firepower?: number;
158
- armor?: number;
159
- torpedo?: number;
160
- anti_air?: number;
161
- speed?: number;
162
- bombing?: number;
163
- asw?: number;
164
- los?: number;
165
- luck?: number;
166
- accuracy?: number;
167
- evasion?: number;
168
- range?: number;
169
- radius?: number;
170
- cost?: number;
171
- improvable?: boolean;
172
- ship_anti_air_resistance?: number;
173
- fleet_anti_air_resistance?: number;
174
- };
290
+ export type ShipCategory =
291
+ | "Battleship"
292
+ | "AircraftCarrier"
293
+ | "HeavyCruiser"
294
+ | "LightCruiser"
295
+ | "Destroyer"
296
+ | "CoastalDefenseShip"
297
+ | "Submarine"
298
+ | "AuxiliaryShip";
299
+
300
+ export type ShellingSpecialAttack =
301
+ | { DayCutin: DayCutin }
302
+ | { FleetCutin: FleetCutin };
303
+
304
+ export type DayCutin =
305
+ | "MainMain"
306
+ | "MainAp"
307
+ | "MainRadar"
308
+ | "MainSec"
309
+ | "DoubleAttack"
310
+ | "FBA"
311
+ | "BBA"
312
+ | "BA"
313
+ | "Zuiun"
314
+ | "AirSea";
175
315
 
176
316
  export type GearCategory =
177
317
  | "Fighter"
@@ -248,9 +388,75 @@ export type GearType =
248
388
  | "LargeRadar2"
249
389
  | "CbRecon2";
250
390
 
251
- export type GearTypeIdArray = [number, number, number, number, number];
391
+ export type Engagement = "GreenT" | "Parallel" | "HeadOn" | "RedT";
392
+
393
+ export interface ShellingSupportSimulatorParams {
394
+ attacker_formation: Formation;
395
+ target_formation: Formation;
396
+ engagement: Engagement;
397
+ custom_mods: CustomModifiers;
398
+ }
399
+
400
+ export interface MasterData {
401
+ gears: MasterGear[];
402
+ gear_attrs: MasterAttrRule<GearAttr>[];
403
+ ships: MasterShip[];
404
+ ship_attrs: MasterAttrRule<ShipAttr>[];
405
+ ibonuses: MasterIBonuses;
406
+ equippable: MasterEquippable;
407
+ formation: NestedFormationDef[];
408
+ anti_air_cutin: AntiAirCutinDef[];
409
+ day_cutin: DayCutinDef[];
410
+ night_cutin: NightCutinDef[];
411
+ }
412
+
413
+ export interface MasterConfig {
414
+ formation: NestedFormationDef[];
415
+ anti_air_cutin: AntiAirCutinDef[];
416
+ day_cutin: DayCutinDef[];
417
+ night_cutin: NightCutinDef[];
418
+ }
419
+
420
+ export interface MasterAttrRule<T> {
421
+ tag: T;
422
+ name: string;
423
+ expr: string;
424
+ }
425
+
426
+ export interface MasterShip {
427
+ ship_id: number;
428
+ name: string;
429
+ yomi: string;
430
+ stype: number;
431
+ ctype: 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
+ speed: number;
444
+ range?: number;
445
+ fuel?: number;
446
+ ammo?: number;
447
+ next_id?: number;
448
+ next_level?: number;
449
+ slotnum: number;
450
+ slots: SlotSizeVec;
451
+ stock: GearState[];
452
+ speed_group?: SpeedGroup;
453
+ useful?: boolean;
454
+ }
455
+
456
+ export type StatInterval = [number | null, number | null];
252
457
 
253
458
  export type ShipAttr =
459
+ | "Unknown"
254
460
  | "Abyssal"
255
461
  | "NightCarrier"
256
462
  | "Installation"
@@ -265,327 +471,153 @@ export type ShipAttr =
265
471
  | "BattleshipSummerPrincess"
266
472
  | "HeavyCruiserSummerPrincess";
267
473
 
268
- export type Role = "Main" | "Escort";
269
-
270
- export type CompMeta = { fleets: Record<FleetType, FleetMeta> };
271
-
272
- export type FleetMeta = {
273
- id: string;
274
- len: number;
275
- ships: [string, ShipMeta | null][];
276
- };
277
-
278
- export type ShipMeta = { id: string; ship_id: number };
279
-
280
- export type GearAttr =
281
- | "Abyssal"
282
- | "HighAngleMount"
283
- | "NightFighter"
284
- | "NightAttacker"
285
- | "HeavyBomber"
286
- | "MainGun"
287
- | "Radar"
288
- | "SurfaceRadar"
289
- | "AirRadar"
290
- | "DepthChargeProjector"
291
- | "AdditionalDepthCharge"
292
- | "AntiSubMortar"
293
- | "AntiSubWeapon"
294
- | "AntiSubAircraft"
295
- | "LateModelBowTorpedo"
296
- | "Seaplane"
297
- | "CbAircraft"
298
- | "LbAircraft"
299
- | "JetAircraft"
300
- | "Fighter"
301
- | "Recon"
302
- | "ObservationSeaplane"
303
- | "CbFighterBomber"
304
- | "AntiInstDiveBomber"
305
- | "NightRecon"
306
- | "CbSwordfish"
307
- | "SemiNightPlane"
308
- | "HighAltitudeInterceptor";
309
-
310
- export type WarfareContext = {
311
- attacker_env: WarfareShipEnvironment;
312
- target_env: WarfareShipEnvironment;
313
- engagement: Engagement;
314
- air_state: AirState;
315
- custom_mods: CustomModifiers;
316
- };
317
-
318
- export type WarfareShipEnvironment = {
319
- org_type: OrgType;
320
- role: Role;
321
- ship_index: number;
322
- fleet_len: number;
323
- formation: Formation;
324
- fleet_los_mod: number | null;
325
- };
326
-
327
- export type ShipType =
328
- | "Unknown"
329
- | "DE"
330
- | "DD"
331
- | "CL"
332
- | "CLT"
333
- | "CA"
334
- | "CAV"
335
- | "CVL"
336
- | "FBB"
337
- | "BB"
338
- | "BBV"
339
- | "CV"
340
- | "XBB"
341
- | "SS"
342
- | "SSV"
343
- | "AP"
344
- | "AV"
345
- | "LHA"
346
- | "CVB"
347
- | "AR"
348
- | "AS"
349
- | "CT"
350
- | "AO";
351
-
352
- export type ShipCategory =
353
- | "Battleship"
354
- | "AircraftCarrier"
355
- | "HeavyCruiser"
356
- | "LightCruiser"
357
- | "Destroyer"
358
- | "CoastalDefenseShip"
359
- | "Submarine"
360
- | "AuxiliaryShip";
361
-
362
- export type ShellingSpecialAttack =
363
- | { DayCutin: DayCutin }
364
- | { FleetCutin: FleetCutin };
365
-
366
- export type DayCutin =
367
- | "MainMain"
368
- | "MainAp"
369
- | "MainRadar"
370
- | "MainSec"
371
- | "DoubleAttack"
372
- | "FBA"
373
- | "BBA"
374
- | "BA"
375
- | "Zuiun"
376
- | "AirSea";
377
-
378
- export type Engagement = "GreenT" | "Parallel" | "HeadOn" | "RedT";
379
-
380
- export type EBonusFnGearInput = {
381
- gear_id: number;
382
- types: GearTypeIdArray;
383
- firepower: number;
384
- torpedo: number;
385
- anti_air: number;
386
- armor: number;
387
- evasion: number;
388
- asw: number;
389
- los: number;
390
- bombing: number;
391
- accuracy: number;
392
- range: number;
393
- radius: number;
394
- stars: number;
395
- ace: number;
396
- };
397
-
398
- export type EBonusFnShipInput = {
399
- ship_id: number;
400
- ctype: number;
401
- stype: number;
402
- yomi: string;
403
- };
404
-
405
- export type EBonuses = {
406
- firepower: number;
407
- torpedo: number;
408
- anti_air: number;
409
- armor: number;
410
- evasion: number;
411
- asw: number;
412
- los: number;
413
- bombing: number;
414
- accuracy: number;
415
- range: number;
416
- };
417
-
418
- export type AirStateRank = "Rank0" | "Rank1" | "Rank2" | "Rank3";
419
-
420
- export type AirState =
421
- | "AirSupremacy"
422
- | "AirSuperiority"
423
- | "AirParity"
424
- | "AirDenial"
425
- | "AirIncapability";
426
-
427
- export type ShellingSupportSimulatorParams = {
428
- attacker_formation: Formation;
429
- target_formation: Formation;
430
- engagement: Engagement;
431
- custom_mods: CustomModifiers;
432
- };
433
-
434
- export type NightSituation = {
435
- night_contact_rank: ContactRank | null;
436
- starshell: boolean;
437
- searchlight: boolean;
438
- };
439
-
440
- export type AttackPower = {
441
- precap: number;
442
- is_capped: boolean;
443
- capped: number;
444
- normal: number;
445
- critical: number;
446
- armor_penetration: number;
447
- remaining_ammo_mod: number;
448
- };
449
-
450
- export type AttackPowerParams = {
451
- basic: number;
452
- cap: number;
453
- precap_mod: AttackPowerModifier;
454
- postcap_mod: AttackPowerModifier;
455
- ap_shell_mod: number | null;
456
- carrier_power: number | null;
457
- proficiency_critical_mod: number | null;
458
- armor_penetration: number;
459
- remaining_ammo_mod: number;
460
- special_enemy_mods: SpecialEnemyModifiers;
461
- custom_mods: CustomModifiers;
462
- };
463
-
464
- export type CustomModifiers = {
465
- precap_mod: AttackPowerModifier;
466
- postcap_mod: AttackPowerModifier;
467
- };
474
+ export type Formation = SingleFormation | CombinedFormation;
468
475
 
469
- export type SpecialEnemyModifiers = {
470
- precap_general_mod: AttackPowerModifier;
471
- stype_mod: AttackPowerModifier;
472
- landing_craft_synergy_mod: AttackPowerModifier;
473
- toku_daihatsu_tank_mod: AttackPowerModifier;
474
- m4a1dd_mod: AttackPowerModifier;
475
- honi_mod: AttackPowerModifier;
476
- postcap_general_mod: AttackPowerModifier;
477
- pt_mod: AttackPowerModifier;
478
- };
476
+ export type CombinedFormation =
477
+ | "Cruising1"
478
+ | "Cruising2"
479
+ | "Cruising3"
480
+ | "Cruising4";
479
481
 
480
- export type AttackPowerModifier = { a: number; b: number };
482
+ export type SingleFormation =
483
+ | "LineAhead"
484
+ | "DoubleLine"
485
+ | "Diamond"
486
+ | "Echelon"
487
+ | "LineAbreast"
488
+ | "Vanguard";
481
489
 
482
- export type FleetType = "Main" | "Escort" | "RouteSup" | "BossSup";
490
+ export type ShellingAttackType = "Normal" | "Carrier";
483
491
 
484
- export type FleetCutinAnalysis = {
492
+ export interface FleetCutinAnalysis {
485
493
  shelling: FleetCutinInfo[];
486
494
  night: FleetCutinInfo[];
487
- };
495
+ }
488
496
 
489
- export type FleetCutinInfo = {
497
+ export interface FleetCutinInfo {
490
498
  cutin: FleetCutin;
491
499
  formation: Formation;
492
500
  items: FleetCutinInfoItem[];
493
- };
501
+ }
494
502
 
495
- export type FleetCutinInfoItem = {
503
+ export interface FleetCutinInfoItem {
496
504
  ship_id: number;
497
505
  cutin: FleetCutin;
498
506
  fleet_cutin_mod: number;
499
507
  stats: AttackStats;
500
- };
501
-
502
- export type CompAntiAirInfo = {
503
- fleet_adjusted_anti_air: number;
504
- ships: ShipAntiAirInfo[];
505
- anti_air_cutin_chance: [number, number][];
506
- };
507
-
508
- export type ShipAntiAirInfo = {
509
- ship_id: number;
510
- adjusted_anti_air: number | null;
511
- proportional_shotdown_rate: number | null;
512
- fixed_shotdown_number: number | null;
513
- guaranteed: number | null;
514
- anti_air_cutin_chance: [number, number][];
515
- anti_air_propellant_barrage_chance: number | null;
516
- };
508
+ }
517
509
 
518
- export type CompContactChanceInfo = {
510
+ export interface CompContactChanceInfo {
519
511
  single: AirstrikeContactChance[] | null;
520
512
  combined: AirstrikeContactChance[] | null;
521
- };
513
+ }
522
514
 
523
- export type AirstrikeContactChance = {
515
+ export interface AirstrikeContactChance {
524
516
  air_state: AirState;
525
517
  trigger_rate: number;
526
518
  rank3: number;
527
519
  rank2: number;
528
520
  rank1: number;
529
521
  total: number;
530
- };
531
-
532
- import * as bindings from "../bindings";
533
- export * from "../bindings";
522
+ }
534
523
 
535
- export type Formation = SingleFormation | CombinedFormation;
524
+ export type GearAttr =
525
+ | "Unknown"
526
+ | "Abyssal"
527
+ | "HighAngleMount"
528
+ | "NightFighter"
529
+ | "NightAttacker"
530
+ | "HeavyBomber"
531
+ | "MainGun"
532
+ | "Radar"
533
+ | "SurfaceRadar"
534
+ | "AirRadar"
535
+ | "DepthChargeProjector"
536
+ | "SynergisticDepthCharge"
537
+ | "AntiSubMortar"
538
+ | "AntiSubWeapon"
539
+ | "AntiSubAircraft"
540
+ | "LateModelBowTorpedo"
541
+ | "Seaplane"
542
+ | "CbAircraft"
543
+ | "LbAircraft"
544
+ | "JetAircraft"
545
+ | "Fighter"
546
+ | "Recon"
547
+ | "ObservationSeaplane"
548
+ | "CbFighterBomber"
549
+ | "AntiInstDiveBomber"
550
+ | "NightRecon"
551
+ | "CbSwordfish"
552
+ | "SemiNightPlane"
553
+ | "HighAltitudeInterceptor";
536
554
 
537
- export type CombinedFormation =
538
- | "Cruising1"
539
- | "Cruising2"
540
- | "Cruising3"
541
- | "Cruising4";
555
+ export type FleetType = "Main" | "Escort" | "RouteSup" | "BossSup";
542
556
 
543
- export type SingleFormation =
544
- | "LineAhead"
545
- | "DoubleLine"
546
- | "Diamond"
547
- | "Echelon"
548
- | "LineAbreast"
549
- | "Vanguard";
557
+ export interface MasterEquippable {
558
+ equip_stype: EquipStype[];
559
+ equip_exslot: number[];
560
+ equip_ship: MstEquipShip[];
561
+ equip_exslot_ship: MstEquipExslotShip[];
562
+ }
550
563
 
551
- export type ShellingAttackType = "Normal" | "Carrier";
564
+ export interface MstEquipExslotShip {
565
+ api_slotitem_id: number;
566
+ api_ship_ids: number[];
567
+ }
552
568
 
553
- export type NightBattleAttackType =
554
- | { t: "NightAttack"; c: NightAttackType }
555
- | { t: "Asw"; c: AswAttackType };
569
+ export interface MstEquipShip {
570
+ api_ship_id: number;
571
+ api_equip_type: number[];
572
+ }
556
573
 
557
- export type DayBattleAttackType =
558
- | { t: "Shelling"; c: ShellingAttackType }
559
- | { t: "Asw"; c: AswAttackType };
574
+ export interface EquipStype {
575
+ id: number;
576
+ equip_type: number[];
577
+ }
560
578
 
561
- export type AttackInfo<AttackType, Cutin> = {
579
+ export interface AttackInfo<AttackType, Cutin> {
562
580
  attack_type: AttackType;
563
581
  items: AttackInfoItem<Cutin>[];
564
582
  damage_state_map: NumMap<DamageState, number> | null;
565
- };
583
+ }
566
584
 
567
- export type AttackInfoItem<Cutin> = {
585
+ export interface AttackInfoItem<Cutin> {
568
586
  cutin: Cutin;
569
587
  rate: number | null;
570
588
  stats: AttackStats;
571
- };
589
+ }
572
590
 
573
- export type AttackStats = {
591
+ export interface AttackStats {
574
592
  attack_power: AttackPower | null;
575
593
  attack_power_params: AttackPowerParams | null;
576
594
  hits: number;
577
595
  hit_rate: HitRate | null;
578
596
  hit_rate_params: HitRateParams | null;
579
597
  damage: DamageInfo | null;
580
- };
598
+ }
581
599
 
582
- export type SlotSizeVec = (number | null)[];
600
+ export interface CompAntiAirInfo {
601
+ fleet_adjusted_anti_air: number;
602
+ ships: ShipAntiAirInfo[];
603
+ anti_air_cutin_chance: [number, number][];
604
+ }
605
+
606
+ export interface ShipAntiAirInfo {
607
+ ship_id: number;
608
+ adjusted_anti_air: number | null;
609
+ proportional_shotdown_rate: number | null;
610
+ fixed_shotdown_number: number | null;
611
+ guaranteed: number | null;
612
+ anti_air_cutin_chance: [number, number][];
613
+ anti_air_propellant_barrage_chance: number | null;
614
+ }
583
615
 
584
616
  export type ShipStateMap = Record<ShipKey, ShipState>;
585
617
 
586
618
  export type ShipKey = "s1" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7";
587
619
 
588
- export type OrgState = {
620
+ export interface OrgState {
589
621
  id?: string;
590
622
  f1?: FleetState;
591
623
  f2?: FleetState;
@@ -599,9 +631,9 @@ export type OrgState = {
599
631
  sortie?: string;
600
632
  route_sup?: string;
601
633
  boss_sup?: string;
602
- };
634
+ }
603
635
 
604
- export type AirSquadronState = {
636
+ export interface AirSquadronState {
605
637
  id?: string;
606
638
  mode?: AirSquadronMode;
607
639
  g1?: GearState;
@@ -615,11 +647,11 @@ export type AirSquadronState = {
615
647
  ss3?: number;
616
648
  ss4?: number;
617
649
  ss5?: number;
618
- };
650
+ }
619
651
 
620
652
  export type AirSquadronMode = "Sortie" | "AirDefense";
621
653
 
622
- export type FleetState = {
654
+ export interface FleetState {
623
655
  id?: string;
624
656
  len?: number;
625
657
  s1?: ShipState;
@@ -629,9 +661,9 @@ export type FleetState = {
629
661
  s5?: ShipState;
630
662
  s6?: ShipState;
631
663
  s7?: ShipState;
632
- };
664
+ }
633
665
 
634
- export type ShipState = {
666
+ export interface ShipState {
635
667
  id?: string;
636
668
  ship_id: number;
637
669
  level?: number;
@@ -659,42 +691,113 @@ export type ShipState = {
659
691
  ss3?: number;
660
692
  ss4?: number;
661
693
  ss5?: number;
662
- };
694
+ overrides?: ShipOverrides;
695
+ }
663
696
 
664
- export type GearState = {
697
+ export interface ShipOverrides {
698
+ max_hp?: number;
699
+ luck?: number;
700
+ naked_evasion?: number;
701
+ naked_asw?: number;
702
+ naked_los?: number;
703
+ }
704
+
705
+ export interface GearState {
665
706
  id?: string;
666
707
  gear_id: number;
667
708
  exp?: number;
668
709
  stars?: number;
669
- };
710
+ }
711
+
712
+ export type Side = "Player" | "Enemy";
713
+
714
+ export type NightBattleAttackType =
715
+ | { t: "NightAttack"; c: NightAttackType }
716
+ | { t: "Asw"; c: AswAttackType };
717
+
718
+ export type DayBattleAttackType =
719
+ | { t: "Shelling"; c: ShellingAttackType }
720
+ | { t: "Asw"; c: AswAttackType };
721
+
722
+ export type NightAttackType = "Normal" | "ArkRoyal" | "Carrier";
723
+
724
+ export type NightSpecialAttack =
725
+ | { NightCutin: NightCutin }
726
+ | { FleetCutin: FleetCutin };
727
+
728
+ export type NightCutin =
729
+ | "MainTorpRadar"
730
+ | "TorpLookoutRadar"
731
+ | "TorpTsloTorp"
732
+ | "TorpTsloDrum"
733
+ | "DoubleAttack"
734
+ | "TorpTorpMain"
735
+ | "TorpTorpTorp"
736
+ | "MainMainSec"
737
+ | "MainMainMain"
738
+ | "SubTorpTorp"
739
+ | "SubRadarTorp"
740
+ | "Cvci1_25"
741
+ | "Cvci1_20"
742
+ | "Cvci1_18"
743
+ | "Photobomber";
744
+
745
+ export interface MasterGear {
746
+ gear_id: number;
747
+ name: string;
748
+ types: GearTypeIdArray;
749
+ special_type?: number;
750
+ max_hp?: number;
751
+ firepower?: number;
752
+ armor?: number;
753
+ torpedo?: number;
754
+ anti_air?: number;
755
+ speed?: number;
756
+ bombing?: number;
757
+ asw?: number;
758
+ los?: number;
759
+ luck?: number;
760
+ accuracy?: number;
761
+ evasion?: number;
762
+ range?: number;
763
+ radius?: number;
764
+ cost?: number;
765
+ improvable?: boolean;
766
+ ship_anti_air_resistance?: number;
767
+ fleet_anti_air_resistance?: number;
768
+ }
670
769
 
671
- export type HitRate = { total: number; normal: number; critical: number };
770
+ export interface HitRate {
771
+ total: number;
772
+ normal: number;
773
+ critical: number;
774
+ }
672
775
 
673
- export type HitRateParams = {
776
+ export interface HitRateParams {
674
777
  accuracy_term: number;
675
778
  evasion_term: number;
676
779
  target_morale_mod: number;
677
780
  critical_rate_constant: number;
678
781
  critical_percentage_bonus: number;
679
782
  hit_percentage_bonus: number;
680
- };
783
+ }
681
784
 
682
- export type WarfareInfo = {
785
+ export interface WarfareInfo {
683
786
  day: AttackInfo<DayBattleAttackType, DayCutin | null> | null;
684
787
  closing_torpedo: AttackInfo<null, null> | null;
685
788
  night: AttackInfo<NightBattleAttackType, NightCutin | null> | null;
686
789
  shelling_support: AttackInfo<null, null> | null;
687
790
  opening_asw: AttackInfo<null, null> | null;
688
- };
791
+ }
689
792
 
690
- export type WarfareAnalyzerContext = {
793
+ export interface WarfareAnalyzerContext {
691
794
  attacker_env: WarfareAnalyzerShipEnvironment;
692
795
  target_env: WarfareAnalyzerShipEnvironment;
693
796
  engagement: Engagement;
694
797
  air_state: AirState;
695
- };
798
+ }
696
799
 
697
- export type WarfareAnalyzerShipEnvironment = {
800
+ export interface WarfareAnalyzerShipEnvironment {
698
801
  org_type: OrgType;
699
802
  role: Role;
700
803
  ship_index: number;
@@ -703,9 +806,11 @@ export type WarfareAnalyzerShipEnvironment = {
703
806
  fleet_los_mod: number | null;
704
807
  night_situation: NightSituation;
705
808
  custom_mods: CustomModifiers;
706
- };
809
+ }
707
810
 
708
- export type Side = "Player" | "Enemy";
811
+ export type GearTypeIdArray = [number, number, number, number, number];
812
+
813
+ export type SlotSizeVec = (number | null)[];
709
814
 
710
815
  export type SpecialEnemyType =
711
816
  | "None"
@@ -724,109 +829,48 @@ export type DamageState = "Normal" | "Shouha" | "Chuuha" | "Taiha" | "Sunk";
724
829
 
725
830
  export type SpeedGroup = "A" | "B1" | "B2" | "C";
726
831
 
727
- export type NightAttackType = "Normal" | "ArkRoyal" | "Carrier";
728
-
729
- export type NightSpecialAttack =
730
- | { NightCutin: NightCutin }
731
- | { FleetCutin: FleetCutin };
732
-
733
- export type NightCutin =
734
- | "MainTorpRadar"
735
- | "TorpLookoutRadar"
736
- | "TorpTsloTorp"
737
- | "TorpTsloDrum"
738
- | "DoubleAttack"
739
- | "TorpTorpMain"
740
- | "TorpTorpTorp"
741
- | "MainMainSec"
742
- | "MainMainMain"
743
- | "SubTorpTorp"
744
- | "SubRadarTorp"
745
- | "Cvci1_25"
746
- | "Cvci1_20"
747
- | "Cvci1_18"
748
- | "Photobomber";
749
-
750
832
  export type FleetCutin =
751
833
  | "NelsonTouch"
752
834
  | "NagatoCutin"
753
835
  | "ColoradoCutin"
754
836
  | "KongouCutin";
755
837
 
756
- export type BattleConfig = {
757
- formation: NestedFormationDef[];
758
- anti_air_cutin: AntiAirCutinDef[];
759
- day_cutin: DayCutinDef[];
760
- night_cutin: NightCutinDef[];
761
- };
762
-
763
- export type NightCutinDef = {
764
- tag: NightCutin;
765
- hits: number;
766
- chance_denom: number | null;
767
- power_mod: number | null;
768
- accuracy_mod: number | null;
769
- };
770
-
771
- export type DayCutinDef = {
772
- tag: DayCutin;
773
- hits: number;
774
- chance_denom: number | null;
775
- power_mod: number | null;
776
- accuracy_mod: number | null;
777
- };
778
-
779
- export type AntiAirCutinDef = {
780
- id: number;
781
- chance_numer: number | null;
782
- multiplier: number | null;
783
- guaranteed: number | null;
784
- sequential: boolean | null;
785
- };
786
-
787
- export type NestedFormationDef =
788
- | FormationDef
789
- | { top_half: FormationDef; bottom_half: FormationDef };
838
+ export type ContactRank = "Rank1" | "Rank2" | "Rank3";
790
839
 
791
- export type FormationDef = {
792
- tag: Formation;
793
- protection_rate: number | null;
794
- fleet_anti_air_mod: number;
795
- shelling: FormationWarfareDef;
796
- torpedo: FormationWarfareDef;
797
- asw: FormationWarfareDef;
798
- night: FormationWarfareDef;
799
- shelling_support: FormationWarfareDef;
800
- };
840
+ export interface SimulatorResult {
841
+ items: SimulatorResultItem[];
842
+ sunk_vec: [number, number, number][];
843
+ }
801
844
 
802
- export type FormationWarfareDef = {
803
- power_mod: number | null;
804
- accuracy_mod: number | null;
805
- evasion_mod: number | null;
806
- };
845
+ export interface SimulatorResultItem {
846
+ id: string;
847
+ role: Role;
848
+ index: number;
849
+ damage_state_map: Record<DamageState, number>;
850
+ }
807
851
 
808
- export type FleetNightCutinRateInfo = {
852
+ export interface FleetNightCutinRateInfo {
809
853
  night_contact_chance: NightContactChance;
810
854
  ships: ShipNightCutinRateInfo[];
811
- };
855
+ }
812
856
 
813
- export type ShipNightCutinRateInfo = {
857
+ export interface ShipNightCutinRateInfo {
814
858
  ship_id: number;
815
859
  normal: NightCutinRateInfo;
816
860
  chuuha: NightCutinRateInfo;
817
- };
861
+ }
818
862
 
819
- export type NightCutinRateInfo = {
863
+ export interface NightCutinRateInfo {
820
864
  cutin_term: number | null;
821
865
  rates: [NightCutin | null, number | null][];
822
- };
866
+ }
823
867
 
824
- export type NightContactChance = {
868
+ export interface NightContactChance {
825
869
  rank1: number;
826
870
  rank2: number;
827
871
  rank3: number;
828
872
  total: number;
829
- };
873
+ }
830
874
 
831
875
  /**
832
876
  */
@@ -1038,10 +1082,9 @@ export class Comp {
1038
1082
  export class FhCore {
1039
1083
  free(): void;
1040
1084
  /**
1041
- * @param {any} js_master
1042
- * @param {Function} js_fn
1085
+ * @param {MasterData} js_master
1043
1086
  */
1044
- constructor(js_master: any, js_fn: Function);
1087
+ constructor(js_master: MasterData);
1045
1088
  /**
1046
1089
  * @param {GearState | undefined} input
1047
1090
  * @returns {Gear | undefined}
@@ -1072,6 +1115,10 @@ export class FhCore {
1072
1115
  * @returns {Ship | undefined}
1073
1116
  */
1074
1117
  create_ship_by_id(ship_id: number): Ship | undefined;
1118
+ /**
1119
+ * @returns {Ship[]}
1120
+ */
1121
+ create_all_ships(): Ship[];
1075
1122
  /**
1076
1123
  * @param {Uint16Array} main
1077
1124
  * @param {Uint16Array | undefined} escort
@@ -1944,6 +1991,10 @@ export class Ship {
1944
1991
  * @returns {number | undefined}
1945
1992
  */
1946
1993
  readonly torpedo: number | undefined;
1994
+ /**
1995
+ * @returns {number}
1996
+ */
1997
+ readonly torpedo_accuracy_mod: number;
1947
1998
  /**
1948
1999
  * @returns {boolean}
1949
2000
  */