ogamejs 4.1.0 → 4.3.0
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.
- package/README.md +56 -16
- package/package.json +1 -1
- package/src/fleets/combat.js +145 -36
- package/src/fleets/combatStatistics.js +189 -0
- package/src/fleets/distance.js +27 -4
- package/src/fleets/flight.js +55 -16
- package/src/fleets/index.js +11 -2
- package/src/fleets/speed.js +22 -7
- package/src/types.js +13 -0
- package/types/fleets/combat.d.ts +88 -24
- package/types/fleets/combat.d.ts.map +1 -1
- package/types/fleets/combatStatistics.d.ts +67 -0
- package/types/fleets/combatStatistics.d.ts.map +1 -0
- package/types/fleets/distance.d.ts +6 -2
- package/types/fleets/distance.d.ts.map +1 -1
- package/types/fleets/flight.d.ts +28 -4
- package/types/fleets/flight.d.ts.map +1 -1
- package/types/fleets/index.d.ts +6 -3
- package/types/fleets/index.d.ts.map +1 -1
- package/types/fleets/speed.d.ts +9 -2
- package/types/fleets/speed.d.ts.map +1 -1
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +41 -0
- package/types/types.d.ts.map +1 -1
package/src/fleets/flight.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import getDistance from './distance.js';
|
|
2
2
|
import { getFleetSpeed, getActiveDrive } from './speed.js';
|
|
3
3
|
|
|
4
|
+
/** The game stops the fuel discounts here, however many add up. */
|
|
5
|
+
const MAX_FUEL_REDUCTION = 0.9;
|
|
6
|
+
|
|
4
7
|
function assertSpeedPercent(speedPercent) {
|
|
5
8
|
if (!Number.isFinite(speedPercent) || speedPercent <= 0 || speedPercent > 100) {
|
|
6
9
|
throw new Error(`speedPercent must be between 1 and 100, received ${speedPercent}`);
|
|
@@ -11,7 +14,9 @@ function assertSpeedPercent(speedPercent) {
|
|
|
11
14
|
*
|
|
12
15
|
* Return the one way flight time of a fleet
|
|
13
16
|
*
|
|
14
|
-
* `(10 +
|
|
17
|
+
* `(10 + 350000 / speedPercent * sqrt(distance * 10 / fleetSpeed)) / universeFleetSpeed`
|
|
18
|
+
*
|
|
19
|
+
* At 100% that is the well known `10 + 3500 * sqrt(distance * 10 / fleetSpeed)`.
|
|
15
20
|
* @param {number} distance The distance to cross, from `getDistance`
|
|
16
21
|
* @param {number} fleetSpeed The speed of the slowest ship, from `getFleetSpeed`
|
|
17
22
|
* @param {number} [speedPercent] The fleet speed slider, 10 to 100 in game
|
|
@@ -25,7 +30,7 @@ function getFlightTime(distance, fleetSpeed, speedPercent = 100, universeFleetSp
|
|
|
25
30
|
throw new Error(`fleetSpeed must be greater than 0, received ${fleetSpeed}`);
|
|
26
31
|
}
|
|
27
32
|
|
|
28
|
-
const seconds = 10 + (
|
|
33
|
+
const seconds = 10 + (350000 / speedPercent) * Math.sqrt((distance * 10) / fleetSpeed);
|
|
29
34
|
|
|
30
35
|
return Math.round(seconds / universeFleetSpeed);
|
|
31
36
|
}
|
|
@@ -34,31 +39,57 @@ function getFlightTime(distance, fleetSpeed, speedPercent = 100, universeFleetSp
|
|
|
34
39
|
*
|
|
35
40
|
* Return the deuterium a fleet burns for a one way trip
|
|
36
41
|
*
|
|
37
|
-
*
|
|
42
|
+
* Each ship type is billed on its own, then the bills add up:
|
|
43
|
+
* `max(1, round(consumption * count * distance / 35000 * (shipSpeedValue / 10 + 1) ** 2))`
|
|
44
|
+
*
|
|
45
|
+
* `shipSpeedValue` is the speed the ship really flies at, on the game's 1 to 10
|
|
46
|
+
* scale: `speedPercent / 10` for the slowest ship, less for the faster ones held
|
|
47
|
+
* back by it, `speedPercent / 10 * sqrt(fleetSpeed / shipSpeed)`. A faster ship
|
|
48
|
+
* flying slower than it could burns less than at full throttle.
|
|
49
|
+
*
|
|
50
|
+
* `consumption` is the ship's own, after the universe deuterium factor and the
|
|
51
|
+
* entry's `fuelReduction` (General, life forms), each rounded down and never
|
|
52
|
+
* below one unit.
|
|
38
53
|
* @param {import('../types.js').FleetEntry[]} fleet The ships taking off
|
|
39
54
|
* @param {number} distance The distance to cross, from `getDistance`
|
|
40
55
|
* @param {number} [speedPercent] The fleet speed slider, 10 to 100 in game
|
|
41
56
|
* @param {import('../types.js').Drives} [drives] Drive levels, needed because a
|
|
42
57
|
* ship that switched drive also changed its consumption
|
|
58
|
+
* @param {object} [options] Universe settings
|
|
59
|
+
* @param {number} [options.deuteriumFactor] The universe deuterium consumption
|
|
60
|
+
* factor (`globalDeuteriumSaveFactor` in the API), 1 when left out
|
|
43
61
|
* @returns {number} The fuel needed, in deuterium
|
|
44
62
|
*/
|
|
45
|
-
function getFuelConsumption(fleet, distance, speedPercent = 100, drives = {}) {
|
|
63
|
+
function getFuelConsumption(fleet, distance, speedPercent = 100, drives = {}, options = {}) {
|
|
46
64
|
assertSpeedPercent(speedPercent);
|
|
47
65
|
|
|
48
|
-
|
|
49
|
-
|
|
66
|
+
const { deuteriumFactor = 1 } = options;
|
|
67
|
+
|
|
68
|
+
if (!Number.isFinite(deuteriumFactor) || deuteriumFactor <= 0) {
|
|
69
|
+
throw new Error(`deuteriumFactor must be greater than 0, received ${deuteriumFactor}`);
|
|
50
70
|
}
|
|
51
71
|
|
|
52
|
-
const
|
|
72
|
+
const fleetSpeed = getFleetSpeed(fleet, drives);
|
|
53
73
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
74
|
+
const total = fleet
|
|
75
|
+
.filter(({ count }) => count > 0)
|
|
76
|
+
.reduce((sum, {
|
|
77
|
+
ship, count, speedBonus = 0, fuelReduction = 0,
|
|
78
|
+
}) => {
|
|
79
|
+
// A ship that switched drive also changed how much it burns.
|
|
80
|
+
const { speed, fuelConsumption } = getActiveDrive(ship, drives, speedBonus);
|
|
81
|
+
const speedValue = (speedPercent / 10) * Math.sqrt(fleetSpeed / speed);
|
|
82
|
+
// Kept in percent until the end: 1 - 0.9 lands just under 0.1 in binary.
|
|
83
|
+
const saved = Math.round(Math.min(Math.max(fuelReduction, 0), MAX_FUEL_REDUCTION) * 10000);
|
|
84
|
+
const perShip = Math.max(1, Math.floor(
|
|
85
|
+
(Math.floor(fuelConsumption * deuteriumFactor) * (10000 - saved)) / 10000,
|
|
86
|
+
));
|
|
87
|
+
const base = Math.max(1, Math.round(perShip * count));
|
|
57
88
|
|
|
58
|
-
|
|
59
|
-
|
|
89
|
+
return sum + Math.max(1, Math.round((base * distance) / 35000 * (speedValue / 10 + 1) ** 2));
|
|
90
|
+
}, 0);
|
|
60
91
|
|
|
61
|
-
return
|
|
92
|
+
return Math.max(1, total);
|
|
62
93
|
}
|
|
63
94
|
|
|
64
95
|
/**
|
|
@@ -70,6 +101,9 @@ function getFuelConsumption(fleet, distance, speedPercent = 100, drives = {}) {
|
|
|
70
101
|
* @param {object} [options] Trip options
|
|
71
102
|
* @param {number} [options.speedPercent] The fleet speed slider, 10 to 100 in game
|
|
72
103
|
* @param {number} [options.universeFleetSpeed] The universe fleet speed
|
|
104
|
+
* @param {number} [options.deuteriumFactor] The universe deuterium consumption factor
|
|
105
|
+
* @param {import('../types.js').UniverseShape} [options.universe] How the universe
|
|
106
|
+
* wraps, for the distance
|
|
73
107
|
* @param {import('../types.js').Drives} [options.drives] The drive technology levels
|
|
74
108
|
* @param {boolean} [options.roundTrip] Whether to account for the way back too
|
|
75
109
|
* @returns {{
|
|
@@ -82,14 +116,17 @@ function getTrip(fleet, origin, target, options = {}) {
|
|
|
82
116
|
const {
|
|
83
117
|
speedPercent = 100,
|
|
84
118
|
universeFleetSpeed = 1,
|
|
119
|
+
deuteriumFactor = 1,
|
|
120
|
+
universe = {},
|
|
85
121
|
drives = {},
|
|
86
122
|
roundTrip = false,
|
|
87
123
|
} = options;
|
|
88
124
|
|
|
89
|
-
const distance = getDistance(origin, target);
|
|
125
|
+
const distance = getDistance(origin, target, universe);
|
|
90
126
|
const fleetSpeed = getFleetSpeed(fleet, drives);
|
|
91
127
|
const oneWay = getFlightTime(distance, fleetSpeed, speedPercent, universeFleetSpeed);
|
|
92
|
-
const fuel = getFuelConsumption(fleet, distance, speedPercent, drives
|
|
128
|
+
const fuel = getFuelConsumption(fleet, distance, speedPercent, drives, { deuteriumFactor })
|
|
129
|
+
* (roundTrip ? 2 : 1);
|
|
93
130
|
const cargo = fleet.reduce((total, { ship, count }) => total + ship.cargo * count, 0);
|
|
94
131
|
|
|
95
132
|
return {
|
|
@@ -102,4 +139,6 @@ function getTrip(fleet, origin, target, options = {}) {
|
|
|
102
139
|
};
|
|
103
140
|
}
|
|
104
141
|
|
|
105
|
-
export {
|
|
142
|
+
export {
|
|
143
|
+
getFlightTime, getFuelConsumption, getTrip, MAX_FUEL_REDUCTION,
|
|
144
|
+
};
|
package/src/fleets/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import getDebris from './getDebris.js';
|
|
2
2
|
import getDistance from './distance.js';
|
|
3
3
|
import getShipSpeed, { getActiveDrive, getFleetSpeed } from './speed.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
getFlightTime, getFuelConsumption, getTrip, MAX_FUEL_REDUCTION,
|
|
6
|
+
} from './flight.js';
|
|
7
|
+
import simulateCombat, { DEFAULT_REPAIR_FACTOR, DEFAULT_PLUNDER_RATIO } from './combat.js';
|
|
8
|
+
import { getCombatStatistics, simulateCombats, DEFAULT_RUNS } from './combatStatistics.js';
|
|
6
9
|
import {
|
|
7
10
|
getWaveChance,
|
|
8
11
|
getMoonbreakWaves,
|
|
@@ -31,6 +34,8 @@ const Fleets = {
|
|
|
31
34
|
getFuelConsumption,
|
|
32
35
|
getTrip,
|
|
33
36
|
simulateCombat,
|
|
37
|
+
simulateCombats,
|
|
38
|
+
getCombatStatistics,
|
|
34
39
|
getWaveChance,
|
|
35
40
|
getMoonbreakWaves,
|
|
36
41
|
getMoonbreakChance,
|
|
@@ -49,6 +54,10 @@ export {
|
|
|
49
54
|
EXPEDITION_TOP_TIER_BASE,
|
|
50
55
|
MOON_DEBRIS_THRESHOLD,
|
|
51
56
|
MAX_MOON_CHANCE,
|
|
57
|
+
MAX_FUEL_REDUCTION,
|
|
58
|
+
DEFAULT_REPAIR_FACTOR,
|
|
59
|
+
DEFAULT_PLUNDER_RATIO,
|
|
60
|
+
DEFAULT_RUNS,
|
|
52
61
|
};
|
|
53
62
|
|
|
54
63
|
export default Fleets;
|
package/src/fleets/speed.js
CHANGED
|
@@ -32,9 +32,15 @@ function driveLevel(drives, drive) {
|
|
|
32
32
|
return level;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function
|
|
35
|
+
function assertBonus(bonus) {
|
|
36
|
+
if (!Number.isFinite(bonus) || bonus < 0) {
|
|
37
|
+
throw new Error(`speed bonus must be a number >= 0, received ${bonus}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function speedWith(baseSpeed, drive, drives, bonus) {
|
|
36
42
|
// eslint-disable-next-line security/detect-object-injection -- drive is a known key
|
|
37
|
-
return Math.floor(baseSpeed * (1 + DRIVE_BONUS[drive] * driveLevel(drives, drive)));
|
|
43
|
+
return Math.floor(baseSpeed * (1 + DRIVE_BONUS[drive] * driveLevel(drives, drive) + bonus));
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
/**
|
|
@@ -44,15 +50,21 @@ function speedWith(baseSpeed, drive, drives) {
|
|
|
44
50
|
* A few ships switch to a better drive once the matching technology is high
|
|
45
51
|
* enough — a small cargo moves to the impulse drive at Impulse 5. When several
|
|
46
52
|
* drives are available the ship uses whichever ends up fastest.
|
|
53
|
+
*
|
|
54
|
+
* `bonus` adds to the drive bonus, as a share of the base speed: the class
|
|
55
|
+
* bonus that doubles a ship's speed is 1, a 5% life form bonus 0.05.
|
|
47
56
|
* @param {import('../types.js').DestroyableEntry} ship An entry of models/destroyable.js
|
|
48
57
|
* @param {import('../types.js').Drives} [drives] Drive levels
|
|
58
|
+
* @param {number} [bonus] Extra speed, as a share of the base speed
|
|
49
59
|
* @returns {{drive: string, speed: number, fuelConsumption: number}} The active drive
|
|
50
60
|
*/
|
|
51
|
-
function getActiveDrive(ship, drives = {}) {
|
|
61
|
+
function getActiveDrive(ship, drives = {}, bonus = 0) {
|
|
52
62
|
if (!ship || !ship.drive) {
|
|
53
63
|
throw new Error('expected an entry of models/destroyable.js');
|
|
54
64
|
}
|
|
55
65
|
|
|
66
|
+
assertBonus(bonus);
|
|
67
|
+
|
|
56
68
|
const candidates = [
|
|
57
69
|
{ drive: ship.drive, speed: ship.speed, fuelConsumption: ship.fuelConsumption },
|
|
58
70
|
...(ship.driveUpgrades ?? [])
|
|
@@ -62,7 +74,7 @@ function getActiveDrive(ship, drives = {}) {
|
|
|
62
74
|
return candidates
|
|
63
75
|
.map(({ drive, speed, fuelConsumption }) => ({
|
|
64
76
|
drive,
|
|
65
|
-
speed: speedWith(speed, drive, drives),
|
|
77
|
+
speed: speedWith(speed, drive, drives, bonus),
|
|
66
78
|
fuelConsumption,
|
|
67
79
|
}))
|
|
68
80
|
.reduce((best, candidate) => (candidate.speed > best.speed ? candidate : best));
|
|
@@ -73,15 +85,18 @@ function getActiveDrive(ship, drives = {}) {
|
|
|
73
85
|
* Return the speed of a ship, drive technologies included
|
|
74
86
|
* @param {import('../types.js').DestroyableEntry} ship An entry of models/destroyable.js
|
|
75
87
|
* @param {import('../types.js').Drives} [drives] Drive levels
|
|
88
|
+
* @param {number} [bonus] Extra speed, as a share of the base speed (class, life forms)
|
|
76
89
|
* @returns {number} The speed the ship flies at
|
|
77
90
|
*/
|
|
78
|
-
function getShipSpeed(ship, drives = {}) {
|
|
79
|
-
return getActiveDrive(ship, drives).speed;
|
|
91
|
+
function getShipSpeed(ship, drives = {}, bonus = 0) {
|
|
92
|
+
return getActiveDrive(ship, drives, bonus).speed;
|
|
80
93
|
}
|
|
81
94
|
|
|
82
95
|
/**
|
|
83
96
|
*
|
|
84
97
|
* Return the speed of a whole fleet, which is the speed of its slowest ship
|
|
98
|
+
*
|
|
99
|
+
* Each entry may carry its own `speedBonus` (class, life forms).
|
|
85
100
|
* @param {import('../types.js').FleetEntry[]} fleet The ships taking off
|
|
86
101
|
* @param {import('../types.js').Drives} [drives] Drive levels
|
|
87
102
|
* @returns {number} The fleet speed
|
|
@@ -93,7 +108,7 @@ function getFleetSpeed(fleet, drives = {}) {
|
|
|
93
108
|
|
|
94
109
|
const speeds = fleet
|
|
95
110
|
.filter(({ count }) => count > 0)
|
|
96
|
-
.map(({ ship }) => getShipSpeed(ship, drives));
|
|
111
|
+
.map(({ ship, speedBonus = 0 }) => getShipSpeed(ship, drives, speedBonus));
|
|
97
112
|
|
|
98
113
|
if (speeds.length === 0) {
|
|
99
114
|
throw new Error('fleet must hold at least one ship with a count above 0');
|
package/src/types.js
CHANGED
|
@@ -120,6 +120,19 @@
|
|
|
120
120
|
* @typedef {object} FleetEntry A group of identical ships
|
|
121
121
|
* @property {DestroyableEntry} ship The ship
|
|
122
122
|
* @property {number} count How many of them
|
|
123
|
+
* @property {number} [speedBonus] Extra speed, as a share of the ship's base
|
|
124
|
+
* speed: 1 for the class bonus that doubles it, 0.05 for a 5% life form bonus,
|
|
125
|
+
* summed
|
|
126
|
+
* @property {number} [fuelReduction] Deuterium saved, as a share: the General's
|
|
127
|
+
* class discount plus the life form one, capped at 0.9 like the game does
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @typedef {object} UniverseShape How the universe wraps around
|
|
132
|
+
* @property {number} [galaxies] The number of galaxies
|
|
133
|
+
* @property {number} [systems] The number of systems per galaxy
|
|
134
|
+
* @property {boolean} [donutGalaxy] Whether the last galaxy touches the first
|
|
135
|
+
* @property {boolean} [donutSystem] Whether the last system touches the first
|
|
123
136
|
*/
|
|
124
137
|
|
|
125
138
|
/**
|
package/types/fleets/combat.d.ts
CHANGED
|
@@ -1,19 +1,84 @@
|
|
|
1
1
|
declare const ROUNDS = 6;
|
|
2
|
+
/** The share of destroyed defenses that come back after a battle, on most universes. */
|
|
3
|
+
declare const DEFAULT_REPAIR_FACTOR = 0.7;
|
|
4
|
+
/** The share of the defender's resources a winning attacker can carry away. */
|
|
5
|
+
declare const DEFAULT_PLUNDER_RATIO = 0.5;
|
|
2
6
|
/**
|
|
3
7
|
* A tiny deterministic PRNG (mulberry32), so a battle can be replayed.
|
|
4
8
|
*/
|
|
5
9
|
declare function createRandom(seed: any): () => number;
|
|
10
|
+
export type CombatResult = {
|
|
11
|
+
/**
|
|
12
|
+
* Who won
|
|
13
|
+
*/
|
|
14
|
+
winner: 'attacker' | 'defender' | 'draw';
|
|
15
|
+
/**
|
|
16
|
+
* How many rounds it lasted
|
|
17
|
+
*/
|
|
18
|
+
rounds: number;
|
|
19
|
+
/**
|
|
20
|
+
* The PRNG seed it ran with
|
|
21
|
+
*/
|
|
22
|
+
seed: number;
|
|
23
|
+
/**
|
|
24
|
+
* What is left of the attacker, and what it lost
|
|
25
|
+
*/
|
|
26
|
+
attacker: {
|
|
27
|
+
survivors: import('../types.js').FleetEntry[];
|
|
28
|
+
losses: import('../types.js').FleetEntry[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* What is left of the defender, what it lost, and which of its lost defenses come back
|
|
32
|
+
*/
|
|
33
|
+
defender: {
|
|
34
|
+
survivors: import('../types.js').FleetEntry[];
|
|
35
|
+
losses: import('../types.js').FleetEntry[];
|
|
36
|
+
rebuilt: import('../types.js').FleetEntry[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The debris field
|
|
40
|
+
*/
|
|
41
|
+
debris: import('../types.js').Resources;
|
|
42
|
+
/**
|
|
43
|
+
* The moon chance it gives, in %
|
|
44
|
+
*/
|
|
45
|
+
moonChance: number;
|
|
46
|
+
/**
|
|
47
|
+
* What the attacker carries away
|
|
48
|
+
*/
|
|
49
|
+
plunder: import('../types.js').Resources;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* @typedef {object} CombatResult One simulated battle
|
|
53
|
+
* @property {'attacker'|'defender'|'draw'} winner Who won
|
|
54
|
+
* @property {number} rounds How many rounds it lasted
|
|
55
|
+
* @property {number} seed The PRNG seed it ran with
|
|
56
|
+
* @property {{survivors: import('../types.js').FleetEntry[], losses: import('../types.js').FleetEntry[]}} attacker
|
|
57
|
+
* What is left of the attacker, and what it lost
|
|
58
|
+
* @property {{
|
|
59
|
+
* survivors: import('../types.js').FleetEntry[], losses: import('../types.js').FleetEntry[],
|
|
60
|
+
* rebuilt: import('../types.js').FleetEntry[],
|
|
61
|
+
* }} defender What is left of the defender, what it lost, and which of its lost defenses come back
|
|
62
|
+
* @property {import('../types.js').Resources} debris The debris field
|
|
63
|
+
* @property {number} moonChance The moon chance it gives, in %
|
|
64
|
+
* @property {import('../types.js').Resources} plunder What the attacker carries away
|
|
65
|
+
*/
|
|
6
66
|
/**
|
|
7
67
|
*
|
|
8
68
|
* Simulate a battle between two fleets
|
|
9
69
|
*
|
|
10
70
|
* Follows the game rules: up to six rounds, every unit fires once per round at a
|
|
11
71
|
* random enemy, rapid fire grants extra shots, shots below 1% of the target
|
|
12
|
-
* shield bounce off, shields come back every round, and a unit
|
|
13
|
-
* may explode
|
|
72
|
+
* shield bounce off, shields come back every round, and a unit hit while under
|
|
73
|
+
* 70% hull may explode.
|
|
74
|
+
*
|
|
75
|
+
* Afterwards, each destroyed defense is rebuilt with a `repairFactor` chance,
|
|
76
|
+
* the debris field gives the moon chance (1% per 100 000, up to 20%), and a
|
|
77
|
+
* winning attacker loads what it can of the defender's resources when
|
|
78
|
+
* `plunder` says what lies on the planet.
|
|
14
79
|
*
|
|
15
80
|
* A battle is random, so one run is one possible outcome. The `seed` makes a run
|
|
16
|
-
* reproducible;
|
|
81
|
+
* reproducible; `getCombatStatistics` averages several of them.
|
|
17
82
|
* @param {object} attacker The attacking side
|
|
18
83
|
* @param {import('../types.js').FleetEntry[]} attacker.fleet Its ships
|
|
19
84
|
* @param {import('../types.js').CombatTechs} [attacker.techs] Its combat technology levels
|
|
@@ -22,13 +87,16 @@ declare function createRandom(seed: any): () => number;
|
|
|
22
87
|
* @param {number} [options.seed] The PRNG seed, for a reproducible battle
|
|
23
88
|
* @param {number} [options.debrisFactor] The universe debris factor
|
|
24
89
|
* @param {number} [options.deuteriumDebrisFactor] The universe deuterium debris factor
|
|
25
|
-
* @param {boolean} [options.defenseDebris] Whether destroyed defenses leave debris
|
|
26
|
-
* @
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* }
|
|
90
|
+
* @param {boolean} [options.defenseDebris] Whether destroyed defenses leave debris, at `debrisFactor`
|
|
91
|
+
* @param {number} [options.defenseDebrisFactor] The universe defense debris factor, overrides `defenseDebris`
|
|
92
|
+
* @param {number} [options.repairFactor] The chance for a destroyed defense to be rebuilt, 0.7 by default
|
|
93
|
+
* @param {object} [options.plunder] What the attacker may carry away if it wins
|
|
94
|
+
* @param {import('../types.js').Resources} options.plunder.resources The resources on the planet
|
|
95
|
+
* @param {number} [options.plunder.ratio] The share of them up for grabs, 0.5 by default
|
|
96
|
+
* @param {number} [options.plunder.hyperspaceLevel] The attacker's Hyperspace Technology level
|
|
97
|
+
* @param {number} [options.plunder.hyperspaceMultiplier] The % of base cargo per level, 5 by default
|
|
98
|
+
* @param {number} [options.plunder.bonus] Any other cargo bonus, as a fraction
|
|
99
|
+
* @returns {CombatResult} Who won, how long it took, what is left on each side, and what the battle left behind
|
|
32
100
|
*/
|
|
33
101
|
declare function simulateCombat(attacker: {
|
|
34
102
|
fleet: import('../types.js').FleetEntry[];
|
|
@@ -38,20 +106,16 @@ declare function simulateCombat(attacker: {
|
|
|
38
106
|
debrisFactor?: number;
|
|
39
107
|
deuteriumDebrisFactor?: number;
|
|
40
108
|
defenseDebris?: boolean;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
109
|
+
defenseDebrisFactor?: number;
|
|
110
|
+
repairFactor?: number;
|
|
111
|
+
plunder?: {
|
|
112
|
+
resources: import('../types.js').Resources;
|
|
113
|
+
ratio?: number;
|
|
114
|
+
hyperspaceLevel?: number;
|
|
115
|
+
hyperspaceMultiplier?: number;
|
|
116
|
+
bonus?: number;
|
|
48
117
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
losses: import('../types.js').FleetEntry[];
|
|
52
|
-
};
|
|
53
|
-
debris: import('../types.js').Resources;
|
|
54
|
-
};
|
|
55
|
-
export { createRandom, ROUNDS };
|
|
118
|
+
}): CombatResult;
|
|
119
|
+
export { createRandom, ROUNDS, DEFAULT_REPAIR_FACTOR, DEFAULT_PLUNDER_RATIO };
|
|
56
120
|
export default simulateCombat;
|
|
57
121
|
//# sourceMappingURL=combat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combat.d.ts","sourceRoot":"","sources":["../../src/fleets/combat.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"combat.d.ts","sourceRoot":"","sources":["../../src/fleets/combat.js"],"names":[],"mappings":"AAKA,QAAA,MAAM,MAAM,IAAI,CAAC;AAcjB,wFAAwF;AACxF,QAAA,MAAM,qBAAqB,MAAM,CAAC;AAElC,+EAA+E;AAC/E,QAAA,MAAM,qBAAqB,MAAM,CAAC;AA0BlC;;GAEG;AACH,iBAAS,YAAY,CAAC,IAAI,KAAA,gBAWzB;AAuNE,YAAkB,YAAY,GAC9B;;;;IAAyC,MAAM,EAApC,UAAU,GAAC,UAAU,GAAC,MAAM,CACvC;;;;IAAmB,MAAM,EAAd,MAAM,CACjB;;;;IAAmB,IAAI,EAAZ,MAAM,CACjB;;;;IAAwG,QAAQ,EAArG;QAAC,SAAS,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAA;KAAC,CAEtG;;;;IAGG,QAAQ,EAHA;QACT,SAAS,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAC;QAC1F,OAAO,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAC;KAC7C,CACD;;;;IAA4C,MAAM,EAAvC,OAAO,aAAa,EAAE,SAAS,CAC1C;;;;IAAmB,UAAU,EAAlB,MAAM,CACjB;;;;IAA4C,OAAO,EAAxC,OAAO,aAAa,EAAE,SAAS,CAC5C;CAAA,CAAA;AAdD;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,iBAAS,cAAc,CAAC,QAAQ,EAlB7B;IAAqD,KAAK,EAAlD,OAAO,aAAa,EAAE,UAAU,EAAE,CAC1C;IAAqD,KAAK,AAA1D,CACA,EADQ,OAAO,aAAa,EAAE,WAAW,CACzC;CAgB6B,EAAE,QAAQ,EAhB/B,MAgB+B,EAAE,OAAO,AAfhD,CAaA,EAZA;IAAyB,IAAI,AAA7B,CACA,EADQ,MAAM,CACd;IAAyB,YAAY,AAArC,CACA,EADQ,MAAM,CACd;IAAyB,qBAAqB,AAA9C,CACA,EADQ,MAAM,CACd;IAA0B,aAAa,AAAvC,CACA,EADQ,OAAO,CACf;IAAyB,mBAAmB,AAA5C,CACA,EADQ,MAAM,CACd;IAAyB,YAAY,AAArC,CACA,EADQ,MAAM,CACd;IAAyB,OAAO,AAAhC,CAMA,EALA;QAAyD,SAAS,EAA1D,OAAO,aAAa,EAAE,SAAS,CACvC;QAAiC,KAAK,AAAtC,CACA,EADQ,MAAM,CACd;QAAiC,eAAe,AAAhD,CACA,EADQ,MAAM,CACd;QAAiC,oBAAoB,AAArD,CACA,EADQ,MAAM,CACd;QAAiC,KAAK,AAAtC,CACA,EADQ,MAAM,CACd;KAAA,CAAA;CAEqD,GAF3C,YAAY,CAsExB;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,CAAC;eAC/D,cAAc"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import simulateCombat from './combat.js';
|
|
2
|
+
/** Enough runs for the averages to settle, without making a big battle wait. */
|
|
3
|
+
declare const DEFAULT_RUNS = 100;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Average a set of simulated battles
|
|
7
|
+
*
|
|
8
|
+
* Counts are averages, so they are not whole numbers. `lostResources` is what
|
|
9
|
+
* the units lost for good would cost to build again: every loss for the
|
|
10
|
+
* attacker, the defender's losses minus its rebuilt defenses.
|
|
11
|
+
* @param {import('./combat.js').CombatResult[]} results Battles from `simulateCombat`
|
|
12
|
+
* @returns {{
|
|
13
|
+
* runs: number,
|
|
14
|
+
* outcomes: {attacker: number, defender: number, draw: number},
|
|
15
|
+
* rounds: number,
|
|
16
|
+
* attacker: {
|
|
17
|
+
* survivors: import('../types.js').FleetEntry[], losses: import('../types.js').FleetEntry[],
|
|
18
|
+
* lostResources: import('../types.js').Resources,
|
|
19
|
+
* },
|
|
20
|
+
* defender: {
|
|
21
|
+
* survivors: import('../types.js').FleetEntry[], losses: import('../types.js').FleetEntry[],
|
|
22
|
+
* rebuilt: import('../types.js').FleetEntry[], lostResources: import('../types.js').Resources,
|
|
23
|
+
* },
|
|
24
|
+
* debris: import('../types.js').Resources,
|
|
25
|
+
* moonChance: number,
|
|
26
|
+
* plunder: import('../types.js').Resources,
|
|
27
|
+
* }} The share of battles each side won (from 0 to 1), and the average of everything else
|
|
28
|
+
*/
|
|
29
|
+
declare function getCombatStatistics(results: import('./combat.js').CombatResult[]): {
|
|
30
|
+
runs: number;
|
|
31
|
+
outcomes: {
|
|
32
|
+
attacker: number;
|
|
33
|
+
defender: number;
|
|
34
|
+
draw: number;
|
|
35
|
+
};
|
|
36
|
+
rounds: number;
|
|
37
|
+
attacker: {
|
|
38
|
+
survivors: import('../types.js').FleetEntry[];
|
|
39
|
+
losses: import('../types.js').FleetEntry[];
|
|
40
|
+
lostResources: import('../types.js').Resources;
|
|
41
|
+
};
|
|
42
|
+
defender: {
|
|
43
|
+
survivors: import('../types.js').FleetEntry[];
|
|
44
|
+
losses: import('../types.js').FleetEntry[];
|
|
45
|
+
rebuilt: import('../types.js').FleetEntry[];
|
|
46
|
+
lostResources: import('../types.js').Resources;
|
|
47
|
+
};
|
|
48
|
+
debris: import('../types.js').Resources;
|
|
49
|
+
moonChance: number;
|
|
50
|
+
plunder: import('../types.js').Resources;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* Simulate the same battle many times and average the outcomes
|
|
55
|
+
*
|
|
56
|
+
* Run `i` uses the seed `seed + i`, so the whole set is reproducible.
|
|
57
|
+
* @param {Parameters<typeof simulateCombat>[0]} attacker The attacking side, as for `simulateCombat`
|
|
58
|
+
* @param {Parameters<typeof simulateCombat>[1]} defender The defending side, as for `simulateCombat`
|
|
59
|
+
* @param {Parameters<typeof simulateCombat>[2] & {runs?: number}} [options] The `simulateCombat`
|
|
60
|
+
* options, plus `runs`, how many battles to simulate (100 by default)
|
|
61
|
+
* @returns {ReturnType<typeof getCombatStatistics>} The averaged outcome, see `getCombatStatistics`
|
|
62
|
+
*/
|
|
63
|
+
declare function simulateCombats(attacker: Parameters<typeof simulateCombat>[0], defender: Parameters<typeof simulateCombat>[1], options?: Parameters<typeof simulateCombat>[2] & {
|
|
64
|
+
runs?: number;
|
|
65
|
+
}): ReturnType<typeof getCombatStatistics>;
|
|
66
|
+
export { getCombatStatistics, simulateCombats, DEFAULT_RUNS };
|
|
67
|
+
//# sourceMappingURL=combatStatistics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combatStatistics.d.ts","sourceRoot":"","sources":["../../src/fleets/combatStatistics.js"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,aAAa,CAAC;AAEzC,gFAAgF;AAChF,QAAA,MAAM,YAAY,MAAM,CAAC;AAoEzB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,iBAAS,mBAAmB,CAAC,OAAO,EAlBzB,OAAO,aAAa,EAAE,YAAY,EAkBT,GAjBvB;IACR,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE;QACR,SAAS,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAC;QAC1F,aAAa,EAAE,OAAO,aAAa,EAAE,SAAS,CAAC;KAChD,CAAC;IACF,QAAQ,EAAE;QACR,SAAS,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAC;QAC1F,OAAO,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAC;QAAC,aAAa,EAAE,OAAO,aAAa,EAAE,SAAS,CAAC;KAC7F,CAAC;IACF,MAAM,EAAE,OAAO,aAAa,EAAE,SAAS,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,aAAa,EAAE,SAAS,CAAC;CAC1C,CAiEH;AAED;;;;;;;;;;GAUG;AACH,iBAAS,eAAe,CAAC,QAAQ,EANtB,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAMb,EAAE,QAAQ,EALhC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAKH,EAAE,OAAO,AAJjD,CAEA,EAFQ,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAIP,GAF5C,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAgBlD;AAED,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
* Return the distance between two coordinates, in OGame distance units
|
|
4
4
|
*
|
|
5
5
|
* The scale is not linear: crossing a galaxy costs far more than crossing a
|
|
6
|
-
* system, which costs far more than moving inside one.
|
|
6
|
+
* system, which costs far more than moving inside one. Most universes are
|
|
7
|
+
* donuts: the last galaxy (or system) touches the first, and the fleet takes the
|
|
8
|
+
* shorter way round.
|
|
7
9
|
* @param {import('../types.js').Coordinates} origin Where the fleet leaves from
|
|
8
10
|
* @param {import('../types.js').Coordinates} target Where it goes
|
|
11
|
+
* @param {import('../types.js').UniverseShape} [universe] How the universe wraps,
|
|
12
|
+
* flat when left out
|
|
9
13
|
* @returns {number} The distance
|
|
10
14
|
*/
|
|
11
|
-
declare function getDistance(origin: import('../types.js').Coordinates, target: import('../types.js').Coordinates): number;
|
|
15
|
+
declare function getDistance(origin: import('../types.js').Coordinates, target: import('../types.js').Coordinates, universe?: import('../types.js').UniverseShape): number;
|
|
12
16
|
export default getDistance;
|
|
13
17
|
//# sourceMappingURL=distance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distance.d.ts","sourceRoot":"","sources":["../../src/fleets/distance.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"distance.d.ts","sourceRoot":"","sources":["../../src/fleets/distance.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;GAaG;AACH,iBAAS,WAAW,CAAC,MAAM,EANhB,OAAO,aAAa,EAAE,WAMN,EAAE,MAAM,EALxB,OAAO,aAAa,EAAE,WAKE,EAAE,QAAQ,AAJ1C,CAEA,EAFQ,OAAO,aAAa,EAAE,aAIiB,GAFrC,MAAM,CAwBlB;eAEc,WAAW"}
|
package/types/fleets/flight.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
/** The game stops the fuel discounts here, however many add up. */
|
|
2
|
+
declare const MAX_FUEL_REDUCTION = 0.9;
|
|
1
3
|
/**
|
|
2
4
|
*
|
|
3
5
|
* Return the one way flight time of a fleet
|
|
4
6
|
*
|
|
5
|
-
* `(10 +
|
|
7
|
+
* `(10 + 350000 / speedPercent * sqrt(distance * 10 / fleetSpeed)) / universeFleetSpeed`
|
|
8
|
+
*
|
|
9
|
+
* At 100% that is the well known `10 + 3500 * sqrt(distance * 10 / fleetSpeed)`.
|
|
6
10
|
* @param {number} distance The distance to cross, from `getDistance`
|
|
7
11
|
* @param {number} fleetSpeed The speed of the slowest ship, from `getFleetSpeed`
|
|
8
12
|
* @param {number} [speedPercent] The fleet speed slider, 10 to 100 in game
|
|
@@ -14,15 +18,30 @@ declare function getFlightTime(distance: number, fleetSpeed: number, speedPercen
|
|
|
14
18
|
*
|
|
15
19
|
* Return the deuterium a fleet burns for a one way trip
|
|
16
20
|
*
|
|
17
|
-
*
|
|
21
|
+
* Each ship type is billed on its own, then the bills add up:
|
|
22
|
+
* `max(1, round(consumption * count * distance / 35000 * (shipSpeedValue / 10 + 1) ** 2))`
|
|
23
|
+
*
|
|
24
|
+
* `shipSpeedValue` is the speed the ship really flies at, on the game's 1 to 10
|
|
25
|
+
* scale: `speedPercent / 10` for the slowest ship, less for the faster ones held
|
|
26
|
+
* back by it, `speedPercent / 10 * sqrt(fleetSpeed / shipSpeed)`. A faster ship
|
|
27
|
+
* flying slower than it could burns less than at full throttle.
|
|
28
|
+
*
|
|
29
|
+
* `consumption` is the ship's own, after the universe deuterium factor and the
|
|
30
|
+
* entry's `fuelReduction` (General, life forms), each rounded down and never
|
|
31
|
+
* below one unit.
|
|
18
32
|
* @param {import('../types.js').FleetEntry[]} fleet The ships taking off
|
|
19
33
|
* @param {number} distance The distance to cross, from `getDistance`
|
|
20
34
|
* @param {number} [speedPercent] The fleet speed slider, 10 to 100 in game
|
|
21
35
|
* @param {import('../types.js').Drives} [drives] Drive levels, needed because a
|
|
22
36
|
* ship that switched drive also changed its consumption
|
|
37
|
+
* @param {object} [options] Universe settings
|
|
38
|
+
* @param {number} [options.deuteriumFactor] The universe deuterium consumption
|
|
39
|
+
* factor (`globalDeuteriumSaveFactor` in the API), 1 when left out
|
|
23
40
|
* @returns {number} The fuel needed, in deuterium
|
|
24
41
|
*/
|
|
25
|
-
declare function getFuelConsumption(fleet: import('../types.js').FleetEntry[], distance: number, speedPercent?: number, drives?: import('../types.js').Drives
|
|
42
|
+
declare function getFuelConsumption(fleet: import('../types.js').FleetEntry[], distance: number, speedPercent?: number, drives?: import('../types.js').Drives, options?: {
|
|
43
|
+
deuteriumFactor?: number;
|
|
44
|
+
}): number;
|
|
26
45
|
/**
|
|
27
46
|
*
|
|
28
47
|
* Return everything about a trip: distance, duration, fuel and cargo left
|
|
@@ -32,6 +51,9 @@ declare function getFuelConsumption(fleet: import('../types.js').FleetEntry[], d
|
|
|
32
51
|
* @param {object} [options] Trip options
|
|
33
52
|
* @param {number} [options.speedPercent] The fleet speed slider, 10 to 100 in game
|
|
34
53
|
* @param {number} [options.universeFleetSpeed] The universe fleet speed
|
|
54
|
+
* @param {number} [options.deuteriumFactor] The universe deuterium consumption factor
|
|
55
|
+
* @param {import('../types.js').UniverseShape} [options.universe] How the universe
|
|
56
|
+
* wraps, for the distance
|
|
35
57
|
* @param {import('../types.js').Drives} [options.drives] The drive technology levels
|
|
36
58
|
* @param {boolean} [options.roundTrip] Whether to account for the way back too
|
|
37
59
|
* @returns {{
|
|
@@ -43,6 +65,8 @@ declare function getFuelConsumption(fleet: import('../types.js').FleetEntry[], d
|
|
|
43
65
|
declare function getTrip(fleet: import('../types.js').FleetEntry[], origin: import('../types.js').Coordinates, target: import('../types.js').Coordinates, options?: {
|
|
44
66
|
speedPercent?: number;
|
|
45
67
|
universeFleetSpeed?: number;
|
|
68
|
+
deuteriumFactor?: number;
|
|
69
|
+
universe?: import('../types.js').UniverseShape;
|
|
46
70
|
drives?: import('../types.js').Drives;
|
|
47
71
|
roundTrip?: boolean;
|
|
48
72
|
}): {
|
|
@@ -53,5 +77,5 @@ declare function getTrip(fleet: import('../types.js').FleetEntry[], origin: impo
|
|
|
53
77
|
cargo: number;
|
|
54
78
|
cargoAfterFuel: number;
|
|
55
79
|
};
|
|
56
|
-
export { getFlightTime, getFuelConsumption, getTrip };
|
|
80
|
+
export { getFlightTime, getFuelConsumption, getTrip, MAX_FUEL_REDUCTION, };
|
|
57
81
|
//# sourceMappingURL=flight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flight.d.ts","sourceRoot":"","sources":["../../src/fleets/flight.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flight.d.ts","sourceRoot":"","sources":["../../src/fleets/flight.js"],"names":[],"mappings":"AAGA,mEAAmE;AACnE,QAAA,MAAM,kBAAkB,MAAM,CAAC;AAQ/B;;;;;;;;;;;;GAYG;AACH,iBAAS,aAAa,CAAC,QAAQ,EANpB,MAMoB,EAAE,UAAU,EALhC,MAKgC,EAAE,YAAY,AAJtD,CACA,EADQ,MAIoD,EAAE,kBAAkB,AAHhF,CACA,EADQ,MAG4E,GAF1E,MAAM,CAYlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,iBAAS,kBAAkB,CAAC,KAAK,EAVtB,OAAO,aAAa,EAAE,UAAU,EAUV,EAAE,QAAQ,EAThC,MASgC,EAAE,YAAY,AARtD,CACA,EADQ,MAQoD,EAAE,MAAM,AAPpE,CAEA,EAFQ,OAAO,aAAa,EAAE,MAO2C,EAAE,OAAO,AALlF,CAGA,EAFA;IAAyB,eAAe,AAAxC,CAEA,EAFQ,MAAM,CAEd;CAEuF,GAF7E,MAAM,CAgClB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,OAAO,CAAC,KAAK,EAjBX,OAAO,aAAa,EAAE,UAAU,EAiBrB,EAAE,MAAM,EAhBnB,OAAO,aAAa,EAAE,WAgBH,EAAE,MAAM,EAf3B,OAAO,aAAa,EAAE,WAeK,EAAE,OAAO,AAd5C,CAQA,EAPA;IAAyB,YAAY,AAArC,CACA,EADQ,MAAM,CACd;IAAyB,kBAAkB,AAA3C,CACA,EADQ,MAAM,CACd;IAAyB,eAAe,AAAxC,CACA,EADQ,MAAM,CACd;IAAsD,QAAQ,AAA9D,CAEA,EAFQ,OAAO,aAAa,EAAE,aAAa,CAE3C;IAA+C,MAAM,AAArD,CACA,EADQ,OAAO,aAAa,EAAE,MAAM,CACpC;IAA0B,SAAS,AAAnC,CACA,EADQ,OAAO,CACf;CAMiD,GANvC;IACR,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IACrE,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;CACvC,CA4BH;AAED,OAAO,EACL,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,kBAAkB,GAC/D,CAAC"}
|
package/types/fleets/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import getDebris from './getDebris.js';
|
|
2
2
|
import getDistance from './distance.js';
|
|
3
3
|
import getShipSpeed, { getActiveDrive, getFleetSpeed } from './speed.js';
|
|
4
|
-
import { getFlightTime, getFuelConsumption, getTrip } from './flight.js';
|
|
5
|
-
import simulateCombat from './combat.js';
|
|
4
|
+
import { getFlightTime, getFuelConsumption, getTrip, MAX_FUEL_REDUCTION } from './flight.js';
|
|
5
|
+
import simulateCombat, { DEFAULT_REPAIR_FACTOR, DEFAULT_PLUNDER_RATIO } from './combat.js';
|
|
6
|
+
import { getCombatStatistics, simulateCombats, DEFAULT_RUNS } from './combatStatistics.js';
|
|
6
7
|
import { getWaveChance, getMoonbreakWaves, getMoonbreakChance, getMoonbreakLosses, MIN_MOON_SIZE, MAX_MOON_SIZE, WAVES_PER_ATTACKER } from './moonbreak.js';
|
|
7
8
|
import { getExpeditionFindBase, getExpeditionMaxFind, getCargoCapacity, EXPEDITION_FIND_TIERS, EXPEDITION_TOP_TIER_BASE } from './expedition.js';
|
|
8
9
|
import { getMoonLockShips, MOON_DEBRIS_THRESHOLD, MAX_MOON_CHANCE } from './moonLock.js';
|
|
@@ -16,6 +17,8 @@ declare const Fleets: {
|
|
|
16
17
|
getFuelConsumption: typeof getFuelConsumption;
|
|
17
18
|
getTrip: typeof getTrip;
|
|
18
19
|
simulateCombat: typeof simulateCombat;
|
|
20
|
+
simulateCombats: typeof simulateCombats;
|
|
21
|
+
getCombatStatistics: typeof getCombatStatistics;
|
|
19
22
|
getWaveChance: typeof getWaveChance;
|
|
20
23
|
getMoonbreakWaves: typeof getMoonbreakWaves;
|
|
21
24
|
getMoonbreakChance: typeof getMoonbreakChance;
|
|
@@ -25,6 +28,6 @@ declare const Fleets: {
|
|
|
25
28
|
getCargoCapacity: typeof getCargoCapacity;
|
|
26
29
|
getMoonLockShips: typeof getMoonLockShips;
|
|
27
30
|
};
|
|
28
|
-
export { MIN_MOON_SIZE, MAX_MOON_SIZE, WAVES_PER_ATTACKER, EXPEDITION_FIND_TIERS, EXPEDITION_TOP_TIER_BASE, MOON_DEBRIS_THRESHOLD, MAX_MOON_CHANCE, };
|
|
31
|
+
export { MIN_MOON_SIZE, MAX_MOON_SIZE, WAVES_PER_ATTACKER, EXPEDITION_FIND_TIERS, EXPEDITION_TOP_TIER_BASE, MOON_DEBRIS_THRESHOLD, MAX_MOON_CHANCE, MAX_FUEL_REDUCTION, DEFAULT_REPAIR_FACTOR, DEFAULT_PLUNDER_RATIO, DEFAULT_RUNS, };
|
|
29
32
|
export default Fleets;
|
|
30
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fleets/index.js"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,YAAY,EAAE,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fleets/index.js"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,YAAY,EAAE,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EACL,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,kBAAkB,EAC/D,MAAM,aAAa,CAAC;AACrB,OAAO,cAAc,EAAE,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEzF,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;CAoBX,CAAC;AAEF,OAAO,EACL,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,GACb,CAAC;eAEa,MAAM"}
|