From 280169d40ddb3a94af5e2db0f3a2fefc322b6d1c Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Mon, 22 Jun 2026 23:20:20 -0600 Subject: [PATCH] feat(yatzi): add AI emotional reactions to score outcomes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AI portraits now play 'happy' or 'upset' animations based on score magnitude - Adjust scorecard vertical positioning (SC_TOP: 60 → 110) - Mute vibrant accent colors across all colored playfield schemes for better visual consistency --- public/data/colored-playfields.json | 40 ++++++++++++++--------------- public/src/games/yatzi/YatziGame.js | 9 ++++++- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/public/data/colored-playfields.json b/public/data/colored-playfields.json index 2362fd4..7bcd99d 100644 --- a/public/data/colored-playfields.json +++ b/public/data/colored-playfields.json @@ -4,121 +4,121 @@ "id": "midnight-aurora", "name": "Midnight Aurora", "base": "#0d0d2b", - "accents": ["#00ffe1", "#7b2fff", "#0099ff", "#ff2d78"] + "accents": ["#008070", "#3d0099", "#004d8f", "#990033"] }, { "id": "sunset-horizon", "name": "Sunset Horizon", "base": "#2b0a0a", - "accents": ["#ff6b47", "#ffb347", "#ff4d7e", "#ffd700"] + "accents": ["#993318", "#996600", "#991040", "#997300"] }, { "id": "forest-glade", "name": "Forest Glade", "base": "#071a0e", - "accents": ["#7fff00", "#87a878", "#2e8b57", "#d4af37"] + "accents": ["#3d8800", "#3a5530", "#144d2e", "#755c10"] }, { "id": "deep-ocean", "name": "Deep Ocean", "base": "#041520", - "accents": ["#00e5ff", "#4169e1", "#20b2aa", "#7fb3d3"] + "accents": ["#007899", "#1a3488", "#0a6660", "#345f80"] }, { "id": "desert-dusk", "name": "Desert Dusk", "base": "#1f1208", - "accents": ["#c04a1a", "#e8a020", "#fa8072", "#d4701a"] + "accents": ["#6a2008", "#845408", "#992e28", "#753804"] }, { "id": "royal-purple", "name": "Royal Purple", "base": "#150820", - "accents": ["#dd00ff", "#0047ab", "#b57bee", "#ffd700"] + "accents": ["#720099", "#001e60", "#582e90", "#997300"] }, { "id": "dragon-fire", "name": "Dragon Fire", "base": "#120404", - "accents": ["#dc143c", "#ff6600", "#ffd700"] + "accents": ["#780020", "#993300", "#997300"] }, { "id": "arctic-frost", "name": "Arctic Frost", "base": "#0a1020", - "accents": ["#9bb7d4", "#b0e0e6", "#b0c4de", "#ddeeff"] + "accents": ["#345878", "#3a7078", "#345070", "#588098"] }, { "id": "mocha-cafe", "name": "Mocha Café", "base": "#0f0a06", - "accents": ["#cd7f32", "#8b2020", "#d4801a", "#f5deb3"] + "accents": ["#6a3c10", "#480404", "#753e04", "#8a6628"] }, { "id": "emerald-isle", "name": "Emerald Isle", "base": "#030f08", - "accents": ["#50c878", "#2e8b57", "#00a86b", "#98ff98"] + "accents": ["#1e6633", "#144d2e", "#004d32", "#267326"] }, { "id": "neon-city", "name": "Neon City", "base": "#050510", - "accents": ["#ff0099", "#00ffcc", "#7b00ff", "#ffee00"] + "accents": ["#850050", "#00856a", "#3d0099", "#998c00"] }, { "id": "cherry-blossom", "name": "Cherry Blossom", "base": "#1a0a10", - "accents": ["#ffb7c5", "#ff8fa3", "#e8cfe0", "#fce4ec"] + "accents": ["#a83d60", "#991048", "#703e64", "#a04860"] }, { "id": "volcanic", "name": "Volcanic", "base": "#080200", - "accents": ["#7f0000", "#dd2200", "#ff6600"] + "accents": ["#440000", "#7e1000", "#993300"] }, { "id": "galactic", "name": "Galactic", "base": "#000008", - "accents": ["#6a1b9a", "#1a237e", "#e8eaf6", "#880e4f"] + "accents": ["#360858", "#0a0e48", "#506099", "#480024"] }, { "id": "autumn-harvest", "name": "Autumn Harvest", "base": "#0f0400", - "accents": ["#a63200", "#7a0c00", "#d48000", "#c62828"] + "accents": ["#5a1800", "#460600", "#754200", "#6a0808"] }, { "id": "bioluminescence", "name": "Bioluminescence", "base": "#000d14", - "accents": ["#00e5ff", "#76ff03", "#f0f4f8"] + "accents": ["#007899", "#388500", "#456078"] }, { "id": "candy-pop", "name": "Candy Pop", "base": "#0d000d", - "accents": ["#ff1493", "#00e676", "#ff9100", "#29b6f6"] + "accents": ["#850052", "#00783c", "#994b00", "#005899"] }, { "id": "copper-patina", "name": "Copper Patina", "base": "#060a04", - "accents": ["#b87333", "#45b08c", "#8b6914", "#d4a853"] + "accents": ["#5e3810", "#145c44", "#443204", "#755418"] }, { "id": "sakura-night", "name": "Sakura Night", "base": "#07030f", - "accents": ["#e91e8c", "#ce93d8", "#ffe082"] + "accents": ["#7e0046", "#642e80", "#997300"] }, { "id": "silver-storm", "name": "Silver Storm", "base": "#080808", - "accents": ["#546e7a", "#90a4ae", "#cfd8dc", "#eceff1"] + "accents": ["#263848", "#3a5868", "#4e6878", "#6a7880"] } ] } diff --git a/public/src/games/yatzi/YatziGame.js b/public/src/games/yatzi/YatziGame.js index 58c6dcd..a49414d 100644 --- a/public/src/games/yatzi/YatziGame.js +++ b/public/src/games/yatzi/YatziGame.js @@ -28,7 +28,7 @@ const SC_RIGHT_MARGIN = 40; const SC_W = GAME_WIDTH - SC_X - SC_RIGHT_MARGIN; // 900 const SC_CAT_W = 220; const SC_PLAYERS_W = SC_W - SC_CAT_W; // shared among N player columns -const SC_TOP = 60; +const SC_TOP = 110; const SC_HEADER_H = 50; const SC_ROW_H = 42; const SC_SUMMARY_H = 40; @@ -643,8 +643,15 @@ export default class YatziGame extends Phaser.Scene { if (cat) { this.flashCell(this.gs.current, cat); await this.delay(500); + const aiIdx = this.gs.current; + const scored = scoreForCommit(this.gs.dice, cat, this.gs.players[aiIdx].scorecard) ?? 0; this.aiRunning = false; this.commitCategory(cat); + const ctrl = this.portraitCtrls[aiIdx]?.controller; + if (ctrl?.playEmotion) { + if (scored > 30) ctrl.playEmotion('happy'); + else if (scored < 10) ctrl.playEmotion('upset'); + } } else { this.aiRunning = false; }