Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion e2e/piece-indicator-animation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ const seedRedoWithIndicatorChange = async (page: Page): Promise<IndicatorSeed> =
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 roundedThirdsProgress = ((Math.round(moveCards * 3) % 3) + 3) % 3;
const lootActionsAwayFromNextFullMoveCard = (3 - roundedThirdsProgress) % 3;
const suffix = lootActionsAwayFromNextFullMoveCard === 1 ? ':' : lootActionsAwayFromNextFullMoveCard === 2 ? '.' : '';
texts.push(`${roundedDownMoveCards}${suffix}`);
}
texts.push(pieceLabels[pieceId]);
texts.push(state.pieceAttackStrength(pieceId).toString());
Expand Down
16 changes: 14 additions & 2 deletions src/components/PlayArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,17 @@ 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 roundedThirdsProgress = ((Math.round(moveCards * 3) % 3) + 3) % 3;
const lootActionsAwayFromNextFullMoveCard = (3 - roundedThirdsProgress) % 3;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Compute loot-progress suffix from real loot increment

The new suffix logic assumes loot progress advances in exact thirds (Math.round(moveCards * 3)), but game rules use MOVE_CARDS_PER_LOOT = 11/32 (see src/KdlRust/src/core/rule_helper.rs), so the displayed :/. can be wrong for valid states. This is immediately observable at integer move-card totals (e.g. 2.0 is actually 3 loot actions away from 3.0, but the code shows no suffix), and it also mislabels high fractional states like 2.96875 (1 loot away, still shown with no suffix). As a result, the indicator text and the updated help explanation are inaccurate relative to actual gameplay math.

Useful? React with 👍 / 👎.

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)),
};
};
Expand Down Expand Up @@ -4144,7 +4153,10 @@ function PlayArea() {
<h4>Piece Indicators</h4>
<p>The small numbers on the pieces give quick reminders of movement and attack strength.</p>
<ul>
<li>The number above a normal player piece is that player's move cards, rounded down.</li>
<li>
The number above a normal player piece is that player's move cards, rounded down; a trailing ":" means
they are 1 loot action away from the next full move card, and a trailing "." means they are 2 away.
</li>
<li>
The number below a normal player piece is that player's next attack strength: natural strength plus 2 if
they have at least 1 weapon card.
Expand Down