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