diff --git a/src/lib/components/Hall.svelte b/src/lib/components/Hall.svelte index b57f3bc..1635fba 100644 --- a/src/lib/components/Hall.svelte +++ b/src/lib/components/Hall.svelte @@ -32,6 +32,20 @@ }); async function playBot() { + busy = true; + error = ''; + try { + rememberName(name); + const remote = await Duel.createBotRoom(name.trim()); + await goto(`/join/${remote.roomId}`); + } catch (e) { + error = e instanceof Error ? e.message : 'The duel could not be opened.'; + } finally { + busy = false; + } + } + + async function playOffline() { rememberName(name); await goto('/play'); } @@ -66,7 +80,7 @@ const g = games[held.roomId]; if (g === undefined) return 'looking'; if (g === null) return 'unreachable'; - const others = g.seats.filter((s) => s.id !== held.seat).map((s) => s.name); + const others = g.seats.filter((s) => s.id !== held.seat).map((s) => (s.bot ? `${s.name} (the bot)` : s.name)); if (!g.state) return `waiting to start${g.seats.length ? ` · ${g.seats.map((s) => s.name).join(', ')}` : ''}`; if (g.state.over) { if (g.state.over.winner === held.seat) return 'you won'; @@ -105,12 +119,14 @@ Your wizard's name - - {#if local} -
Or start afresh from the board's "New duel".
- {/if} + ++ {#if local} + + {:else} + + {/if} +