Add speech cues and audio config for slots machines

- Wire up intro, big-win, tumble, scatter, coin, wild, and per-symbol
  line-win speech clips across Pharaoh's Fortune, Dragon's Hoard, Gold Rush,
  Sugar Spin, and Abyssal Treasures.
- Generalize `playSpinCues` to resolve tiered cue maps (pyramids, coins) and
  new `symbolWins` / `wild` cues; support `{ file, chance }` entries so
  common one-dynamite callouts only fire ~40% of the time.
- Track tumble number during cascade steps and fire per-tumble Sugar Spin
  clips as each tumble occurs.
- Expose `wilds` count on line-win results in `SlotsLogic.evaluateLines` so
  wild participation can be detected for cue selection.
- Rename `dragons-intro.mp3` to `dragon-intro.mp3` to match naming scheme.
This commit is contained in:
Brian Fertig 2026-11-27 00:51:02 -07:00
parent abe50a7486
commit 320891bf2a
No known key found for this signature in database
24 changed files with 130 additions and 9 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -830,6 +830,7 @@ export default class SlotsGame extends Phaser.Scene {
await this.playSpinCues(result, m); await this.playSpinCues(result, m);
let spinTotal = result.totalWin; let spinTotal = result.totalWin;
let tumbleCount = 0;
// Animate the engine's step script in order. // Animate the engine's step script in order.
for (const step of result.steps) { for (const step of result.steps) {
@ -837,6 +838,13 @@ export default class SlotsGame extends Phaser.Scene {
else if (step.type === 'scatterPay') await this.fx.playScatterPay(step); else if (step.type === 'scatterPay') await this.fx.playScatterPay(step);
else if (step.type === 'tumble') { else if (step.type === 'tumble') {
this.stage?.tumble(step.cascadeIndex); this.stage?.tumble(step.cascadeIndex);
// Tumble cue (m.audio.tumbles) fires the moment each tumble happens —
// key = this spin's tumble number (2nd → sugar-2, 3rd → sugar-3, …).
if (m.audio?.tumbles) {
tumbleCount++;
const clip = m.audio.tumbles[tumbleCount];
if (clip) this.cueAudio(clip);
}
await this.fx.playTumble(step); await this.fx.playTumble(step);
} else if (step.type === 'rainbow') { } else if (step.type === 'rainbow') {
this.stage?.bigMoment(); this.stage?.bigMoment();
@ -985,14 +993,57 @@ export default class SlotsGame extends Phaser.Scene {
// Called after all reels have stopped; collects this spin's cues in order // Called after all reels have stopped; collects this spin's cues in order
// and plays them sequentially. Bandit: at least one NEW sticky wild landed. // and plays them sequentially. Bandit: at least one NEW sticky wild landed.
// Dynamite: tiered by sticks on the reels (1 / 2 / 3+ → highest tier). // Dynamite: tiered by sticks on the reels (1 / 2 / 3+ → highest tier).
// Pyramids (Pharaoh's Fortune): tiered by scatter count in the grid
// (3 / 4 / 5 → highest tier).
// Wild (Pharaoh's Fortune): at least one wild in a winning line.
// Coins (Dragon's Hoard): tiered by coins on the grid (3–5 / 6+).
// Symbol wins (Dragon's Hoard): per-symbol clip when it wins a line.
async playSpinCues(result, m) { async playSpinCues(result, m) {
const a = m.audio ?? {}; const a = m.audio ?? {};
const cues = []; const cues = [];
// Shared "highest qualifying tier" picker for count-tiered cue maps.
const tierClip = (tiers, count) => Object.entries(tiers)
.filter(([t]) => count >= Number(t))
.sort((x, y) => Number(y[0]) - Number(x[0]))[0]?.[1] ?? null;
const stickyStep = result.steps.find((st) => st.type === 'stickyWilds'); const stickyStep = result.steps.find((st) => st.type === 'stickyWilds');
if (a.bandit && stickyStep?.placed?.length > 0) cues.push(a.bandit); if (a.bandit && stickyStep?.placed?.length > 0) cues.push(a.bandit);
const scatter = m.scatter?.symbol; const scatter = m.scatter?.symbol;
const n = scatter ? result.grid.flat().filter((s) => s === scatter).length : 0; const n = scatter ? result.grid.flat().filter((s) => s === scatter).length : 0;
if (a.dynamite?.length && n > 0) cues.push(a.dynamite[Math.min(n, a.dynamite.length) - 1]); if (a.dynamite?.length && n > 0) {
const entry = a.dynamite[Math.min(n, a.dynamite.length) - 1];
const cue = typeof entry === 'string' ? { file: entry } : entry;
if (cue.chance === undefined || Math.random() < cue.chance) cues.push(cue.file);
}
if (a.pyramids) {
const clip = tierClip(a.pyramids, n);
if (clip) cues.push(clip);
}
if (a.coins) {
const coinSym = m.features?.holdSpin?.coinSymbol;
const count = coinSym ? result.grid.flat().filter((s) => s === coinSym).length : 0;
const clip = tierClip(a.coins, count);
if (clip) cues.push(clip);
}
if (a.symbolWins) {
const winStep = result.steps.find((st) => st.type === 'lineWins');
if (winStep) {
const seen = new Set();
for (const w of winStep.wins) {
const clip = a.symbolWins[w.symbol];
if (clip && w.count >= 3 && !seen.has(w.symbol)) {
seen.add(w.symbol);
cues.push(clip);
}
}
}
}
if (a.wild) {
const wildSym = m.wild?.symbol;
const winStep = result.steps.find((st) => st.type === 'lineWins');
const hasWild = winStep?.wins?.some(
(w) => (w.wilds ?? 0) > 0 || (!!wildSym && w.symbol === wildSym));
if (hasWild) cues.push(a.wild);
}
for (const file of cues) await this.cueAudio(file); for (const file of cues) await this.cueAudio(file);
} }

View File

@ -118,6 +118,7 @@ export function evaluateLines(machine, grid, bet) {
cells: line.slice(0, tier.count).map((row, c) => ({ c, r: row })), cells: line.slice(0, tier.count).map((row, c) => ({ c, r: row })),
credits, credits,
wildMult, wildMult,
wilds: wildsInWin,
}; };
} }
} }

View File

@ -334,7 +334,27 @@ export const MACHINES = [
name: "Pharaoh's Fortune", name: "Pharaoh's Fortune",
tagline: 'Free Spins of the Nile', tagline: 'Free Spins of the Nile',
era: 'modern', era: 'modern',
audio: { music: 'slots/pharaohs.mp3', intro: null }, audio: {
music: 'slots/pharaohs.mp3',
intro: 'assets/speech/slots/pharaohs-intro.mp3',
bigWin: 'assets/speech/slots/pharaohs-big-win.mp3',
// Tiered pyramid (scatter) cue — count → clip, highest qualifying
// tier wins (3 → 3-pyramids, 4 → 4-pyramids, 5 → 5-pyramids).
pyramids: {
3: 'assets/speech/slots/pharaohs-3-pyramids.mp3',
4: 'assets/speech/slots/pharaohs-4-pyramids.mp3',
5: 'assets/speech/slots/pharaohs-5-pyramids.mp3',
},
// Plays once when a wild takes part in any winning line.
wild: 'assets/speech/slots/pharaohs-wild.mp3',
// Per-symbol line win cues (3+ match).
symbolWins: {
sphinx: 'assets/speech/slots/pharaohs-sphinx.mp3',
ankh: 'assets/speech/slots/pharaohs-ankh.mp3',
eye: 'assets/speech/slots/pharaoh-eye.mp3', // note: singular “pharaoh”
cat: 'assets/speech/slots/pharaohs-cat.mp3',
},
},
featureLabel: 'FREE SPINS', featureLabel: 'FREE SPINS',
layout: { reels: 5, rows: 3 }, layout: { reels: 5, rows: 3 },
evaluation: 'lines', evaluation: 'lines',
@ -431,11 +451,12 @@ export const MACHINES = [
era: 'modern', era: 'modern',
audio: { audio: {
music: 'slots/abyssal-treasures.mp3', music: 'slots/abyssal-treasures.mp3',
intro: null, intro: 'assets/speech/slots/abyssal-intro.mp3',
bigWin: 'assets/speech/slots/abyssal-big-win.mp3', bigWin: 'assets/speech/slots/abyssal-big-win.mp3',
// Tiered cascade cue — plays the moment the ladder indicator reaches // Tiered cascade cue — plays the moment the ladder indicator reaches
// the rung (×4 → 4x, ×6 → 6x). // the rung (×2 → 2x, ×4 → 4x, ×6 → 6x).
cascades: { cascades: {
2: 'assets/speech/slots/abyssal-2x.mp3',
4: 'assets/speech/slots/abyssal-4x.mp3', 4: 'assets/speech/slots/abyssal-4x.mp3',
6: 'assets/speech/slots/abyssal-6x.mp3', 6: 'assets/speech/slots/abyssal-6x.mp3',
}, },
@ -519,7 +540,24 @@ export const MACHINES = [
name: "Dragon's Hoard", name: "Dragon's Hoard",
tagline: 'Hold & Spin Jackpots', tagline: 'Hold & Spin Jackpots',
era: 'modern', era: 'modern',
audio: { music: 'slots/dragons-hoard.mp3', intro: null, bigWin: 'assets/speech/slots/dragon-big-win.mp3' }, audio: {
music: 'slots/dragons-hoard.mp3',
intro: 'assets/speech/slots/dragon-intro.mp3',
bigWin: 'assets/speech/slots/dragon-big-win.mp3',
// Tiered coin cue — count on the grid → clip: 3–5 coins → dragon-coins,
// 6+ coins (bonus trigger) → dragon-unlocked.
coins: {
3: 'assets/speech/slots/dragon-coins.mp3',
6: 'assets/speech/slots/dragon-unlocked.mp3',
},
// Per-symbol line win cues (3+ match).
symbolWins: {
dragon: 'assets/speech/slots/dragon-dragon.mp3',
castle: 'assets/speech/slots/dragon-castle.mp3',
chest: 'assets/speech/slots/dragon-treasure.mp3',
knight: 'assets/speech/slots/dragon-knight.mp3',
},
},
featureLabel: 'JACKPOT COINS', featureLabel: 'JACKPOT COINS',
layout: { reels: 5, rows: 3 }, layout: { reels: 5, rows: 3 },
evaluation: 'lines', evaluation: 'lines',
@ -636,9 +674,20 @@ export const MACHINES = [
// bandit plays when a spin lands at least one NEW sticky bandit // bandit plays when a spin lands at least one NEW sticky bandit
// (replaces the stock sticky-wild fx) // (replaces the stock sticky-wild fx)
// dynamite tiered by sticks on the reels after the spin: index 0 = 1, // dynamite tiered by sticks on the reels after the spin: index 0 = 1,
// 1 = 2, 2 = 3+; multiple cues play sequentially // 1 = 2, 2 = 3+; multiple cues play sequentially. An entry
// may be { file, chance } to play it only some of the time
// cascades tiered cascade cue: multiplier → clip, played the moment // cascades tiered cascade cue: multiplier → clip, played the moment
// the cascade ladder indicator reaches that rung // the cascade ladder indicator reaches that rung
// pyramids tiered scatter cue: count → clip, highest qualifying tier
// wins (Pharaoh's Fortune)
// wild plays once when at least one wild is part of a winning
// line (Pharaoh's Fortune)
// coins tiered coin cue: count → clip, highest qualifying tier
// wins (Dragon's Hoard)
// symbolWins symbol → clip, played when that symbol wins a line
// (Dragon's Hoard)
// tumbles tiered tumble cue: tumble number in the spin → clip, each
// fires the moment that tumble happens (Sugar Spin)
// bigWin plays once when the spin settles as a Big Win (≥10× bet) // bigWin plays once when the spin settles as a Big Win (≥10× bet)
audio: { audio: {
music: 'slots/gold-rush-gulch.mp3', music: 'slots/gold-rush-gulch.mp3',
@ -646,10 +695,18 @@ export const MACHINES = [
bigWin: 'assets/speech/slots/gold-rush-big-win.mp3', bigWin: 'assets/speech/slots/gold-rush-big-win.mp3',
bandit: 'assets/speech/slots/gold-rush-gulch-bandit.mp3', bandit: 'assets/speech/slots/gold-rush-gulch-bandit.mp3',
dynamite: [ dynamite: [
'assets/speech/slots/gold-rush-one-dynomite.mp3', // One dynamite is common — hear the call-out only 40% of the time.
{ file: 'assets/speech/slots/gold-rush-one-dynomite.mp3', chance: 0.4 },
'assets/speech/slots/gold-rush-two-dynomites.mp3', 'assets/speech/slots/gold-rush-two-dynomites.mp3',
'assets/speech/slots/gold-rush-triple-dynomite.mp3', 'assets/speech/slots/gold-rush-triple-dynomite.mp3',
], ],
// Per-symbol line win cues (3+ match).
symbolWins: {
sheriff: 'assets/speech/slots/gold-rush-sheriff.mp3',
saloon: 'assets/speech/slots/gold-rush-saloon.mp3',
wagon: 'assets/speech/slots/gold-rush-cart.mp3', // the mine cart
pickaxe: 'assets/speech/slots/gold-rush-pickaxe.mp3',
},
}, },
featureLabel: 'PICK BONUS', featureLabel: 'PICK BONUS',
layout: { reels: 5, rows: 3 }, layout: { reels: 5, rows: 3 },
@ -738,7 +795,19 @@ export const MACHINES = [
name: 'Sugar Spin', name: 'Sugar Spin',
tagline: 'Tumbling Candy Mountain', tagline: 'Tumbling Candy Mountain',
era: 'modern', era: 'modern',
audio: { music: 'slots/sugar-spins.mp3', intro: null, bigWin: 'assets/speech/slots/sugar-big-win.mp3' }, audio: {
music: 'slots/sugar-spins.mp3',
intro: 'assets/speech/slots/sugar-intro.mp3',
bigWin: 'assets/speech/slots/sugar-big-win.mp3',
// Tumble cue — key = this spin's tumble number; each clip fires the
// moment that tumble happens (2nd → sugar-2, 3rd → sugar-3, …, 5th → sugar-5).
tumbles: {
2: 'assets/speech/slots/sugar-2.mp3',
3: 'assets/speech/slots/sugar-3.mp3',
4: 'assets/speech/slots/sugar-4.mp3',
5: 'assets/speech/slots/sugar-5.mp3',
},
},
featureLabel: 'TUMBLE WINS', featureLabel: 'TUMBLE WINS',
layout: { reels: 6, rows: 5 }, layout: { reels: 6, rows: 5 },
evaluation: 'scatterPays', evaluation: 'scatterPays',