feat: fire gem warning

This commit is contained in:
2024-05-16 23:30:47 +02:00
parent fea9f96fe6
commit e0ac743c7a
+17 -3
View File
@@ -30,6 +30,7 @@ const isPlayerTurn = computed(() => props.player.team === goStore.current_game?.
const isSelf = computed(() => props.player.uuid === goStore.self?.uuid); const isSelf = computed(() => props.player.uuid === goStore.self?.uuid);
const isSelfTurn = computed(() => goStore.self?.team === goStore.current_game?.current_turn) const isSelfTurn = computed(() => goStore.self?.team === goStore.current_game?.current_turn)
const isPlayerEnemy = computed(() => goStore.self?.team !== props.player.team) const isPlayerEnemy = computed(() => goStore.self?.team !== props.player.team)
const warningText = ref("Effets restants!")
function run_effect( function run_effect(
effect_type: CardEffects, effect_type: CardEffects,
@@ -58,13 +59,17 @@ let warning = ref(false)
function has_actions_remaining(): boolean { function has_actions_remaining(): boolean {
return (goStore.self?.turn?.damage_reserve ? goStore.self?.turn?.damage_reserve > 0 : false) return (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?.gold_reserve ? goStore.self?.turn?.gold_reserve >= goStore.current_game?.market.reduce((min, card) => Math.min(min, card?.cost ?? Infinity), Infinity) : false)
|| (goStore.self?.turn?.fuck_u_markers ? goStore.self?.turn?.fuck_u_markers > 0 : false) || (goStore.self?.turn?.fuck_u_markers ? goStore.self?.turn?.fuck_u_markers > 0 : false)
|| !goStore.self?.turn?.effects_availables.every(e => !e.usable) || !goStore.self?.turn?.effects_availables.every(e => !e.usable)
|| !goStore.self?.board.every(c => (c.uuid in (goStore.self?.turn?.cards_locked ?? {}))) || !goStore.self?.board.every(c => (c.uuid in (goStore.self?.turn?.cards_locked ?? {})))
|| false || false
} }
function can_buy_fire_gem(): boolean {
return (goStore.self?.turn?.gold_reserve ? goStore.self?.turn?.gold_reserve >= 2 : false)
}
function checkEndTurn() { function checkEndTurn() {
// TODO: Add a confirmation dialog if resources are left // TODO: Add a confirmation dialog if resources are left
console.log("Checking end turn") console.log("Checking end turn")
@@ -75,7 +80,12 @@ function checkEndTurn() {
// Display an alert somehow using this warning flag // Display an alert somehow using this warning flag
warning.value = true warning.value = true
} }
else if (!warning.value && can_buy_fire_gem()) {
warningText.value = "P'tite Fire gem?"
warning.value = true
}
else { else {
warningText.value = "Effets restants!"
warning.value = false warning.value = false
endTurn() endTurn()
} }
@@ -141,7 +151,7 @@ function damage_team_all(team: Team) {
</PlayerStats> </PlayerStats>
<template v-if="!hide_stack_and_discard"> <template v-if="!hide_stack_and_discard">
<button id="end_turn" v-if="isSelfTurn" class="end_turn_button" @click="checkEndTurn">END TURN</button> <button id="end_turn" v-if="isSelfTurn" class="end_turn_button" @click="checkEndTurn">END TURN</button>
<div class="warning" v-if="warning">/!\<br> Effets restants!</div> <div class="warning" v-if="warning" :class="{'warning-fire-gem': warningText == 'P\'tite Fire gem?'}">/!\<br>{{warningText}}</div>
</template> </template>
</template> </template>
@@ -236,11 +246,15 @@ function damage_team_all(team: Team) {
color: white; color: white;
padding: 5px; padding: 5px;
border-radius: 5px; border-radius: 5px;
width: 85px; width: 90px;
font-size: 0.85em; font-size: 0.85em;
margin-left: 5px; margin-left: 5px;
} }
.warning-fire-gem {
background-color: rgba(255, 165, 0, 0.7);
}
#end_turn { #end_turn {
z-index: 10; z-index: 10;
height: 100%; height: 100%;