diff --git a/components/MarketCards.vue b/components/MarketCards.vue index 0b038ad..e8e1600 100644 --- a/components/MarketCards.vue +++ b/components/MarketCards.vue @@ -4,7 +4,9 @@ import { CardEffects, type Effect } from '@/netcode/Effect' import { CardType } from '@/netcode/Card' const isTurn = computed(() => goStore.self && goStore.current_game?.started && (goStore.self.team == goStore.current_game.current_turn)) +const clientStore = useClientSideStore() +const buyableFiregem = computed(() => goStore?.current_game?.gem_stack.at(-1)) diff --git a/components/PlayerSlot.vue b/components/PlayerSlot.vue index 766f8a5..525feb4 100644 --- a/components/PlayerSlot.vue +++ b/components/PlayerSlot.vue @@ -15,6 +15,7 @@ import { CardType, type Card } from "~/netcode/Card"; import type { Player } from "~/netcode/Player"; import { CardEffects, type Effect, EffectType } from "@/netcode/Effect"; import type { Team } from "~/netcode/Team"; +import { useClientSideStore } from "~/stores/turn"; export interface Props { player: Player; @@ -31,28 +32,15 @@ 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, - target: Player | Card -) { - if (!goStore.self?.turn) { - return - } - const effect = goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == effect_type) && e.usable); - if (!effect) { - return; - } - useEffect(effect, target); -} +const clientStore = useClientSideStore() const make_discard = (target: Player) => - run_effect(CardEffects.MAKE_DISCARD, target); -const sacrifice = (target: Card) => run_effect(CardEffects.SACRIFICE, target); -const stun = (target: Card) => run_effect(CardEffects.STUN, target) -const restack_discarded_champion = (target: Card) => run_effect(CardEffects.RESTACK_DISCARDED_CHAMPION, target) -const restack_discarded_card = (target: Card) => run_effect(CardEffects.RESTACK_DISCARDED_CARD, target) -const prepare_champion = (target: Card) => run_effect(CardEffects.PREPARE, target) + clientStore.findUseEffect(CardEffects.MAKE_DISCARD, target); +const sacrifice = (target: Card) => clientStore.findUseEffect(CardEffects.SACRIFICE, target); +const stun = (target: Card) => clientStore.findUseEffect(CardEffects.STUN, target) +const restack_discarded_champion = (target: Card) => clientStore.findUseEffect(CardEffects.RESTACK_DISCARDED_CHAMPION, target) +const restack_discarded_card = (target: Card) => clientStore.findUseEffect(CardEffects.RESTACK_DISCARDED_CARD, target) +const prepare_champion = (target: Card) => clientStore.findUseEffect(CardEffects.PREPARE, target) let warning = ref(false) @@ -100,6 +88,7 @@ function damage_team_all(team: Team) { function check_for_guard(player: Player) { return player.board.some(c => c.guard === true) } +
@@ -180,7 +167,7 @@ function check_for_guard(player: Player) {
@@ -202,15 +189,24 @@ function check_for_guard(player: Player) {