我想制作一个可以自我治愈的蠕动,但下面的代码似乎不起作用。有什么建议么?
module.exports = function(creep) {
var targets = creep.room.find(Game.HOSTILE_CREEPS);
if(targets.length) {
creep.rangedAttack(targets[0]);
}
if(creep.hits < creep.hitsMax) {
creep.heal(creep);
console.log("healing")
}}