Merge branch 'main' of https://git.legonzaur.fr/legonzaur/heron-realms-front
release-tag / release-image (push) Successful in 31s
release-tag / release-image (push) Successful in 31s
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>
|
||||
|
||||
+31
-23
@@ -39,7 +39,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;
|
||||
}
|
||||
@@ -118,15 +118,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>
|
||||
@@ -150,7 +153,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" :class="{'warning-fire-gem': warningText == 'P\'tite Fire gem?'}">/!\<br>{{warningText}}</div>
|
||||
</template>
|
||||
|
||||
@@ -160,20 +164,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>
|
||||
@@ -197,13 +198,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 -->
|
||||
@@ -212,7 +214,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>
|
||||
@@ -229,7 +232,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>
|
||||
@@ -369,8 +373,8 @@ function damage_team_all(team: Team) {
|
||||
}
|
||||
|
||||
.damage_button:active {
|
||||
transform: translateY(2px);
|
||||
box-shadow: none;
|
||||
transform: translateY(2px);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.all_damage_button {
|
||||
@@ -380,7 +384,7 @@ function damage_team_all(team: Team) {
|
||||
|
||||
.make_discard_button {
|
||||
background-color: #55b42f;
|
||||
color: white;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
padding: 5px 15px;
|
||||
@@ -390,7 +394,7 @@ function damage_team_all(team: Team) {
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.4);
|
||||
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.make_discard_button:disabled {
|
||||
@@ -461,7 +465,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;
|
||||
@@ -476,12 +481,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 {
|
||||
|
||||
@@ -10,7 +10,7 @@ const isTurn = computed(() => goStore.self?.team == goStore.current_game?.curren
|
||||
<div class="cards_container" id="self_hand">
|
||||
<CardPreview :card_id="c?.card_id" v-for=" c in goStore.self?.hand " @click="c && playCard(c)">
|
||||
<button v-if="c && goStore.self?.turn && (goStore.self.turn.fuck_u_markers ?? 0) > 0"
|
||||
@click="discard(c)">DISCARD</button>
|
||||
@click.stop="discard(c)">DISCARD</button>
|
||||
</CardPreview>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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