Wall drags at 45° lay slopes; diagonal tubes drawn as one pipe; no side arrow on drag ghosts (t35, t36)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+11
-6
@@ -91,17 +91,22 @@ function filterBlockAt(x, y) { if (x < 0 || y < 0 || x >= W || y >= H) return -1
|
||||
function chipCost(cost) { const ok = canAfford(cost, 1); return `<span class="chip ${ok ? 'ok' : 'bad'}">${esc(costText(cost, 1))}</span>`; }
|
||||
function pieceCostNow(P, m = GAME.wallMat) {
|
||||
if (P.kind === 'mold') return wallCost(m, MOLDS[P.mold].walls);
|
||||
if (P.kind === 'block' && isWall(P.code)) return pieceCost(P.code, m);
|
||||
if (P.kind === 'block' && isWall(P.code)) return pieceCost(pieceCode(P), m);
|
||||
return P.cost;
|
||||
}
|
||||
|
||||
function pieceCode(P, end = aimBlock()) {
|
||||
if (!isSlope(P.code)) return P.code;
|
||||
const a = GAME.drag || end;
|
||||
return slopeCode(end.bx - a.bx, end.by - a.by, GAME.pieceDir.slope || 0);
|
||||
if (P.code !== BP_WALL) return P.code;
|
||||
const a = GAME.drag || end, dx = end.bx - a.bx, dy = end.by - a.by;
|
||||
if (GAME.drag && (dx || dy)) {
|
||||
return diagonalDrag(dx, dy) && !(typeof modShift === 'function' && modShift()) ? slopeCode(dx, dy, a.flip ? 2 : 0) : BP_WALL;
|
||||
}
|
||||
const shape = GAME.pieceDir.wall || 0;
|
||||
return shape ? BP_SLOPE_BL + shape - 1 : BP_WALL;
|
||||
}
|
||||
function turnSlope() {
|
||||
const n = GAME.pieceDir.slope || 0;
|
||||
GAME.pieceDir.slope = GAME.drag ? n ^ 2 : (n + 1) % 4;
|
||||
const a = GAME.drag, b = aimBlock();
|
||||
if (a && diagonalDrag(b.bx - a.bx, b.by - a.by)) a.flip = !a.flip;
|
||||
else GAME.pieceDir.wall = ((GAME.pieceDir.wall || 0) + 1) % 5;
|
||||
hudDirty = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user