[Feat] : add card locked and effects available check on end turn warning
release-tag / release-image (push) Successful in 32s
release-tag / release-image (push) Successful in 32s
Closes #44
This commit is contained in:
@@ -14,6 +14,7 @@ import goStore, {
|
|||||||
import { CardType, type Card } from "~/netcode/Card";
|
import { CardType, type Card } from "~/netcode/Card";
|
||||||
import type { Player } from "~/netcode/Player";
|
import type { Player } from "~/netcode/Player";
|
||||||
import { CardEffects, type Effect } from "@/netcode/Effect";
|
import { CardEffects, type Effect } from "@/netcode/Effect";
|
||||||
|
import type { Team } from "~/netcode/Team";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
player: Player;
|
player: Player;
|
||||||
@@ -55,16 +56,21 @@ const prepare_champion = (target: Card) => run_effect(CardEffects.PREPARE, targe
|
|||||||
|
|
||||||
let warning = ref(false)
|
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?.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 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")
|
||||||
if (
|
if (
|
||||||
(!warning.value)
|
(!warning.value)
|
||||||
&& (
|
&& has_actions_remaining()) {
|
||||||
(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
|
||||||
@@ -74,8 +80,6 @@ function checkEndTurn() {
|
|||||||
endTurn()
|
endTurn()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in New Issue
Block a user