diff --git a/e2e/piece-indicator-animation.spec.ts b/e2e/piece-indicator-animation.spec.ts index 8c15ed7..dbc8970 100644 --- a/e2e/piece-indicator-animation.spec.ts +++ b/e2e/piece-indicator-animation.spec.ts @@ -43,7 +43,19 @@ const seedRedoWithIndicatorChange = async (page: Page): Promise = const isNormalPlayer = pieceId === 'player1' || pieceId === 'player2'; const texts = [] as string[]; if (isNormalPlayer) { - texts.push(Math.floor(state.pieceMoveCards(pieceId)).toString()); + const moveCards = state.pieceMoveCards(pieceId); + const roundedDownMoveCards = Math.floor(moveCards); + const progressThirtySeconds = ((Math.round(moveCards * 32) % 32) + 32) % 32; + const lootActionsAwayFromNextFullMoveCard = (() => { + for (let lootActions = 0; lootActions < 32; lootActions += 1) { + if ((progressThirtySeconds + lootActions * 11) % 32 === 0) { + return lootActions; + } + } + return 0; + })(); + const suffix = lootActionsAwayFromNextFullMoveCard === 1 ? ':' : lootActionsAwayFromNextFullMoveCard === 2 ? '.' : ''; + texts.push(`${roundedDownMoveCards}${suffix}`); } texts.push(pieceLabels[pieceId]); texts.push(state.pieceAttackStrength(pieceId).toString()); diff --git a/src/components/PlayArea.tsx b/src/components/PlayArea.tsx index c34817d..11d4be2 100644 --- a/src/components/PlayArea.tsx +++ b/src/components/PlayArea.tsx @@ -77,8 +77,24 @@ const getLivePieceIndicators = (gameState: GameStateHandle | null, pieceId: Piec return { top: null, bottom: null }; } const isNormalPlayer = pieceId === 'player1' || pieceId === 'player2'; + const getNormalPlayerMoveCardIndicator = () => { + const moveCards = gameState.pieceMoveCards(pieceId); + const roundedDownMoveCards = Math.floor(moveCards); + const progressThirtySeconds = ((Math.round(moveCards * 32) % 32) + 32) % 32; + const lootActionsAwayFromNextFullMoveCard = (() => { + for (let lootActions = 0; lootActions < 32; lootActions += 1) { + if ((progressThirtySeconds + lootActions * 11) % 32 === 0) { + return lootActions; + } + } + return 0; + })(); + const suffix = + lootActionsAwayFromNextFullMoveCard === 1 ? ':' : lootActionsAwayFromNextFullMoveCard === 2 ? '.' : ''; + return `${formatPlayerInteger(roundedDownMoveCards)}${suffix}`; + }; return { - top: isNormalPlayer ? formatPlayerInteger(Math.floor(gameState.pieceMoveCards(pieceId))) : null, + top: isNormalPlayer ? getNormalPlayerMoveCardIndicator() : null, bottom: formatPlayerInteger(gameState.pieceAttackStrength(pieceId)), }; }; @@ -4086,8 +4102,8 @@ function PlayArea() {

How to gain and use the cards...