Preview victory points while assigning workers

This commit is contained in:
coyotte508 2026-10-19 16:31:11 +02:00
commit e7a71a3387
3 changed files with 13 additions and 20 deletions

View file

@ -1,6 +1,6 @@
{
"name": "outpost-viewer",
"version": "0.1.26",
"version": "0.1.27",
"description": "Browser viewer for the Outpost game on boardgamers.space",
"license": "AGPL-3.0",
"files": [

View file

@ -12,6 +12,7 @@
handValueRange,
needsMegaChoice,
productionRange,
victoryPoints,
operators as availableOperators,
type GameState,
type Resource,
@ -81,18 +82,16 @@
const pickTotal = $derived(isMe ? store.pickTotal() : 0);
const pickRequired = $derived(isMe ? store.pickRequired : null);
const pickCount = $derived(isMe ? store.cardPick.length : 0);
// While I stage the manning assignment, show the production the STAGED
// factories would give next round — the range updates live with each toggle.
const production = $derived.by(() => {
if (!manning) {
return productionRange(player);
}
const staged = {
...player,
factories: player.factories.map((f, i) => ({ ...f, manned: store.manningPick.includes(i) })),
};
return productionRange(staged);
});
const assignedPlayer = $derived(
manning
? {
...player,
factories: player.factories.map((f, i) => ({ ...f, manned: store.manningPick.includes(i) })),
}
: player
);
const production = $derived(productionRange(assignedPlayer));
const vp = $derived(victoryPoints(assignedPlayer));
</script>
<div
@ -133,7 +132,7 @@
{exchangeTargeted ? "✓ trading" : "trade"}
</span>
{/if}
<span class="vp" title="victory points">{store.vpOf(index)}<span class="unit">VP</span></span>
<span class="vp" title="victory points">{vp}<span class="unit">VP</span></span>
</div>
<div class="row stats">

View file

@ -30,7 +30,6 @@ import {
robotMax,
scores,
upgradeDiscount,
victoryPoints,
type FactoryType,
type GameState,
type Kicker,
@ -685,11 +684,6 @@ export class ViewerStore {
return me ? me.hand.reduce((sum, card) => sum + card.v, 0) : 0;
}
vpOf(index: number): number {
const p = this.state?.players[index];
return p ? victoryPoints(p) : 0;
}
handCapOf(index: number): number {
const p = this.state?.players[index];
return p ? handCapacity(p) : 0;