This commit is contained in:
+13
-11
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import goStore, { buy, useEffect } from '@/netcode';
|
||||
import { CardEffects } from '@/netcode/Effect'
|
||||
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))
|
||||
@@ -16,16 +16,18 @@ const isTurn = computed(() => goStore.self && goStore.current_game?.started && (
|
||||
<template
|
||||
v-if="isTurn && goStore.self?.turn && c && c.cost && (goStore.self?.turn.gold_reserve ?? 0) >= c.cost">
|
||||
<button @click.stop="buy(c)">BUY</button>
|
||||
<button @click.stop="useEffect(goStore.self!.turn.find_effect(CardEffects.PLAY_NEXT_CARD_BOUGHT)!, c)"
|
||||
v-if="goStore.self?.turn.find_effect(CardEffects.PLAY_NEXT_CARD_BOUGHT)">
|
||||
<button
|
||||
@click.stop="useEffect(goStore.self!.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.PLAY_NEXT_CARD_BOUGHT) && e.usable)!, c)"
|
||||
v-if="goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.PLAY_NEXT_CARD_BOUGHT) && e.usable)">
|
||||
BUY IN HAND</button>
|
||||
<button @click.stop="useEffect(goStore.self!.turn.find_effect(CardEffects.STACK_NEXT_CARD_BOUGHT)!, c)"
|
||||
v-if="goStore.self?.turn.find_effect(CardEffects.STACK_NEXT_CARD_BOUGHT)">
|
||||
<button
|
||||
@click.stop="useEffect(goStore.self!.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.STACK_NEXT_CARD_BOUGHT) && e.usable)!, c)"
|
||||
v-if="goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.STACK_NEXT_CARD_BOUGHT) && e.usable)">
|
||||
BUY IN STACK (generic)</button>
|
||||
|
||||
<button
|
||||
@click.stop="useEffect(goStore.self!.turn.find_effect(CardEffects.STACK_NEXT_ACTION_BOUGHT)!, c)"
|
||||
v-if="c.card_type == CardType.ACTION && goStore.self?.turn.find_effect(CardEffects.STACK_NEXT_ACTION_BOUGHT)">
|
||||
@click.stop="useEffect(goStore.self!.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.STACK_NEXT_ACTION_BOUGHT) && e.usable)!, c)"
|
||||
v-if="c.card_type == CardType.ACTION && goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.STACK_NEXT_ACTION_BOUGHT) && e.usable)">
|
||||
BUY IN STACK (actions)</button>
|
||||
</template>
|
||||
</CardPreview>
|
||||
@@ -38,12 +40,12 @@ const isTurn = computed(() => goStore.self && goStore.current_game?.started && (
|
||||
BUY
|
||||
</button>
|
||||
<button
|
||||
@click.stop="useEffect(goStore.self!.turn.find_effect(CardEffects.PLAY_NEXT_CARD_BOUGHT)!, goStore.current_game.gem_stack.at(-1))"
|
||||
v-if="goStore.self?.turn.find_effect(CardEffects.PLAY_NEXT_CARD_BOUGHT)">
|
||||
@click.stop="useEffect(goStore.self!.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.PLAY_NEXT_CARD_BOUGHT) && e.usable)!, goStore.current_game.gem_stack.at(-1))"
|
||||
v-if="goStore.self?.turn..effects_availables.find((e: Effect) => (e.effect == CardEffects.PLAY_NEXT_CARD_BOUGHT) && e.usable)">
|
||||
BUY IN HAND</button>
|
||||
<button
|
||||
@click.stop="useEffect(goStore.self!.turn.find_effect(CardEffects.STACK_NEXT_CARD_BOUGHT)!, goStore.current_game.gem_stack.at(-1))"
|
||||
v-if="goStore.self?.turn.find_effect(CardEffects.STACK_NEXT_CARD_BOUGHT)">
|
||||
@click.stop="useEffect(goStore.self!.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.STACK_NEXT_CARD_BOUGHT) && e.usable)!, goStore.current_game.gem_stack.at(-1))"
|
||||
v-if="goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.STACK_NEXT_CARD_BOUGHT) && e.usable)">
|
||||
BUY IN STACK(generic)
|
||||
</button>
|
||||
</template>
|
||||
|
||||
+27
-19
@@ -38,7 +38,7 @@ function run_effect(
|
||||
if (!goStore.self?.turn) {
|
||||
return
|
||||
}
|
||||
const effect = goStore.self?.turn.find_effect(effect_type);
|
||||
const effect = goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == effect_type) && e.usable);
|
||||
if (!effect) {
|
||||
return;
|
||||
}
|
||||
@@ -108,15 +108,18 @@ function damage_team_all(team: Team) {
|
||||
v-for="c in props.player.discard_pile">
|
||||
<template v-if="goStore.self?.turn && c && isSelf && isPlayerTurn">
|
||||
|
||||
<button v-if="goStore.self?.turn.find_effect(CardEffects.SACRIFICE)"
|
||||
<button
|
||||
v-if="goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.SACRIFICE) && e.usable)"
|
||||
@click.stop="sacrifice(c)">
|
||||
SACRIFICE
|
||||
</button>
|
||||
<button v-if="goStore.self?.turn.find_effect(CardEffects.RESTACK_DISCARDED_CHAMPION)"
|
||||
<button
|
||||
v-if="goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.RESTACK_DISCARDED_CHAMPION) && e.usable)"
|
||||
@click.stop="restack_discarded_champion(c)">
|
||||
RESTACK_DISCARDED_CHAMPION
|
||||
</button>
|
||||
<button v-if="goStore.self?.turn.find_effect(CardEffects.RESTACK_DISCARDED_CARD)"
|
||||
<button
|
||||
v-if="goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.RESTACK_DISCARDED_CARD) && e.usable)"
|
||||
@click.stop="restack_discarded_card(c)">
|
||||
RESTACK_DISCARDED_CARD
|
||||
</button>
|
||||
@@ -140,7 +143,8 @@ function damage_team_all(team: Team) {
|
||||
<PlayerStats :player="props.player">
|
||||
</PlayerStats>
|
||||
<template v-if="!hide_stack_and_discard">
|
||||
<button id="end_turn" v-if="isSelfTurn" class="end_turn_button" @click="checkEndTurn">END TURN</button>
|
||||
<button id="end_turn" v-if="isSelfTurn" class="end_turn_button" @click="checkEndTurn">END
|
||||
TURN</button>
|
||||
<div class="warning" v-if="warning">/!\<br> Effets restants!</div>
|
||||
</template>
|
||||
|
||||
@@ -150,20 +154,17 @@ function damage_team_all(team: Team) {
|
||||
<div id="current_player_board">
|
||||
<div class="other_player_buttons_container">
|
||||
<button @click.stop="damage_team(props.player.team)"
|
||||
v-if="isSelfTurn && isPlayerEnemy && goStore.self?.turn && props.player.team"
|
||||
class="damage_button"
|
||||
v-if="isSelfTurn && isPlayerEnemy && goStore.self?.turn && props.player.team" class="damage_button"
|
||||
:disabled="(goStore.self?.turn.damage_reserve ?? 0) <= 0">
|
||||
Damage
|
||||
</button>
|
||||
<button @click.stop="damage_team_all(props.player.team)"
|
||||
v-if="isSelfTurn && isPlayerEnemy && goStore.self?.turn && props.player.team"
|
||||
class="damage_button all_damage_button"
|
||||
:disabled="(goStore.self?.turn.damage_reserve ?? 0) <= 0">
|
||||
class="damage_button all_damage_button" :disabled="(goStore.self?.turn.damage_reserve ?? 0) <= 0">
|
||||
(All)
|
||||
</button>
|
||||
<button v-if="goStore.self && isSelfTurn && isPlayerEnemy && goStore.self?.turn"
|
||||
@click.stop="make_discard(props.player)"
|
||||
class="make_discard_button"
|
||||
@click.stop="make_discard(props.player)" class="make_discard_button"
|
||||
:disabled="!goStore.self.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.MAKE_DISCARD) && e.usable)">
|
||||
make Discard
|
||||
</button>
|
||||
@@ -187,13 +188,14 @@ function damage_team_all(team: Team) {
|
||||
<!-- Card Locked -->
|
||||
<template v-if="c.uuid in props.player.turn.cards_locked">
|
||||
<template v-for="e in props.player.turn.effects_availables">
|
||||
<button v-if="e.card == c" @click.stop="useEffect(e)" :disabled="!e.usable" :class="{ 'suicide_effect': e.effect_type == EffectType.SUICIDE }" >
|
||||
<button v-if="e.card == c" @click.stop="useEffect(e)" :disabled="!e.usable"
|
||||
:class="{ 'suicide_effect': e.effect_type == EffectType.SUICIDE }">
|
||||
EFFECT<br>
|
||||
{{ e.effect + " " + (e.effect_type ?? '') }}
|
||||
</button>
|
||||
</template>
|
||||
<button
|
||||
v-if="props.player.turn.find_effect(CardEffects.PREPARE) && c.card_type == CardType.CHAMPION"
|
||||
v-if="props.player.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.PREPARE) && e.usable) && c.card_type == CardType.CHAMPION"
|
||||
@click.stop="prepare_champion(c)">PREPARE</button>
|
||||
</template>
|
||||
<!-- Card Unlocked -->
|
||||
@@ -202,7 +204,8 @@ function damage_team_all(team: Team) {
|
||||
@click.stop="discard(c)">
|
||||
DISCARD
|
||||
</button>
|
||||
<button v-if="props.player.turn.find_effect(CardEffects.SACRIFICE)"
|
||||
<button
|
||||
v-if="props.player.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.SACRIFICE) && e.usable)"
|
||||
@click.stop="sacrifice(c)">
|
||||
SACRIFICE
|
||||
</button>
|
||||
@@ -219,7 +222,8 @@ function damage_team_all(team: Team) {
|
||||
@click.stop="damage_champion(c)">
|
||||
DAMAGE ({{ c.health_as_champion }})
|
||||
</button>
|
||||
<button class="enemy_action" v-if="goStore.self?.turn.find_effect(CardEffects.STUN)"
|
||||
<button class="enemy_action"
|
||||
v-if="goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.STUN) && e.usable)"
|
||||
@click.stop="stun(c)">
|
||||
STUN
|
||||
</button>
|
||||
@@ -447,7 +451,8 @@ function damage_team_all(team: Team) {
|
||||
}
|
||||
|
||||
.end_turn_button {
|
||||
background-color: #4CAF50; /* Green background color */
|
||||
background-color: #4CAF50;
|
||||
/* Green background color */
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
@@ -462,12 +467,15 @@ function damage_team_all(team: Team) {
|
||||
}
|
||||
|
||||
.end_turn_button:hover {
|
||||
background-color: #45a049; /* Darker green on hover */
|
||||
background-color: #45a049;
|
||||
/* Darker green on hover */
|
||||
}
|
||||
|
||||
.end_turn_button:active {
|
||||
transform: translateY(2px); /* Add a slight press effect on click */
|
||||
box-shadow: none; /* Remove shadow on click */
|
||||
transform: translateY(2px);
|
||||
/* Add a slight press effect on click */
|
||||
box-shadow: none;
|
||||
/* Remove shadow on click */
|
||||
}
|
||||
|
||||
.ready-bubble {
|
||||
|
||||
@@ -20,7 +20,6 @@ export type Turn = Omit<TurnNetcode, 'cards_locked' | 'effects_availables' | 'ch
|
||||
effects_availables: Array<Effect>
|
||||
champions_health: Map<string, number>
|
||||
discard_marker_card: Card
|
||||
find_effect: (card_effect: CardEffects) => Effect | undefined
|
||||
}
|
||||
export function create_turn(input: TurnNetcode, register: GameObjectRegister) {
|
||||
const turn = new Proxy<any>(input, {
|
||||
@@ -38,11 +37,6 @@ export function create_turn(input: TurnNetcode, register: GameObjectRegister) {
|
||||
}
|
||||
return healths
|
||||
}
|
||||
if (prop == "find_effect") {
|
||||
return (card_effect: CardEffects) => {
|
||||
return turn.effects_availables.find((e:Effect) => (e.effect == card_effect) && e.usable)
|
||||
}
|
||||
}
|
||||
if(prop == "discard_marker_card"){
|
||||
return register.cards.get(target.discard_marker_card)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user