Skip to content

Commit

Permalink
Damn imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Roy committed Jun 13, 2019
1 parent 4cd2b89 commit 903ea1d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/directives/defense/invasionDefense.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {ColonyStage} from '../../Colony';
import {CombatIntel} from '../../intel/CombatIntel';
import {Directive} from '../Directive';
import {BunkerDefenseOverlord} from '../../overlords/defense/bunkerDefense';
import {MeleeDefenseOverlord} from '../../overlords/defense/meleeDefense';
import {RangedDefenseOverlord} from '../../overlords/defense/rangedDefense';
import {NotifierPriority} from '../Notifier';
import {profile} from '../../profiler/decorator';

import {ColonyStage} from '../../Colony';
import {Directive} from '../Directive';
import {NotifierPriority} from '../Notifier';

interface DirectiveInvasionDefenseMemory extends FlagMemory {
persistent?: boolean;
created: number;
Expand Down
14 changes: 14 additions & 0 deletions src/movement/Pathing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,20 @@ export class Pathing {
});
}

/**
* Sets walkable rampart positions to 1, everything else is blocked
*/
static blockNonRamparts(matrix: CostMatrix, room: Room) {
for (let y = 0; y < 50; ++y) {
for (let x = 0; x < 50; ++x) {
matrix.set(x, y, 0xff);
}
}
_.forEach(room.walkableRamparts, rampart => {
matrix.set(rampart.pos.x, rampart.pos.y, 1);
});
}

/**
* Explicitly blocks off walls for a room
*/
Expand Down
2 changes: 1 addition & 1 deletion src/overlords/defense/bunkerDefense.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {log} from '../../console/log';
import {CombatSetups, Roles} from '../../creepSetups/setups';
import {DirectiveInvasionDefense} from '../../directives/defense/invasionDefense';
import {OverlordPriority} from '../../priorities/priorities_overlords';
import {profile} from '../../profiler/decorator';
import {boostResources} from '../../resources/map_resources';
import {CombatZerg} from '../../zerg/CombatZerg';
import {CombatOverlord} from '../CombatOverlord';
import {log} from '../../console/log';

/**
* Spawns bunker-only defenders to defend against incoming sieges
Expand Down
7 changes: 3 additions & 4 deletions src/zerg/CombatZerg.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {CombatIntel} from '../intel/CombatIntel';
import {insideBunkerBounds} from '../roomPlanner/layouts/bunker';
import {Movement, NO_ACTION} from '../movement/Movement';
import {profile} from '../profiler/decorator';
import {insideBunkerBounds} from '../roomPlanner/layouts/bunker';
import {CombatTargeting} from '../targeting/CombatTargeting';
import {GoalFinder} from '../targeting/GoalFinder';
import {randomHex} from '../utilities/utils';
Expand Down Expand Up @@ -286,16 +286,15 @@ export class CombatZerg extends Zerg {
return this.goToRoom(roomName, {ensurePath: true});
}

// TODO check if right colony
// TODO check if right colony, also yes colony check is in there to stop red squigglies
const siegingCreeps = this.room.hostiles.filter(creep =>
_.any(creep.pos.neighbors, pos => insideBunkerBounds(pos, this.colony)));
_.any(creep.pos.neighbors, pos => this.colony && insideBunkerBounds(pos, this.colony)));

const target = CombatTargeting.findTarget(this, siegingCreeps);

if (target) {
return Movement.combatMove(this, [{pos: target.pos, range: 1}], [], {preferRamparts: true, requireRamparts: true});
}

}

needsToRecover(recoverThreshold = CombatIntel.minimumDamageTakenMultiplier(this.creep) < 1 ? 0.85 : 0.75,
Expand Down

0 comments on commit 903ea1d

Please sign in to comment.