From e0ac743c7a3d89f8af3859aaff0497ab144c7911 Mon Sep 17 00:00:00 2001 From: Erzangel Date: Thu, 16 May 2024 23:30:47 +0200 Subject: [PATCH] feat: fire gem warning --- components/PlayerSlot.vue | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/components/PlayerSlot.vue b/components/PlayerSlot.vue index 69092d6..bec0664 100644 --- a/components/PlayerSlot.vue +++ b/components/PlayerSlot.vue @@ -30,6 +30,7 @@ const isPlayerTurn = computed(() => props.player.team === goStore.current_game?. const isSelf = computed(() => props.player.uuid === goStore.self?.uuid); const isSelfTurn = computed(() => goStore.self?.team === goStore.current_game?.current_turn) const isPlayerEnemy = computed(() => goStore.self?.team !== props.player.team) +const warningText = ref("Effets restants!") function run_effect( effect_type: CardEffects, @@ -58,13 +59,17 @@ let warning = ref(false) function has_actions_remaining(): boolean { 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?.effects_availables.every(e => !e.usable) || !goStore.self?.board.every(c => (c.uuid in (goStore.self?.turn?.cards_locked ?? {}))) || false } +function can_buy_fire_gem(): boolean { + return (goStore.self?.turn?.gold_reserve ? goStore.self?.turn?.gold_reserve >= 2 : false) +} + function checkEndTurn() { // TODO: Add a confirmation dialog if resources are left console.log("Checking end turn") @@ -75,7 +80,12 @@ function checkEndTurn() { // Display an alert somehow using this warning flag warning.value = true } + else if (!warning.value && can_buy_fire_gem()) { + warningText.value = "P'tite Fire gem?" + warning.value = true + } else { + warningText.value = "Effets restants!" warning.value = false endTurn() } @@ -141,7 +151,7 @@ function damage_team_all(team: Team) { @@ -236,11 +246,15 @@ function damage_team_all(team: Team) { color: white; padding: 5px; border-radius: 5px; - width: 85px; + width: 90px; font-size: 0.85em; margin-left: 5px; } +.warning-fire-gem { + background-color: rgba(255, 165, 0, 0.7); +} + #end_turn { z-index: 10; height: 100%;