Hit tiles: positions round half to even (PRTS 作战机制); enemies held just inside the field edge

This commit is contained in:
Cloudnyco committed 2026-10-11 21:33:44 +08:00
1 parent bc50cac01f
commit 119a04888a
13 files changed
+113 -24

No files matched your search

+2 -1
View File
@@ -6,6 +6,7 @@
import { ROWS, COLS } from '../constants.js';
import { absoluteRangeKeys, canTargetEnemy, extendedGrid, enemyStealthed } from '../targeting.js';
import { bodyKeys, bodyInKeys, bodyInRadius } from '../body.js';
import { roundHalfEven } from '../detmath.js';
export class BattleQueries {
/**
@@ -21,7 +22,7 @@ export class BattleQueries {
for (const k of bodyKeys(e)) { const b = this._eb[k]; if (!b.length) this._ebUsed.push(k); b.push(e); }
continue;
}
const r = Math.round(e.y), c = Math.round(e.x);
const r = roundHalfEven(e.y), c = roundHalfEven(e.x); // the tile body.js gives a point enemy
if (r < 0 || r >= ROWS || c < 0 || c >= COLS) continue;
const k = r * COLS + c;
const b = this._eb[k];