diff --git a/src/App.tsx b/src/App.tsx index 12a3e55..f0ea340 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -124,7 +124,7 @@ function CreatureComponent({ * Displays card shape with a number on it indicating how many cards are in the pile. This one has onclick to allow player to draw * @returns returns markup displaying what i wrote just above */ -function Deck({ player, handState }: { player: Player, handState: React.Dispatch>}) { +function Deck({ player, handState}: { player: Player, handState: React.Dispatch>}) { let handleDraw = function () { let boolean = player.drawCardUsingAction(); handState(player.hand); @@ -205,18 +205,19 @@ function HandOfCards({ playerHand, stateChange}: { playerHand: Card[], stateChan function Board({ game, board}: { game: Game, board: SidedBoard}) { let p1Board = []; let p2Board = []; + let t = board.getSideByOwnerId(0); //Looping through board to display it for (let i = 0; i < 4; i++) { p1Board.push( LandscapeCard({ - creature: game.board.getBoardPosByOwnerId(0, i)?.creature, + creature: board.getBoardPosByOwnerId(0, i)?.creature, //building: game.board.getBoardPosByOwnerId(0, i)?.building }), ); p2Board.push( LandscapeCard({ - creature: game.board.getBoardPosByOwnerId(1, i)?.creature, + creature: board.getBoardPosByOwnerId(1, i)?.creature, //building: game.board.getBoardPosByOwnerId(1, i)?.building, }), ); @@ -318,7 +319,8 @@ function GameBoard({ game }: { game: Game }) { let player2 = game.getPlayerById(1); let buttons = (<>) if(summoningCard+1){ - buttons = + buttons = } return (
@@ -343,7 +345,7 @@ function GameBoard({ game }: { game: Game }) { {/*The first column shows the deck and discard pile (like the one you saw earlier*/}
- +
{/*This column shows the game log text bot and the button for moving phases below it*/} @@ -374,18 +376,23 @@ function GameBoard({ game }: { game: Game }) { ); } -function SummoningButtons({cardPos, game, setSummonState, hand}: {cardPos: number, game: Game, setSummonState: any, hand: Card[]}){ +function SummoningButtons({cardPos, game, setSummonState, hand, setHandState, setBoardState, board}: {cardPos: number, game: Game, setSummonState: any, + hand: Card[], setHandState: any, setBoardState: any, board: SidedBoard}){ function handle(){ - let card = hand.splice(cardPos,1); + let card = hand[cardPos]; + hand.splice(cardPos, 1); + setHandState(hand); + console.log(hand.length) game.summonCard(0, 0, card); + setBoardState(game.board); setSummonState(-1); } return(
- - - + + +
)