sendClaimer: function(room, target){
     
     var claimer = _.filter(room.memory.creeps, (creep) => (creep.role == 'claimer') && (creep.task == target.controller.id))
     if (claimer.length == 0) {
         let order = new spawnManager.creepOrder(room.name, 'claimer', 3, target.controller.id)
         spawnManager.queueSpawn(order)
     }
 },
 Tick: function() {
     
     for (let roomName in Memory.MyOwnedRooms){
         let room = Game.rooms[roomName];
         
         this.responseToFlags(room);
         this.manageSatellites(room);
         spawnManager.Tick(room);
     }
 },
 sendExplorer: function(room, targetName){
     
     
     roompos = new RoomPosition(25,25,targetName);
     var explorer = _.filter(room.memory.creeps, (creep) => (creep.role == 'explorer') && (creep.task.roomName == targetName));
     if (explorer.length < 1){
         place = new RoomPosition(25,25,targetName)
         let order = new spawnManager.creepOrder(room.name, 'explorer', 5, place)
         spawnManager.queueSpawn(order)
     }
 },
 manageSatellites: function(room){
     
     for (satelliteName in Memory.MyOwnedRooms[room.name]){
         satellite = Game.rooms[satelliteName]
         roommem = Memory.MyOwnedRooms[room.name];
         if (!satellite){
             roompos = new RoomPosition(25,25,satelliteName);
             var explorer = _.filter(room.memory.creeps, (creep) => (creep.role == 'explorer') && (creep.task.roomName == satelliteName));
             if (explorer.length < 1){
                 spawn = Game.spawns[room.memory.spawn.primaryspawn];
                 place = new RoomPosition(25,25,satelliteName)
                 let order = new spawnManager.creepOrder(room.name, 'explorer', 5, place)
                 spawnManager.queueSpawn(order)
             }
         }
         if (satellite){
             controller = satellite.controller
             if ((!controller.reservation) || (controller.reservation.ticksToEnd < 2000)){
                 reservername = []
                 for (let name in room.memory.creeps){
                     let checkmemory = room.memory.creeps[name]
                     if ((checkmemory.role == 'reserver') && (checkmemory.task == controller.id)){
                         reservername.push(name);
                     }
                 }
                 reserver = Game.creeps[reservername[0]]
                 if ((reservername.length < room.memory.config.reservers) || 
                 ((reserver.ticksToLive < 100) && (reservername.length < (room.memory.config.reservers + 1)))){
                     spawn = Game.spawns[room.memory.spawn.primaryspawn];
                     let order = new spawnManager.creepOrder(room.name, 'reserver', 9, controller.id)
                     spawnManager.queueSpawn(order)
                 }
             }
         }
         
     }
 },
 responseToFlags: function(room){
     
     for (flagname in Game.flags){
         flag = Game.flags[flagname]
         flagroom = Game.rooms[flag.pos.roomName]
         if (flag.name == (room.name + '+')){
             if (Game.rooms[flag.pos.roomName]){
                 if (!flagroom.controller.my){
                     this.addSatellite(room.name, flag);
                 }
                 if (flagroom.controller.my){
                     flag.remove()
                 }
             }
             else{
                 var explorer = _.filter(room.memory.creeps, (creep) => (creep.role == 'explorer') && (creep.task.roomName == flag.pos.roomName));
                 if (explorer.length < 1){
                     spawn = Game.spawns[room.memory.spawn.primaryspawn];
                     let order = new spawnManager.creepOrder(room.name, 'explorer', 5, flag.pos)
                     spawnManager.queueSpawn(order)
                 }
             }
         }
         if (flag.name == (room.name + '-')){
             this.removeSatellite(flag.pos.roomName);
         }
         if (flag.name == (room.name + 'war')){
             if (Memory.WarTargets == undefined){
                 Memory.WarTargets[flag.pos.roomName].attacker = room.name;
             }
         }
         if (flag.name == (room.name + 'peace')){
             delete Memory.Wartargets[flag.pos.roomName]
         }
         if (flag.name == (room.name + 'claim')){
             if (Memory.ClaimTargets[flag.pos.roomName] == undefined){
                 Memory.ClaimTargets[flag.pos.roomName] = {}
                 Memory.ClaimTargets[flag.pos.roomName].claimer = room.name;
             }
         }
     }
 },