forked from Sriep/screeps-obsolete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ayrtep.pad.js
411 lines (285 loc) · 14.4 KB
/
ayrtep.pad.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
/**
* @fileOverview Screeps main processing loop.
* @author Piers Shepperson
*/
"use strict";
var policy = require("policy");
var gc = require("gc");
//var gf = require("gf");
var routeBase = require("route.base");
var ayrtepPad = {
top: function () {
//console.log("------------------------------ flags -------------------------------");
// for ( var i in Game.flags) {
// if (Game.flags[i].memory.type == "constructedWall")
// Game.flags[i].memory.type == "wall"
//console.log(Game.flags[i].pos,i, JSON.stringify(Game.flags[i].memory));
// }
//console.log("------------------------------ flags -------------------------------");
//Memory.rooms["W28S22"].flagged = false;
// console.log("------------------------------ routes W26S21 ---------------------------");
// routeBase.showRoutes("W26S21");
// console.log("------------------------------ routes W25S22 ---------------------------");
// routeBase.showRoutes("W25S22");
// console.log("------------------------------ routes W25S23 ---------------------------");
// routeBase.showRoutes("W25S23");
// console.log("------------------------------ routes W25S19 ---------------------------");
// routeBase.showRoutes("W25S19");
// console.log("------------------------------ routes W28S23 ---------------------------");
// routeBase.showRoutes("W24S23");
// console.log("------------------------------ routes W24S23 ---------------------------");
// routeBase.showRoutes("W24S23");
// console.log("---------------------------------------------------------------------");
// console.log("------------------------------ routes sim ---------------------------");
// routeBase.showRoutes("sim");
// console.log("------------------------------ routes sim ---------------------------");
// var creeps = _.filter(Game.creeps, function (creep) {
// return creep.memory.role == gc.ROLE_WALL_BUILDER});
// for ( var i = 0 ; i < creeps.length ; i++ ) {
// roleBase.switchRoles(creeps[i], gc.ROLE_WALL_BUILDER);
// }
//var sim = Game.rooms["sim"];
//var w25s19 = Game.rooms["W25S19"];
//var w26s21 = Game.rooms["W26S21"];
//var w26s22 = Game.rooms["W26S22"];
//var w25s22 = Game.rooms["W25S22"];
var w25s23 = Game.rooms["W25S23"];
//var w24s23 = Game.rooms["W24S23"];
//w25s19.memory.routes.details[12].size = 8;
//w25s23.memory.routes.details[12604].respawnRate = 1500;
//w25s23.memory.routes.details[15].basePriority = 100;
// delete w25s23.memory.routes.details[389];
// delete w25s23.memory.routes.details[390];
//delete w25s23.memory.routes.details[392];
//delete w25s23.memory.routes.details[393];
//w25s23.memory.routes.details[39].priority = gc.PRIORITY_LINKER;
//delete w26s21.memory.routes.details[5];
//delete w25s23.memory.routes.details[3];
//var creep = Game.creeps["Bentley"];
// roleBase.switchRoles(creep, gc.ROLE_LINKER, "55db3176efa8e3fe66e04a54", true);
// creep = Game.creeps["Bentley"];
//roleBase.switchRoles(creep, gc.ROLE_LINKER, "55db3176efa8e3fe66e04a54", true);
//delete Memory.policies;
},
bottom: function () {
console.log("START MY PAD START MY PAD");
// var boostPart = _.findKey(BOOSTS,"LH");
// var action = BOOSTS[WORK]["LH"];
// var key = _.findKey(action);
// var multiplyer = BOOSTS[WORK]["LH"][key];
// console.log("boostPart", boostPart,"action",JSON.stringify(action),"key",key,"mult",multiplyer);
//for ( var i in Memory.policies ) {
// console.log("policy",i, Memory.policies[i].type, Memory.policies[i].roomName);
//console.log("number of policies", Memory.policies)
//}
//var sim = Game.rooms["sim"];
var w25s19 = Game.rooms["W25S19"];
var w26s21 = Game.rooms["W26S21"];
var w25s22 = Game.rooms["W25S22"];
var w25s23 = Game.rooms["W25S23"];
// var body = [MOVE,MOVE,MOVE,MOVE,WORK,WORK,WORK,WORK,CARRY,CARRY,CARRY,CARRY];
// var boostActions = [gc.BUILD,gc.FATIGUE];
// var rtv;
// rtv = routeBase.reserveBoosts(w25s23, body, boostActions);
// console.log(w25s23,"routeBase.reserveBoosts",JSON.stringify(rtv));
// var routeBase = require("route.base");
var routeBase = require("route.base");
//routeBase.resetRoutes("sim");
//routeBase.resetRoutes("W26S21");
//routeBase.resetRoutes("W25S22");
//routeBase.resetRoutes("W25S23");
//routeBase.resetRoutes("W25S19");
//routeBase.resetRoutes("W28S23");
//routeBase.resetRoutes("W26S22");
//routeBase.resetRoutes("W25S24");
//console.log("room.memory.routes.nextRouteId",w25s23.memory.routes.nextRouteId);
var roleBase = require("role.base");
var gc = require("gc");
var creep = Game.creeps["Annabelle"];
//roleBase.switchRoles(creep, gc.ROLE_FLEXI_STORAGE_PORTER);
//creep.move(BOTTOM_LEFT);
//creep.moveTo(creep.room.controller);
//creep.upgradeController(creep.room.controller);
//creep.drop("U");
// creep.move(LEFT);
// creep.transfer(cre
// creep.transfer(creep.room.storage, "U");
// roleBase.switchRolesA(Game.creeps["Sebastian"],"wall.builder", []);
// roleBase.switchRoles( Game.creeps["Katherine"], gc.ROLE_BOOST_AND_SWITCH,
// ["57bacbe9625f659d69b79372","57b70598a03b6e9a4c8e4eb3"], gc.ROLE_SUPPRESS_KEEPERS, ["W25S24"] );
//creep.drop("L");
// creep.move(BOTTOM)
// var creep = Game.creeps["OwenNathaniel"];
// creep.transfer(creep.room.storage,"O");
// creep2.move(BOTTOM)
// roleBase.switchRoles(creep2, gc.ROLE_SUPPRESS_KEEPERS,"W24S24");
//var creep3 = Game.creeps["Carter"];
//roleBase.switchRoles(creep3, gc.ROLE_FLEXI_STORAGE_PORTER);
//creep3.move(RIGHT)
//creep.drop(RESOURCE_ENERGY);
//Jeremiah.move(LEFT);
//roleBase.switchRoles(creep, gc.ROLE_MINER,"W25S23","56e14bf41f7d4167346e0a9c",
// "Z", undefined, false);
//roleBase.switchRoles(creep, gc.ROLE_DISMANTLE_ROOM,"W28S24",targetList);
// var parth = creep.pos.findPathTo(36,26);
// console.log(creep,"parth",JSON.stringify(parth));
// console.log(creep, creep.moveTo(36,26));
//creep.moveTo(creep.room.terminal);
//creep.move(BOTTOM);
// console.log( "isy transfer",creep.transfer(creep.room.storage, "L"));
// roleBase.switchRoles(creep, gc.ROLE_FLEXI_STORAGE_PORTER);
// roleBase.switchRoles(creep,gc.ROLE_MOVE_RESOURCE,Game.getObjectById("57a8c118a8e324986f9dc2e9"),
// Game.getObjectById("577a641bb4633dec4b04f15f"),"O");
//
if (Game.time == 13328027 ) {
var raceClaimer = require("race.claimer");
var RouteRemoteActions = require("route.remote.actions");
var routeBase = require("route.base");
var claimerBody = raceClaimer.body(1);
var actions = {
room : "W26S22",
action : "claimController",
findFunction : "findController",
findFunctionsModule : "policy.remote.actions"
};
var claimOrder = new RouteRemoteActions(actions, claimerBody, 0);
console.log("claimOrder",JSON.stringify(claimOrder));
routeBase.attachRoute("W25S22", undefined, claimOrder, 4);
}
if (Game.time == 12885878 ) {
var gc = require("gc");
var raceWorker = require("race.worker");
var RouteGiftCreep = require("route.gift.creep");
var routeBase = require("route.base");
var w25s22 = Game.rooms["W25S22"];
var size = raceWorker.maxSizeRoom(w25s22,true);
var body = raceWorker.body(12, true);
console.log("worker size",size);
var order = new RouteGiftCreep("W25S22", "W26S22", undefined, body, gc.ROUTE_FLEXI_STORAGE_PORTER, 1500);
routeBase.attachRoute("W25S23", gc.ROUTE_FLEXI_STORAGE_PORTER, order, gc.PRIORITY_HOME_PORTER);
}
if (Game.time == 12885878 ) {
var gc = require("gc");
var raceWorker = require("race.worker");
var RouteGiftCreep = require("route.gift.creep");
var routeBase = require("route.base");
var w26s21 = Game.rooms["W25S23"];
var size = raceWorker.maxSizeRoom(w25s23,true);
var body = raceWorker.body(12, true);
console.log("worker size",size);
var order = new RouteGiftCreep("W25S23", "W25S23", undefined, body, gc.ROUTE_FLEXI_STORAGE_PORTER, 1500);
routeBase.attachRoute("W25S23", gc.ROUTE_FLEXI_STORAGE_PORTER, order, gc.PRIORITY_HOME_PORTER);
}
if (Game.time == 12885878 ) {
var gc = require("gc");
var raceWorker = require("race.worker");
var RouteGiftCreep = require("route.gift.creep");
var routeBase = require("route.base");
var w26s21 = Game.rooms["W25S23"];
var size = raceWorker.maxSizeRoom(w25s23,true);
var body = raceWorker.body(12, true);
console.log("worker size",size);
var order = new RouteGiftCreep("W25S23", "W25S22", undefined, body, gc.ROUTE_FLEXI_STORAGE_PORTER, 1500);
routeBase.attachRoute("W25S23", gc.ROUTE_FLEXI_STORAGE_PORTER, order, gc.PRIORITY_HOME_PORTER);
}
if (Game.time == 13763110 ) {
var gc = require("gc");
var raceWorker = require("race.worker");
var RouteGiftCreep = require("route.gift.creep");
var routeBase = require("route.base");
var w26s21 = Game.rooms["W25S23"];
var size = raceWorker.maxSizeRoom(w25s23,true);
var body = raceWorker.body(12, true);
console.log("worker size",size);
var order = new RouteGiftCreep("W25S23", "W25S22", undefined, body, gc.ROUTE_FLEXI_STORAGE_PORTER, 1500);
routeBase.attachRoute("W25S23", gc.ROUTE_FLEXI_STORAGE_PORTER, order, gc.PRIORITY_HOME_PORTER);
}
if (Game.time == 13763140 ) {
var gc = require("gc");
var raceWorker = require("race.worker");
var RouteGiftCreep = require("route.gift.creep");
var routeBase = require("route.base");
var w26s21 = Game.rooms["W25S23"];
var size = raceWorker.maxSizeRoom(w25s23,true);
var body = raceWorker.body(12, true);
console.log("worker size",size);
var order = new RouteGiftCreep("W25S23", "W26S21", undefined, body, gc.ROUTE_FLEXI_STORAGE_PORTER, 1500);
routeBase.attachRoute("W25S23", gc.ROUTE_FLEXI_STORAGE_PORTER, order, gc.PRIORITY_HOME_PORTER);
}
if (Game.time == 13764065 ) {
var gc = require("gc");
var raceWorker = require("race.worker");
var RouteGiftCreep = require("route.gift.creep");
var routeBase = require("route.base");
//var w26s21 = Game.rooms["W25S23"];
var size = raceWorker.maxSizeRoom(w25s23,true);
var body = raceWorker.body(12, true);
console.log("worker size",size);
var order = new RouteGiftCreep("W25S23", "W28S23", undefined, body, gc.ROUTE_FLEXI_STORAGE_PORTER, 1500);
routeBase.attachRoute("W25S23", gc.ROUTE_FLEXI_STORAGE_PORTER, order, gc.PRIORITY_HOME_PORTER);
}
if (Game.time == 12881479 ) {
var gc = require("gc");
var raceSwordsman = require("race.swordsman");
var soldierBody = raceSwordsman.body(10);
var routeBase = require("route.base");
var order = new RoutePatrolRoom(
"W25S22",
"W26S22",
{roomName: "W26S22", x: 28, y: 41},
soldierBody,
1400
);
routeBase.attachRoute("W26S22", gc.ROUTE_PATROL_ROOM,
order,gc.PRIORITY_ROOM_PATROL);
}
if (Game.time == 13764964 ) {
var gc = require("gc");
var RouteWallBuilder = require("route.wall.builder");
var order = new RouteWallBuilder("W26S21");
routeBase.attachRoute("W26S21", undefined,
order,gc.PRIORITY_WALL_BUILDER);
}
if (Game.time == 13359926 ) {
var gc = require("gc");
var raceWorker = require("race.worker");
var RouteDismantleRoom = require("route.dismantle.room");
var routeBase = require("route.base");
var sapperBody = raceWorker.bodyE(1,0,1);
//RouteDismantleRoom (targetRoomName, body, respawn, targetList)
var targetList = [
{ type : gc.TARGET_ID, target : "57c9568b55d5bc0d46e2c9ff" },
{ type : gc.TARGET_ID, target : "57c9537bdc05b2b82ee06881" },
];
var orderW25s23 = new RouteDismantleRoom(
"W24S23",
sapperBody,
0,
targetList
);
console.log("dismantle room", JSON.stringify(orderW25s23));
routeBase.attachRoute("W25S23",undefined,orderW25s23,60);
}
// var gc = require("gc");
// var roleBase = require("role.base");
// var AriaRuby = Game.creeps["AriaRuby"];
// console.log("AriaRuby",AriaRuby.transfer(AriaRuby.room.storage,"Z"));
//var targetList = [
// { type : gc.TARGET_ID, target : "57c98edeb80ae1d315dfcc97" },
// { type : gc.TARGET_ID, target : "57c9537bdc05b2b82ee06881" },
//];
//roleBase.switchRoles(Mayo,"W24S23",targetList)
//roomBase.sendScoutFromTo("W28S23", "W29S23");
//console.log("wokerbody£",raceWorker.bodyE(37,0,13));
var gc = require("gc");
// console.log("TERMINAL_RESERVE",gc.TERMINAL_RESERVE,"TERMINAL_RESTOCK_THRESHOLD",gc.TERMINAL_RESTOCK_THRESHOLD);
var from = new RoomPosition(32,1,"W24S24");
var to = new RoomPosition(1,8,"W24S24");
var roadBuilder = require("road.builder");
//roadBuilder.buildRoad( from, to );
}
};
module.exports = ayrtepPad;
/**
* Created by Piers on 07/07/2016.
*/