Remove 2 job & refactor tower spec

This commit is contained in:
2018-05-18 17:46:38 +02:00
parent 220a110ae1
commit 433142d1ff
8 changed files with 15 additions and 191 deletions

View File

@@ -1,15 +1,15 @@
StructureTower.prototype.defend =
function () {
// find closes hostile creep
// Defend Base
var target = this.pos.findClosestByRange(FIND_HOSTILE_CREEPS);
// if one is found...
if (target != undefined) {
// ...FIRE!
this.attack(target);
}
// Repair structure & only first 100k of wall
var closestDamagedStructure = this.pos.findClosestByRange(FIND_STRUCTURES, {
filter: (structure) => structure.hits < structure.hitsMax
filter: (structure) => structure.hits < structure.hitsMax && (structure.structureType != STRUCTURE_WALL || structure.hits < 100000)
});
if(closestDamagedStructure) {