forked from WikiDeck/wikideck
QA only (never merge): #duel-live real bot match on duel-core engine-wip + duel-cards sample
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
// QA ONLY (branch night2/ui-duel/engine-preview, never merged): a real bot match on duel-core's
|
||||||
|
// engine-wip with duel-cards' derived sample. The player's "deck" is 40 sample cards, because QA has no
|
||||||
|
// wallet here; the real DuelBotMatch only takes owned cards. Route: #duel-live[/<easy|normal>].
|
||||||
|
import sample from '../../../docs/game/duel-card-sample.json';
|
||||||
|
import { duelEngine, DEFAULT_DUEL_RULESET } from '../../../shared/duel/index.ts';
|
||||||
|
import type { DuelCard } from './contract.ts';
|
||||||
|
import { EASY_BOT, NORMAL_BOT } from './bots.ts';
|
||||||
|
import { DuelBotMatch } from './DuelBotMatch.tsx';
|
||||||
|
|
||||||
|
const POOL = (sample as unknown as { cards: DuelCard[] }).cards;
|
||||||
|
const mine = POOL.slice(0, 40);
|
||||||
|
const cards = mine.map(c => ({ tokenId: c.cardId, title: c.title, duel: c }));
|
||||||
|
const botPool = POOL.slice(40);
|
||||||
|
|
||||||
|
export function LivePreview() {
|
||||||
|
const bot = location.hash.includes('easy') ? EASY_BOT : NORMAL_BOT;
|
||||||
|
return <DuelBotMatch deck={cards.map(c => c.tokenId)} cards={cards} engine={duelEngine} rules={DEFAULT_DUEL_RULESET} bot={bot} botPool={botPool}
|
||||||
|
playerName="QA" onExit={() => { location.hash = '#duel-live'; location.reload(); }} onFinish={() => { location.hash = '#duel-live'; location.reload(); }} />;
|
||||||
|
}
|
||||||
+2
-1
@@ -7,5 +7,6 @@ import './themes.css';
|
|||||||
|
|
||||||
// ui-duel review aid: `#duel-preview` renders static duel board scenes from card-sample.json.
|
// ui-duel review aid: `#duel-preview` renders static duel board scenes from card-sample.json.
|
||||||
const DuelPreview = lazy(() => import('./game/duel/DuelPreview.tsx').then(m => ({ default: m.DuelPreview })));
|
const DuelPreview = lazy(() => import('./game/duel/DuelPreview.tsx').then(m => ({ default: m.DuelPreview })));
|
||||||
const root = location.hash.startsWith('#duel-preview') ? <Suspense fallback={null}><DuelPreview /></Suspense> : <App />;
|
const LivePreview = lazy(() => import('./game/duel/LivePreview.tsx').then(m => ({ default: m.LivePreview })));
|
||||||
|
const root = location.hash.startsWith('#duel-live') ? <Suspense fallback={null}><LivePreview /></Suspense> : location.hash.startsWith('#duel-preview') ? <Suspense fallback={null}><DuelPreview /></Suspense> : <App />;
|
||||||
ReactDOM.createRoot(document.getElementById('root')!).render(<React.StrictMode>{root}</React.StrictMode>);
|
ReactDOM.createRoot(document.getElementById('root')!).render(<React.StrictMode>{root}</React.StrictMode>);
|
||||||
|
|||||||
Reference in New Issue
Block a user