我想让它自我治愈,但下面的代码似乎不起作用。有什么建议吗?
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")
}}发布于 2014-12-05 00:42:57
假设https://gist.github.com/avdg/7835babe74904a8a123b的代码是准确的,爬虫是无法自我治愈的。第4657行有一组检查,这些检查会导致恢复函数什么也不做,没有错误。其中一个检查是k==b,其中k似乎是目标,b似乎是进行治疗的爬行者。所以,如果它们是一样的,它就什么也做不了。
https://stackoverflow.com/questions/27306204
复制相似问题