Beispiel #1
0
  @Override
  public boolean isArrowPassable(int x, int y, int heading) {
    L1Location newLoc = new L1Location(x, y, _mapId);
    newLoc.forward(heading);
    // 現在のタイル
    int tile1 = accessTile(x, y);
    // 移動予定の座標
    int tile2 = accessTile(newLoc.getX(), newLoc.getY());

    if (heading == Heading.UP) {
      int dir = DoorTable.getInstance().getDoorDirection(newLoc);
      return (tile1 & 0x08) == 0x08 && dir != 1;
    } else if (heading == Heading.UP_RIGHT) {
      return isArrowPassableUpThenRight(x, y) || isArrowPassableRightThenUp(x, y);
    } else if (heading == Heading.RIGHT) {
      int dir = DoorTable.getInstance().getDoorDirection(newLoc);
      return (tile1 & 0x04) == 0x04 && dir != 0;
    } else if (heading == Heading.DOWN_RIGHT) {
      return isArrowPassableRightThenDown(x, y) || isArrowPassableDownThenRight(x, y);
    } else if (heading == Heading.DOWN) {
      int dir = DoorTable.getInstance().getDoorDirection(new L1Location(x, y, _mapId));
      return (tile2 & 0x08) == 0x08 && dir != 1;
    } else if (heading == Heading.DOWN_LEFT) {
      return isArrowPassableDownThenLeft(x, y) || isArrowPassableLeftThenDown(x, y);
    } else if (heading == Heading.LEFT) {
      int dir = DoorTable.getInstance().getDoorDirection(new L1Location(x, y, _mapId));
      return (tile2 & 0x04) == 0x04 && dir != 0;
    } else if (heading == Heading.UP_LEFT) {
      return isArrowPassableUpThenLeft(x, y) || isArrowPassableLeftThenUp(x, y);
    }

    return false;
  }
  @Override
  public void onTrod(L1PcInstance trodFrom, L1Object trapObj) {
    sendEffect(trapObj);

    L1Teleport.teleport(trodFrom, _loc.getX(), _loc.getY(), (short) _loc.getMapId(), 5, true);
  }