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,
});
const emit = defineEmits(["cardClick", "effectClick", "tokenClick"]);
const emit = defineEmits([
"cardClick",
"effectClick",
"tokenClick",
"damageChampionClick",
]);
const settingsStore = useSettingsStore();
@@ -115,7 +120,9 @@ function tokenClick(token: Effect, card: Card) {
emit("tokenClick", { token, card });
}
function damageChampion() {}
function damageChampionClick(card: Card) {
emit("damageChampionClick", card);
}
</script>
<template>
@@ -167,7 +174,11 @@ function damageChampion() {}
"
></TokenComponent>
</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
</button>
</CardPreview>
+5
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import {
damageChampion,
endTurn,
joinGame,
lockCard,
@@ -138,6 +139,9 @@ function effectClick(cardUUID: string, effectIndex: number) {
function tokenClick({ card, token }: { card: Card; token: Effect }) {
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>
<template>
@@ -199,6 +203,7 @@ function tokenClick({ card, token }: { card: Card; token: Effect }) {
:tokens="cardTokens"
@tokenClick="tokenClick"
:championsKillable="!isSelf && isSelfTurn.value"
@damageChampionClick="damageChampionClick"
>
</CardsGrouped>