[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 type { Player } from "~/netcode/Player";
|
||||
import { CardEffects, type Effect } from "@/netcode/Effect";
|
||||
import type { Team } from "~/netcode/Team";
|
||||
|
||||
export interface Props {
|
||||
player: Player;
|
||||
@@ -55,16 +56,21 @@ const prepare_champion = (target: Card) => run_effect(CardEffects.PREPARE, targe
|
||||
|
||||
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() {
|
||||
// TODO: Add a confirmation dialog if resources are left
|
||||
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)
|
||||
)) {
|
||||
&& has_actions_remaining()) {
|
||||
// Set a warning flag to true
|
||||
// Display an alert somehow using this warning flag
|
||||
warning.value = true
|
||||
@@ -74,8 +80,6 @@ function checkEndTurn() {
|
||||
endTurn()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user