Skip to content

Commit b6d521b

Browse files
WIP
1 parent 8f83ace commit b6d521b

3 files changed

Lines changed: 18 additions & 14 deletions

File tree

islanders-client/src/lib/stores/game.svelte.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ class Game {
131131
ui.setPlayingKnight(true);
132132
}
133133
// Check if the thief was moved and stealing is required
134-
const knightNeedsStealing = world.conditions?.playedKnight?.movedThief && !world.conditions.playedKnight.stoleFromPlayer;
135-
const sevenNeedsStealing = world.conditions?.rolledASeven?.movedThief && !world.conditions.rolledASeven.stoleFromPlayer;
134+
const knightNeedsStealing =
135+
world.conditions?.playedKnight?.movedThief &&
136+
!world.conditions.playedKnight.stoleFromPlayer;
137+
const sevenNeedsStealing =
138+
world.conditions?.rolledASeven?.movedThief &&
139+
!world.conditions.rolledASeven.stoleFromPlayer;
136140
if (knightNeedsStealing || sevenNeedsStealing) {
137141
ui.setStealingFromPlayers(true);
138142
} else {

islanders-client/src/routes/game/[gameId]/+layout.svelte

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,17 @@
115115
});
116116
117117
$effect(() => {
118-
console.log('Steal effect running:', {
119-
isStealingFromPlayers,
118+
console.log('Steal effect running:', {
119+
isStealingFromPlayers,
120120
stealableCount: stealablePlayers.length,
121-
modalElement: !!stealModalElement
121+
modalElement: !!stealModalElement
122122
});
123-
123+
124124
if (isStealingFromPlayers && stealablePlayers.length > 0) {
125-
console.log('Opening steal modal with players:', stealablePlayers.map(p => p.name));
125+
console.log(
126+
'Opening steal modal with players:',
127+
stealablePlayers.map((p) => p.name)
128+
);
126129
stealModalElement?.showModal();
127130
} else if (isStealingFromPlayers && stealablePlayers.length === 0) {
128131
console.log('No stealable players, closing steal UI');
@@ -132,10 +135,10 @@
132135
133136
const handleStealFrom = async (playerToStealFrom: string) => {
134137
if (!game.playerName) return;
135-
138+
136139
const action = new StealFromPlayerAction(game.playerName, playerToStealFrom);
137140
await game.sendAction(action);
138-
141+
139142
stealModalElement?.close();
140143
ui.setStealingFromPlayers(false);
141144
};
@@ -272,10 +275,7 @@
272275

273276
<div class="flex flex-col gap-2">
274277
{#each stealablePlayers as player}
275-
<button
276-
class="btn btn-block justify-start"
277-
onclick={() => handleStealFrom(player.name)}
278-
>
278+
<button class="btn btn-block justify-start" onclick={() => handleStealFrom(player.name)}>
279279
<div
280280
class="h-4 w-4 flex-shrink-0 rounded-full"
281281
style="background-color: #{player.color.toString(16).padStart(6, '0')}"

islanders-client/src/routes/game/[gameId]/actions/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
<div class="flex flex-col gap-1">
165165
{#each viewerPlayer.devCards as card}
166166
<div class="flex items-center justify-between rounded bg-base-100 px-2 py-1 text-sm">
167-
<span>{card}</span>
167+
<span>{card.type}</span>
168168
<button class="btn btn-xs" disabled={!isMyTurn}>Play</button>
169169
</div>
170170
{/each}

0 commit comments

Comments
 (0)