Small edits
This commit is contained in:
parent
07aeb03a60
commit
1d69cbaabe
@ -19,7 +19,7 @@ export default function Game(props: GameProps): JSX.Element {
|
|||||||
team,
|
team,
|
||||||
board,
|
board,
|
||||||
player,
|
player,
|
||||||
deck,
|
deckSize,
|
||||||
enemyLife,
|
enemyLife,
|
||||||
enemyDeckSize,
|
enemyDeckSize,
|
||||||
enemyHandSize,
|
enemyHandSize,
|
||||||
@ -79,18 +79,24 @@ export default function Game(props: GameProps): JSX.Element {
|
|||||||
</div>
|
</div>
|
||||||
<div className="player-info">
|
<div className="player-info">
|
||||||
<p>Life: {player.life}</p>
|
<p>Life: {player.life}</p>
|
||||||
<p>Deck: {deck.cards.length}</p>
|
<p>Deck: {deckSize}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="game-board">
|
<div className="game-board">
|
||||||
<div className="hand">
|
<div className="hand">
|
||||||
{Array(enemyHandSize).fill(null).map(() => (
|
{Array(enemyHandSize).fill(null).map((_, i) => (
|
||||||
<CardToken cardKey={null} isSelected={false} disabled />
|
<CardToken
|
||||||
|
key={`enemy-hand-${i}`}
|
||||||
|
cardKey={null}
|
||||||
|
isSelected={false}
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="fighter-area enemy">
|
<div className="fighter-area enemy">
|
||||||
{enemyBoard.map((card, index) => (
|
{enemyBoard.map((card, index) => (
|
||||||
<BoardSlot
|
<BoardSlot
|
||||||
|
key={`enemy-${index}`}
|
||||||
card={card ?? null}
|
card={card ?? null}
|
||||||
onSelect={() => selectCard({target: 'opponent', type: 'board', index})}
|
onSelect={() => selectCard({target: 'opponent', type: 'board', index})}
|
||||||
isSelected={
|
isSelected={
|
||||||
@ -105,6 +111,7 @@ export default function Game(props: GameProps): JSX.Element {
|
|||||||
<div className="fighter-area ally">
|
<div className="fighter-area ally">
|
||||||
{allyBoard.map((card, index) => (
|
{allyBoard.map((card, index) => (
|
||||||
<BoardSlot
|
<BoardSlot
|
||||||
|
key={`ally-${index}`}
|
||||||
card={card ?? null}
|
card={card ?? null}
|
||||||
onSelect={() => selectCard({target: 'ally', type: 'board', index})}
|
onSelect={() => selectCard({target: 'ally', type: 'board', index})}
|
||||||
isSelected={
|
isSelected={
|
||||||
@ -121,6 +128,7 @@ export default function Game(props: GameProps): JSX.Element {
|
|||||||
<div className="draw-choices">
|
<div className="draw-choices">
|
||||||
{drawChoices.map((card, index) => (
|
{drawChoices.map((card, index) => (
|
||||||
<CardToken
|
<CardToken
|
||||||
|
key={`draw-choices-${index}`}
|
||||||
cardKey={card.type === -1 ? null : card.type}
|
cardKey={card.type === -1 ? null : card.type}
|
||||||
onSelect={() => selectCard({target: 'ally', type: 'draws', index})}
|
onSelect={() => selectCard({target: 'ally', type: 'draws', index})}
|
||||||
isSelected={
|
isSelected={
|
||||||
@ -148,6 +156,7 @@ export default function Game(props: GameProps): JSX.Element {
|
|||||||
<div className="hand">
|
<div className="hand">
|
||||||
{player.hand.map((card, index) => (
|
{player.hand.map((card, index) => (
|
||||||
<CardToken
|
<CardToken
|
||||||
|
key={`hand-${index}`}
|
||||||
cardKey={card.type === -1 ? null : card.type}
|
cardKey={card.type === -1 ? null : card.type}
|
||||||
onSelect={() => selectCard({target: 'ally', type: 'hand', index})}
|
onSelect={() => selectCard({target: 'ally', type: 'hand', index})}
|
||||||
isSelected={
|
isSelected={
|
||||||
|
@ -84,19 +84,17 @@ const initialState: GameClientState = {
|
|||||||
},
|
},
|
||||||
player: {
|
player: {
|
||||||
name: '',
|
name: '',
|
||||||
id: 0,
|
id: -1,
|
||||||
hand: [],
|
hand: [],
|
||||||
life: 0,
|
life: -1,
|
||||||
ready: false,
|
ready: false,
|
||||||
},
|
},
|
||||||
deck: {
|
deckSize: 0,
|
||||||
cards: []
|
|
||||||
},
|
|
||||||
team: 1,
|
team: 1,
|
||||||
enemyLife: 0,
|
enemyLife: 0,
|
||||||
enemyDeckSize: 0,
|
enemyDeckSize: 0,
|
||||||
enemyHandSize: 0,
|
enemyHandSize: 0,
|
||||||
currentTurn: 1,
|
currentTurn: 0,
|
||||||
canDraw: false,
|
canDraw: false,
|
||||||
hasDrawn: false,
|
hasDrawn: false,
|
||||||
gameStatus: 0,
|
gameStatus: 0,
|
||||||
|
@ -56,9 +56,7 @@ interface GameStatusMap {
|
|||||||
export interface GameState {
|
export interface GameState {
|
||||||
board: Board
|
board: Board
|
||||||
player: Player
|
player: Player
|
||||||
deck: {
|
deckSize: number
|
||||||
cards: Card[]
|
|
||||||
}
|
|
||||||
team: Team
|
team: Team
|
||||||
enemyLife: number
|
enemyLife: number
|
||||||
enemyDeckSize: number
|
enemyDeckSize: number
|
||||||
|
@ -164,7 +164,7 @@ export default function useServerSocket(
|
|||||||
state: {
|
state: {
|
||||||
board: result.board,
|
board: result.board,
|
||||||
player: result.player,
|
player: result.player,
|
||||||
deck: result.deck,
|
deckSize: result.deck_size,
|
||||||
enemyLife: result.enemy_life,
|
enemyLife: result.enemy_life,
|
||||||
enemyDeckSize: result.enemy_deck_size,
|
enemyDeckSize: result.enemy_deck_size,
|
||||||
enemyHandSize: result.enemy_hand_size,
|
enemyHandSize: result.enemy_hand_size,
|
||||||
|
Loading…
Reference in New Issue
Block a user