68 lines
3.4 KiB
Vue
68 lines
3.4 KiB
Vue
<script setup lang="ts">
|
|
import goStore, { buy, useEffect } from '@/netcode';
|
|
import { CardEffects, type Effect } from '@/netcode/Effect'
|
|
import { CardType } from '@/netcode/Card'
|
|
|
|
const isTurn = computed(() => goStore.self && goStore.current_game?.started && (goStore.self.team == goStore.current_game.current_turn))
|
|
const clientStore = useClientSideStore()
|
|
|
|
const buyableFiregem = computed(() => goStore?.current_game?.gem_stack.at(-1))
|
|
</script>
|
|
|
|
<template>
|
|
<div id="market">
|
|
<CardPreview :tilted="false" :card_id="undefined"></CardPreview>
|
|
<div class="separator"></div>
|
|
<CardPreview :tilted="false" :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="clientStore.findUseEffect(CardEffects.PLAY_NEXT_CARD_BOUGHT, c);"
|
|
v-if="clientStore.activatedClientside.find((e: Effect) => (e.effect == CardEffects.PLAY_NEXT_CARD_BOUGHT) && e.usable)">
|
|
BUY IN HAND</button>
|
|
<button @click.stop="clientStore.findUseEffect(CardEffects.STACK_NEXT_CARD_BOUGHT, c)"
|
|
v-if="clientStore.activatedClientside.find((e: Effect) => (e.effect == CardEffects.STACK_NEXT_CARD_BOUGHT) && e.usable)">
|
|
BUY IN STACK (generic)</button>
|
|
|
|
<button @click.stop="clientStore.findUseEffect(CardEffects.STACK_NEXT_ACTION_BOUGHT, c)"
|
|
v-if="c.card_type == CardType.ACTION && clientStore.activatedClientside.find((e: Effect) => (e.effect == CardEffects.STACK_NEXT_ACTION_BOUGHT) && e.usable)">
|
|
BUY IN STACK (actions)</button>
|
|
</template>
|
|
</CardPreview>
|
|
<div class="separator"></div>
|
|
<CardPreview :tilted="false" :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.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>
|
|
<button @click.stop="clientStore.findUseEffect(CardEffects.PLAY_NEXT_CARD_BOUGHT, buyableFiregem)"
|
|
v-if="buyableFiregem && clientStore.activatedClientside.find((e: Effect) => (e.effect == CardEffects.PLAY_NEXT_CARD_BOUGHT) && e.usable)">
|
|
BUY IN HAND</button>
|
|
<button @click.stop="clientStore.findUseEffect(CardEffects.STACK_NEXT_CARD_BOUGHT, buyableFiregem)"
|
|
v-if="buyableFiregem && clientStore.activatedClientside.find((e: Effect) => (e.effect == CardEffects.STACK_NEXT_CARD_BOUGHT) && e.usable)">
|
|
BUY IN STACK(generic)
|
|
</button>
|
|
</template>
|
|
</CardPreview>
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<style scoped>
|
|
#market {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: center;
|
|
align-items: center;
|
|
z-index: 2;
|
|
position: relative;
|
|
gap: 2px;
|
|
}
|
|
|
|
.separator {
|
|
width: 50px;
|
|
}
|
|
</style> |