Keep completed duel outcomes visible throughout the scene
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
$: hand = state.player.hand_cards ? JSON.parse(state.player.hand_cards) : [];
|
||||
$: openChallenges = (state.challenges || []).filter(c => c.status === 'open');
|
||||
$: completedDuels = (state.challenges || []).filter(c => c.challenge_type === 'pvp' && ['succeeded', 'failed'].includes(c.status));
|
||||
$: challengedObstacleIds = new Set(openChallenges.flatMap(c => JSON.parse(c.obstacle_ids || '[]')));
|
||||
$: myTaxRequest = openChallenges.find(c => c.tax_state === 'requested' && c.tax_target_id === state.player.id) || null;
|
||||
$: myPvpDefense = openChallenges.find(c => c.challenge_type === 'pvp' && c.acting_player_id === state.player.id) || null;
|
||||
@@ -184,6 +185,25 @@
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
<!-- Results remain available until the next scene, including after a reload. -->
|
||||
{#each completedDuels as ch (ch.id)}
|
||||
<div class="challenge-item duel-result">
|
||||
<h4>⚔️ Duel: {playerName(ch.challenger_player_id)} vs {playerName(ch.target_player_id)}</h4>
|
||||
<p class="duel-outcome">
|
||||
{ch.status === 'succeeded' ? '✓' : '✕'}
|
||||
<strong>{playerName(ch.acting_player_id)} {ch.status === 'succeeded' ? 'won the defense' : 'lost the defense'}.</strong>
|
||||
{playerName(ch.status === 'succeeded' ? ch.acting_player_id : ch.challenger_player_id)} wins the duel.
|
||||
</p>
|
||||
<p class="info-text">Temporary Obstacle: <strong use:tooltip={{ html: cardTooltipHtml(ch.temp_card, $obstacleTable, true) }}>{getCardDisplay(ch.temp_card)}</strong></p>
|
||||
{#each JSON.parse(ch.plays || '[]') as play}
|
||||
<p class="info-text">
|
||||
Defense: <strong use:tooltip={{ html: cardTooltipHtml(play.card, $obstacleTable, true) }}>{getCardDisplay(play.card)}</strong>.
|
||||
{play.details}
|
||||
</p>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
<!-- Deep controls: call a Challenge, and end the scene when none is active -->
|
||||
<!-- The Deep calls Challenges and ends the scene only when none is active. -->
|
||||
{#if isDeep && openChallenges.length === 0}
|
||||
|
||||
Reference in New Issue
Block a user