Ejemplo n.º 1
0
 public void pushCodeGetCloser(MapLocation destination) throws GameActionException {
   if (NavSystem.navMode != NavMode.GETCLOSER || NavSystem.destination != destination) {
     NavSystem.setupGetCloser(destination);
   }
   if (rc.isActive()) {
     NavSystem.moveCloserFavorNoMines();
   }
 }
Ejemplo n.º 2
0
  /**
   * code to be used by capturers
   *
   * @throws GameActionException
   */
  private void captureCode() throws GameActionException {
    if (!unassigned) { // if assigned to something
      EncampmentJobSystem.updateJobTaken();
    }
    if (rc.isActive()) {
      if (rc.senseEncampmentSquare(currentLocation)
          && currentLocation.equals(EncampmentJobSystem.goalLoc)) {
        if (rc.getTeamPower() > rc.senseCaptureCost()) {
          rc.captureEncampment(EncampmentJobSystem.assignedRobotType);
        }
      } else {

        if (rc.senseNearbyGameObjects(Robot.class, 14, rc.getTeam().opponent()).length > 0) {
          unassigned = true;
          soldierState = SoldierState.FIGHTING;
        }

        if (NavSystem.navMode == NavMode.BFSMODE) {
          NavSystem.tryBFSNextTurn();
        } else if (NavSystem.navMode == NavMode.GETCLOSER) {
          NavSystem.tryMoveCloser();
        } else if (rc.getLocation().distanceSquaredTo(EncampmentJobSystem.goalLoc) <= 8) {
          NavSystem.setupGetCloser(EncampmentJobSystem.goalLoc);
          NavSystem.tryMoveCloser();
        } else {
          NavSystem.moveCloserFavorNoMines(EncampmentJobSystem.goalLoc);
          //					if (NavSystem.navMode == NavMode.NEUTRAL){
          //						NavSystem.setupSmartNav(EncampmentJobSystem.goalLoc);
          //						NavSystem.followWaypoints();
          //					} else {
          //						NavSystem.followWaypoints();
          //					}
        }
      }
    }
  }