@@ -94,10 +94,9 @@ const discard_unwrapped = ref(false)
:disabled="c.uuid in props.player.turn.cards_locked">
LOCK
-
+ @click="useEffect(props.player.turn.find_effect(CardEffects.SACRIFICE)!, c)">SACRIFICE
{{ c.health_as_champion }}
@@ -106,8 +105,8 @@ const discard_unwrapped = ref(false)
:disabled="(goStore.self?.turn.damage_reserve ?? 0) <= 0"
@click="damage_champion(c)">DAMAGE
+ v-if="!isSelf && !isTurn && goStore.self?.team == props.player.turn.find_effect(CardEffects.STUN) && (c.health_as_champion ?? 0) > 0"
+ @click="useEffect(props.player.turn.find_effect(CardEffects.STUN)!, c)">STUN
diff --git a/components/SelfView.vue b/components/SelfView.vue
index 756376d..64f0874 100644
--- a/components/SelfView.vue
+++ b/components/SelfView.vue
@@ -17,8 +17,8 @@ const discard_unwrapped = ref(false)
Heal
@@ -62,7 +62,7 @@ const discard_unwrapped = ref(false)
discard_markers = {{ goStore.self?.turn.discard_markers }}
effects_availables =
@@ -77,15 +77,14 @@ const discard_unwrapped = ref(false)
:disabled="c.uuid in goStore.self?.turn.cards_locked">
LOCK
-
+ @click="useEffect(goStore.self!.turn.find_effect(CardEffects.SACRIFICE)!, c)">SACRIFICE
+ @click="useEffect(goStore.self!.turn.find_effect(CardEffects.PREPARE)!, c)">PREPARE
{{ c.health_as_champion }}
@@ -99,23 +98,23 @@ const discard_unwrapped = ref(false)
-
+
+ :disabled="!goStore.self || !c || !goStore.self!.turn.find_effect(CardEffects.SACRIFICE)"
+ @click="useEffect(goStore.self!.turn.find_effect(CardEffects.SACRIFICE)!, c)">SACRIFICE
diff --git a/netcode/Turn.ts b/netcode/Turn.ts
index 5d745f3..2b72b7b 100644
--- a/netcode/Turn.ts
+++ b/netcode/Turn.ts
@@ -1,6 +1,6 @@
import { type GameObjectRegister } from "."
import type { Card } from "./Card"
-import { type Effect } from "./Effect"
+import { type Effect, CardEffects } from "./Effect"
import type { GameObjectNetcode } from "./GameObject"
export interface TurnNetcode extends GameObjectNetcode {
cards_locked: Array
@@ -17,9 +17,10 @@ export type Turn = Omit
champions_health: Map
+ find_effect: (card_effect: CardEffects) => Effect | undefined
}
export function create_turn(input: TurnNetcode, register: GameObjectRegister) {
- return new Proxy(input, {
+ const turn = new Proxy(input, {
get(target: TurnNetcode, prop, reciever) {
if (prop == "cards_locked") {
return Object.fromEntries(target.cards_locked.map(e => [e, register.cards.get(e)]))
@@ -34,10 +35,16 @@ export function create_turn(input: TurnNetcode, register: GameObjectRegister) {
}
return healths
}
+ if (prop == "find_effect") {
+ return (card_effect: CardEffects) => {
+ return turn.effects_availables.find(e => (e.effect == card_effect) && e.usable)
+ }
+ }
return Reflect.get(target, prop, reciever);
},
set(target, prop, val, receiver) {
return Reflect.set(target, prop, val, receiver);
}
}) as Turn
+ return turn
}