UNPKG

@gamepark/rules-api

Version:

API to implement the rules of a board game

19 lines 708 B
import { MoveKind } from '../MoveKind'; import { ItemMoveType } from './ItemMoveType'; /** * Type guard to test if a {@link MaterialMove} is a {@link RollItem} move * @param move Move to test * @returns true if move is a {@link RollItem} */ export function isRoll(move) { return move.kind === MoveKind.ItemMove && move.type === ItemMoveType.Roll; } /** * Function to get a type guard for a {@link RollItem} move for specific item types. * @param type Item type to test * @returns a type guard similar as {@link isRoll} but that also verify the item type. */ export function isRollItemType(type) { return (move) => isRoll(move) && move.itemType === type; } //# sourceMappingURL=RollItem.js.map