public void run() { super.run(); try { this.attack(); if (this.robotController.isCoreReady()) { if (this.isDesignatedBuilder && this.robotController.getHealth() > 10) { Boolean builtBuilding = false; RobotType buildType = this.currentPlaystyle().nextBuildingType(); if (buildType != null) { builtBuilding = this.tryBuild(this.movementController.randomDirection(), buildType); } // try to build a supply depot if (!builtBuilding) { this.tryBuild(this.movementController.randomDirection(), SupplyDepot.type()); } } if (this.tryMine(false)) { } else { // no ore underneath if (this.isDesignatedBuilder) { MapLocation hqLocation = this.locationController.HQLocation(); if (this.locationController.distanceTo(hqLocation) > 81) { this.movementController.moveToward(hqLocation); } else { this.movementController.moveTo(this.movementController.randomDirection()); } } else { } } } this.supplyController.transferSupplyIfPossible(); } catch (GameActionException e) { } this.robotController.yield(); }
public void run() { super.run(); try { this.attack(); } catch (GameActionException e) { } this.robotController.yield(); }
public void run() { super.run(); try { Boolean attacked = attack(); if (this.robotController.isCoreReady()) { Boolean shouldMove = !attacked; if (shouldMove) { if (!this.shouldMobilize()) { MapLocation rallyLocation = this.locationController.militaryRallyLocation(); if (this.locationController.distanceTo(rallyLocation) > 18) { this.movementController.moveToward(rallyLocation); } else { this.movementController.moveTo(this.movementController.randomDirection()); } } else { this.mobilize(); } } } this.supplyController.transferSupplyIfPossible(); } catch (GameActionException exception) { } this.robotController.yield(); }
public void run() { super.run(); try { // run some checks against harassment if (this.broadcaster.isEnemyTeamRushing()) this.isHarassing = false; int roundNumber = Clock.getRoundNum(); if (roundNumber > 800) this.isHarassing = false; // harassment is A-ok if (this.robotController.isWeaponReady()) { this.attack(); } if (this.robotController.isCoreReady()) { Boolean canMove = true; if (canMove) { RobotInfo[] enemiesInRange = this.unitController.nearbyEnemiesWithinTheirAttackRange(); if (enemiesInRange.length > 0) { canMove = (this.movementController.moveAway(enemiesInRange) != null); } } if (this.isHarassing) { if (canMove) { canMove = (this.movementController.moveToward(this.locationController.enemyHQLocation()) != null); } } else { if (!this.shouldMobilize()) { if (canMove) { RobotInfo[] enemiesInTerritory = this.enemiesInTerritory(); if (enemiesInTerritory.length > 0) { RobotInfo enemy = this.desiredEnemy(enemiesInTerritory); MapLocation bestLocation = enemy.location; canMove = this.movementController.moveToward(bestLocation) == null; } } // if we haven't moved toward an enemy location then we can go and stick to the plan if (canMove) { MapLocation rallyLocation = this.locationController.militaryRallyLocation(); if (this.locationController.distanceTo(rallyLocation) > 18) { this.movementController.moveToward(rallyLocation); } else { this.movementController.moveTo(this.movementController.randomDirection()); } } } else { this.mobilize(); } } this.supplyController.transferSupplyIfPossible(); } } catch (GameActionException exception) { } this.robotController.yield(); }