Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 13 additions & 1 deletion e2e/piece-indicator-animation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,19 @@ 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 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());
Expand Down
27 changes: 23 additions & 4 deletions src/components/PlayArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
};
};
Expand Down Expand Up @@ -4086,8 +4102,8 @@ function PlayArea() {
<p>How to gain and use the cards...</p>
<ul>
<li>
Every time you loot a room ("draw a card") as your action, you gain 1/3 of a move card, 1/3 of a weapon
card, and 1/3 of a failure card. Looting a room is automatic; if you can loot during the action phase of
Every time you loot a room ("draw a card") as your action, you gain 11/32 of a move card, 11/32 of a weapon
card, and 11/32 of a failure card. Looting a room is automatic; if you can loot during the action phase of
your turn, then you do.
</li>
<li>
Expand Down Expand Up @@ -4144,7 +4160,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