var battle = require("battle") var roleGuard = { run: function(creep){ console.log(creep, "running Guard") var target = battle.findEnemy(creep); console.log("\t", creep, "tageting:",target) if(target && creep.hits > creep.hitsMax - 500 /* no more attack */) { creep.moveTo(target); creep.attack(target); } else { creep.moveTo(Game.spawns.Spawn1); } } } module.exports = roleGuard;