Closes #48
This commit is contained in:
@@ -20,6 +20,7 @@ const discard_unwrapped = ref<boolean>(false)
|
|||||||
<PlayerSlot v-for="p in current_players" :player="p"></PlayerSlot>
|
<PlayerSlot v-for="p in current_players" :player="p"></PlayerSlot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<SelfView></SelfView>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import goStore, {
|
|||||||
heal,
|
heal,
|
||||||
damage_champion,
|
damage_champion,
|
||||||
damage_team,
|
damage_team,
|
||||||
|
endTurn
|
||||||
|
|
||||||
} from "~/netcode";
|
} from "~/netcode";
|
||||||
import { CardType, type Card } from "~/netcode/Card";
|
import { CardType, type Card } from "~/netcode/Card";
|
||||||
@@ -51,6 +52,30 @@ const restack_discarded_champion = (target: Card) => run_effect(CardEffects.REST
|
|||||||
const restack_discarded_card = (target: Card) => run_effect(CardEffects.RESTACK_DISCARDED_CARD, target)
|
const restack_discarded_card = (target: Card) => run_effect(CardEffects.RESTACK_DISCARDED_CARD, target)
|
||||||
const prepare_champion = (target: Card) => run_effect(CardEffects.PREPARE, target)
|
const prepare_champion = (target: Card) => run_effect(CardEffects.PREPARE, target)
|
||||||
|
|
||||||
|
|
||||||
|
let warning = ref(false)
|
||||||
|
|
||||||
|
function checkEndTurn() {
|
||||||
|
// TODO: Add a confirmation dialog if resources are left
|
||||||
|
console.log("Checking end turn")
|
||||||
|
if (
|
||||||
|
(!warning.value)
|
||||||
|
&& (
|
||||||
|
(goStore.self?.turn?.damage_reserve ? goStore.self?.turn?.damage_reserve > 0 : false)
|
||||||
|
|| (goStore.self?.turn?.gold_reserve ? goStore.self?.turn?.gold_reserve > 0 : false)
|
||||||
|
|| (goStore.self?.turn?.fuck_u_markers ? goStore.self?.turn?.fuck_u_markers > 0 : false)
|
||||||
|
)) {
|
||||||
|
// Set a warning flag to true
|
||||||
|
// Display an alert somehow using this warning flag
|
||||||
|
warning.value = true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
warning.value = false
|
||||||
|
endTurn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -101,10 +126,13 @@ const prepare_champion = (target: Card) => run_effect(CardEffects.PREPARE, targe
|
|||||||
</div>
|
</div>
|
||||||
<div id="player_stats">
|
<div id="player_stats">
|
||||||
<template v-if="goStore.current_game?.started">
|
<template v-if="goStore.current_game?.started">
|
||||||
<PlayerStats v-if="props.player !== goStore.self || hide_stack_and_discard" :player="props.player">
|
<PlayerStats :player="props.player">
|
||||||
</PlayerStats>
|
</PlayerStats>
|
||||||
<SelfView v-if="props.player === goStore.self && !hide_stack_and_discard" :player="props.player">
|
<template v-if="!hide_stack_and_discard">
|
||||||
</SelfView>
|
<button id="end_turn" v-if="isSelfTurn" @click="checkEndTurn">END TURN</button>
|
||||||
|
<div class="warning" v-if="warning">/!\<br> Effets restants!<br> /!\</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -182,6 +210,20 @@ const prepare_champion = (target: Card) => run_effect(CardEffects.PREPARE, targe
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.warning {
|
||||||
|
background-color: rgba(255, 0, 0, 0.7);
|
||||||
|
color: white;
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
width: 60px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#end_turn {
|
||||||
|
z-index: 10;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.stack,
|
.stack,
|
||||||
.discard,
|
.discard,
|
||||||
.cards_container {
|
.cards_container {
|
||||||
|
|||||||
+11
-29
@@ -4,40 +4,13 @@ import { CardEffects } from '@/netcode/Effect'
|
|||||||
|
|
||||||
const isTurn = computed(() => goStore.self?.team == goStore.current_game?.current_turn)
|
const isTurn = computed(() => goStore.self?.team == goStore.current_game?.current_turn)
|
||||||
|
|
||||||
let warning = ref(false)
|
|
||||||
|
|
||||||
function checkEndTurn() {
|
|
||||||
// TODO: Add a confirmation dialog if resources are left
|
|
||||||
console.log("Checking end turn")
|
|
||||||
if (
|
|
||||||
(!warning.value)
|
|
||||||
&& (
|
|
||||||
(goStore.self?.turn?.damage_reserve ? goStore.self?.turn?.damage_reserve > 0 : false)
|
|
||||||
|| (goStore.self?.turn?.gold_reserve ? goStore.self?.turn?.gold_reserve > 0 : false)
|
|
||||||
|| (goStore.self?.turn?.fuck_u_markers ? goStore.self?.turn?.fuck_u_markers > 0 : false)
|
|
||||||
)) {
|
|
||||||
// Set a warning flag to true
|
|
||||||
// Display an alert somehow using this warning flag
|
|
||||||
warning.value = true
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
warning.value = false
|
|
||||||
endTurn()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
||||||
<PlayerStats v-if="goStore.self" :player='goStore.self'></PlayerStats>
|
|
||||||
<button id="end_turn" v-if="isTurn" @click="checkEndTurn">END TURN</button>
|
|
||||||
<div class="warning" v-if="warning">/!\<br> Effets restants!<br> /!\</div>
|
|
||||||
<div class="cards_container" id="self_hand">
|
<div class="cards_container" id="self_hand">
|
||||||
<CardPreview :card_id="c?.card_id" v-for=" c in goStore.self?.hand " @click="c && playCard(c)">
|
<CardPreview :card_id="c?.card_id" v-for=" c in goStore.self?.hand " @click="c && playCard(c)">
|
||||||
<button v-if="c && isTurn && goStore.self?.turn && (goStore.self.turn.discard_markers ?? 0) > 0"
|
<button v-if="c && goStore.self?.turn && (goStore.self.turn.fuck_u_markers ?? 0) > 0"
|
||||||
@click="discard(c!)">DISCARD</button>
|
@click="discard(c)">DISCARD</button>
|
||||||
</CardPreview>
|
</CardPreview>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -118,6 +91,15 @@ function checkEndTurn() {
|
|||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#self_hand .card #contextMenuButtons {
|
||||||
|
top: 0;
|
||||||
|
bottom: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
#self_hand .card.active:hover #contextMenuButtons {
|
||||||
|
transform: translateY(-100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#self_hand .card:hover {
|
#self_hand .card:hover {
|
||||||
transform: translateY(-40px);
|
transform: translateY(-40px);
|
||||||
|
|||||||
Reference in New Issue
Block a user