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
+6 -5
View File
@@ -9,10 +9,11 @@ const isTurn = computed(() => goStore.self && goStore.current_game?.started && (
<template>
<div id="market">
<CardPreview :data="null"></CardPreview>
<CardPreview :card_id="undefined"></CardPreview>
<div class="separator"></div>
<CardPreview :data="c" v-for="c in goStore.current_game?.market" @click="c && buy(c)">
<template v-if="isTurn && c && c.cost && (goStore.self?.turn.gold_reserve ?? 0) >= c.cost">
<CardPreview :card_id="c?.card_id" v-for="c in goStore.current_game?.market" @click="c && buy(c)">
<template
v-if="isTurn && goStore.self?.turn && c && c.cost && (goStore.self?.turn.gold_reserve ?? 0) >= c.cost">
<button @click.stop="buy(c)">BUY</button>
<button @click.stop="useEffect(goStore.self!.turn.find_effect(CardEffects.PLAY_NEXT_CARD_BOUGHT)!, c)"
v-if="goStore.self?.turn.find_effect(CardEffects.PLAY_NEXT_CARD_BOUGHT)">
@@ -28,10 +29,10 @@ const isTurn = computed(() => goStore.self && goStore.current_game?.started && (
</template>
</CardPreview>
<div class="separator"></div>
<CardPreview :data="goStore.current_game?.gem_stack.at(-1)"
<CardPreview :card_id="goStore.current_game?.gem_stack.at(-1)?.card_id"
@click="buy(goStore.current_game?.gem_stack.at(-1)!)">
<template
v-if="isTurn && goStore.current_game?.gem_stack.length && goStore.current_game?.gem_stack.length > 0 && (goStore.self?.turn.gold_reserve ?? 0) >= (goStore.current_game?.gem_stack.at(-1)?.cost ?? Infinity)">
v-if="isTurn && goStore.self?.turn && goStore.current_game?.gem_stack.length && goStore.current_game?.gem_stack.length > 0 && (goStore.self?.turn.gold_reserve ?? 0) >= (goStore.current_game?.gem_stack.at(-1)?.cost ?? Infinity)">
<button @click.stop="buy(goStore.current_game.gem_stack.at(-1)!)">
BUY
</button>