type PieceBoardState = { canMoveAtTurn : number | null ; canBeAttackedAtTurn : number ; canAttackAtTurn : number | null ; removeFromBoardAtTurn : number | null ; } ; export type PieceCombatState = { targetId : string | null ; board : PieceBoardState ; } ; export const createPieceCombatState = ( ) : PieceCombatState => ( { board : { canMoveAtTurn : null , canBeAttackedAtTurn : 0 , canAttackAtTurn : null , removeFromBoardAtTurn : null } , targetId : null } ) ; export const clonePieceCombatState = ( combat ? ) => { if ( ! combat || ! combat . board ) { return createPieceCombatState ( ) ; } return { ... combat , board : { ... combat . board } } ; } ;