diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx index 1ce4d7b..d989f3c 100644 --- a/src/components/Card/Card.tsx +++ b/src/components/Card/Card.tsx @@ -1,12 +1,15 @@ -/// +import { CardData } from '../../util/types'; -export default function Card(data: Universals.Card) { +type CardProps = { + data: CardData +} + +export default function Card({ data }: CardProps) { return (

{data.gemValue}

{data.tier}

{data.points || 0}

-

{data.cost}

) } \ No newline at end of file diff --git a/src/components/Gameboard/CardRow.tsx b/src/components/Gameboard/CardRow.tsx index 231337c..d1cf7a6 100644 --- a/src/components/Gameboard/CardRow.tsx +++ b/src/components/Gameboard/CardRow.tsx @@ -1,6 +1,14 @@ -export default function CardRow() { +import { CardData } from "../../util/types" +import Card from "../Card/Card" + +export default function CardRow(tier: number, cards: CardData[]) { return ( <> +

Tier: {tier}

+
+

Cards:

+ { cards.map((cardData: CardData) => ) } +
) } \ No newline at end of file diff --git a/src/components/Gameboard/Gameboard.d.ts b/src/components/Gameboard/Gameboard.d.ts deleted file mode 100644 index 6642f6d..0000000 --- a/src/components/Gameboard/Gameboard.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// - -declare namespace Gameboard { - export interface CardRow { - tier: number - displayedCards: Card[3] - remainingCards: Card[] - } -} \ No newline at end of file diff --git a/src/components/Gameboard/Gameboard.tsx b/src/components/Gameboard/Gameboard.tsx index 873be66..878fbc1 100644 --- a/src/components/Gameboard/Gameboard.tsx +++ b/src/components/Gameboard/Gameboard.tsx @@ -1,19 +1,60 @@ -/// -/// +import { useEffect, useState } from 'react'; +import { CardData, NobleData, GemValue } from '../../util/types'; +import CardDeck from '../../util/cards.json'; export default function Gameboard() { - const exampleCard: Universals.Card = { - gemValue: Universals.GemValue.Ruby, - tier: 1, - cost: 5 + const [state, setState] = useState({ + deck: CardDeck, + nobles: new Array, + cardRows: { + tierOne: new Array, + tierTwo: new Array, + tierThree: new Array + }, + }) + + useEffect(() => { + initializeBoard(); + console.log(state || null); + }, []) + + const shuffleDeck = () => { + if (!state.deck) return; + + let newDeck = state.deck; + + for (const [key, value] of Object.entries(newDeck)) { + for (let i = value.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)) + const temp = value[i]; + value[i] = value[j]; + value[j] = temp; + } + } + + setState({ ...state, deck: newDeck }); + } + + const initializeBoard = () => { + shuffleDeck(); + + let newState = state; + + for (const [key, value] of Object.entries(state.deck)) { + // @ts-ignore + while (newState.cardRows[key].length < 4) { + const nextCard = value.shift(); + // @ts-ignore + newState.cardRows[key].push(nextCard); + } + } + + setState(newState); } return (

Gameboard

-

Name: {exampleCard.gemValue}

-

Tier: {exampleCard.tier}

-

Cost: {exampleCard.cost}

) } \ No newline at end of file diff --git a/src/util/cards.json b/src/util/cards.json index 80b84e8..2717b06 100644 --- a/src/util/cards.json +++ b/src/util/cards.json @@ -2,996 +2,996 @@ "tierOne": [ { "cost": { - "cherry": 1, - "walnut": 1, - "cedar": 1, - "mahogany": 1, - "aspen": 0 + "ruby": 1, + "sapphire": 1, + "emerald": 1, + "onyx": 1, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 0 }, { "cost": { - "cherry": 1, - "walnut": 1, - "cedar": 0, - "mahogany": 1, - "aspen": 1 + "ruby": 1, + "sapphire": 1, + "emerald": 0, + "onyx": 1, + "diamond": 1 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 0 }, { "cost": { - "cherry": 1, - "walnut": 1, - "cedar": 1, - "mahogany": 0, - "aspen": 1 + "ruby": 1, + "sapphire": 1, + "emerald": 1, + "onyx": 0, + "diamond": 1 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 0 }, { "cost": { - "cherry": 1, - "walnut": 0, - "cedar": 1, - "mahogany": 1, - "aspen": 1 + "ruby": 1, + "sapphire": 0, + "emerald": 1, + "onyx": 1, + "diamond": 1 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 1, - "cedar": 1, - "mahogany": 1, - "aspen": 1 + "ruby": 0, + "sapphire": 1, + "emerald": 1, + "onyx": 1, + "diamond": 1 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 0 }, { "cost": { - "cherry": 1, - "walnut": 2, - "cedar": 0, - "mahogany": 0, - "aspen": 2 + "ruby": 1, + "sapphire": 2, + "emerald": 0, + "onyx": 0, + "diamond": 2 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 0 }, { "cost": { - "cherry": 1, - "walnut": 0, - "cedar": 2, - "mahogany": 0, - "aspen": 0 + "ruby": 1, + "sapphire": 0, + "emerald": 2, + "onyx": 0, + "diamond": 0 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 3, - "cedar": 1, - "mahogany": 0, - "aspen": 1 + "ruby": 0, + "sapphire": 3, + "emerald": 1, + "onyx": 0, + "diamond": 1 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 0 }, { "cost": { - "cherry": 1, - "walnut": 1, - "cedar": 3, - "mahogany": 0, - "aspen": 0 + "ruby": 1, + "sapphire": 1, + "emerald": 3, + "onyx": 0, + "diamond": 0 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 2, - "aspen": 1 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 2, + "diamond": 1 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 0 }, { "cost": { - "cherry": 1, - "walnut": 1, - "cedar": 2, - "mahogany": 1, - "aspen": 0 + "ruby": 1, + "sapphire": 1, + "emerald": 2, + "onyx": 1, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 1, - "cedar": 1, - "mahogany": 1, - "aspen": 2 + "ruby": 0, + "sapphire": 1, + "emerald": 1, + "onyx": 1, + "diamond": 2 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 1, - "mahogany": 1, - "aspen": 2 + "ruby": 0, + "sapphire": 0, + "emerald": 1, + "onyx": 1, + "diamond": 2 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 0 }, { "cost": { - "cherry": 2, - "walnut": 0, - "cedar": 1, - "mahogany": 1, - "aspen": 1 + "ruby": 2, + "sapphire": 0, + "emerald": 1, + "onyx": 1, + "diamond": 1 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 2, - "cedar": 2, - "mahogany": 1, - "aspen": 0 + "ruby": 0, + "sapphire": 2, + "emerald": 2, + "onyx": 1, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 0 }, { "cost": { - "cherry": 1, - "walnut": 2, - "cedar": 1, - "mahogany": 0, - "aspen": 1 + "ruby": 1, + "sapphire": 2, + "emerald": 1, + "onyx": 0, + "diamond": 1 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 2, - "cedar": 1, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 2, + "emerald": 1, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 0 }, { "cost": { - "cherry": 1, - "walnut": 0, - "cedar": 0, - "mahogany": 3, - "aspen": 1 + "ruby": 1, + "sapphire": 0, + "emerald": 0, + "onyx": 3, + "diamond": 1 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 1, - "cedar": 0, - "mahogany": 1, - "aspen": 3 + "ruby": 0, + "sapphire": 1, + "emerald": 0, + "onyx": 1, + "diamond": 3 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 0 }, { "cost": { - "cherry": 2, - "walnut": 0, - "cedar": 0, - "mahogany": 1, - "aspen": 0 + "ruby": 2, + "sapphire": 0, + "emerald": 0, + "onyx": 1, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 1, - "cedar": 0, - "mahogany": 0, - "aspen": 2 + "ruby": 0, + "sapphire": 1, + "emerald": 0, + "onyx": 0, + "diamond": 2 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 0 }, { "cost": { - "cherry": 1, - "walnut": 1, - "cedar": 0, - "mahogany": 2, - "aspen": 1 + "ruby": 1, + "sapphire": 1, + "emerald": 0, + "onyx": 2, + "diamond": 1 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 0 }, { "cost": { - "cherry": 2, - "walnut": 1, - "cedar": 0, - "mahogany": 1, - "aspen": 0 + "ruby": 2, + "sapphire": 1, + "emerald": 0, + "onyx": 1, + "diamond": 0 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 0 }, { "cost": { - "cherry": 3, - "walnut": 0, - "cedar": 1, - "mahogany": 1, - "aspen": 0 + "ruby": 3, + "sapphire": 0, + "emerald": 1, + "onyx": 1, + "diamond": 0 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 0 }, { "cost": { - "cherry": 2, - "walnut": 0, - "cedar": 2, - "mahogany": 0, - "aspen": 1 + "ruby": 2, + "sapphire": 0, + "emerald": 2, + "onyx": 0, + "diamond": 1 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 2, - "mahogany": 0, - "aspen": 2 + "ruby": 0, + "sapphire": 0, + "emerald": 2, + "onyx": 0, + "diamond": 2 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 2, - "cedar": 0, - "mahogany": 2, - "aspen": 0 + "ruby": 0, + "sapphire": 2, + "emerald": 0, + "onyx": 2, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 0 }, { "cost": { - "cherry": 2, - "walnut": 2, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 2, + "sapphire": 2, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 0 }, { "cost": { - "cherry": 2, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 2 + "ruby": 2, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 2 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 2, - "mahogany": 2, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 2, + "onyx": 2, + "diamond": 0 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 3, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 3, + "diamond": 0 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 3 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 3 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 3, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 3, + "onyx": 0, + "diamond": 0 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 0 }, { "cost": { - "cherry": 3, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 3, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 0 }, { "cost": { - "cherry": 0, - "walnut": 3, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 3, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 0 }, { "cost": { - "cherry": 4, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 4, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 1 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 4 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 4 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 1 }, { "cost": { - "cherry": 0, - "walnut": 4, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 4, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 1 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 4, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 4, + "onyx": 0, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 1 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 4, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 4, + "diamond": 0 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 1 } ], "tierTwo": [ { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 5, - "aspen": 3 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 5, + "diamond": 3 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 2 }, { "cost": { - "cherry": 3, - "walnut": 0, - "cedar": 5, - "mahogany": 0, - "aspen": 0 + "ruby": 3, + "sapphire": 0, + "emerald": 5, + "onyx": 0, + "diamond": 0 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 2 }, { "cost": { - "cherry": 0, - "walnut": 3, - "cedar": 0, - "mahogany": 2, - "aspen": 2 + "ruby": 0, + "sapphire": 3, + "emerald": 0, + "onyx": 2, + "diamond": 2 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 1 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 5 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 5 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 2 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 5, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 5, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 2 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 5, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 5, + "diamond": 0 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 2 }, { "cost": { - "cherry": 5, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 5, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 2 }, { "cost": { - "cherry": 0, - "walnut": 5, - "cedar": 3, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 5, + "emerald": 3, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 2 }, { "cost": { - "cherry": 5, - "walnut": 0, - "cedar": 0, - "mahogany": 3, - "aspen": 0 + "ruby": 5, + "sapphire": 0, + "emerald": 0, + "onyx": 3, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 2 }, { "cost": { - "cherry": 0, - "walnut": 5, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 5, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 2 }, { "cost": { - "cherry": 3, - "walnut": 3, - "cedar": 0, - "mahogany": 0, - "aspen": 2 + "ruby": 3, + "sapphire": 3, + "emerald": 0, + "onyx": 0, + "diamond": 2 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 1 }, { "cost": { - "cherry": 2, - "walnut": 1, - "cedar": 4, - "mahogany": 0, - "aspen": 0 + "ruby": 2, + "sapphire": 1, + "emerald": 4, + "onyx": 0, + "diamond": 0 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 2 }, { "cost": { - "cherry": 1, - "walnut": 0, - "cedar": 0, - "mahogany": 4, - "aspen": 2 + "ruby": 1, + "sapphire": 0, + "emerald": 0, + "onyx": 4, + "diamond": 2 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 2 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 6, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 6, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 3 }, { "cost": { - "cherry": 0, - "walnut": 2, - "cedar": 0, - "mahogany": 1, - "aspen": 4 + "ruby": 0, + "sapphire": 2, + "emerald": 0, + "onyx": 1, + "diamond": 4 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 2 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 6 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 6 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 3 }, { "cost": { - "cherry": 0, - "walnut": 4, - "cedar": 2, - "mahogany": 0, - "aspen": 1 + "ruby": 0, + "sapphire": 4, + "emerald": 2, + "onyx": 0, + "diamond": 1 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 2 }, { "cost": { - "cherry": 0, - "walnut": 2, - "cedar": 2, - "mahogany": 0, - "aspen": 3 + "ruby": 0, + "sapphire": 2, + "emerald": 2, + "onyx": 0, + "diamond": 3 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 1 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 3, - "mahogany": 2, - "aspen": 3 + "ruby": 0, + "sapphire": 0, + "emerald": 3, + "onyx": 2, + "diamond": 3 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 1 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 6, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 6, + "diamond": 0 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 3 }, { "cost": { - "cherry": 2, - "walnut": 0, - "cedar": 0, - "mahogany": 3, - "aspen": 2 + "ruby": 2, + "sapphire": 0, + "emerald": 0, + "onyx": 3, + "diamond": 2 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 1 }, { "cost": { - "cherry": 4, - "walnut": 0, - "cedar": 1, - "mahogany": 2, - "aspen": 0 + "ruby": 4, + "sapphire": 0, + "emerald": 1, + "onyx": 2, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 2 }, { "cost": { - "cherry": 3, - "walnut": 0, - "cedar": 2, - "mahogany": 0, - "aspen": 3 + "ruby": 3, + "sapphire": 0, + "emerald": 2, + "onyx": 0, + "diamond": 3 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 1 }, { "cost": { - "cherry": 2, - "walnut": 0, - "cedar": 3, - "mahogany": 2, - "aspen": 0 + "ruby": 2, + "sapphire": 0, + "emerald": 3, + "onyx": 2, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 1 }, { "cost": { - "cherry": 2, - "walnut": 3, - "cedar": 0, - "mahogany": 3, - "aspen": 0 + "ruby": 2, + "sapphire": 3, + "emerald": 0, + "onyx": 3, + "diamond": 0 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 1 }, { "cost": { - "cherry": 3, - "walnut": 2, - "cedar": 2, - "mahogany": 0, - "aspen": 0 + "ruby": 3, + "sapphire": 2, + "emerald": 2, + "onyx": 0, + "diamond": 0 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 1 }, { "cost": { - "cherry": 6, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 6, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 3 }, { "cost": { - "cherry": 0, - "walnut": 6, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 6, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 3 }, { "cost": { - "cherry": 0, - "walnut": 3, - "cedar": 0, - "mahogany": 0, - "aspen": 5 + "ruby": 0, + "sapphire": 3, + "emerald": 0, + "onyx": 0, + "diamond": 5 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 2 }, { "cost": { - "cherry": 0, - "walnut": 2, - "cedar": 3, - "mahogany": 3, - "aspen": 0 + "ruby": 0, + "sapphire": 2, + "emerald": 3, + "onyx": 3, + "diamond": 0 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 1 } ], "tierThree": [ { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 7, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 7, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 4 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 7, - "aspen": 0 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 7, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 4 }, { "cost": { - "cherry": 3, - "walnut": 0, - "cedar": 0, - "mahogany": 6, - "aspen": 3 + "ruby": 3, + "sapphire": 0, + "emerald": 0, + "onyx": 6, + "diamond": 3 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 4 }, { "cost": { - "cherry": 3, - "walnut": 3, - "cedar": 6, - "mahogany": 0, - "aspen": 0 + "ruby": 3, + "sapphire": 3, + "emerald": 6, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 4 }, { "cost": { - "cherry": 7, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 7, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 4 }, { "cost": { - "cherry": 0, - "walnut": 3, - "cedar": 0, - "mahogany": 3, - "aspen": 6 + "ruby": 0, + "sapphire": 3, + "emerald": 0, + "onyx": 3, + "diamond": 6 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 4 }, { "cost": { - "cherry": 6, - "walnut": 0, - "cedar": 3, - "mahogany": 3, - "aspen": 0 + "ruby": 6, + "sapphire": 0, + "emerald": 3, + "onyx": 3, + "diamond": 0 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 4 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 0, - "aspen": 7 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 0, + "diamond": 7 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 4 }, { "cost": { - "cherry": 0, - "walnut": 7, - "cedar": 0, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 7, + "emerald": 0, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 4 }, { "cost": { - "cherry": 0, - "walnut": 6, - "cedar": 3, - "mahogany": 0, - "aspen": 3 + "ruby": 0, + "sapphire": 6, + "emerald": 3, + "onyx": 0, + "diamond": 3 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 4 }, { "cost": { - "cherry": 0, - "walnut": 5, - "cedar": 3, - "mahogany": 3, - "aspen": 3 + "ruby": 0, + "sapphire": 5, + "emerald": 3, + "onyx": 3, + "diamond": 3 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 3 }, { "cost": { - "cherry": 3, - "walnut": 3, - "cedar": 0, - "mahogany": 3, - "aspen": 5 + "ruby": 3, + "sapphire": 3, + "emerald": 0, + "onyx": 3, + "diamond": 5 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 3 }, { "cost": { - "cherry": 5, - "walnut": 3, - "cedar": 3, - "mahogany": 3, - "aspen": 0 + "ruby": 5, + "sapphire": 3, + "emerald": 3, + "onyx": 3, + "diamond": 0 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 3 }, { "cost": { - "cherry": 3, - "walnut": 3, - "cedar": 5, - "mahogany": 0, - "aspen": 3 + "ruby": 3, + "sapphire": 3, + "emerald": 5, + "onyx": 0, + "diamond": 3 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 3 }, { "cost": { - "cherry": 3, - "walnut": 0, - "cedar": 3, - "mahogany": 5, - "aspen": 3 + "ruby": 3, + "sapphire": 0, + "emerald": 3, + "onyx": 5, + "diamond": 3 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 3 }, { "cost": { - "cherry": 0, - "walnut": 3, - "cedar": 0, - "mahogany": 0, - "aspen": 7 + "ruby": 0, + "sapphire": 3, + "emerald": 0, + "onyx": 0, + "diamond": 7 }, - "isWorth": "walnut", + "gemValue": "sapphire", "points": 5 }, { "cost": { - "cherry": 0, - "walnut": 0, - "cedar": 0, - "mahogany": 7, - "aspen": 3 + "ruby": 0, + "sapphire": 0, + "emerald": 0, + "onyx": 7, + "diamond": 3 }, - "isWorth": "aspen", + "gemValue": "diamond", "points": 5 }, { "cost": { - "cherry": 3, - "walnut": 0, - "cedar": 7, - "mahogany": 0, - "aspen": 0 + "ruby": 3, + "sapphire": 0, + "emerald": 7, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cherry", + "gemValue": "ruby", "points": 5 }, { "cost": { - "cherry": 0, - "walnut": 7, - "cedar": 3, - "mahogany": 0, - "aspen": 0 + "ruby": 0, + "sapphire": 7, + "emerald": 3, + "onyx": 0, + "diamond": 0 }, - "isWorth": "cedar", + "gemValue": "emerald", "points": 5 }, { "cost": { - "cherry": 7, - "walnut": 0, - "cedar": 0, - "mahogany": 3, - "aspen": 0 + "ruby": 7, + "sapphire": 0, + "emerald": 0, + "onyx": 3, + "diamond": 0 }, - "isWorth": "mahogany", + "gemValue": "onyx", "points": 5 } ] diff --git a/src/util/main.d.ts b/src/util/main.d.ts deleted file mode 100644 index 7a71dc9..0000000 --- a/src/util/main.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare namespace Universals { - export interface Card { - gemValue: GemValue - tier: number - points?: number - cost: any - } - - export interface Nobles { - points: 3 - - } - - export enum GemValue { - Ruby, - Sapphire, - Emerald, - Diamond, - Onyx, - Gol, - } -} \ No newline at end of file diff --git a/src/util/types.ts b/src/util/types.ts new file mode 100644 index 0000000..bac1ae9 --- /dev/null +++ b/src/util/types.ts @@ -0,0 +1,34 @@ +export interface FullDeck { + tierOne: CardData[], + tierTwo: CardData[], + tierThree: CardData[] +} + +export interface CardData { + gemValue: GemValue + tier: number + points?: number + cost: ResourceCost +} + +export interface ResourceCost { + ruby: number, + sapphire: number, + emerald: number, + diamond: number, + onyx: number, +} + +export interface NobleData { + points: 3, + cost: ResourceCost +} + +export enum GemValue { + Ruby, + Sapphire, + Emerald, + Diamond, + Onyx, + Gold, +} \ No newline at end of file