'use client' import { Card } from '@/Deck'; import { useDeck } from '@/hooks/useDeck' import { camelToSpace } from '@/utils/camelToSpace'; import Image from 'next/image' import { useCallback, useEffect, useState } from 'react'; type planeCard = { maneuvers: [ { name: string, complexity: 'simple' | 'complex', length: number } ], attacks: ('airToGround' | 'groundToAir' | 'airToAir')[], penalties: ('Stall' | 'Damage' | 'Ground Battle')[], type: 'action' | 'win condition' | 'wild card' | 'sudden death' }; export default function Home() { const { addCard, createHand, deck, discard, drawToHand, hands, reshuffle, shuffle, createDeck } = useDeck(); const series = 1; const fetchDeckJson = useCallback(async () => { const res = await fetch('./json/deck.json'); const json: Card[] = await res.json(); json.forEach(c => c.id = crypto.randomUUID()); createDeck(json); }, []) useEffect(() => { fetchDeckJson().then(() => { shuffle() // setRender(!render) }) }, []) return (
{deck.map((c,i) => (

{c.type}

{c.attacks.length || c.maneuvers.length ?

Select either one maneuver or one attack to make. If you can't complete one action from this card, you must take one penalty listed. If there are no penalties listed, discard this card.

:

Bad luck! You must take one of the following penalties

} {c.maneuvers.length > 0 ?

Maneuvers: {c.maneuvers.map(a => camelToSpace(a.name)).join(', ')}

: ''} {c.attacks.length > 0 ?

Attacks: {c.attacks.map(a => camelToSpace(a)).join(', ')}

: ''} {c.penalties.length > 0 ? <>

Penalties: {c.penalties.join(', ')}

: ''}

Series {series}

{i + 1}/{deck.length}

© {new Date().getFullYear()} Cyborg Grizzly Games

))}
) }