Playtest
This commit is contained in:
+64
-21
@@ -1,7 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import goStore, { useEffect, playCard, playAllCards, discard, lockCard } from '~/netcode';
|
||||
import goStore, { useEffect, playCard, playAllCards, discard, lockCard, heal, damage_champion, damage_team } from '~/netcode';
|
||||
import type { Card } from '~/netcode/Card';
|
||||
import type { Player } from '~/netcode/Player';
|
||||
import { CardEffects } from '@/netcode/Effect'
|
||||
import { CardType } from '~/netcode/Card';
|
||||
|
||||
export interface Props {
|
||||
player: Player
|
||||
@@ -11,7 +13,7 @@ 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_wrapped = ref(false)
|
||||
const discard_unwrapped = ref(false)
|
||||
|
||||
|
||||
|
||||
@@ -19,15 +21,28 @@ const discard_wrapped = ref(false)
|
||||
|
||||
<template>
|
||||
<div :class="'player ' + (isTurn ? 'turn' : '')">
|
||||
<button @click="heal" v-if="props.player.team == goStore.self?.team"
|
||||
:disabled="(goStore.self?.turn.heal_reserve ?? 0) <= 0">
|
||||
Heal
|
||||
</button>
|
||||
<button @click="damage_team(props.player.team)" v-if="props.player.team != goStore.self?.team"
|
||||
:disabled="(goStore.self?.turn.damage_reserve ?? 0) <= 0">
|
||||
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)">
|
||||
make Discard</button>
|
||||
<div id="turn" v-if="props.player.turn">
|
||||
champions_health = {{ props.player.turn.champions_health }} <br>
|
||||
heal_reserve = {{ props.player.turn.heal_reserve }} <br>
|
||||
damage_reserve = {{ props.player.turn.damage_reserve }} <br>
|
||||
gold_reserve = {{ props.player.turn.gold_reserve }} <br>
|
||||
discard_markers = {{ props.player.turn.discard_markers }} <br>
|
||||
effects_availables = <div v-for="e in props.player.turn.effects_availables" :key="e.uuid"
|
||||
@click="useEffect(e)">
|
||||
{{ e.effect + '*' + 1 }}
|
||||
effects_availables = <div v-for="e in props.player.turn.effects_availables">
|
||||
<button v-if="e" @click="useEffect(e)">
|
||||
{{ e.effect + ' ' + e.effect_type }}
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -35,13 +50,11 @@ const discard_wrapped = ref(false)
|
||||
<div v-if="isSelf"><b>YOU</b></div>
|
||||
username = <b>{{ props.player.username }}</b>
|
||||
<br>
|
||||
health =
|
||||
<template v-if="!isSelf">{{ player.team.health }}</template>
|
||||
<!-- <input type="number" :value="player.team.health" v-if="isSelf" @change="setHealth" /> -->
|
||||
health = {{ props.player.team.health }}
|
||||
<br>
|
||||
hand =
|
||||
<div class="cards_container">
|
||||
<CardPreview :data="c" v-for="c in props.player.hand">
|
||||
<CardPreview :data="c" v-for=" c in props.player.hand " @click="c && playCard(c)">
|
||||
<button v-if="c && isSelf && isTurn" @click="playCard(c)">PLAY</button>
|
||||
<button v-if="c && isSelf && isTurn && props.player.turn.discard_markers > 0"
|
||||
@click="discard(c)">DISCARD</button>
|
||||
@@ -53,13 +66,28 @@ const discard_wrapped = ref(false)
|
||||
<br>
|
||||
board =
|
||||
<div class="cards_container">
|
||||
<CardPreview :data="c" v-for="c in props.player.board"
|
||||
:locked="Object.values(props.player.turn.cards_locked).includes(c)">
|
||||
<CardPreview :data="c" v-for=" c in props.player.board " @click="lockCard(c)"
|
||||
:locked="c.uuid in props.player.turn.cards_locked">
|
||||
<button v-if="isSelf && isTurn && props.player.turn.discard_markers > 0"
|
||||
@click="discard(c)">DISCARD</button>
|
||||
<button v-if="isSelf && isTurn && props.player.turn.discard_markers == 0"
|
||||
@click="lockCard(c)">LOCK</button>
|
||||
<button v-if="!isSelf && !isTurn"></button>
|
||||
<button v-if="isSelf && isTurn && props.player.turn.discard_markers == 0" @click="lockCard(c)"
|
||||
:disabled="c.uuid in props.player.turn.cards_locked">
|
||||
LOCK
|
||||
</button>
|
||||
<button
|
||||
v-if="isSelf && isTurn && props.player.turn.effects_availables.some(e => (e.effect == CardEffects.SACRIFICE) && e.usable)"
|
||||
:disabled="!goStore.self || !c || c.uuid in props.player.turn.cards_locked"
|
||||
@click="useEffect(goStore.self!.turn.effects_availables.find(e => (e.effect == CardEffects.SACRIFICE) && e.usable)!, c)">SACRIFICE</button>
|
||||
|
||||
|
||||
<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>
|
||||
</div>
|
||||
<br>
|
||||
@@ -71,20 +99,35 @@ const discard_wrapped = ref(false)
|
||||
discard =
|
||||
|
||||
{{ props.player.discard_pile.length }}
|
||||
<input type="checkbox" v-model="discard_wrapped" />
|
||||
<input type="checkbox" v-model="discard_unwrapped" />
|
||||
|
||||
<CardPreview v-if="!discard_wrapped" :data="props.player.discard_pile.at(-1) ?? null">
|
||||
<CardPreview v-if="!discard_unwrapped" :data="props.player.discard_pile.at(-1) ?? null">
|
||||
<!-- <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" @click="sacrifice(props.player.discard_pile.at(-1))">SACRIFICE</button> -->
|
||||
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_wrapped" v-for="c in props.player.discard_pile">
|
||||
<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" @click="sacrifice(c)">SACRIFICE</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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user