@supalosa/chronodivide-bot 0.5.3 → 0.6.4
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/.env.template +4 -4
- package/.github/workflows/npm-publish.yml +24 -0
- package/README.md +108 -97
- package/dist/bot/bot.js +105 -105
- package/dist/bot/bot.js.map +1 -1
- package/dist/bot/logic/awareness.js +136 -136
- package/dist/bot/logic/building/antiAirStaticDefence.js +42 -42
- package/dist/bot/logic/building/antiGroundStaticDefence.js +34 -30
- package/dist/bot/logic/building/antiGroundStaticDefence.js.map +1 -1
- package/dist/bot/logic/building/{ArtilleryUnit.js → artilleryUnit.js} +18 -18
- package/dist/bot/logic/building/basicAirUnit.js +19 -19
- package/dist/bot/logic/building/basicBuilding.js +26 -26
- package/dist/bot/logic/building/basicGroundUnit.js +19 -19
- package/dist/bot/logic/building/buildingRules.js +175 -174
- package/dist/bot/logic/building/buildingRules.js.map +1 -1
- package/dist/bot/logic/building/common.js +19 -18
- package/dist/bot/logic/building/common.js.map +1 -1
- package/dist/bot/logic/building/harvester.js +16 -16
- package/dist/bot/logic/building/powerPlant.js +20 -20
- package/dist/bot/logic/building/queueController.js +183 -183
- package/dist/bot/logic/building/resourceCollectionBuilding.js +36 -36
- package/dist/bot/logic/common/scout.js +126 -126
- package/dist/bot/logic/common/utils.js +95 -85
- package/dist/bot/logic/common/utils.js.map +1 -1
- package/dist/bot/logic/composition/alliedCompositions.js +12 -12
- package/dist/bot/logic/composition/common.js +1 -1
- package/dist/bot/logic/composition/sovietCompositions.js +12 -12
- package/dist/bot/logic/map/map.js +44 -44
- package/dist/bot/logic/map/sector.js +137 -137
- package/dist/bot/logic/mission/actionBatcher.js +91 -91
- package/dist/bot/logic/mission/mission.js +122 -122
- package/dist/bot/logic/mission/missionController.js +321 -321
- package/dist/bot/logic/mission/missionFactories.js +12 -12
- package/dist/bot/logic/mission/missions/attackMission.js +214 -214
- package/dist/bot/logic/mission/missions/defenceMission.js +82 -82
- package/dist/bot/logic/mission/missions/engineerMission.js +63 -63
- package/dist/bot/logic/mission/missions/expansionMission.js +60 -60
- package/dist/bot/logic/mission/missions/retreatMission.js +33 -33
- package/dist/bot/logic/mission/missions/scoutingMission.js +133 -133
- package/dist/bot/logic/mission/missions/squads/combatSquad.js +115 -115
- package/dist/bot/logic/mission/missions/squads/common.js +57 -57
- package/dist/bot/logic/mission/missions/squads/squad.js +1 -1
- package/dist/bot/logic/threat/threat.js +22 -22
- package/dist/bot/logic/threat/threatCalculator.js +73 -73
- package/dist/exampleBot.js +100 -112
- package/dist/exampleBot.js.map +1 -1
- package/package.json +32 -29
- package/src/bot/bot.ts +161 -161
- package/src/bot/logic/awareness.ts +245 -245
- package/src/bot/logic/building/antiAirStaticDefence.ts +64 -64
- package/src/bot/logic/building/antiGroundStaticDefence.ts +55 -51
- package/src/bot/logic/building/artilleryUnit.ts +39 -39
- package/src/bot/logic/building/basicAirUnit.ts +39 -39
- package/src/bot/logic/building/basicBuilding.ts +49 -49
- package/src/bot/logic/building/basicGroundUnit.ts +39 -39
- package/src/bot/logic/building/buildingRules.ts +250 -247
- package/src/bot/logic/building/common.ts +21 -23
- package/src/bot/logic/building/harvester.ts +31 -31
- package/src/bot/logic/building/powerPlant.ts +32 -32
- package/src/bot/logic/building/queueController.ts +297 -297
- package/src/bot/logic/building/resourceCollectionBuilding.ts +52 -52
- package/src/bot/logic/common/scout.ts +183 -183
- package/src/bot/logic/common/utils.ts +120 -112
- package/src/bot/logic/composition/alliedCompositions.ts +22 -22
- package/src/bot/logic/composition/common.ts +3 -3
- package/src/bot/logic/composition/sovietCompositions.ts +21 -21
- package/src/bot/logic/map/map.ts +66 -66
- package/src/bot/logic/map/sector.ts +174 -174
- package/src/bot/logic/mission/actionBatcher.ts +124 -124
- package/src/bot/logic/mission/mission.ts +232 -232
- package/src/bot/logic/mission/missionController.ts +413 -413
- package/src/bot/logic/mission/missionFactories.ts +51 -51
- package/src/bot/logic/mission/missions/attackMission.ts +336 -336
- package/src/bot/logic/mission/missions/defenceMission.ts +151 -151
- package/src/bot/logic/mission/missions/engineerMission.ts +113 -113
- package/src/bot/logic/mission/missions/expansionMission.ts +104 -104
- package/src/bot/logic/mission/missions/retreatMission.ts +54 -54
- package/src/bot/logic/mission/missions/scoutingMission.ts +186 -186
- package/src/bot/logic/mission/missions/squads/combatSquad.ts +160 -160
- package/src/bot/logic/mission/missions/squads/common.ts +63 -63
- package/src/bot/logic/mission/missions/squads/squad.ts +19 -19
- package/src/bot/logic/threat/threatCalculator.ts +100 -100
- package/src/exampleBot.ts +111 -124
- package/tsconfig.json +73 -73
- package/dist/bot/logic/building/building.js +0 -82
- package/dist/bot/logic/building/massedAntiGroundUnit.js +0 -20
- package/dist/bot/logic/building/queues.js +0 -19
- package/dist/bot/logic/knowledge.js +0 -1
- package/dist/bot/logic/mission/basicMission.js +0 -26
- package/dist/bot/logic/mission/behaviours/combatSquad.js +0 -124
- package/dist/bot/logic/mission/behaviours/combatSquad.js.map +0 -1
- package/dist/bot/logic/mission/behaviours/common.js +0 -56
- package/dist/bot/logic/mission/behaviours/common.js.map +0 -1
- package/dist/bot/logic/mission/behaviours/engineerSquad.js +0 -39
- package/dist/bot/logic/mission/behaviours/engineerSquad.js.map +0 -1
- package/dist/bot/logic/mission/behaviours/expansionSquad.js +0 -46
- package/dist/bot/logic/mission/behaviours/expansionSquad.js.map +0 -1
- package/dist/bot/logic/mission/behaviours/retreatSquad.js +0 -31
- package/dist/bot/logic/mission/behaviours/retreatSquad.js.map +0 -1
- package/dist/bot/logic/mission/behaviours/scoutingSquad.js +0 -94
- package/dist/bot/logic/mission/behaviours/scoutingSquad.js.map +0 -1
- package/dist/bot/logic/mission/expansionMission.js +0 -32
- package/dist/bot/logic/mission/missions/basicMission.js +0 -13
- package/dist/bot/logic/mission/missions/basicMission.js.map +0 -1
- package/dist/bot/logic/mission/missions/missionBehaviour.js +0 -2
- package/dist/bot/logic/mission/missions/missionBehaviour.js.map +0 -1
- package/dist/bot/logic/mission/missions/oneTimeMission.js +0 -27
- package/dist/bot/logic/mission/missions/oneTimeMission.js.map +0 -1
- package/dist/bot/logic/squad/behaviours/actionBatcher.js +0 -36
- package/dist/bot/logic/squad/behaviours/actionBatcher.js.map +0 -1
- package/dist/bot/logic/squad/behaviours/attackSquad.js +0 -82
- package/dist/bot/logic/squad/behaviours/combatSquad.js +0 -106
- package/dist/bot/logic/squad/behaviours/combatSquad.js.map +0 -1
- package/dist/bot/logic/squad/behaviours/common.js +0 -55
- package/dist/bot/logic/squad/behaviours/common.js.map +0 -1
- package/dist/bot/logic/squad/behaviours/defenceSquad.js +0 -48
- package/dist/bot/logic/squad/behaviours/engineerSquad.js +0 -38
- package/dist/bot/logic/squad/behaviours/engineerSquad.js.map +0 -1
- package/dist/bot/logic/squad/behaviours/expansionSquad.js +0 -45
- package/dist/bot/logic/squad/behaviours/expansionSquad.js.map +0 -1
- package/dist/bot/logic/squad/behaviours/retreatSquad.js +0 -31
- package/dist/bot/logic/squad/behaviours/retreatSquad.js.map +0 -1
- package/dist/bot/logic/squad/behaviours/scoutingSquad.js +0 -93
- package/dist/bot/logic/squad/behaviours/scoutingSquad.js.map +0 -1
- package/dist/bot/logic/squad/behaviours/squadExpansion.js +0 -31
- package/dist/bot/logic/squad/behaviours/squadScouters.js +0 -8
- package/dist/bot/logic/squad/squad.js +0 -126
- package/dist/bot/logic/squad/squad.js.map +0 -1
- package/dist/bot/logic/squad/squadBehaviour.js +0 -6
- package/dist/bot/logic/squad/squadBehaviour.js.map +0 -1
- package/dist/bot/logic/squad/squadBehaviours.js +0 -7
- package/dist/bot/logic/squad/squadBehaviours.js.map +0 -1
- package/dist/bot/logic/squad/squadController.js +0 -215
- package/dist/bot/logic/squad/squadController.js.map +0 -1
|
@@ -1,175 +1,176 @@
|
|
|
1
|
-
import { GameMath, LandType, ObjectType, Vector2, } from "@chronodivide/game-api";
|
|
2
|
-
import { AntiGroundStaticDefence } from "./antiGroundStaticDefence.js";
|
|
3
|
-
import { ArtilleryUnit } from "./artilleryUnit.js";
|
|
4
|
-
import { BasicAirUnit } from "./basicAirUnit.js";
|
|
5
|
-
import { BasicBuilding } from "./basicBuilding.js";
|
|
6
|
-
import { BasicGroundUnit } from "./basicGroundUnit.js";
|
|
7
|
-
import { PowerPlant } from "./powerPlant.js";
|
|
8
|
-
import { ResourceCollectionBuilding } from "./resourceCollectionBuilding.js";
|
|
9
|
-
import { Harvester } from "./harvester.js";
|
|
10
|
-
import { uniqBy } from "../common/utils.js";
|
|
11
|
-
import { AntiAirStaticDefence } from "./antiAirStaticDefence.js";
|
|
12
|
-
export function numBuildingsOwnedOfType(game, playerData, technoRules) {
|
|
13
|
-
return game.getVisibleUnits(playerData.name, "self", (r) => r == technoRules).length;
|
|
14
|
-
}
|
|
15
|
-
export function numBuildingsOwnedOfName(game, playerData, name) {
|
|
16
|
-
return game.getVisibleUnits(playerData.name, "self", (r) => r.name === name).length;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Computes a rect 'centered' around a structure of a certain size with an additional radius (`adjacent`).
|
|
20
|
-
* The radius is optionally expanded by the size of the new building.
|
|
21
|
-
*
|
|
22
|
-
* This is essentially the candidate placement around a given structure.
|
|
23
|
-
*
|
|
24
|
-
* @param point Top-left location of the inner rect.
|
|
25
|
-
* @param t Size of the inner rect.
|
|
26
|
-
* @param adjacent Amount to expand the building's inner rect by (so buildings must be adjacent by this many tiles)
|
|
27
|
-
* @param newBuildingSize? Size of the new building
|
|
28
|
-
* @returns
|
|
29
|
-
*/
|
|
30
|
-
function computeAdjacentRect(point, t, adjacent, newBuildingSize) {
|
|
31
|
-
return {
|
|
32
|
-
x: point.x - adjacent - (newBuildingSize?.width || 0),
|
|
33
|
-
y: point.y - adjacent - (newBuildingSize?.height || 0),
|
|
34
|
-
width: t.width + 2 * adjacent + (newBuildingSize?.width || 0),
|
|
35
|
-
height: t.height + 2 * adjacent + (newBuildingSize?.height || 0),
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
tile.
|
|
79
|
-
tile.ry
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
tile
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
export const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
["
|
|
127
|
-
["
|
|
128
|
-
["
|
|
129
|
-
["
|
|
130
|
-
["
|
|
131
|
-
["
|
|
132
|
-
["
|
|
133
|
-
["
|
|
134
|
-
["
|
|
135
|
-
["
|
|
136
|
-
["
|
|
137
|
-
["
|
|
138
|
-
["
|
|
139
|
-
["
|
|
140
|
-
["
|
|
141
|
-
["
|
|
142
|
-
["
|
|
143
|
-
["
|
|
144
|
-
["
|
|
145
|
-
["
|
|
146
|
-
["
|
|
147
|
-
["
|
|
148
|
-
["
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
["
|
|
152
|
-
["
|
|
153
|
-
["
|
|
154
|
-
["
|
|
155
|
-
["
|
|
156
|
-
["
|
|
157
|
-
["
|
|
158
|
-
["
|
|
159
|
-
["
|
|
160
|
-
["
|
|
161
|
-
["
|
|
162
|
-
["
|
|
163
|
-
["
|
|
164
|
-
["
|
|
165
|
-
["
|
|
166
|
-
["
|
|
167
|
-
["
|
|
168
|
-
["
|
|
169
|
-
["
|
|
170
|
-
["
|
|
171
|
-
["
|
|
172
|
-
["
|
|
173
|
-
["
|
|
174
|
-
]
|
|
1
|
+
import { GameMath, LandType, ObjectType, Vector2, } from "@chronodivide/game-api";
|
|
2
|
+
import { AntiGroundStaticDefence } from "./antiGroundStaticDefence.js";
|
|
3
|
+
import { ArtilleryUnit } from "./artilleryUnit.js";
|
|
4
|
+
import { BasicAirUnit } from "./basicAirUnit.js";
|
|
5
|
+
import { BasicBuilding } from "./basicBuilding.js";
|
|
6
|
+
import { BasicGroundUnit } from "./basicGroundUnit.js";
|
|
7
|
+
import { PowerPlant } from "./powerPlant.js";
|
|
8
|
+
import { ResourceCollectionBuilding } from "./resourceCollectionBuilding.js";
|
|
9
|
+
import { Harvester } from "./harvester.js";
|
|
10
|
+
import { uniqBy } from "../common/utils.js";
|
|
11
|
+
import { AntiAirStaticDefence } from "./antiAirStaticDefence.js";
|
|
12
|
+
export function numBuildingsOwnedOfType(game, playerData, technoRules) {
|
|
13
|
+
return game.getVisibleUnits(playerData.name, "self", (r) => r == technoRules).length;
|
|
14
|
+
}
|
|
15
|
+
export function numBuildingsOwnedOfName(game, playerData, name) {
|
|
16
|
+
return game.getVisibleUnits(playerData.name, "self", (r) => r.name === name).length;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Computes a rect 'centered' around a structure of a certain size with an additional radius (`adjacent`).
|
|
20
|
+
* The radius is optionally expanded by the size of the new building.
|
|
21
|
+
*
|
|
22
|
+
* This is essentially the candidate placement around a given structure.
|
|
23
|
+
*
|
|
24
|
+
* @param point Top-left location of the inner rect.
|
|
25
|
+
* @param t Size of the inner rect.
|
|
26
|
+
* @param adjacent Amount to expand the building's inner rect by (so buildings must be adjacent by this many tiles)
|
|
27
|
+
* @param newBuildingSize? Size of the new building
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
function computeAdjacentRect(point, t, adjacent, newBuildingSize) {
|
|
31
|
+
return {
|
|
32
|
+
x: point.x - adjacent - (newBuildingSize?.width || 0),
|
|
33
|
+
y: point.y - adjacent - (newBuildingSize?.height || 0),
|
|
34
|
+
width: t.width + 2 * adjacent + (newBuildingSize?.width || 0),
|
|
35
|
+
height: t.height + 2 * adjacent + (newBuildingSize?.height || 0),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function getAdjacentTiles(game, range, onWater) {
|
|
39
|
+
// use the bulk API to get all tiles from the baseTile to the (baseTile + range)
|
|
40
|
+
const adjacentTiles = game.mapApi
|
|
41
|
+
.getTilesInRect(range)
|
|
42
|
+
.filter((tile) => !onWater || tile.landType === LandType.Water);
|
|
43
|
+
return adjacentTiles;
|
|
44
|
+
}
|
|
45
|
+
export function getAdjacencyTiles(game, playerData, technoRules, onWater, minimumSpace) {
|
|
46
|
+
const placementRules = game.getBuildingPlacementData(technoRules.name);
|
|
47
|
+
const { width: newBuildingWidth, height: newBuildingHeight } = placementRules.foundation;
|
|
48
|
+
const tiles = [];
|
|
49
|
+
const buildings = game.getVisibleUnits(playerData.name, "self", (r) => r.type === ObjectType.Building);
|
|
50
|
+
const removedTiles = new Set();
|
|
51
|
+
for (let buildingId of buildings) {
|
|
52
|
+
const building = game.getUnitData(buildingId);
|
|
53
|
+
if (!building?.rules?.baseNormal) {
|
|
54
|
+
// This building is not considered for adjacency checks.
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const { foundation, tile } = building;
|
|
58
|
+
const buildingBase = new Vector2(tile.rx, tile.ry);
|
|
59
|
+
const buildingSize = {
|
|
60
|
+
width: foundation?.width,
|
|
61
|
+
height: foundation?.height,
|
|
62
|
+
};
|
|
63
|
+
const range = computeAdjacentRect(buildingBase, buildingSize, technoRules.adjacent, placementRules.foundation);
|
|
64
|
+
const adjacentTiles = getAdjacentTiles(game, range, onWater);
|
|
65
|
+
if (adjacentTiles.length === 0) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
tiles.push(...adjacentTiles);
|
|
69
|
+
// Prevent placing the new building on tiles that would cause it to overlap with this building.
|
|
70
|
+
const modifiedBase = new Vector2(buildingBase.x - (newBuildingWidth - 1), buildingBase.y - (newBuildingHeight - 1));
|
|
71
|
+
const modifiedSize = {
|
|
72
|
+
width: buildingSize.width + (newBuildingWidth - 1),
|
|
73
|
+
height: buildingSize.height + (newBuildingHeight - 1),
|
|
74
|
+
};
|
|
75
|
+
const blockedRect = computeAdjacentRect(modifiedBase, modifiedSize, minimumSpace);
|
|
76
|
+
const buildingTiles = adjacentTiles.filter((tile) => {
|
|
77
|
+
return (tile.rx >= blockedRect.x &&
|
|
78
|
+
tile.rx < blockedRect.x + blockedRect.width &&
|
|
79
|
+
tile.ry >= blockedRect.y &&
|
|
80
|
+
tile.ry < blockedRect.y + blockedRect.height);
|
|
81
|
+
});
|
|
82
|
+
buildingTiles.forEach((buildingTile) => removedTiles.add(buildingTile.id));
|
|
83
|
+
}
|
|
84
|
+
// Remove duplicate tiles.
|
|
85
|
+
const withDuplicatesRemoved = uniqBy(tiles, (tile) => tile.id);
|
|
86
|
+
// Remove tiles containing buildings and potentially area around them removed as well.
|
|
87
|
+
return withDuplicatesRemoved.filter((tile) => !removedTiles.has(tile.id));
|
|
88
|
+
}
|
|
89
|
+
function getTileDistances(startPoint, tiles) {
|
|
90
|
+
return tiles
|
|
91
|
+
.map((tile) => ({
|
|
92
|
+
tile,
|
|
93
|
+
distance: distance(tile.rx, tile.ry, startPoint.x, startPoint.y),
|
|
94
|
+
}))
|
|
95
|
+
.sort((a, b) => {
|
|
96
|
+
return a.distance - b.distance;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function distance(x1, y1, x2, y2) {
|
|
100
|
+
var dx = x1 - x2;
|
|
101
|
+
var dy = y1 - y2;
|
|
102
|
+
let tmp = dx * dx + dy * dy;
|
|
103
|
+
if (0 === tmp) {
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
return GameMath.sqrt(tmp);
|
|
107
|
+
}
|
|
108
|
+
export function getDefaultPlacementLocation(game, playerData, idealPoint, technoRules, onWater = false, minSpace = 1) {
|
|
109
|
+
// Closest possible location near `startPoint`.
|
|
110
|
+
const size = game.getBuildingPlacementData(technoRules.name);
|
|
111
|
+
if (!size) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
const tiles = getAdjacencyTiles(game, playerData, technoRules, onWater, minSpace);
|
|
115
|
+
const tileDistances = getTileDistances(idealPoint, tiles);
|
|
116
|
+
for (let tileDistance of tileDistances) {
|
|
117
|
+
if (tileDistance.tile && game.canPlaceBuilding(playerData.name, technoRules.name, tileDistance.tile)) {
|
|
118
|
+
return tileDistance.tile;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
export const DEFAULT_BUILDING_PRIORITY = 0;
|
|
124
|
+
export const BUILDING_NAME_TO_RULES = new Map([
|
|
125
|
+
// Allied
|
|
126
|
+
["GAPOWR", new PowerPlant()],
|
|
127
|
+
["GAREFN", new ResourceCollectionBuilding(10, 3)],
|
|
128
|
+
["GAWEAP", new BasicBuilding(15, 1)],
|
|
129
|
+
["GAPILE", new BasicBuilding(12, 1)],
|
|
130
|
+
["CMIN", new Harvester(15, 4, 2)],
|
|
131
|
+
["GADEPT", new BasicBuilding(1, 1, 10000)],
|
|
132
|
+
["GAAIRC", new BasicBuilding(10, 1, 500)],
|
|
133
|
+
["AMRADR", new BasicBuilding(10, 1, 500)],
|
|
134
|
+
["GATECH", new BasicBuilding(20, 1, 4000)],
|
|
135
|
+
["GAYARD", new BasicBuilding(0, 0, 0)],
|
|
136
|
+
["GAPILL", new AntiGroundStaticDefence(2, 1, 5, 5)],
|
|
137
|
+
["ATESLA", new AntiGroundStaticDefence(2, 1, 10, 3)],
|
|
138
|
+
["NASAM", new AntiAirStaticDefence(2, 1, 5)],
|
|
139
|
+
["GAWALL", new AntiGroundStaticDefence(0, 0, 0, 0)],
|
|
140
|
+
["E1", new BasicGroundUnit(2, 2, 0.2, 0)],
|
|
141
|
+
["ENGINEER", new BasicGroundUnit(1, 0, 0)],
|
|
142
|
+
["MTNK", new BasicGroundUnit(10, 3, 2, 0)],
|
|
143
|
+
["MGTK", new BasicGroundUnit(10, 1, 2.5, 0)],
|
|
144
|
+
["FV", new BasicGroundUnit(5, 2, 0.5, 1)],
|
|
145
|
+
["JUMPJET", new BasicAirUnit(10, 1, 1, 1)],
|
|
146
|
+
["ORCA", new BasicAirUnit(7, 1, 2, 0)],
|
|
147
|
+
["SREF", new ArtilleryUnit(10, 5, 3, 3)],
|
|
148
|
+
["CLEG", new BasicGroundUnit(0, 0)],
|
|
149
|
+
["SHAD", new BasicGroundUnit(0, 0)],
|
|
150
|
+
// Soviet
|
|
151
|
+
["NAPOWR", new PowerPlant()],
|
|
152
|
+
["NAREFN", new ResourceCollectionBuilding(10, 3)],
|
|
153
|
+
["NAWEAP", new BasicBuilding(15, 1)],
|
|
154
|
+
["NAHAND", new BasicBuilding(12, 1)],
|
|
155
|
+
["HARV", new Harvester(15, 4, 2)],
|
|
156
|
+
["NADEPT", new BasicBuilding(1, 1, 10000)],
|
|
157
|
+
["NARADR", new BasicBuilding(10, 1, 500)],
|
|
158
|
+
["NANRCT", new PowerPlant()],
|
|
159
|
+
["NAYARD", new BasicBuilding(0, 0, 0)],
|
|
160
|
+
["NATECH", new BasicBuilding(20, 1, 4000)],
|
|
161
|
+
["NALASR", new AntiGroundStaticDefence(2, 1, 5, 5)],
|
|
162
|
+
["NAFLAK", new AntiAirStaticDefence(2, 1, 5)],
|
|
163
|
+
["TESLA", new AntiGroundStaticDefence(2, 1, 10, 3)],
|
|
164
|
+
["NAWALL", new AntiGroundStaticDefence(0, 0, 0, 0)],
|
|
165
|
+
["E2", new BasicGroundUnit(2, 2, 0.2, 0)],
|
|
166
|
+
["SENGINEER", new BasicGroundUnit(1, 0, 0)],
|
|
167
|
+
["FLAKT", new BasicGroundUnit(2, 2, 0.1, 0.3)],
|
|
168
|
+
["YURI", new BasicGroundUnit(1, 1, 1, 0)],
|
|
169
|
+
["DOG", new BasicGroundUnit(1, 1, 0, 0)],
|
|
170
|
+
["HTNK", new BasicGroundUnit(10, 3, 3, 0)],
|
|
171
|
+
["APOC", new BasicGroundUnit(6, 1, 5, 0)],
|
|
172
|
+
["HTK", new BasicGroundUnit(5, 2, 0.33, 1.5)],
|
|
173
|
+
["ZEP", new BasicAirUnit(5, 1, 5, 1)],
|
|
174
|
+
["V3", new ArtilleryUnit(9, 10, 0, 3)], // V3 Rocket Launcher
|
|
175
|
+
]);
|
|
175
176
|
//# sourceMappingURL=buildingRules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildingRules.js","sourceRoot":"","sources":["../../../../src/bot/logic/building/buildingRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,QAAQ,EACR,QAAQ,EACR,UAAU,
|
|
1
|
+
{"version":3,"file":"buildingRules.js","sourceRoot":"","sources":["../../../../src/bot/logic/building/buildingRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,QAAQ,EACR,QAAQ,EACR,UAAU,EAMV,OAAO,GACV,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,uBAAuB,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AAC,CAAC,CAAC;IACzC,CAAC,KAAK,EAAE,IAAI,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC,KAAK,EAAE,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC,IAAI,EAAE,IAAI,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,qBAAqB;CAChE,CAAC,CAAC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { getPointTowardsOtherPoint } from "../map/map.js";
|
|
2
|
-
import { getDefaultPlacementLocation } from "./buildingRules.js";
|
|
3
|
-
export const getStaticDefencePlacement = (game, playerData, technoRules) => {
|
|
4
|
-
// Prefer front towards enemy.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { getPointTowardsOtherPoint } from "../map/map.js";
|
|
2
|
+
import { getDefaultPlacementLocation } from "./buildingRules.js";
|
|
3
|
+
export const getStaticDefencePlacement = (game, playerData, technoRules) => {
|
|
4
|
+
// Prefer front towards enemy.
|
|
5
|
+
const { startLocation, name: currentName } = playerData;
|
|
6
|
+
const allNames = game.getPlayers();
|
|
7
|
+
// Create a list of positions that point roughly towards hostile player start locatoins.
|
|
8
|
+
const candidates = allNames
|
|
9
|
+
.filter((otherName) => otherName !== currentName && !game.areAlliedPlayers(otherName, currentName))
|
|
10
|
+
.map((otherName) => {
|
|
11
|
+
const enemyPlayer = game.getPlayerData(otherName);
|
|
12
|
+
return getPointTowardsOtherPoint(game, startLocation, enemyPlayer.startLocation, 4, 16, 1.5);
|
|
13
|
+
});
|
|
14
|
+
if (candidates.length === 0) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const selectedLocation = candidates[Math.floor(game.generateRandom() * candidates.length)];
|
|
18
|
+
return getDefaultPlacementLocation(game, playerData, selectedLocation, technoRules, false, 2);
|
|
19
|
+
};
|
|
19
20
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/bot/logic/building/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,IAAa,EAAE,UAAsB,EAAE,WAAwB,EAAE,EAAE;IACzG,8BAA8B;IAC9B,
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/bot/logic/building/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,IAAa,EAAE,UAAsB,EAAE,WAAwB,EAAE,EAAE;IACzG,8BAA8B;IAC9B,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC;IACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IACnC,wFAAwF;IACxF,MAAM,UAAU,GAAG,QAAQ;SACtB,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;SAClG,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QACf,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAClD,OAAO,yBAAyB,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IACjG,CAAC,CAAC,CAAC;IACP,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KACpB;IACD,MAAM,gBAAgB,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3F,OAAO,2BAA2B,CAAC,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAClG,CAAC,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { BasicGroundUnit } from "./basicGroundUnit.js";
|
|
2
|
-
const IDEAL_HARVESTERS_PER_REFINERY = 2;
|
|
3
|
-
const MAX_HARVESTERS_PER_REFINERY = 4;
|
|
4
|
-
export class Harvester extends BasicGroundUnit {
|
|
5
|
-
constructor(basePriority, baseAmount, minNeeded) {
|
|
6
|
-
super(basePriority, baseAmount, 0, 0);
|
|
7
|
-
this.minNeeded = minNeeded;
|
|
8
|
-
}
|
|
9
|
-
// Priority goes up when we have fewer than this many refineries.
|
|
10
|
-
getPriority(game, playerData, technoRules, threatCache) {
|
|
11
|
-
const refineries = game.getVisibleUnits(playerData.name, "self", (r) => r.refinery).length;
|
|
12
|
-
const harvesters = game.getVisibleUnits(playerData.name, "self", (r) => r.harvester).length;
|
|
13
|
-
const boost = harvesters < this.minNeeded ? 3 : harvesters > refineries * MAX_HARVESTERS_PER_REFINERY ? 0 : 1;
|
|
14
|
-
return this.basePriority * (refineries / Math.max(harvesters / IDEAL_HARVESTERS_PER_REFINERY, 1)) * boost;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { BasicGroundUnit } from "./basicGroundUnit.js";
|
|
2
|
+
const IDEAL_HARVESTERS_PER_REFINERY = 2;
|
|
3
|
+
const MAX_HARVESTERS_PER_REFINERY = 4;
|
|
4
|
+
export class Harvester extends BasicGroundUnit {
|
|
5
|
+
constructor(basePriority, baseAmount, minNeeded) {
|
|
6
|
+
super(basePriority, baseAmount, 0, 0);
|
|
7
|
+
this.minNeeded = minNeeded;
|
|
8
|
+
}
|
|
9
|
+
// Priority goes up when we have fewer than this many refineries.
|
|
10
|
+
getPriority(game, playerData, technoRules, threatCache) {
|
|
11
|
+
const refineries = game.getVisibleUnits(playerData.name, "self", (r) => r.refinery).length;
|
|
12
|
+
const harvesters = game.getVisibleUnits(playerData.name, "self", (r) => r.harvester).length;
|
|
13
|
+
const boost = harvesters < this.minNeeded ? 3 : harvesters > refineries * MAX_HARVESTERS_PER_REFINERY ? 0 : 1;
|
|
14
|
+
return this.basePriority * (refineries / Math.max(harvesters / IDEAL_HARVESTERS_PER_REFINERY, 1)) * boost;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=harvester.js.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { getDefaultPlacementLocation } from "./buildingRules.js";
|
|
2
|
-
export class PowerPlant {
|
|
3
|
-
getPlacementLocation(game, playerData, technoRules) {
|
|
4
|
-
return getDefaultPlacementLocation(game, playerData, playerData.startLocation, technoRules);
|
|
5
|
-
}
|
|
6
|
-
getPriority(game, playerData, technoRules) {
|
|
7
|
-
if (playerData.power.total < playerData.power.drain) {
|
|
8
|
-
return 100;
|
|
9
|
-
}
|
|
10
|
-
else if (playerData.power.total < playerData.power.drain + technoRules.power / 2) {
|
|
11
|
-
return 20;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
return 0;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
getMaxCount(game, playerData, technoRules, threatCache) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
import { getDefaultPlacementLocation } from "./buildingRules.js";
|
|
2
|
+
export class PowerPlant {
|
|
3
|
+
getPlacementLocation(game, playerData, technoRules) {
|
|
4
|
+
return getDefaultPlacementLocation(game, playerData, playerData.startLocation, technoRules);
|
|
5
|
+
}
|
|
6
|
+
getPriority(game, playerData, technoRules) {
|
|
7
|
+
if (playerData.power.total < playerData.power.drain) {
|
|
8
|
+
return 100;
|
|
9
|
+
}
|
|
10
|
+
else if (playerData.power.total < playerData.power.drain + technoRules.power / 2) {
|
|
11
|
+
return 20;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
getMaxCount(game, playerData, technoRules, threatCache) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
21
|
//# sourceMappingURL=powerPlant.js.map
|