-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspawner.js
More file actions
55 lines (51 loc) · 1.78 KB
/
spawner.js
File metadata and controls
55 lines (51 loc) · 1.78 KB
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
var Spawner = {
/** @param {Creep} creep **/
run: function(hCount, uCount, bCount) {
var myEnergyCapacity = Game.rooms.W8N3.energyCapacityAvailable;
if(Game.spawns.HomeBase.memory == 'debug'){
console.log("Room Capacity at = ",myEnergyCapacity);
}
if(myEnergyCapacity <= 250){
if(hCount < 5) {
Game.spawns.HomeBase.createCreep([WORK, CARRY, MOVE], null, {role: 'harvester'});
if(Game.spawns.HomeBase.memory == 'debug'){
console.log('Spawning Harvester')
}
}
if(bCount < 2 && hCount >= 5){
Game.spawns.HomeBase.createCreep([WORK, CARRY, MOVE], null, {role: 'builder'});
if(Game.spawns.HomeBase.memory == 'debug'){
console.log('Spawning Builder')
}
}
if(uCount < 7 && bCount >= 2 && hCount >= 5) {
Game.spawns.HomeBase.createCreep([WORK, CARRY, MOVE], null, {role: 'upgrader'});
if(Game.spawns.HomeBase.memory == 'debug'){
console.log('Spawning Upgrader')
}
}
}
else
{
if(hCount < 5) {
Game.spawns.HomeBase.createCreep([WORK, WORK, CARRY, CARRY, MOVE, MOVE], null, {role: 'harvester'});
if(Game.spawns.HomeBase.memory == 'debug'){
console.log('Spawning Harvester')
}
}
if(bCount < 2 && hCount >= 5){
Game.spawns.HomeBase.createCreep([WORK, WORK, CARRY, CARRY, MOVE, MOVE], null, {role: 'builder'});
if(Game.spawns.HomeBase.memory == 'debug'){
console.log('Spawning Builder')
}
}
if(uCount < 7 && bCount >= 2 && hCount >= 5) {
Game.spawns.HomeBase.createCreep([WORK, WORK, CARRY, CARRY, MOVE, MOVE], null, {role: 'upgrader'});
if(Game.spawns.HomeBase.memory == 'debug'){
console.log('Spawning Upgrader')
}
}
}
}
};
module.exports = Spawner;