Exemplo n.º 1
0
  @Override
  protected void fillExitsOfGridRoom(Room R, int x, int y) {
    super.fillExitsOfGridRoom(R, x, y);

    if ((x < 0) || (y < 0) || (y >= yGridSize()) || (x >= xGridSize())) return;
    // the adjacent rooms created by this method should also take
    // into account the possibility that they are on the edge.
    // it does NOT
    if (ox == null) ox = CMClass.getExit("Open");
    Room R2 = null;

    if ((y == 0) && (R.rawDoors()[Directions.NORTH] == null)) {
      R2 = getMakeSingleGridRoom(x, yGridSize() / 2);
      if (R2 != null) linkRoom(R, R2, Directions.NORTH, ox, ox);
    } else if ((y == yGridSize() - 1) && (R.rawDoors()[Directions.SOUTH] == null)) {
      R2 = getMakeSingleGridRoom(x, yGridSize() / 2);
      if (R2 != null) linkRoom(R, R2, Directions.SOUTH, ox, ox);
    }
    if ((x == 0) && (R.rawDoors()[Directions.WEST] == null)) {
      R2 = getMakeSingleGridRoom(xGridSize() / 2, y);
      if (R2 != null) linkRoom(R, R2, Directions.WEST, ox, ox);
    } else if ((x == xGridSize() - 1) && (R.rawDoors()[Directions.EAST] == null)) {
      R2 = getMakeSingleGridRoom(xGridSize() / 2, y);
      if (R2 != null) linkRoom(R, R2, Directions.EAST, ox, ox);
    }
    if (Directions.NORTHEAST < Directions.NUM_DIRECTIONS()) {
      if (((x == 0) || (y == 0)) && (R.rawDoors()[Directions.NORTHWEST] == null)) {
        R2 = getMakeSingleGridRoom(xGridSize() / 2, yGridSize() / 2);
        if (R2 != null) linkRoom(R, R2, Directions.NORTHWEST, ox, ox);
      } else if (((x == xGridSize() - 1) || (y == yGridSize() - 1))
          && (R.rawDoors()[Directions.SOUTHEAST] == null)) {
        R2 = getMakeSingleGridRoom(xGridSize() / 2, yGridSize() / 2);
        if (R2 != null) linkRoom(R, R2, Directions.SOUTHEAST, ox, ox);
      }
      if (((x == xGridSize() - 1) || (y == 0)) && (R.rawDoors()[Directions.NORTHEAST] == null)) {
        R2 = getMakeSingleGridRoom(xGridSize() / 2, yGridSize() / 2);
        if (R2 != null) linkRoom(R, R2, Directions.NORTHEAST, ox, ox);
      } else if (((x == 0) || (y == yGridSize() - 1))
          && (R.rawDoors()[Directions.SOUTHWEST] == null)) {
        R2 = getMakeSingleGridRoom(xGridSize() / 2, yGridSize() / 2);
        if (R2 != null) linkRoom(R, R2, Directions.SOUTHWEST, ox, ox);
      }
    }
  }
Exemplo n.º 2
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   super.executeMsg(myHost, msg);
   UnderWater.sinkAffects(this, msg);
 }