Feat: disable damage button when guard is present
release-tag / release-image (push) Successful in 32s

Closes #52
This commit is contained in:
2024-05-16 23:49:42 +02:00
parent 05a95b2d1d
commit b807b68d9b
+8 -5
View File
@@ -97,7 +97,9 @@ function damage_team_all(team: Team) {
}
}
function check_for_guard(player: Player) {
return player.board.some(c => c.guard === true)
}
</script>
<template>
@@ -167,12 +169,13 @@ function damage_team_all(team: Team) {
<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"
:disabled="(goStore.self?.turn.damage_reserve ?? 0) <= 0">
:disabled="(goStore.self?.turn.damage_reserve ?? 0) <= 0 || check_for_guard(props.player)">
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 || check_for_guard(props.player)">
(All)
</button>
<button v-if="goStore.self && isSelfTurn && isPlayerEnemy && goStore.self?.turn"
@@ -230,13 +233,13 @@ function damage_team_all(team: Team) {
<template
v-if="c && goStore.self?.turn && isPlayerEnemy && isSelfTurn && (c.health_as_champion ?? 0) > 0">
<button class="enemy_action"
:disabled="(goStore.self?.turn.damage_reserve ?? 0) < (c.health_as_champion ?? Infinity)"
:disabled="(goStore.self?.turn.damage_reserve ?? 0) < (c.health_as_champion ?? Infinity) || (check_for_guard(props.player) && !c.guard)"
@click.stop="damage_champion(c)">
DAMAGE ({{ c.health_as_champion }})
</button>
<button class="enemy_action"
v-if="goStore.self?.turn.effects_availables.find((e: Effect) => (e.effect == CardEffects.STUN) && e.usable)"
@click.stop="stun(c)">
@click.stop="stun(c)" :disabled="(check_for_guard(props.player) && !c.guard)">
STUN
</button>
</template>