import { isMyRoom } from '@open-screeps/is-my-room' ; import { Colony } from './colony' ; export class Empire { private colonies : { [ coreRoomName ] : Colony ; } = { } ; constructor ( ) { if ( ! Memory . arcos . colonies ) { Memory . arcos . colonies = { } ; } let myRooms = _ . filter ( Game . rooms , isMyRoom ) ; myRooms . forEach ( ( room ) => { this . colonies [ room . name ] = new Colony ( room . name , this ) ; } ) ; } param coreRoomName hasColony ( coreRoomName ) { return ! ! this . colonies [ coreRoomName ] ; } param roomName getColony ( roomName ) { let colony = false ; Object . keys ( this . colonies ) . forEach ( ( coreRoomName ) => { if ( this . colonies [ coreRoomName ] . hasRoom ( roomName ) ) { colony = this . colonies [ coreRoomName ] ; } } ) ; return colony ; } }