Calculate all the things

This commit is contained in:
Tyrel Souza 2016-06-29 21:16:00 -04:00
parent 0aeab1cf36
commit 0ada42efb3

View File

@ -2,8 +2,14 @@ var battle = require('battle')
var roleGuard = { var roleGuard = {
getLastFlag: function(){ getLastFlag: function(){
let patrolFlags = _.filter(Game.flags, function(flag){
return 4; // TODO. calculate me. 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){ run: function(creep){
console.log(creep, 'running Guard') console.log(creep, 'running Guard')