diff --git a/src/module/util.js b/src/module/util.js index e618f95..cf2d52e 100644 --- a/src/module/util.js +++ b/src/module/util.js @@ -35,6 +35,18 @@ export function isShipCell(grid_cell_state) { ].includes(grid_cell_state) } +/** + * Returns true if the given grid cell state can be fired upon. + * @param {GridCellState} grid_cell_state + * @return {boolean} + */ +export function isValidTargetCell(grid_cell_state) { + return [ + GridCellState.Ship, + GridCellState.Available, + ].includes(grid_cell_state) +} + /** * Enum of all possible players. * @type {object}