Feat : add tokens, handle mutex effects

This commit is contained in:
2024-07-07 10:45:55 +02:00
parent 12d6de5074
commit db7959d7f1
110 changed files with 627 additions and 798 deletions
+16 -4
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { endTurn, joinGame, lockCard, startGame } from "~/netcode";
import { endTurn, joinGame, lockCard, lockEffect, startGame } from "~/netcode";
import type { Game, Player } from "~/netcode/interfaces";
import { useTurnStore } from "~/stores/turnStore";
@@ -92,6 +92,19 @@ function boardCardClick(cardUUID: string) {
}
lockCard(props.game._id, cardUUID);
}
function effectClick(cardUUID: string, effectIndex: number) {
const card = props.player.board.cards.find((c) => c._id == cardUUID);
if (!card) {
console.error("card not found");
return;
}
if (!props.game.currentTurn.cardsLocked.includes(cardUUID)) {
return;
}
const effectUUID = card.effects[effectIndex]._id;
lockEffect(props.game._id, effectUUID);
}
// function damage_team_all(team: Team) {
// for (let i = 0; i < (goStore.self?.turn?.damage_reserve ?? 0); i++) {
// damage_team(team)
@@ -158,6 +171,7 @@ function boardCardClick(cardUUID: string) {
:wrapped="false"
:playingTurn="props.game.currentTurn"
@cardClick="boardCardClick"
@effectClick="effectClick"
>
</CardsGrouped>
@@ -270,7 +284,6 @@ function boardCardClick(cardUUID: string) {
visibility: hidden;
}
.player {
display: grid;
grid-template-columns: 1fr;
@@ -282,12 +295,11 @@ function boardCardClick(cardUUID: string) {
"turn_buttons";
justify-items: center;
transition: all 1s;
}
#current_player_board {
grid-area: player;
display:flex;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;