Calculate all the things
This commit is contained in:
parent
0aeab1cf36
commit
0ada42efb3
@ -2,8 +2,14 @@ var battle = require('battle')
|
||||
|
||||
var roleGuard = {
|
||||
getLastFlag: function(){
|
||||
|
||||
return 4; // TODO. calculate me.
|
||||
let patrolFlags = _.filter(Game.flags, function(flag){
|
||||
return flag.name.indexOf("patrol_") == 0;
|
||||
});
|
||||
let flagNumbers = _.map(patrolFlags, function(flag){
|
||||
return parseInt(flag.name.substring("patrol_".length, flag.name.length));
|
||||
});
|
||||
let max = Math.max.apply(Math, flagNumbers);
|
||||
return max;
|
||||
},
|
||||
run: function(creep){
|
||||
console.log(creep, 'running Guard')
|
||||
|
Loading…
Reference in New Issue
Block a user