Skip to main content

Class: DealCards

commands.DealCards

A command which by itself changes nothing, but applies subCommands and executes these instead.

Hierarchy

Constructors

constructor

new DealCards(source, targets, options?)

Deals count cards from this container to other containers. Eg. hands

Parameters

NameTypeDescription
sourceTarget<ParentTrait>will take cards from here
targetsTargets<ParentTrait>and put them in these containers
optionsDealCardsOptions-

Overrides

Command.constructor

Properties

count

count: number


onEmptied

onEmptied: () => Command<State<Record<string, unknown>>>

Type declaration

▸ (): Command<State<Record<string, unknown>>>

Returns

Command<State<Record<string, unknown>>>


source

source: TargetHolder<ParentTrait>


step

step: number


targets

targets: TargetsHolder<ParentTrait>

Accessors

name

get name(): string

Returns

string

Inherited from

Command.name

Methods

execute

execute(state, room): Promise<void>

Parameters

NameType
stateState<Record<string, unknown>>
roomRoom<any, Record<string, unknown>>

Returns

Promise<void>

Overrides

Command.execute


subExecute

Protected subExecute(state, room, command): Promise<void>

Execute a sub command. Call ONLY during your commands execute method. Will also remember it internally for undoing.

Parameters

NameType
stateState<Record<string, unknown>>
roomRoom<State<Record<string, unknown>>, Record<string, unknown>>
commandCommand<State<Record<string, unknown>>>

Returns

Promise<void>

Inherited from

Command.subExecute


undo

undo(state, room): Promise<void>

Undoes every remembered extra sub command. Command may gather new sub commands only while executing. Sequence will only gather sub commands upon construction.

Parameters

NameType
stateState<Record<string, unknown>>
roomRoom<any, Record<string, unknown>>

Returns

Promise<void>

Overrides

Command.undo