-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenew.js
40 lines (38 loc) · 1.25 KB
/
renew.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
/*
* Module code goes here. Use 'module.exports' to export things:
* module.exports.thing = 'a thing';
*
* You can import it from another modules like this:
* var mod = require('renew');
* mod.thing == 'a thing'; // true
*/
module.exports = {
check : function () {
if (Game.spawns.Spawn1.isActive())
var heal = Game.spawns.Spawn1.pos.closestByPath(FIND_MY_CREEPS, {
filter: (c) => c.memory.health == "danger"
})
if (heal != undefined) {
}
},
full : function(creep) {
if (creep.memory.health != "high") {
if (creep.ticksToLive < 250 && Game.spawns.Spawn1.renewCreep(creep) == ERR_NOT_IN_RANGE) {
creep.moveTo(Game.spawns.Spawn1);
}
else {
creep.memory.health = "high";
}
}
},
half : function(creep) {
if (creep.memory.health != "high" || creep.memory.health != "low") {
if (creep.ticksToLive < 150 && Game.spawns.Spawn1.renewCreep(creep) == ERR_NOT_IN_RANGE) {
creep.moveTo(Game.spawns.Spawn1);
}
else {
creep.memory.health = "low";
}
}
}
};