test
This commit is contained in:
@@ -98,6 +98,7 @@ interface MatchView {
|
||||
sourceId: string
|
||||
sourceName: string
|
||||
amount?: number
|
||||
label?: string
|
||||
options: string[]
|
||||
cards?: CardView[]
|
||||
}
|
||||
@@ -1172,6 +1173,16 @@ async function chooseCreatureType(type: string) {
|
||||
await act({ type: 'choose_type', choice: type })
|
||||
}
|
||||
|
||||
async function chooseColor(color: string) {
|
||||
if (busy.value) return
|
||||
await act({ type: 'choose_color', choice: color })
|
||||
}
|
||||
|
||||
async function chooseOptional(accept: boolean) {
|
||||
if (busy.value) return
|
||||
await act({ type: 'choose_optional', accept })
|
||||
}
|
||||
|
||||
async function chooseCost(pay: boolean) {
|
||||
if (busy.value) return
|
||||
await act({ type: 'choose_cost', pay })
|
||||
@@ -1901,14 +1912,18 @@ onUnmounted(() => {
|
||||
</section>
|
||||
|
||||
<section v-if="pendingChoice && pendingChoice.player !== viewerId" class="panel side search-panel">
|
||||
<h2>{{ pendingChoice.what === 'pay_cost' ? 'Pay a cost' : pendingChoice.what === 'hideaway' ? 'Hideaway' : 'Choose a type' }}</h2>
|
||||
<h2>{{ pendingChoice.what === 'pay_cost' ? 'Pay a cost' : pendingChoice.what === 'hideaway' ? 'Hideaway' : pendingChoice.what === 'color' ? 'Choose a color' : pendingChoice.what === 'optional' ? 'Optional effect' : 'Choose a type' }}</h2>
|
||||
<p class="muted">
|
||||
{{ playerName(pendingChoice.player) }}
|
||||
{{ pendingChoice.what === 'pay_cost'
|
||||
? `is deciding whether to pay ${pendingCostLabel} for ${pendingChoice.sourceName}.`
|
||||
: pendingChoice.what === 'hideaway'
|
||||
? 'is looking at the top cards of their library.'
|
||||
: `is choosing a creature type for ${pendingChoice.sourceName}.` }}
|
||||
: pendingChoice.what === 'color'
|
||||
? `is choosing a color for ${pendingChoice.sourceName}.`
|
||||
: pendingChoice.what === 'optional'
|
||||
? `is deciding whether to use ${pendingChoice.label ?? pendingChoice.sourceName}.`
|
||||
: `is choosing a creature type for ${pendingChoice.sourceName}.` }}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
@@ -2049,10 +2064,12 @@ onUnmounted(() => {
|
||||
<div class="grow">
|
||||
<h2 id="choice-title">{{ pendingChoice.what === 'pay_cost'
|
||||
? `Pay ${pendingCostLabel}?`
|
||||
: pendingChoice.what === 'hideaway' ? 'Hideaway' : 'Choose a creature type' }}</h2>
|
||||
: pendingChoice.what === 'hideaway' ? 'Hideaway' : pendingChoice.what === 'color' ? 'Choose a color' : pendingChoice.what === 'optional' ? 'Use this effect?' : 'Choose a creature type' }}</h2>
|
||||
<p class="muted">{{ pendingChoice.what === 'hideaway'
|
||||
? 'Look at the top cards of your library and exile one face down.'
|
||||
: `${pendingChoice.sourceName} enters.` }}</p>
|
||||
: pendingChoice.what === 'optional'
|
||||
? pendingChoice.label ?? `${pendingChoice.sourceName} gives you a choice.`
|
||||
: `${pendingChoice.sourceName} enters.` }}</p>
|
||||
</div>
|
||||
<span v-if="pendingChoice.what === 'creature_type'" class="tag">{{ filteredChoiceOptions.length }} types</span>
|
||||
<span v-else-if="pendingChoice.what === 'hideaway'" class="tag">{{ pendingChoice.cards?.length ?? 0 }} cards</span>
|
||||
@@ -2093,6 +2110,34 @@ onUnmounted(() => {
|
||||
</div>
|
||||
<p class="muted small">The rest go to the bottom of your library in a random order.</p>
|
||||
</template>
|
||||
<template v-else-if="pendingChoice.what === 'optional'">
|
||||
<div class="choice-grid">
|
||||
<button
|
||||
type="button"
|
||||
class="choice-option"
|
||||
:disabled="busy"
|
||||
@click="chooseOptional(true)"
|
||||
>Use it</button>
|
||||
<button
|
||||
type="button"
|
||||
class="choice-option"
|
||||
:disabled="busy"
|
||||
@click="chooseOptional(false)"
|
||||
>Decline</button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="pendingChoice.what === 'color'">
|
||||
<div class="choice-grid">
|
||||
<button
|
||||
v-for="color in pendingChoice.options"
|
||||
:key="color"
|
||||
type="button"
|
||||
class="choice-option"
|
||||
:disabled="busy"
|
||||
@click="chooseColor(color)"
|
||||
>{{ color }}</button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<input
|
||||
ref="choiceInput"
|
||||
|
||||
Reference in New Issue
Block a user