<script lang="ts">
	import { page } from "$app/state";
	import BattleView from "$lib/active-view/battle.svelte";

	const turn = $derived.by(() => {
		const raw = page.url.searchParams.get("turn");
		const n = raw === null ? NaN : Number(raw);
		return Number.isFinite(n) && n >= 0 ? Math.trunc(n) : 0;
	});
</script>

<BattleView
	gameId={page.params.id ?? ""}
	{turn}
	battleId={page.params.battleId ?? ""}
/>
