Closes #48
This commit is contained in:
@@ -8,6 +8,7 @@ import goStore, {
|
||||
heal,
|
||||
damage_champion,
|
||||
damage_team,
|
||||
endTurn
|
||||
|
||||
} from "~/netcode";
|
||||
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 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>
|
||||
|
||||
<template>
|
||||
@@ -101,10 +126,13 @@ const prepare_champion = (target: Card) => run_effect(CardEffects.PREPARE, targe
|
||||
</div>
|
||||
<div id="player_stats">
|
||||
<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>
|
||||
<SelfView v-if="props.player === goStore.self && !hide_stack_and_discard" :player="props.player">
|
||||
</SelfView>
|
||||
<template v-if="!hide_stack_and_discard">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -182,6 +210,20 @@ const prepare_champion = (target: Card) => run_effect(CardEffects.PREPARE, targe
|
||||
</template>
|
||||
|
||||
<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,
|
||||
.discard,
|
||||
.cards_container {
|
||||
|
||||
Reference in New Issue
Block a user