Class MapleFootholdTree

java.lang.Object
server.maps.MapleFootholdTree

public class MapleFootholdTree extends Object
以四叉樹(quadtree)儲存地圖所有 MapleFoothold 的空間索引結構。

最大深度為 maxDepth(8 層),在 insert 時依地形線段的座標範圍 遞迴分配至西北(nw)、東北(ne)、西南(sw)、東南(se)四個子樹, 超出子象限邊界的線段存放於當前節點的 footholds 清單。 對外提供下列核心查詢方法:

  • findBelow(Point) — 取得指定坐標正下方最近的地形。
  • findBelow(Point, boolean) — 同上,支援飛行判定。
  • findWall(Point, Point) — 在水平範圍內搜尋垂直牆壁。
  • xMatches/yMatches — 取得橫/縱軸範圍內相關的地形清單, 並在座標超出地圖邊界時回退至最外圍地形。
  • calcY(MapleFoothold, Point) — 依平台類型(水平、斜面、垂直)計算精確 y 值。
根節點另維護 maxDropXminDropX 供道具掉落邊界計算使用。 由 MapleMapFactory 在解析 WZ 地形資料時填入,並存放於 MapleMap 中。
  • Constructor Details

    • MapleFootholdTree

      public MapleFootholdTree(Point p1, Point p2)
    • MapleFootholdTree

      public MapleFootholdTree(Point p1, Point p2, int depth)
  • Method Details

    • insert

      public final void insert(MapleFoothold f)
    • getAllRelevants

      public final List<MapleFoothold> getAllRelevants()
    • findWall

      public final MapleFoothold findWall(Point p1, Point p2)
    • checkRelevantFH

      public final boolean checkRelevantFH(short fromx, short fromy, short tox, short toy)
    • findBelow

      public final MapleFoothold findBelow(Point p)
    • getX1

      public final int getX1()
    • getX2

      public final int getX2()
    • getY1

      public final int getY1()
    • getY2

      public final int getY2()
    • getMaxDropX

      public final int getMaxDropX()
    • getMinDropX

      public final int getMinDropX()
    • xMatches

      public final List<MapleFoothold> xMatches(Point p)
    • yMatches

      public final List<MapleFoothold> yMatches(Point p)
    • calcY

      public static final int calcY(MapleFoothold fh, Point p)
    • findBelow

      public final MapleFoothold findBelow(Point p, boolean flying)