-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrole.warrior.js
28 lines (22 loc) · 968 Bytes
/
role.warrior.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
let rolewarrior = {
run: function(creep) {
var hostile = creep.pos.findClosestByRange(FIND_HOSTILE_CREEPS);
var hostilebuilding = creep.pos.findClosestByRange(FIND_HOSTILE_SPAWNS );
if(hostile!=undefined) {
creep.say('Sorry')
creep.travelTo(hostile,{ignoreCreeps:true});
creep.attack(hostile);
} else if(hostilebuilding!=undefined){
creep.say('Sorry')
creep.travelTo(hostilebuilding,{ignoreCreeps:true});
creep.attack(hostilebuilding);
}else if(Game.flags.protect,{ignoreCreeps:true}) {
creep.say('ATK')
creep.travelTo(Game.flags.protect,{ignoreCreeps:true})
} else{
creep.say('parking')
creep.travelTo(creep.room.memory.warriorparkx,creep.room.memory.warriorparky,creep.room.roomName,{ignoreCreeps:true})
}
}
};
module.exports = rolewarrior;