2020-11-09 19:31:39 -06:00
|
|
|
let rolewarrior = {
|
2017-06-06 13:17:26 -05:00
|
|
|
run: function(creep) {
|
2020-11-09 19:31:39 -06:00
|
|
|
var hostile = creep.pos.findClosestByRange(FIND_HOSTILE_CREEPS);
|
|
|
|
var hostilebuilding = creep.pos.findClosestByRange(FIND_HOSTILE_SPAWNS );
|
|
|
|
if(hostile!=undefined) {
|
2017-06-06 13:17:26 -05:00
|
|
|
creep.say('Sorry')
|
2020-11-09 19:31:39 -06:00
|
|
|
creep.travelTo(hostile,{ignoreCreeps:true});
|
2017-06-06 13:17:26 -05:00
|
|
|
creep.attack(hostile);
|
|
|
|
|
|
|
|
} else if(hostilebuilding!=undefined){
|
|
|
|
creep.say('Sorry')
|
2020-11-09 19:31:39 -06:00
|
|
|
creep.travelTo(hostilebuilding,{ignoreCreeps:true});
|
2017-06-06 13:17:26 -05:00
|
|
|
creep.attack(hostilebuilding);
|
|
|
|
|
2020-11-09 19:31:39 -06:00
|
|
|
}else if(Game.flags.protect,{ignoreCreeps:true}) {
|
2017-06-06 13:17:26 -05:00
|
|
|
creep.say('ATK')
|
2020-11-09 19:31:39 -06:00
|
|
|
creep.travelTo(Game.flags.protect,{ignoreCreeps:true})
|
2017-06-06 13:17:26 -05:00
|
|
|
|
|
|
|
} else{
|
|
|
|
creep.say('parking')
|
2020-11-09 19:31:39 -06:00
|
|
|
creep.travelTo(creep.room.memory.warriorparkx,creep.room.memory.warriorparky,creep.room.roomName,{ignoreCreeps:true})
|
2017-06-06 13:17:26 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2020-11-09 19:31:39 -06:00
|
|
|
module.exports = rolewarrior;
|
|
|
|
|
|
|
|
|
|
|
|
|