@gamepark/rules-api
Version:
API to implement the rules of a board game
19 lines • 781 B
JavaScript
import { MoveKind } from '../MoveKind';
import { ItemMoveType } from './ItemMoveType';
/**
* Type guard to test if a {@link MaterialMove} is a {@link MoveItemsAtOnce} move
* @param move Move to test
* @returns true if move is a {@link MoveItemsAtOnce}
*/
export function isMoveItemsAtOnce(move) {
return move.kind === MoveKind.ItemMove && move.type === ItemMoveType.MoveAtOnce;
}
/**
* Function to get a type guard for a {@link MoveItemsAtOnce} move for specific item types.
* @param type Item type to test
* @returns a type guard similar as {@link isMoveItemsAtOnce} but that also verify the item type.
*/
export function isMoveItemTypeAtOnce(type) {
return (move) => isMoveItemsAtOnce(move) && move.itemType === type;
}
//# sourceMappingURL=MoveItemsAtOnce.js.map