28 lines
746 B
Python
28 lines
746 B
Python
"""手的區域規則與遊戲共用常數"""
|
|
|
|
COLS, ROWS = 5, 6
|
|
|
|
# 與遊戲一致:GridDisplay.AppearLead / NoteJudge.BadWindow
|
|
APPEAR_MS = 500
|
|
EXPIRE_MS = 200
|
|
|
|
LANES = ("L", "M", "R")
|
|
|
|
# tap / hold 可用欄
|
|
TAP_COLS = {"L": (0, 1), "M": (2,), "R": (3, 4)}
|
|
# slide 路徑可用欄:可進中間欄,但不跨到另一隻手的區域
|
|
SLIDE_COLS = {"L": (0, 1, 2), "M": (2,), "R": (2, 3, 4)}
|
|
|
|
|
|
def allowed_cols(lane, note_type):
|
|
return SLIDE_COLS[lane] if note_type == "slide" else TAP_COLS[lane]
|
|
|
|
|
|
def cell_allowed(lane, note_type, x, y):
|
|
return 0 <= y < ROWS and x in allowed_cols(lane, note_type)
|
|
|
|
|
|
def lane_of_column(x):
|
|
"""格子屬於哪一軌(用於預覽上色)"""
|
|
return "L" if x <= 1 else "R" if x >= 3 else "M"
|