HoldAndWinBuilder\<TData\>
pixi-reels / index / HoldAndWinBuilder
Class: HoldAndWinBuilder<TData>
Defined in: board/HoldAndWinBuilder.ts:19
Fluent builder for HoldAndWinBoard.
A Hold & Win board is a W×H grid of cells that spin independently — the mechanic’s atomic unit is the cell, the engine’s is the column, so each cell is its own 1×1 ReelSet. This builder wires that grid plus the round choreography; everything value-shaped stays in the game layer (see HoldAndWinBoard).
TData types the opaque payload carried on each coin’s data.
Type Parameters
| Type Parameter | Default type |
|---|---|
TData | unknown |
Constructors
Constructor
new HoldAndWinBuilder<TData>(): HoldAndWinBuilder<TData>;
Returns
HoldAndWinBuilder<TData>
Methods
anticipateWhen()
anticipateWhen(fn: (state: {
capacity: number;
locked: number;
respinsLeft: number;
}) => boolean): this;
Defined in: board/HoldAndWinBuilder.ts:110
When the predicate returns true for a wave, every spinning cell uses a drawn-out tension profile — the “one cell left for Grand” moment. Evaluated once per wave for the whole board (not per cell), against the pre-wave state.
Parameters
| Parameter | Type |
|---|---|
fn | (state: { capacity: number; locked: number; respinsLeft: number; }) => boolean |
Returns
this
build()
build(): HoldAndWinBoard<TData>;
Defined in: board/HoldAndWinBuilder.ts:134
Returns
HoldAndWinBoard<TData>
cellChrome()
cellChrome(draw: (g: Graphics, size: number) => void): this;
Defined in: board/HoldAndWinBuilder.ts:118
Per-cell background, drawn behind each mini reel.
Parameters
| Parameter | Type |
|---|---|
draw | (g: Graphics, size: number) => void |
Returns
this
cellSize()
cellSize(size: number, opts?: HwCellSizeOptions): this;
Defined in: board/HoldAndWinBuilder.ts:44
Parameters
| Parameter | Type |
|---|---|
size | number |
opts | HwCellSizeOptions |
Returns
this
emptyId()
emptyId(id: string): this;
Defined in: board/HoldAndWinBuilder.ts:67
Symbol id a cell shows when it holds no coin. Default 'empty'.
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
this
grid()
grid(cols: number, rows: number): this;
Defined in: board/HoldAndWinBuilder.ts:38
Parameters
| Parameter | Type |
|---|---|
cols | number |
rows | number |
Returns
this
respins()
respins(count: number): this;
Defined in: board/HoldAndWinBuilder.ts:84
Respins granted on enter and restored on every hit. Default 3.
Parameters
| Parameter | Type |
|---|---|
count | number |
Returns
this
rng()
rng(fn: () => number): this;
Defined in: board/HoldAndWinBuilder.ts:129
Injected RNG for the spin strips (deterministic demos / tests).
Parameters
| Parameter | Type |
|---|---|
fn | () => number |
Returns
this
speedProfile()
speedProfile(profile: SpeedProfile): this;
Defined in: board/HoldAndWinBuilder.ts:90
Base spin feel for every cell. Default: NORMAL with a 320ms floor.
Parameters
| Parameter | Type |
|---|---|
profile | SpeedProfile |
Returns
this
stagger()
stagger(fn: (col: number, row: number) => number): this;
Defined in: board/HoldAndWinBuilder.ts:100
Extra milliseconds of spin per cell on top of the base minimum spin time.
Default (col + row) * 70 — the diagonal landing wave. Return 0 for
simultaneous landings.
Parameters
| Parameter | Type |
|---|---|
fn | (col: number, row: number) => number |
Returns
this
symbolData()
symbolData(overrides: Record<string, Partial<SymbolData>>): this;
Defined in: board/HoldAndWinBuilder.ts:78
Per-symbol engine overrides, exactly like ReelSetBuilder.symbolData. The
headline use is { unmask: true } for coins whose lock/reveal animations
expand past the cell. Safe only for server-placed ids (weight 0): unmasked
strip symbols mis-track vertically while the reel spins.
Parameters
| Parameter | Type |
|---|---|
overrides | Record<string, Partial<SymbolData>> |
Returns
this
symbols()
symbols(configurator: (registry: SymbolRegistry) => void): this;
Defined in: board/HoldAndWinBuilder.ts:55
Register coin symbol classes, exactly like ReelSetBuilder.symbols. Applied
to every cell. An EmptySymbol is auto-registered under emptyId
unless the configurator registers one itself.
Parameters
| Parameter | Type |
|---|---|
configurator | (registry: SymbolRegistry) => void |
Returns
this
ticker()
ticker(ticker: Ticker): this;
Defined in: board/HoldAndWinBuilder.ts:123
Parameters
| Parameter | Type |
|---|---|
ticker | Ticker |
Returns
this
weights()
weights(weights: Record<string, number>): this;
Defined in: board/HoldAndWinBuilder.ts:61
Strip weights during the spin (how often coins flash past empties).
Parameters
| Parameter | Type |
|---|---|
weights | Record<string, number> |
Returns
this