From 38b992b7a52bd30548755810438fe1c76d5c4de2 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Tue, 7 May 2024 17:25:46 +0200 Subject: [PATCH] FIX : Allow actions on discard --- components/GameBoard.vue | 5 ++- components/MarketCards.vue | 22 +++++++------ components/PlayerListElement.vue | 7 +++-- components/PlayerSlot.vue | 53 ++++++++++++++++++++++++++------ components/SelfView.vue | 11 ++++--- netcode/Turn.ts | 13 ++++++-- 6 files changed, 81 insertions(+), 30 deletions(-) diff --git a/components/GameBoard.vue b/components/GameBoard.vue index c4d44a4..e20eab6 100644 --- a/components/GameBoard.vue +++ b/components/GameBoard.vue @@ -3,6 +3,8 @@ import goStore from '~/netcode'; import type { Player } from '~/netcode/Player'; const current_players = computed>(() => Array.from(goStore.players.values()).filter(p => p.team === goStore.game?.current_turn)) + +const discard_unwrapped = ref(false) diff --git a/components/PlayerListElement.vue b/components/PlayerListElement.vue index e35f91c..a83cd2b 100644 --- a/components/PlayerListElement.vue +++ b/components/PlayerListElement.vue @@ -43,8 +43,11 @@ const props = defineProps()
- - + +
diff --git a/components/PlayerSlot.vue b/components/PlayerSlot.vue index b67584e..863fba6 100644 --- a/components/PlayerSlot.vue +++ b/components/PlayerSlot.vue @@ -8,6 +8,7 @@ import goStore, { heal, damage_champion, damage_team, + } from "~/netcode"; import type { Card } from "~/netcode/Card"; import type { Player } from "~/netcode/Player"; @@ -16,10 +17,12 @@ import { CardEffects, type Effect } from "@/netcode/Effect"; export interface Props { player: Player; hide_stack_and_discard?: boolean; + discard_unwrapped?: boolean; } const props = withDefaults(defineProps(), { hide_stack_and_discard: () => false, + discard_unwrapped: () => false, }) const isPlayerTurn = computed(() => props.player.team === goStore.game?.current_turn); @@ -31,7 +34,7 @@ function run_effect( effect_type: CardEffects, target: Player | Card ) { - const effect = goStore.self?.turn.find_effect(effect_type); + const effect = goStore.self?.turn.find_effect(effect_type).value; if (!effect) { return; } @@ -42,20 +45,41 @@ 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) @@ -108,11 +134,10 @@ const stun = (target: Card) => run_effect(CardEffects.STUN, target) - - @@ -134,6 +159,7 @@ const stun = (target: Card) => run_effect(CardEffects.STUN, target) } .discard { + margin-top: 50px; grid-area: discard; } @@ -148,6 +174,13 @@ const stun = (target: Card) => run_effect(CardEffects.STUN, target) "discard player"; } +.player.discard_unwrapped { + grid-template-areas: + "player_stats player_stats" + "stack player" + "discard discard"; +} + #current_player_board { grid-area: player; } diff --git a/components/SelfView.vue b/components/SelfView.vue index 89bb3de..1673db8 100644 --- a/components/SelfView.vue +++ b/components/SelfView.vue @@ -8,9 +8,9 @@ const isTurn = computed(() => goStore.self?.team == goStore.game?.current_turn)