pixi-reels

HoldAndWinBuilder\<TData\>

pixi-reels


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 ParameterDefault type
TDataunknown

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

ParameterType
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

ParameterType
draw(g: Graphics, size: number) => void

Returns

this


cellSize()

cellSize(size: number, opts?: HwCellSizeOptions): this;

Defined in: board/HoldAndWinBuilder.ts:44

Parameters

ParameterType
sizenumber
optsHwCellSizeOptions

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

ParameterType
idstring

Returns

this


grid()

grid(cols: number, rows: number): this;

Defined in: board/HoldAndWinBuilder.ts:38

Parameters

ParameterType
colsnumber
rowsnumber

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

ParameterType
countnumber

Returns

this


rng()

rng(fn: () => number): this;

Defined in: board/HoldAndWinBuilder.ts:129

Injected RNG for the spin strips (deterministic demos / tests).

Parameters

ParameterType
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

ParameterType
profileSpeedProfile

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

ParameterType
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

ParameterType
overridesRecord<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

ParameterType
configurator(registry: SymbolRegistry) => void

Returns

this


ticker()

ticker(ticker: Ticker): this;

Defined in: board/HoldAndWinBuilder.ts:123

Parameters

ParameterType
tickerTicker

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

ParameterType
weightsRecord<string, number>

Returns

this