Feat : allow damage champion

This commit is contained in:
2024-07-14 00:19:16 +02:00
parent 3c5b30be9e
commit 2e201fa14e
2 changed files with 19 additions and 3 deletions
+14 -3
View File
@@ -28,7 +28,12 @@ const props = withDefaults(defineProps<Props>(), {
championsKillable: () => false, championsKillable: () => false,
}); });
const emit = defineEmits(["cardClick", "effectClick", "tokenClick"]); const emit = defineEmits([
"cardClick",
"effectClick",
"tokenClick",
"damageChampionClick",
]);
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
@@ -115,7 +120,9 @@ function tokenClick(token: Effect, card: Card) {
emit("tokenClick", { token, card }); emit("tokenClick", { token, card });
} }
function damageChampion() {} function damageChampionClick(card: Card) {
emit("damageChampionClick", card);
}
</script> </script>
<template> <template>
@@ -167,7 +174,11 @@ function damageChampion() {}
" "
></TokenComponent> ></TokenComponent>
</template> </template>
<button v-if="championsKillable && c.cardType == CardType.CHAMPION"> <button
v-if="championsKillable && c.cardType == CardType.CHAMPION"
@click.stop="damageChampionClick(c)"
@mousedown.left.stop=""
>
Damage Damage
</button> </button>
</CardPreview> </CardPreview>
+5
View File
@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { import {
damageChampion,
endTurn, endTurn,
joinGame, joinGame,
lockCard, lockCard,
@@ -138,6 +139,9 @@ function effectClick(cardUUID: string, effectIndex: number) {
function tokenClick({ card, token }: { card: Card; token: Effect }) { function tokenClick({ card, token }: { card: Card; token: Effect }) {
useToken(props.game._id, token._id, card._id, props.player._id); useToken(props.game._id, token._id, card._id, props.player._id);
} }
function damageChampionClick(card: Card) {
damageChampion(props.game._id, props.player._id, card._id);
}
</script> </script>
<template> <template>
@@ -199,6 +203,7 @@ function tokenClick({ card, token }: { card: Card; token: Effect }) {
:tokens="cardTokens" :tokens="cardTokens"
@tokenClick="tokenClick" @tokenClick="tokenClick"
:championsKillable="!isSelf && isSelfTurn.value" :championsKillable="!isSelf && isSelfTurn.value"
@damageChampionClick="damageChampionClick"
> >
</CardsGrouped> </CardsGrouped>