diff --git a/src/directives/colony/colonize.ts b/src/directives/colony/colonize.ts index d0e055f46..ebb91c94d 100644 --- a/src/directives/colony/colonize.ts +++ b/src/directives/colony/colonize.ts @@ -1,13 +1,14 @@ -import {profile} from '../../profiler/decorator'; -import {Directive} from '../Directive'; -import {ClaimingOverlord} from '../../overlords/colonization/claimer'; -import {Colony} from '../../Colony'; -import {PioneerOverlord} from '../../overlords/colonization/pioneer'; -import {MY_USERNAME} from '../../~settings'; -import {log} from '../../console/log'; -import {Roles} from '../../creepSetups/setups'; -import {Cartographer, ROOMTYPE_CONTROLLER} from '../../utilities/Cartographer'; -import {printRoomName} from '../../utilities/utils'; +import { Colony } from '../../Colony'; +import { log } from '../../console/log'; +import { Roles } from '../../creepSetups/setups'; +import { RoomIntel } from '../../intel/RoomIntel'; +import { ClaimingOverlord } from '../../overlords/colonization/claimer'; +import { PioneerOverlord } from '../../overlords/colonization/pioneer'; +import { profile } from '../../profiler/decorator'; +import { Cartographer, ROOMTYPE_CONTROLLER } from '../../utilities/Cartographer'; +import { printRoomName } from '../../utilities/utils'; +import { MY_USERNAME } from '../../~settings'; +import { Directive } from '../Directive'; /** @@ -67,6 +68,20 @@ export class DirectiveColonize extends Directive { // Remove the directive this.remove(); } + + // if reserved or owned by Overmind user - throw warning but don't remove? Included code to remove, just commented out. + let AssimilatedRoomOwner = (typeof RoomIntel.roomOwnedBy(this.pos.roomName) === 'string' && RoomIntel.roomOwnedBy(this.pos.roomName) != MY_USERNAME && Assimilator.isAssimilated(RoomIntel.roomOwnedBy(this.pos.roomName)!)) + let AssimilatedRoomReserved = (typeof RoomIntel.roomReservedBy(this.pos.roomName) === 'string' && RoomIntel.roomReservedBy(this.pos.roomName) != MY_USERNAME && Assimilator.isAssimilated(RoomIntel.roomReservedBy(this.pos.roomName)!)) + //log.debug(`${this.print} Owned by: ${RoomIntel.roomOwnedBy(this.pos.roomName)}, who is ${AssimilatedRoomOwner} Assimilated. Reserved by: ${RoomIntel.roomReservedBy(this.pos.roomName)}, who is ${AssimilatedRoomReserved} Assimilated`) + if (Game.time % 10 == 2 && AssimilatedRoomOwner) { + log.warning(`${this.print} is in a room controlled by another Overmind user ${RoomIntel.roomOwnedBy(this.pos.roomName)}!`) + //this.remove(); + } + else if (Game.time % 10 == 2 && AssimilatedRoomReserved) { + log.warning(`${this.print} is in a room controlled by another Overmind user ${RoomIntel.roomReservedBy(this.pos.roomName)}!`) + //this.remove(); + } + if (Game.time % 10 == 2 && this.room && !!this.room.owner && this.room.owner != MY_USERNAME) { log.notify(`Removing Colonize directive in ${this.pos.roomName}: room already owned by another player.`); this.remove(); diff --git a/src/directives/colony/incubate.ts b/src/directives/colony/incubate.ts index d6d136bd5..24f759e9d 100644 --- a/src/directives/colony/incubate.ts +++ b/src/directives/colony/incubate.ts @@ -1,8 +1,11 @@ -import {profile} from '../../profiler/decorator'; -import {Directive} from '../Directive'; -import {ClaimingOverlord} from '../../overlords/colonization/claimer'; -import {Colony} from '../../Colony'; -import {SpawnGroup} from '../../logistics/SpawnGroup'; +import { Colony } from '../../Colony'; +import { log } from '../../console/log'; +import { RoomIntel } from '../../intel/RoomIntel'; +import { SpawnGroup } from '../../logistics/SpawnGroup'; +import { ClaimingOverlord } from '../../overlords/colonization/claimer'; +import { profile } from '../../profiler/decorator'; +import { Directive } from '../Directive'; +import { MY_USERNAME } from '../../~settings'; /** @@ -43,5 +46,18 @@ export class DirectiveIncubate extends Directive { this.remove(); } } + + // if reserved or owned by Overmind user - throw warning but don't remove? Included code to remove, just commented out. + let AssimilatedRoomOwner = (typeof RoomIntel.roomOwnedBy(this.pos.roomName) === 'string' && RoomIntel.roomOwnedBy(this.pos.roomName) != MY_USERNAME && Assimilator.isAssimilated(RoomIntel.roomOwnedBy(this.pos.roomName)!)) + let AssimilatedRoomReserved = (typeof RoomIntel.roomReservedBy(this.pos.roomName) === 'string' && RoomIntel.roomReservedBy(this.pos.roomName) != MY_USERNAME && Assimilator.isAssimilated(RoomIntel.roomReservedBy(this.pos.roomName)!)) + //log.debug(`${this.print} Owned by: ${RoomIntel.roomOwnedBy(this.pos.roomName)}, who is ${AssimilatedRoomOwner} Assimilated. Reserved by: ${RoomIntel.roomReservedBy(this.pos.roomName)}, who is ${AssimilatedRoomReserved} Assimilated`) + if (Game.time % 10 == 2 && AssimilatedRoomOwner) { + log.warning(`${this.print} is in a room controlled by another Overmind user ${RoomIntel.roomOwnedBy(this.pos.roomName)}!`) + //this.remove(); + } + else if (Game.time % 10 == 2 && AssimilatedRoomReserved) { + log.warning(`${this.print} is in a room controlled by another Overmind user ${RoomIntel.roomReservedBy(this.pos.roomName)}!`) + //this.remove(); + } } } diff --git a/src/directives/colony/outpost.ts b/src/directives/colony/outpost.ts index 4c4dc158b..4627ddd92 100644 --- a/src/directives/colony/outpost.ts +++ b/src/directives/colony/outpost.ts @@ -1,10 +1,11 @@ -import {Directive} from '../Directive'; -import {profile} from '../../profiler/decorator'; -import {ReservingOverlord} from '../../overlords/colonization/reserver'; -import {StationaryScoutOverlord} from '../../overlords/scouting/stationary'; -import {Cartographer, ROOMTYPE_CONTROLLER} from '../../utilities/Cartographer'; -import {RoomIntel} from '../../intel/RoomIntel'; -import {log} from '../../console/log'; +import { MY_USERNAME } from '../../~settings'; +import { log } from '../../console/log'; +import { RoomIntel } from '../../intel/RoomIntel'; +import { ReservingOverlord } from '../../overlords/colonization/reserver'; +import { StationaryScoutOverlord } from '../../overlords/scouting/stationary'; +import { profile } from '../../profiler/decorator'; +import { Cartographer, ROOMTYPE_CONTROLLER } from '../../utilities/Cartographer'; +import { Directive } from '../Directive'; /** * Claims a new room and incubates it from the nearest (or specified) colony @@ -39,6 +40,20 @@ export class DirectiveOutpost extends Directive { log.warning(`Removing ${this.print} since room is owned!`); this.remove(); } + + // if reserved or owned by Overmind user - throw warning but don't remove? Included code to remove, just commented out. + let AssimilatedRoomOwner = (typeof RoomIntel.roomOwnedBy(this.pos.roomName) === 'string' && RoomIntel.roomOwnedBy(this.pos.roomName) != MY_USERNAME && Assimilator.isAssimilated(RoomIntel.roomOwnedBy(this.pos.roomName)!)) + let AssimilatedRoomReserved = (typeof RoomIntel.roomReservedBy(this.pos.roomName) === 'string' && RoomIntel.roomReservedBy(this.pos.roomName) != MY_USERNAME && Assimilator.isAssimilated(RoomIntel.roomReservedBy(this.pos.roomName)!)) + //log.debug(`${this.print} Owned by: ${RoomIntel.roomOwnedBy(this.pos.roomName)}, who is ${AssimilatedRoomOwner} Assimilated. Reserved by: ${RoomIntel.roomReservedBy(this.pos.roomName)}, who is ${AssimilatedRoomReserved} Assimilated`) + if (Game.time % 10 == 2 && AssimilatedRoomOwner) { + log.warning(`${this.print} is in a room controlled by another Overmind user ${RoomIntel.roomOwnedBy(this.pos.roomName)}!`) + //this.remove(); + } + else if (Game.time % 10 == 2 && AssimilatedRoomReserved) { + log.warning(`${this.print} is in a room controlled by another Overmind user ${RoomIntel.roomReservedBy(this.pos.roomName)}!`) + //this.remove(); + } + if (Game.time % 10 == 3 && this.room && this.room.controller && !this.pos.isEqualTo(this.room.controller.pos) && !this.memory.setPosition) { this.setPosition(this.room.controller.pos); diff --git a/src/strategy/Strategist.ts b/src/strategy/Strategist.ts index 630b75da9..d99d4395e 100644 --- a/src/strategy/Strategist.ts +++ b/src/strategy/Strategist.ts @@ -1,14 +1,14 @@ -import {Autonomy, getAutonomyLevel, Mem} from '../memory/Memory'; -import {Colony, getAllColonies} from '../Colony'; -import {DirectiveColonize} from '../directives/colony/colonize'; -import {Cartographer} from '../utilities/Cartographer'; -import {MIN_EXPANSION_DISTANCE} from './ExpansionPlanner'; -import {maxBy} from '../utilities/utils'; -import {log} from '../console/log'; -import {Pathing} from '../movement/Pathing'; -import {assimilationLocked} from '../assimilation/decorator'; -import {MAX_OWNED_ROOMS, SHARD3_MAX_OWNED_ROOMS} from '../~settings'; -import {profile} from '../profiler/decorator'; +import { Colony, getAllColonies } from '../Colony'; +import { assimilationLocked } from '../assimilation/decorator'; +import { log } from '../console/log'; +import { DirectiveColonize } from '../directives/colony/colonize'; +import { Autonomy, Mem, getAutonomyLevel } from '../memory/Memory'; +import { Pathing } from '../movement/Pathing'; +import { profile } from '../profiler/decorator'; +import { Cartographer } from '../utilities/Cartographer'; +import { maxBy } from '../utilities/utils'; +import { MAX_OWNED_ROOMS, MY_USERNAME, SHARD3_MAX_OWNED_ROOMS } from '../~settings'; +import { MIN_EXPANSION_DISTANCE } from './ExpansionPlanner'; const CHECK_EXPANSION_FREQUENCY = 1000; @@ -114,6 +114,13 @@ export class Strategist implements IStrategist { if (_.any(adjacentRooms, roomName => Memory.rooms[roomName][_RM.AVOID])) { continue; } + + // Are there other Overmind users nearby? + if (_.any(adjacentRooms, roomName => typeof Game.rooms[roomName].owner === 'string' && Game.rooms[roomName].owner != MY_USERNAME && Assimilator.isAssimilated(Game.rooms[roomName].owner!))) { + score -= TOO_CLOSE_PENALTY; + log.debug(`Strategist triggered too close to overmind user ${Game.rooms[roomName].owner} for ${roomName}`) + } + // Reward new minerals and catalyst rooms let mineralType = Memory.rooms[roomName][_RM.MINERAL] ? Memory.rooms[roomName][_RM.MINERAL]![_RM_MNRL.MINERALTYPE]