Better cards stacks and discard view
This commit is contained in:
@@ -5,9 +5,13 @@ import type { Card } from '~/netcode/Card';
|
|||||||
export interface Props {
|
export interface Props {
|
||||||
data: Card | null | undefined
|
data: Card | null | undefined
|
||||||
locked?: boolean
|
locked?: boolean
|
||||||
|
wrapped?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>()
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
wrapped: () => false,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
const emit = defineEmits(["click"])
|
const emit = defineEmits(["click"])
|
||||||
|
|
||||||
@@ -24,17 +28,23 @@ function contextmenu(e: MouseEvent) {
|
|||||||
buttonsElement.value?.setAttribute("style", `top:${e.clientY + 10}px;left:${e.clientX + 10}px`)
|
buttonsElement.value?.setAttribute("style", `top:${e.clientY + 10}px;left:${e.clientX + 10}px`)
|
||||||
rightClicked.value = true
|
rightClicked.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const rotation = ref(0)
|
||||||
|
|
||||||
|
onBeforeUpdate(() => {
|
||||||
|
rotation.value = Math.random() > .5 ? 2 : -2
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="`card ${Number(buttonsElement?.childElementCount) > 0 ? 'active' : ''}`" @contextmenu.prevent="false"
|
<div :class="`card ${Number(buttonsElement?.childElementCount) > 0 ? 'active' : ''} ${wrapped ? 'wrapped' : ''}`"
|
||||||
@click.left="cardClick" @click.right="contextmenu">
|
@contextmenu.prevent="false" @click.left="cardClick" @click.right="contextmenu"
|
||||||
|
:style="`rotate:${rotation}deg;`">
|
||||||
<img :class="`card_image ${rightClicked ? 'outlined' : ''} ${props.locked ? 'locked' : ''}`" v-if="props.data"
|
<img :class="`card_image ${rightClicked ? 'outlined' : ''} ${props.locked ? 'locked' : ''}`" v-if="props.data"
|
||||||
:src="'/cards/' + data?.card_id?.toString().padStart(3, '0') + '.png'">
|
:src="'/cards/' + data?.card_id?.toString().padStart(3, '0') + '.png'">
|
||||||
|
|
||||||
<img :class="`card_image ${rightClicked ? 'outlined' : ''} ${props.locked ? 'locked' : ''}`" v-if="!props.data"
|
<img :class="`card_image ${rightClicked ? 'outlined' : ''} ${props.locked ? 'locked' : ''}`" v-if="!props.data"
|
||||||
:src="'/cards/background.png'">
|
:src="'/cards/background.png'">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div :class="rightClicked ? '' : 'hidden'" id="contextMenu" @click.self.prevent="rightClicked = false">
|
<div :class="rightClicked ? '' : 'hidden'" id="contextMenu" @click.self.prevent="rightClicked = false">
|
||||||
@@ -46,6 +56,12 @@ function contextmenu(e: MouseEvent) {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.card {
|
||||||
|
transition: 0.025s rotate linear;
|
||||||
|
transition: max-width .125s linear;
|
||||||
|
max-width: 256px;
|
||||||
|
}
|
||||||
|
|
||||||
.card.active {
|
.card.active {
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
}
|
}
|
||||||
@@ -59,6 +75,14 @@ function contextmenu(e: MouseEvent) {
|
|||||||
filter: brightness(0.5);
|
filter: brightness(0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card.wrapped {
|
||||||
|
max-width: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card.wrapped:last-child {
|
||||||
|
max-width: 256px;
|
||||||
|
}
|
||||||
|
|
||||||
.card_image {
|
.card_image {
|
||||||
max-height: 250px;
|
max-height: 250px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,20 +14,18 @@ const unwrapped = ref(false)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
{{ props.stack?.length }}
|
<div>
|
||||||
<input type="checkbox" v-model="unwrapped" />
|
<input type="checkbox" v-model="unwrapped" class="checkbox" />
|
||||||
<div class="cards_container">
|
<div class="cards_container">
|
||||||
<CardPreview v-if="!unwrapped && props.stack.length > 0" :data="props.stack.at(-1) ?? null">
|
<template v-if="props.stack.length > 0" v-for="c in props.stack">
|
||||||
<slot></slot>
|
<CardPreview :data="c" :wrapped="!unwrapped">
|
||||||
</CardPreview>
|
|
||||||
|
|
||||||
<template v-if="unwrapped" v-for="c in props.stack">
|
|
||||||
<CardPreview :data="c">
|
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</CardPreview>
|
</CardPreview>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
+27
-24
@@ -14,30 +14,7 @@ const isTurn = computed(() => goStore.self && goStore.game?.started && (goStore.
|
|||||||
<div>
|
<div>
|
||||||
market_amount = {{ goStore.game?.market_stack?.length }}
|
market_amount = {{ goStore.game?.market_stack?.length }}
|
||||||
<br>
|
<br>
|
||||||
market =
|
|
||||||
<div class="cards_container">
|
<div class="cards_container">
|
||||||
<CardPreview :data="c" v-for="c in goStore.game?.market" @click="c && buy(c)">
|
|
||||||
<template v-if="isTurn && c">
|
|
||||||
<button @click="buy(c)"
|
|
||||||
:disabled="goStore.self === undefined || c.cost === undefined || (goStore.self?.turn.gold_reserve ?? 0) < c.cost">BUY</button>
|
|
||||||
<button
|
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.PLAY_NEXT_CARD_BOUGHT) && e.usable)!, c)"
|
|
||||||
:disabled="(goStore.self === undefined || c.cost === undefined || (goStore.self?.turn.gold_reserve ?? 0) < c.cost) || !goStore.self!.turn.effects_availables.some(e => (e.effect == CardEffects.PLAY_NEXT_CARD_BOUGHT) && e.usable)">
|
|
||||||
BUY IN HAND</button>
|
|
||||||
<button
|
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.STACK_NEXT_CARD_BOUGHT) && e.usable)!, c)"
|
|
||||||
:disabled="(goStore.self === undefined || c.cost === undefined || (goStore.self?.turn.gold_reserve ?? 0) < c.cost) || !goStore.self!.turn.effects_availables.some(e => (e.effect == CardEffects.STACK_NEXT_CARD_BOUGHT) && e.usable)">
|
|
||||||
BUY IN STACK (generic)</button>
|
|
||||||
<button v-if="c.card_type == CardType.ACTION"
|
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.STACK_NEXT_ACTION_BOUGHT) && e.usable)!, c)"
|
|
||||||
:disabled="(goStore.self === undefined || c.cost === undefined || (goStore.self?.turn.gold_reserve ?? 0) < c.cost) || !goStore.self!.turn.effects_availables.some(e => (e.effect == CardEffects.STACK_NEXT_ACTION_BOUGHT) && e.usable)">
|
|
||||||
BUY IN STACK (actions)</button>
|
|
||||||
</template>
|
|
||||||
</CardPreview>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
gems =
|
|
||||||
<CardSlot :stack="goStore.game?.gem_stack">
|
<CardSlot :stack="goStore.game?.gem_stack">
|
||||||
<template v-if="isTurn && goStore.game?.gem_stack.length && goStore.game?.gem_stack.length > 0">
|
<template v-if="isTurn && goStore.game?.gem_stack.length && goStore.game?.gem_stack.length > 0">
|
||||||
<button @click="buy(goStore.game.gem_stack.at(-1)!)">
|
<button @click="buy(goStore.game.gem_stack.at(-1)!)">
|
||||||
@@ -59,6 +36,28 @@ const isTurn = computed(() => goStore.self && goStore.game?.started && (goStore.
|
|||||||
</button> -->
|
</button> -->
|
||||||
</template>
|
</template>
|
||||||
</CardSlot>
|
</CardSlot>
|
||||||
|
<div class="separator"></div>
|
||||||
|
<CardPreview :data="c" v-for="c in goStore.game?.market" @click="c && buy(c)">
|
||||||
|
<template v-if="isTurn && c">
|
||||||
|
<button @click="buy(c)"
|
||||||
|
:disabled="goStore.self === undefined || c.cost === undefined || (goStore.self?.turn.gold_reserve ?? 0) < c.cost">BUY</button>
|
||||||
|
<button
|
||||||
|
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.PLAY_NEXT_CARD_BOUGHT) && e.usable)!, c)"
|
||||||
|
:disabled="(goStore.self === undefined || c.cost === undefined || (goStore.self?.turn.gold_reserve ?? 0) < c.cost) || !goStore.self!.turn.effects_availables.some(e => (e.effect == CardEffects.PLAY_NEXT_CARD_BOUGHT) && e.usable)">
|
||||||
|
BUY IN HAND</button>
|
||||||
|
<button
|
||||||
|
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.STACK_NEXT_CARD_BOUGHT) && e.usable)!, c)"
|
||||||
|
:disabled="(goStore.self === undefined || c.cost === undefined || (goStore.self?.turn.gold_reserve ?? 0) < c.cost) || !goStore.self!.turn.effects_availables.some(e => (e.effect == CardEffects.STACK_NEXT_CARD_BOUGHT) && e.usable)">
|
||||||
|
BUY IN STACK (generic)</button>
|
||||||
|
<button v-if="c.card_type == CardType.ACTION"
|
||||||
|
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.STACK_NEXT_ACTION_BOUGHT) && e.usable)!, c)"
|
||||||
|
:disabled="(goStore.self === undefined || c.cost === undefined || (goStore.self?.turn.gold_reserve ?? 0) < c.cost) || !goStore.self!.turn.effects_availables.some(e => (e.effect == CardEffects.STACK_NEXT_ACTION_BOUGHT) && e.usable)">
|
||||||
|
BUY IN STACK (actions)</button>
|
||||||
|
</template>
|
||||||
|
</CardPreview>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<PlayerList>
|
<PlayerList>
|
||||||
@@ -70,7 +69,11 @@ const isTurn = computed(() => goStore.self && goStore.game?.started && (goStore.
|
|||||||
<style>
|
<style>
|
||||||
.cards_container {
|
.cards_container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row-reverse;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.separator {
|
||||||
|
margin-left: 100px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -7,5 +7,5 @@ import goStore from '@/netcode';
|
|||||||
<div v-for="[k, l] in goStore.players">
|
<div v-for="[k, l] in goStore.players">
|
||||||
<PlayerSlot :player="l" v-if="l !== goStore.self" :key="k" />
|
<PlayerSlot :player="l" v-if="l !== goStore.self" :key="k" />
|
||||||
</div>
|
</div>
|
||||||
<SelfView v-if="goStore.self" :player="goStore.self"></SelfView>
|
<SelfView v-if="goStore.self"></SelfView>
|
||||||
</template>
|
</template>
|
||||||
@@ -63,8 +63,7 @@ const discard_unwrapped = ref(false)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span>effects_availables = <div v-for=" e in props.player.turn.effects_availables ">
|
<span>effects_availables = <div v-for=" e in props.player.turn.effects_availables ">
|
||||||
<button v-if="e && ![CardEffects.DAMAGE, CardEffects.GOLD, CardEffects.HEAL].includes(e.effect)"
|
<button v-if="e" @click="useEffect(e)" :disabled="!e.usable">
|
||||||
@click="useEffect(e)" :disabled="!e.usable">
|
|
||||||
{{ e.effect + ' ' + e.effect_type }}
|
{{ e.effect + ' ' + e.effect_type }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -112,46 +111,15 @@ const discard_unwrapped = ref(false)
|
|||||||
</CardPreview>
|
</CardPreview>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
stack =
|
|
||||||
<CardSlot :stack="props.player.stack_pile">
|
<CardSlot :stack="props.player.stack_pile">
|
||||||
<!-- <button v-if="isSelf && isTurn" @click="draw">DRAW</button> -->
|
<!-- <button v-if="isSelf && isTurn" @click="draw">DRAW</button> -->
|
||||||
</CardSlot>
|
</CardSlot>
|
||||||
<br>
|
|
||||||
discard =
|
|
||||||
|
|
||||||
{{ props.player.discard_pile.length }}
|
|
||||||
<input type="checkbox" v-model="discard_unwrapped" />
|
|
||||||
|
|
||||||
<CardPreview v-if="!discard_unwrapped && props.player.discard_pile.length > 0"
|
<CardSlot :stack="props.player.discard_pile">
|
||||||
:data="props.player.discard_pile.at(-1)">
|
|
||||||
<!-- <button v-if="isSelf && isTurn" @click="play_from_discard(props.player.discard_pile.at(-1))">DRAW</button>
|
|
||||||
<button v-if="isSelf && isTurn" @click="put_on_stack_from_discard(props.player.discard_pile.at(-1))">PUT ON
|
|
||||||
STACK</button> -->
|
|
||||||
|
|
||||||
<button v-if="isSelf && isTurn"
|
</CardSlot>
|
||||||
:disabled="!goStore.self || !props.player.discard_pile.at(-1) || !props.player.turn.effects_availables.some(e => (e.effect == CardEffects.SACRIFICE) && e.usable) || props.player.discard_pile.at(-1)!.uuid in props.player.turn.cards_locked"
|
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.SACRIFICE) && e.usable)!, props.player.discard_pile.at(-1))">SACRIFICE</button>
|
|
||||||
</CardPreview>
|
|
||||||
|
|
||||||
<template v-if="discard_unwrapped" v-for=" c in props.player.discard_pile ">
|
|
||||||
<CardPreview :data="c">
|
|
||||||
<!-- <button v-if="isSelf && isTurn" @click="play_from_discard(c)">DRAW</button>
|
|
||||||
<button v-if="isSelf && isTurn" @click="put_on_stack_from_discard(c)">PUT ON STACK</button>
|
|
||||||
-->
|
|
||||||
<button v-if="isSelf && isTurn && c.card_type == CardType.CHAMPION"
|
|
||||||
:disabled="!goStore.self || !c || !props.player.turn.effects_availables.some(e => (e.effect == CardEffects.RESTACK_DISCARDED_CHAMPION) && e.usable)"
|
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.RESTACK_DISCARDED_CHAMPION) && e.usable)!, c)">RESTACK
|
|
||||||
(champion)</button>
|
|
||||||
|
|
||||||
<button v-if="isSelf && isTurn"
|
|
||||||
:disabled="!goStore.self || !c || !props.player.turn.effects_availables.some(e => (e.effect == CardEffects.RESTACK_DISCARDED_CARD) && e.usable)"
|
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.RESTACK_DISCARDED_CARD) && e.usable)!, c)">RESTACK
|
|
||||||
(card)</button>
|
|
||||||
<button v-if="isSelf && isTurn"
|
|
||||||
:disabled="!goStore.self || !c || !props.player.turn.effects_availables.some(e => (e.effect == CardEffects.SACRIFICE) && e.usable)"
|
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.SACRIFICE) && e.usable)!, c)">SACRIFICE</button>
|
|
||||||
</CardPreview>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+55
-78
@@ -1,36 +1,23 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import goStore, { useEffect, playCard, playAllCards, discard, lockCard, heal, damage_champion, damage_team } from '~/netcode';
|
import goStore, { useEffect, playCard, playAllCards, discard, lockCard, heal, damage_champion, damage_team } from '~/netcode';
|
||||||
import type { Card } from '~/netcode/Card';
|
import type { Card } from '~/netcode/Card';
|
||||||
import type { Player } from '~/netcode/Player';
|
|
||||||
import { CardEffects } from '@/netcode/Effect'
|
import { CardEffects } from '@/netcode/Effect'
|
||||||
import { CardType } from '~/netcode/Card';
|
import { CardType } from '~/netcode/Card';
|
||||||
|
|
||||||
export interface Props {
|
const isTurn = computed(() => goStore.self?.team == goStore.game?.current_turn)
|
||||||
player: Player
|
|
||||||
}
|
|
||||||
const props = defineProps<Props>()
|
|
||||||
|
|
||||||
const isTurn = computed(() => props.player.team == goStore.game?.current_turn)
|
|
||||||
const isSelf = computed(() => props.player.uuid == goStore.self?.uuid)
|
|
||||||
|
|
||||||
const discard_unwrapped = ref(false)
|
const discard_unwrapped = ref(false)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="'player ' + (isTurn ? 'turn' : '')">
|
<div :class="'player ' + (isTurn ? 'turn' : '')">
|
||||||
<button @click="heal" v-if="props.player.team == goStore.self?.team"
|
<button @click="heal" v-if="goStore.self?.team == goStore.self?.team"
|
||||||
:disabled="(goStore.self?.turn.heal_reserve ?? 0) <= 0">
|
:disabled="(goStore.self?.turn.heal_reserve ?? 0) <= 0">
|
||||||
Heal
|
Heal
|
||||||
</button>
|
</button>
|
||||||
<button @click="damage_team(props.player.team)" v-if="props.player.team != goStore.self?.team"
|
<button v-if="goStore.self && goStore.self?.team != goStore.self?.team"
|
||||||
:disabled="(goStore.self?.turn.damage_reserve ?? 0) <= 0">
|
@click="useEffect(goStore.self?.turn.effects_availables.find(e => (e.effect == CardEffects.DISCARD) && e.usable)!, goStore.self)"
|
||||||
Damage
|
|
||||||
</button>
|
|
||||||
<button v-if="props.player.team != goStore.self?.team"
|
|
||||||
@click="useEffect(goStore.self?.turn.effects_availables.find(e => (e.effect == CardEffects.DISCARD) && e.usable)!, props.player)"
|
|
||||||
:disabled="!goStore.self?.turn.effects_availables.some(e => (e.effect == CardEffects.DISCARD) && e.usable)">
|
:disabled="!goStore.self?.turn.effects_availables.some(e => (e.effect == CardEffects.DISCARD) && e.usable)">
|
||||||
make Discard</button>
|
make Discard</button>
|
||||||
<div id="turn_data">
|
<div id="turn_data">
|
||||||
@@ -38,42 +25,42 @@ const discard_unwrapped = ref(false)
|
|||||||
<div class="turn_icon">
|
<div class="turn_icon">
|
||||||
<img src="/images/heal.png" />
|
<img src="/images/heal.png" />
|
||||||
<span class="turn_icon_number">
|
<span class="turn_icon_number">
|
||||||
{{ props.player.turn.heal_reserve }}
|
{{ goStore.self?.turn.heal_reserve }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="turn_icon">
|
<div class="turn_icon">
|
||||||
<img src="/images/damage.png" />
|
<img src="/images/damage.png" />
|
||||||
<span class="turn_icon_number">
|
<span class="turn_icon_number">
|
||||||
{{ props.player.turn.damage_reserve }}
|
{{ goStore.self?.turn.damage_reserve }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="turn_icon">
|
<div class="turn_icon">
|
||||||
<img src="/images/gold.png" />
|
<img src="/images/gold.png" />
|
||||||
<span class="turn_icon_number">
|
<span class="turn_icon_number">
|
||||||
{{ props.player.turn.gold_reserve }}
|
{{ goStore.self?.turn.gold_reserve }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="turn_icon">
|
<div class="turn_icon">
|
||||||
<img src="/images/champion-shield.png" />
|
<img src="/images/champion-shield.png" />
|
||||||
<span class="turn_icon_number">
|
<span class="turn_icon_number">
|
||||||
{{ props.player.team.health }}
|
{{ goStore.self?.team.health }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cards_container" id="self_hand">
|
<div class="cards_container" id="self_hand">
|
||||||
<button v-if="isSelf && isTurn && props.player.hand.length > 1"
|
<button v-if="isTurn && (goStore.self?.hand.length ?? 0) > 1"
|
||||||
@click="playAllCards(props.player.hand as Card[])">
|
@click="playAllCards(goStore.self?.hand as Card[])">
|
||||||
PLAY ALL
|
PLAY ALL
|
||||||
</button>
|
</button>
|
||||||
<CardPreview :data="c" v-for=" c in props.player.hand " @click="c && playCard(c)">
|
<CardPreview :data="c" v-for=" c in goStore.self?.hand " @click="c && playCard(c)">
|
||||||
<button v-if="c && isSelf && isTurn" @click="playCard(c)">PLAY</button>
|
<button v-if="c && isTurn" @click="playCard(c)">PLAY</button>
|
||||||
<button v-if="c && isSelf && isTurn && props.player.turn.discard_markers > 0"
|
<button v-if="c && isTurn && (goStore.self?.turn.discard_markers ?? 0) > 0"
|
||||||
@click="discard(c)">DISCARD</button>
|
@click="discard(c!)">DISCARD</button>
|
||||||
</CardPreview>
|
</CardPreview>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span>discard_markers = {{ props.player.turn.discard_markers }} <br></span>
|
<span>discard_markers = {{ goStore.self?.turn.discard_markers }} <br></span>
|
||||||
<span>effects_availables = <div v-for="e in props.player.turn.effects_availables">
|
<span>effects_availables = <div v-for="e in goStore.self?.turn.effects_availables">
|
||||||
<button @click="useEffect(e)" :disabled="!e.usable">
|
<button @click="useEffect(e)" :disabled="!e.usable">
|
||||||
{{ e.effect + ' ' + e.effect_type }}
|
{{ e.effect + ' ' + e.effect_type }}
|
||||||
</button>
|
</button>
|
||||||
@@ -82,76 +69,73 @@ const discard_unwrapped = ref(false)
|
|||||||
<br>
|
<br>
|
||||||
board =
|
board =
|
||||||
<div class="cards_container">
|
<div class="cards_container">
|
||||||
<CardPreview :data="c" v-for=" c in props.player.board " @click="lockCard(c)"
|
<CardPreview :data="c" v-for=" c in goStore.self?.board " @click="lockCard(c)"
|
||||||
:locked="c.uuid in props.player.turn.cards_locked">
|
:locked="c.uuid in (goStore.self?.turn.cards_locked ?? [])">
|
||||||
<button v-if="isSelf && isTurn && props.player.turn.discard_markers > 0"
|
<button v-if="isTurn && (goStore.self?.turn.discard_markers ?? 0) > 0"
|
||||||
@click="discard(c)">DISCARD</button>
|
@click="discard(c)">DISCARD</button>
|
||||||
<button v-if="isSelf && isTurn && props.player.turn.discard_markers == 0" @click="lockCard(c)"
|
<button v-if="isTurn && goStore.self?.turn.discard_markers == 0" @click="lockCard(c)"
|
||||||
:disabled="c.uuid in props.player.turn.cards_locked">
|
:disabled="c.uuid in goStore.self?.turn.cards_locked">
|
||||||
LOCK
|
LOCK
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="isSelf && isTurn && props.player.turn.effects_availables.some(e => (e.effect == CardEffects.SACRIFICE) && e.usable)"
|
v-if="isTurn && goStore.self?.turn.effects_availables.some(e => (e.effect == CardEffects.SACRIFICE) && e.usable)"
|
||||||
:disabled="!goStore.self || !c || c.uuid in props.player.turn.cards_locked"
|
:disabled="!goStore.self || !c || c.uuid in goStore.self?.turn.cards_locked"
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.SACRIFICE) && e.usable)!, c)">SACRIFICE</button>
|
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.SACRIFICE) && e.usable)!, c)">SACRIFICE</button>
|
||||||
|
|
||||||
|
|
||||||
<div>{{ c.health_as_champion }}</div>
|
<div>{{ c.health_as_champion }}</div>
|
||||||
<button
|
|
||||||
v-if="!isSelf && !isTurn && goStore.self?.team == goStore.game?.current_turn && (c.health_as_champion ?? 0) > 0"
|
|
||||||
:disabled="(goStore.self?.turn.damage_reserve ?? 0) <= 0"
|
|
||||||
@click="damage_champion(c)">DAMAGE</button>
|
|
||||||
<button
|
|
||||||
v-if="!isSelf && !isTurn && goStore.self?.team == goStore.game?.current_turn && goStore.self?.turn.effects_availables.some(e => (e.effect == CardEffects.STUN) && e.usable) && (c.health_as_champion ?? 0) > 0"
|
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.STUN) && e.usable)!, c)">STUN</button>
|
|
||||||
</CardPreview>
|
</CardPreview>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
stack =
|
|
||||||
<CardSlot :stack="props.player.stack_pile">
|
|
||||||
<!-- <button v-if="isSelf && isTurn" @click="draw">DRAW</button> -->
|
|
||||||
</CardSlot>
|
|
||||||
<br>
|
|
||||||
discard =
|
|
||||||
|
|
||||||
{{ props.player.discard_pile.length }}
|
<div class="stack_and_discard">
|
||||||
|
<div>
|
||||||
<input type="checkbox" v-model="discard_unwrapped" />
|
<input type="checkbox" v-model="discard_unwrapped" />
|
||||||
|
<div class="cards_container">
|
||||||
|
|
||||||
<CardPreview v-if="!discard_unwrapped" :data="props.player.discard_pile.at(-1)">
|
<template v-for="c in goStore.self?.discard_pile ">
|
||||||
<!-- <button v-if="isSelf && isTurn" @click="play_from_discard(props.player.discard_pile.at(-1))">DRAW</button>
|
<CardPreview :data="c" :wrapped="!discard_unwrapped">
|
||||||
<button v-if="isSelf && isTurn" @click="put_on_stack_from_discard(props.player.discard_pile.at(-1))">PUT ON
|
|
||||||
STACK</button> -->
|
|
||||||
|
|
||||||
<button v-if="isSelf && isTurn"
|
|
||||||
:disabled="!goStore.self || !props.player.discard_pile.at(-1) || !props.player.turn.effects_availables.some(e => (e.effect == CardEffects.SACRIFICE) && e.usable) || props.player.discard_pile.at(-1)!.uuid in props.player.turn.cards_locked"
|
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.SACRIFICE) && e.usable)!, props.player.discard_pile.at(-1))">SACRIFICE</button>
|
|
||||||
</CardPreview>
|
|
||||||
|
|
||||||
<template v-if="discard_unwrapped" v-for="c in props.player.discard_pile ">
|
|
||||||
<CardPreview :data="c">
|
|
||||||
<!-- <button v-if="isSelf && isTurn" @click="play_from_discard(c)">DRAW</button>
|
<!-- <button v-if="isSelf && isTurn" @click="play_from_discard(c)">DRAW</button>
|
||||||
<button v-if="isSelf && isTurn" @click="put_on_stack_from_discard(c)">PUT ON STACK</button>
|
<button v-if="isSelf && isTurn" @click="put_on_stack_from_discard(c)">PUT ON STACK</button>
|
||||||
-->
|
-->
|
||||||
<button v-if="isSelf && isTurn && c.card_type == CardType.CHAMPION"
|
<button v-if="isTurn && c.card_type == CardType.CHAMPION"
|
||||||
:disabled="!goStore.self || !c || !props.player.turn.effects_availables.some(e => (e.effect == CardEffects.RESTACK_DISCARDED_CHAMPION) && e.usable)"
|
:disabled="!goStore.self || !c || !goStore.self?.turn.effects_availables.some(e => (e.effect == CardEffects.RESTACK_DISCARDED_CHAMPION) && e.usable)"
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.RESTACK_DISCARDED_CHAMPION) && e.usable)!, c)">RESTACK
|
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.RESTACK_DISCARDED_CHAMPION) && e.usable)!, c)">RESTACK
|
||||||
(champion)</button>
|
(champion)</button>
|
||||||
|
|
||||||
<button v-if="isSelf && isTurn"
|
<button v-if="isTurn"
|
||||||
:disabled="!goStore.self || !c || !props.player.turn.effects_availables.some(e => (e.effect == CardEffects.RESTACK_DISCARDED_CARD) && e.usable)"
|
:disabled="!goStore.self || !c || !goStore.self?.turn.effects_availables.some(e => (e.effect == CardEffects.RESTACK_DISCARDED_CARD) && e.usable)"
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.RESTACK_DISCARDED_CARD) && e.usable)!, c)">RESTACK
|
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.RESTACK_DISCARDED_CARD) && e.usable)!, c)">RESTACK
|
||||||
(card)</button>
|
(card)</button>
|
||||||
<button v-if="isSelf && isTurn"
|
<button v-if="isTurn"
|
||||||
:disabled="!goStore.self || !c || !props.player.turn.effects_availables.some(e => (e.effect == CardEffects.SACRIFICE) && e.usable)"
|
:disabled="!goStore.self || !c || !goStore.self?.turn.effects_availables.some(e => (e.effect == CardEffects.SACRIFICE) && e.usable)"
|
||||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.SACRIFICE) && e.usable)!, c)">SACRIFICE</button>
|
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.SACRIFICE) && e.usable)!, c)">SACRIFICE</button>
|
||||||
</CardPreview>
|
</CardPreview>
|
||||||
</template>
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="separator"></div>
|
||||||
|
<div class="separator"></div>
|
||||||
|
|
||||||
|
<CardSlot :stack="goStore.self?.stack_pile">
|
||||||
|
<!-- <button v-if="isSelf && isTurn" @click="draw">DRAW</button> -->
|
||||||
|
</CardSlot>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.stack_and_discard {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.player {
|
.player {
|
||||||
border-top: 5px solid black;
|
border-top: 5px solid black;
|
||||||
}
|
}
|
||||||
@@ -181,14 +165,7 @@ const discard_unwrapped = ref(false)
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%, -50%);
|
const stack_unwrapped=ref(false) position: fixed;
|
||||||
}
|
|
||||||
|
|
||||||
#self_hand {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
position: fixed;
|
|
||||||
right: 60px;
|
right: 60px;
|
||||||
bottom: -50px;
|
bottom: -50px;
|
||||||
max-width: 100vw;
|
max-width: 100vw;
|
||||||
|
|||||||
Reference in New Issue
Block a user