fix: warn properly on end turn
This commit is contained in:
+13
-9
@@ -8,11 +8,14 @@ let warning = ref(false)
|
||||
|
||||
function checkEndTurn() {
|
||||
// TODO: Add a confirmation dialog if resources are left
|
||||
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)) {
|
||||
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
|
||||
@@ -21,7 +24,6 @@ function checkEndTurn() {
|
||||
warning.value = false
|
||||
endTurn()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +36,8 @@ function checkEndTurn() {
|
||||
:disabled="!goStore.self.turn.find_effect(CardEffects.MAKE_DISCARD)">
|
||||
make Discard</button>
|
||||
<div id="turn_data">
|
||||
<div class="warning" v-if="warning">ATTENTION: il reste des ressources!</div>
|
||||
<button id="end_turn" v-if="isTurn" @click="">END TURN</button>
|
||||
<div class="warning" v-if="warning">/!\<br> Effets restants!<br> /!\</div>
|
||||
<button id="end_turn" v-if="isTurn" @click="checkEndTurn">END TURN</button>
|
||||
<PlayerStats v-if="goStore.self" :player='goStore.self'></PlayerStats>
|
||||
</div>
|
||||
|
||||
@@ -84,10 +86,12 @@ function checkEndTurn() {
|
||||
}
|
||||
|
||||
.warning {
|
||||
background-color: red;
|
||||
background-color: rgba(255, 0, 0, 0.7);
|
||||
color: white;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
width: 60px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
#end_turn {
|
||||
|
||||
Reference in New Issue
Block a user