import { GroundType, groundDefinition } from "../definitions/tiles.js"; /** * A* step cost into a path tile when preferring roads (out of combat). * Slightly cheaper than grass so equal-ish routes favour the path without * accepting long detours. */ export const PATH_GROUND_STEP_COST = 0.82; export function isPathGround (typeId) { return typeId === GroundType.path || !!groundDefinition(typeId)?.pathSurface; } /** * @param {number} typeId * @param {{ preferPaths?: boolean }} [options] */ export function stepCostForGround (typeId, { preferPaths = false } = {}) { if (preferPaths && isPathGround(typeId)) { return PATH_GROUND_STEP_COST; } return 1; }