Kkdjskjd
This commit is contained in:
@@ -23,6 +23,7 @@ import type {
|
||||
GameConfig,
|
||||
ManaColor,
|
||||
ManaPool,
|
||||
MulliganState,
|
||||
PendingChoice,
|
||||
PendingSearch,
|
||||
Phase,
|
||||
@@ -195,8 +196,10 @@ export class Game {
|
||||
phase: Phase = 'beginning'
|
||||
step: Step = 'untap'
|
||||
priority = ''
|
||||
status: 'not_started' | 'active' | 'finished' = 'not_started'
|
||||
status: 'not_started' | 'mulligan' | 'active' | 'finished' = 'not_started'
|
||||
winner?: string
|
||||
/** Opening-hand choices, keyed by player id. */
|
||||
readonly mulligans = new Map<string, MulliganState>()
|
||||
/** Blocks all other actions until the searching player picks a card. */
|
||||
pendingSearch?: PendingSearch
|
||||
/** "As this enters, choose..." prompts, in entry order. */
|
||||
@@ -258,6 +261,9 @@ export class Game {
|
||||
energy: 0,
|
||||
poison: 0,
|
||||
}))
|
||||
for (const player of this.players) {
|
||||
this.mulligans.set(player.id, { count: 0, kept: false, bottom: 0 })
|
||||
}
|
||||
|
||||
for (const playerConfig of config.players) {
|
||||
for (const definition of playerConfig.deck) {
|
||||
@@ -290,7 +296,10 @@ export class Game {
|
||||
return object
|
||||
}
|
||||
|
||||
/** Starts the game, shuffles libraries, draws opening hands, and begins turn 1. */
|
||||
/**
|
||||
* Starts the game, shuffles libraries, and draws opening hands. With mulligans
|
||||
* enabled, turn 1 waits until every player keeps; otherwise it begins immediately.
|
||||
*/
|
||||
start(): void {
|
||||
if (this.status !== 'not_started') throw new GameError('Game already started')
|
||||
for (const player of this.players) this.shuffleLibrary(player)
|
||||
@@ -301,8 +310,69 @@ export class Game {
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.config.mulligans) {
|
||||
this.beginGame()
|
||||
return
|
||||
}
|
||||
this.status = 'mulligan'
|
||||
this.turn = 1
|
||||
this.activePlayer = this.firstPlayer
|
||||
}
|
||||
|
||||
/** Keeps the opening hand; turn 1 begins once every living player has kept. */
|
||||
keepHand(playerId: string): void {
|
||||
const mulligan = this.requireMulligan(playerId)
|
||||
if (mulligan.kept) throw new GameError('You already kept your hand')
|
||||
if (mulligan.bottom > 0) throw new GameError('Put your cards on the bottom first')
|
||||
mulligan.kept = true
|
||||
const player = this.getPlayer(playerId)
|
||||
this.logMessage(`${player.name} keeps their hand${mulligan.count ? ` after ${mulligan.count} mulligan${mulligan.count === 1 ? '' : 's'}` : ''}`)
|
||||
if (this.players.every(entry => entry.lost || this.mulligans.get(entry.id)?.kept)) this.beginGame()
|
||||
}
|
||||
|
||||
/** Shuffles the hand back and draws a new one; each mulligan bottoms one more card. */
|
||||
mulligan(playerId: string): void {
|
||||
const mulligan = this.requireMulligan(playerId)
|
||||
if (mulligan.kept) throw new GameError('You already kept your hand')
|
||||
if (mulligan.bottom > 0) throw new GameError('Put your cards on the bottom first')
|
||||
const player = this.getPlayer(playerId)
|
||||
for (const id of [...player.hand]) this.moveToZone(id, 'library', { silent: true })
|
||||
this.shuffleLibrary(player)
|
||||
for (let i = 0; i < this.startingHandSize; i++) {
|
||||
if (!player.library.length) break
|
||||
this.drawCard(player.id, true)
|
||||
}
|
||||
mulligan.count++
|
||||
mulligan.bottom = Math.min(Math.max(0, mulligan.count - 1), player.hand.length)
|
||||
this.logMessage(`${player.name} mulligans${mulligan.bottom
|
||||
? ` and puts ${mulligan.bottom} card${mulligan.bottom === 1 ? '' : 's'} on the bottom`
|
||||
: ''}`)
|
||||
}
|
||||
|
||||
/** Puts one card from a mulliganed opening hand on the bottom of the library. */
|
||||
putOnBottom(playerId: string, cardId: string): void {
|
||||
const mulligan = this.requireMulligan(playerId)
|
||||
if (mulligan.kept) throw new GameError('You already kept your hand')
|
||||
if (mulligan.bottom <= 0) throw new GameError('You have no cards to put on the bottom')
|
||||
const player = this.getPlayer(playerId)
|
||||
if (!player.hand.includes(cardId)) throw new GameError('Card is not in hand')
|
||||
this.moveToZone(cardId, 'library', { silent: true })
|
||||
mulligan.bottom--
|
||||
}
|
||||
|
||||
private requireMulligan(playerId: string): MulliganState {
|
||||
if (this.status !== 'mulligan') throw new GameError('The game is not in its mulligan step')
|
||||
const player = this.getPlayer(playerId)
|
||||
if (player.lost) throw new GameError('You have left the game')
|
||||
const mulligan = this.mulligans.get(playerId)
|
||||
if (!mulligan) throw new GameError(`Unknown player: ${playerId}`)
|
||||
return mulligan
|
||||
}
|
||||
|
||||
private beginGame(): void {
|
||||
// Leyline-style "begin the game with it on the battlefield" cards.
|
||||
for (const player of this.players) {
|
||||
if (player.lost) continue
|
||||
for (const id of [...player.hand]) {
|
||||
const object = this.getObject(id)
|
||||
const beginsOnBattlefield = (object.definition.abilities ?? []).some(ability =>
|
||||
@@ -773,7 +843,7 @@ export class Game {
|
||||
|
||||
/** Marks a player as having forfeited. */
|
||||
concede(playerId: string): void {
|
||||
if (this.status !== 'active') throw new GameError('Game is not active')
|
||||
if (this.status !== 'active' && this.status !== 'mulligan') throw new GameError('Game is not active')
|
||||
this.losePlayer(playerId)
|
||||
if (this.priority === playerId) this.priority = this.nextAlivePlayer(playerId)
|
||||
}
|
||||
@@ -783,7 +853,7 @@ export class Game {
|
||||
if (this.phase !== 'combat' || this.step !== 'declare_blockers') throw new GameError('Not in the declare blockers step')
|
||||
if (this.stack.length) throw new GameError('Cannot declare blockers while the stack is not empty')
|
||||
if (this.pendingSearch) throw new GameError('Choose a card from your library first')
|
||||
if (this.pendingChoice) throw new GameError('Choose a creature type first')
|
||||
if (this.pendingChoice) throw new GameError('Resolve the pending choice first')
|
||||
if (this.priority !== playerId) throw new GameError('You do not have priority')
|
||||
|
||||
const seen = new Set<string>()
|
||||
@@ -843,7 +913,7 @@ export class Game {
|
||||
pass(playerId?: string): void {
|
||||
if (this.status !== 'active') throw new GameError('Game is not active')
|
||||
if (this.pendingSearch) throw new GameError('Choose a card from your library first')
|
||||
if (this.pendingChoice) throw new GameError('Choose a creature type first')
|
||||
if (this.pendingChoice) throw new GameError('Resolve the pending choice first')
|
||||
const actual = playerId ?? this.priority
|
||||
if (this.priority !== actual) throw new GameError('You do not have priority')
|
||||
const alive = this.alivePlayers().length
|
||||
@@ -947,7 +1017,7 @@ export class Game {
|
||||
chooseSearchCard(playerId: string, cardId: string): void {
|
||||
const pending = this.pendingSearch
|
||||
if (!pending) throw new GameError('No search is waiting for a choice')
|
||||
if (this.pendingChoice) throw new GameError('Choose a creature type first')
|
||||
if (this.pendingChoice) throw new GameError('Resolve the pending choice first')
|
||||
if (pending.playerId !== playerId) throw new GameError('You are not searching your library')
|
||||
const object = this.searchCandidates(playerId).find(candidate => candidate.id === cardId)
|
||||
if (!object) throw new GameError('That card is not a legal choice')
|
||||
@@ -992,7 +1062,7 @@ export class Game {
|
||||
*/
|
||||
chooseCreatureType(playerId: string, type: string): void {
|
||||
const pending = this.pendingChoice
|
||||
if (!pending) throw new GameError('No choice is waiting')
|
||||
if (!pending || pending.what !== 'creature_type') throw new GameError('No choice is waiting')
|
||||
if (pending.playerId !== playerId) throw new GameError('You are not choosing this permanent\'s type')
|
||||
const chosen = CREATURE_TYPES.find(entry => entry.toLowerCase() === type.trim().toLowerCase())
|
||||
if (!chosen) throw new GameError('Choose a creature type')
|
||||
@@ -1003,6 +1073,32 @@ export class Game {
|
||||
this.logMessage(`${this.getPlayer(playerId).name} chooses ${chosen} for ${object.definition.name}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Answers an "as this enters, you may pay a cost; otherwise it enters tapped"
|
||||
* replacement. The match API uses the `choose_cost` action.
|
||||
*/
|
||||
chooseCostPayment(playerId: string, pay: boolean): void {
|
||||
const pending = this.pendingChoice
|
||||
if (!pending || pending.what !== 'pay_cost' || !pending.cost) throw new GameError('No cost payment is waiting')
|
||||
if (pending.playerId !== playerId) throw new GameError('You are not choosing this payment')
|
||||
const object = this.objects.get(pending.sourceId)
|
||||
if (object && object.zone === 'battlefield') {
|
||||
if (pay) {
|
||||
const context = this.contextFor(object, playerId, [], 0, 0)
|
||||
if (!this.tryPayUnless(pending.cost, playerId, object, context)) throw new GameError('Cannot pay the cost')
|
||||
this.pendingChoices.shift()
|
||||
const detail = pending.amount === undefined ? 'the cost' : `${pending.amount} life`
|
||||
this.logMessage(`${this.getPlayer(playerId).name} pays ${detail} for ${object.definition.name}`)
|
||||
return
|
||||
}
|
||||
this.pendingChoices.shift()
|
||||
object.tapped = true
|
||||
this.logMessage(`${object.definition.name} enters tapped`)
|
||||
return
|
||||
}
|
||||
this.pendingChoices.shift()
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes priority for players who cannot do anything meaningful. Stops at the
|
||||
* first player who can act, or when the turn ends, so turns never run on.
|
||||
@@ -1289,10 +1385,15 @@ export class Game {
|
||||
const source = this.players
|
||||
.flatMap(entry => entry.battlefield)
|
||||
.map(id => this.objects.get(id))
|
||||
.find((object): object is GameObject => Boolean(object && object.zone === 'battlefield'
|
||||
&& object.controller === player.id
|
||||
&& !object.tapped
|
||||
&& this.findFreeManaAbility(object) !== undefined))
|
||||
.map(object => {
|
||||
if (!object || object.zone !== 'battlefield' || object.controller !== player.id || object.tapped) return undefined
|
||||
const found = this.findFreeManaAbility(object)
|
||||
if (!found) return undefined
|
||||
return { object, allowed: this.manaAbilityAllowedColors(object, found.ability) }
|
||||
})
|
||||
.filter((entry): entry is { object: GameObject; allowed: Set<ManaColor> | undefined } => Boolean(entry))
|
||||
.filter(entry => this.neededColor(player, cost, entry.allowed) !== undefined)
|
||||
.sort((a, b) => (a.allowed?.size ?? Number.MAX_SAFE_INTEGER) - (b.allowed?.size ?? Number.MAX_SAFE_INTEGER))[0]?.object
|
||||
if (!source) break
|
||||
this.autoManaDepth++
|
||||
try {
|
||||
@@ -1321,37 +1422,128 @@ export class Game {
|
||||
const found = this.findFreeManaAbility(source)
|
||||
if (!found) return
|
||||
const player = this.getPlayer(source.controller)
|
||||
const color = this.manaAbilityColor(source, found.ability, player, cost)
|
||||
if (!color) return
|
||||
for (const entry of found.ability.costs) {
|
||||
if (entry.kind === 'tap') source.tapped = true
|
||||
}
|
||||
const color = this.neededColor(player, cost)
|
||||
for (const effect of found.ability.effects) {
|
||||
if (effect.op === 'add_mana') this.addMana(source.controller, effect.mana, color)
|
||||
}
|
||||
}
|
||||
|
||||
private neededColor(player: PlayerState, cost: ManaCost): ManaColor {
|
||||
for (const color of cost.colored) {
|
||||
if (player.manaPool[color] <= 0) return color
|
||||
}
|
||||
const hybridColor = cost.hybrid.flatMap(entry => entry.colors).find(color => player.manaPool[color] <= 0)
|
||||
return hybridColor ?? 'W'
|
||||
private manaAbilityColor(
|
||||
source: GameObject,
|
||||
ability: Extract<Ability, { kind: 'activated' }>,
|
||||
player: PlayerState,
|
||||
cost: ManaCost,
|
||||
): ManaColor | undefined {
|
||||
return this.neededColor(player, cost, this.manaAbilityAllowedColors(source, ability))
|
||||
}
|
||||
|
||||
private addMana(playerId: string, mana: ManaSpec, preferred: ManaColor = 'W'): void {
|
||||
private manaAbilityAllowedColors(
|
||||
source: GameObject,
|
||||
ability: Extract<Ability, { kind: 'activated' }>,
|
||||
): Set<ManaColor> | undefined {
|
||||
for (const effect of ability.effects) {
|
||||
if (effect.op !== 'add_mana') continue
|
||||
if (effect.mana.kind === 'symbols' && effect.mana.oneOf) {
|
||||
return new Set(effect.mana.symbols.map(colorOfSymbol))
|
||||
}
|
||||
return this.anyColorRestrictionColors(effect.mana, source.controller)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
private neededColor(player: PlayerState, cost: ManaCost, allowed?: Set<ManaColor>): ManaColor | undefined {
|
||||
for (const color of cost.colored) {
|
||||
if (player.manaPool[color] > 0) continue
|
||||
return allowed && !allowed.has(color) ? undefined : color
|
||||
}
|
||||
for (const hybrid of cost.hybrid) {
|
||||
if (hybrid.colors.some(color => player.manaPool[color] > 0)) continue
|
||||
return hybrid.colors.find(color => !allowed || allowed.has(color))
|
||||
}
|
||||
if (allowed) return MANA_COLORS.find(color => allowed.has(color))
|
||||
return 'W'
|
||||
}
|
||||
|
||||
private addMana(playerId: string, mana: ManaSpec, preferred?: ManaColor): void {
|
||||
const player = this.getPlayer(playerId)
|
||||
if (mana.kind === 'symbols') {
|
||||
if (mana.oneOf) {
|
||||
const colors = mana.symbols.map(colorOfSymbol)
|
||||
const color = preferred && colors.includes(preferred) ? preferred : colors[0]
|
||||
if (color) player.manaPool[color]++
|
||||
return
|
||||
}
|
||||
for (const symbol of mana.symbols) player.manaPool[colorOfSymbol(symbol)]++
|
||||
} else {
|
||||
const amount = this.value(mana.amount, {
|
||||
source: this.playerSource(playerId),
|
||||
controller: playerId,
|
||||
targets: [],
|
||||
x: 0,
|
||||
mode: 0,
|
||||
})
|
||||
for (let i = 0; i < amount; i++) player.manaPool[preferred]++
|
||||
return
|
||||
}
|
||||
const amount = this.value(mana.amount, {
|
||||
source: this.playerSource(playerId),
|
||||
controller: playerId,
|
||||
targets: [],
|
||||
x: 0,
|
||||
mode: 0,
|
||||
})
|
||||
const allowed = this.anyColorRestrictionColors(mana, playerId)
|
||||
if (allowed?.size === 0) return
|
||||
let color: ManaColor = preferred ?? 'W'
|
||||
if (allowed && !allowed.has(color)) {
|
||||
color = MANA_COLORS.find(entry => allowed.has(entry)) ?? 'W'
|
||||
}
|
||||
for (let i = 0; i < amount; i++) player.manaPool[color]++
|
||||
}
|
||||
|
||||
/**
|
||||
* Colors a land could produce for an "any color that a land ... could
|
||||
* produce" restriction. Colorless and snow are not colors.
|
||||
*/
|
||||
private landManaColors(playerId: string, opponentsOnly: boolean, seen = new Set<string>()): Set<ManaColor> {
|
||||
const colors = new Set<ManaColor>()
|
||||
const opponents = this.opponentsOf(playerId)
|
||||
for (const object of this.battlefieldObjects()) {
|
||||
if (!this.isLand(object) || seen.has(object.id)) continue
|
||||
if (opponentsOnly ? !opponents.includes(object.controller) : object.controller !== playerId) continue
|
||||
seen.add(object.id)
|
||||
for (const ability of object.definition.abilities ?? []) {
|
||||
if (ability.kind !== 'activated') continue
|
||||
for (const effect of ability.effects) {
|
||||
if (effect.op !== 'add_mana') continue
|
||||
if (effect.mana.kind === 'symbols') {
|
||||
for (const symbol of effect.mana.symbols) {
|
||||
for (const letter of symbol.match(/[WUBRG]/gi) ?? []) colors.add(letter.toUpperCase() as ManaColor)
|
||||
}
|
||||
} else {
|
||||
const nested = this.anyColorRestrictionColors(effect.mana, object.controller, seen)
|
||||
if (nested) {
|
||||
for (const color of nested) colors.add(color)
|
||||
} else {
|
||||
for (const color of MANA_COLORS) if (color !== 'C') colors.add(color)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
seen.delete(object.id)
|
||||
}
|
||||
return colors
|
||||
}
|
||||
|
||||
/** The colors an any-color mana source may produce, when the restriction is known. */
|
||||
private anyColorRestrictionColors(
|
||||
mana: ManaSpec,
|
||||
playerId: string,
|
||||
seen?: Set<string>,
|
||||
): Set<ManaColor> | undefined {
|
||||
if (mana.kind !== 'any_color') return undefined
|
||||
if (mana.restriction === 'a land an opponent controls could produce') {
|
||||
return this.landManaColors(playerId, true, seen)
|
||||
}
|
||||
if (mana.restriction === 'a land you control could produce') {
|
||||
return this.landManaColors(playerId, false, seen)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
private payCosts(costs: Cost[], playerId: string, source: GameObject, context: EffectContext): void {
|
||||
@@ -1378,7 +1570,7 @@ export class Game {
|
||||
case 'energy':
|
||||
return player.energy >= cost.amount
|
||||
case 'pay_life':
|
||||
return player.life > this.value(cost.amount, this.staticContext(source))
|
||||
return player.life >= this.value(cost.amount, this.staticContext(source))
|
||||
case 'discard':
|
||||
return player.hand.length >= this.value(cost.amount, this.staticContext(source))
|
||||
case 'sacrifice':
|
||||
@@ -2497,9 +2689,19 @@ export class Game {
|
||||
for (const effect of staticSource.ability.effects) {
|
||||
if (effect.op === 'enters_tapped') {
|
||||
if (effect.unless && this.checkCondition(effect.unless, staticSource.source)) continue
|
||||
if (this.staticTargets(staticSource.source, effect.target).some(target => target.id === object.id)) {
|
||||
object.tapped = true
|
||||
if (!this.staticTargets(staticSource.source, effect.target).some(target => target.id === object.id)) continue
|
||||
if (effect.unlessCost && !object.tapped) {
|
||||
const context = this.staticContext(staticSource.source)
|
||||
this.pendingChoices.push({
|
||||
playerId: object.controller,
|
||||
sourceId: object.id,
|
||||
what: 'pay_cost',
|
||||
cost: effect.unlessCost,
|
||||
amount: effect.unlessCost.kind === 'pay_life' ? this.value(effect.unlessCost.amount, context) : undefined,
|
||||
})
|
||||
continue
|
||||
}
|
||||
object.tapped = true
|
||||
} else if (effect.op === 'enters_with_counters') {
|
||||
if (!this.staticTargets(staticSource.source, effect.target).some(target => target.id === object.id)) continue
|
||||
const amount = this.value(effect.amount, this.staticContext(staticSource.source))
|
||||
@@ -2773,9 +2975,8 @@ export class Game {
|
||||
|
||||
/**
|
||||
* Affordability check that mirrors auto-tapping without changing the game.
|
||||
* shortcut: any_color sources are counted as flexible even when they must
|
||||
* produce one color, so rare "one color only" sources can be overestimated;
|
||||
* upgrade if a card ever needs an exact color split from such a source.
|
||||
* shortcut: only land-based any_color restrictions are modelled; mana
|
||||
* restricted by a commander identity or a spell type is still flexible.
|
||||
*/
|
||||
private canAffordMana(playerId: string, symbols: string, x: number): boolean {
|
||||
if (!symbols) return true
|
||||
@@ -2783,6 +2984,7 @@ export class Game {
|
||||
const cost = parseManaCost(symbols, x)
|
||||
const pool = { ...player.manaPool }
|
||||
let flexible = 0
|
||||
const restricted: { colors: Set<ManaColor>; amount: number }[] = []
|
||||
for (const object of this.battlefieldObjects()) {
|
||||
if (object.controller !== playerId) continue
|
||||
const found = this.findFreeManaAbility(object)
|
||||
@@ -2792,23 +2994,32 @@ export class Game {
|
||||
if (effect.mana.kind === 'symbols') {
|
||||
for (const symbol of effect.mana.symbols) pool[colorOfSymbol(symbol)]++
|
||||
} else {
|
||||
flexible += this.value(effect.mana.amount, {
|
||||
const amount = this.value(effect.mana.amount, {
|
||||
source: object,
|
||||
controller: playerId,
|
||||
targets: [],
|
||||
x: 0,
|
||||
mode: 0,
|
||||
})
|
||||
const allowed = this.anyColorRestrictionColors(effect.mana, playerId)
|
||||
if (!allowed) flexible += amount
|
||||
else if (allowed.size) restricted.push({ colors: allowed, amount })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let life = player.life
|
||||
restricted.sort((a, b) => a.colors.size - b.colors.size)
|
||||
const take = (color: ManaColor): boolean => {
|
||||
if (pool[color] > 0) {
|
||||
pool[color]--
|
||||
return true
|
||||
}
|
||||
const source = restricted.find(entry => entry.amount > 0 && entry.colors.has(color))
|
||||
if (source) {
|
||||
source.amount--
|
||||
return true
|
||||
}
|
||||
if (flexible > 0) {
|
||||
flexible--
|
||||
return true
|
||||
@@ -2824,7 +3035,9 @@ export class Game {
|
||||
if (!(hybrid.life > 0 && life >= hybrid.life)) return false
|
||||
life -= hybrid.life
|
||||
}
|
||||
const remaining = MANA_COLORS.reduce((total, color) => total + pool[color], 0) + flexible
|
||||
const remaining = MANA_COLORS.reduce((total, color) => total + pool[color], 0)
|
||||
+ flexible
|
||||
+ restricted.reduce((total, entry) => total + entry.amount, 0)
|
||||
return remaining >= cost.generic
|
||||
}
|
||||
|
||||
@@ -2923,6 +3136,21 @@ export class Game {
|
||||
}
|
||||
changed = true
|
||||
}
|
||||
for (const player of this.alivePlayers()) {
|
||||
const legends = new Map<string, GameObject[]>()
|
||||
for (const object of this.battlefieldObjects()) {
|
||||
if (object.controller !== player.id || !/\blegendary\b/i.test(object.definition.typeLine)) continue
|
||||
const name = object.definition.name.toLowerCase()
|
||||
legends.set(name, [...(legends.get(name) ?? []), object])
|
||||
}
|
||||
for (const copies of legends.values()) {
|
||||
// shortcut: keeps the first copy found, not the player's choice; ask when the API can pause for it
|
||||
for (const extra of copies.slice(1)) {
|
||||
this.moveToZone(extra, 'graveyard', { silent: false })
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3248,7 +3476,7 @@ export class Game {
|
||||
private requirePriority(playerId: string): void {
|
||||
if (this.status !== 'active') throw new GameError('Game is not active')
|
||||
if (this.pendingSearch) throw new GameError('Choose a card from your library first')
|
||||
if (this.pendingChoice) throw new GameError('Choose a creature type first')
|
||||
if (this.pendingChoice) throw new GameError('Resolve the pending choice first')
|
||||
if (this.priority !== playerId) throw new GameError('You do not have priority')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user