Change CardPreview component to use only card ID

This commit is contained in:
2024-05-13 15:41:43 +02:00
parent 3f66249106
commit c86232cf6a
8 changed files with 266 additions and 231 deletions
+5 -5
View File
@@ -8,9 +8,9 @@ const isTurn = computed(() => goStore.self?.team == goStore.current_game?.curren
<template>
<div :class="'player ' + (isTurn ? 'turn' : '')">
<button v-if="goStore.self && goStore.self?.team != goStore.self?.team" id="end_turn"
@click="useEffect(goStore.self!.turn.find_effect(CardEffects.MAKE_DISCARD)!, goStore.self)"
:disabled="!goStore.self!.turn.find_effect(CardEffects.MAKE_DISCARD)">
<button v-if="goStore.self && goStore.self!.turn && goStore.self?.team != goStore.self?.team" id="end_turn"
@click="useEffect(goStore.self.turn.find_effect(CardEffects.MAKE_DISCARD)!, goStore.self)"
:disabled="!goStore.self.turn.find_effect(CardEffects.MAKE_DISCARD)">
make Discard</button>
<div id="turn_data">
<button id="end_turn" v-if="isTurn" @click="endTurn">END TURN</button>
@@ -18,8 +18,8 @@ const isTurn = computed(() => goStore.self?.team == goStore.current_game?.curren
</div>
<div class="cards_container" id="self_hand">
<CardPreview :data="c" v-for=" c in goStore.self?.hand " @click="c && playCard(c)">
<button v-if="c && isTurn && (goStore.self?.turn.discard_markers ?? 0) > 0"
<CardPreview :card_id="c?.card_id" v-for=" c in goStore.self?.hand " @click="c && playCard(c)">
<button v-if="c && isTurn && goStore.self?.turn && (goStore.self.turn.discard_markers ?? 0) > 0"
@click="discard(c!)">DISCARD</button>
</CardPreview>
</div>