feat(SCOPONE-0003): allow player to choose capture target

- findCaptures() returns each direct match as separate option plus sum subsets
- highlightMultipleCaptures() uses distinct colors per capture option
- clicking highlighted table cards confirms that option's capture
This commit is contained in:
Giancarmine Salucci
2026-03-31 19:59:38 +02:00
parent 3d1f3e5eb4
commit 9524161481
2 changed files with 25 additions and 16 deletions

View File

@@ -674,32 +674,45 @@ export class GameScene extends Phaser.Scene {
private highlightMultipleCaptures(captures: Card[][]): void {
this.clearHighlights();
const W = this.scale.width;
// Distinct color palette for each capture option
const palette = [
{ fill: 0x00cc66, stroke: 0x00ff88, text: '#00ffaa', bg: 0x001a0a },
{ fill: 0x3399ff, stroke: 0x66bbff, text: '#88ccff', bg: 0x001020 },
{ fill: 0xff8833, stroke: 0xffaa55, text: '#ffcc88', bg: 0x1a0d00 },
{ fill: 0xcc44cc, stroke: 0xff66ff, text: '#ff88ff', bg: 0x1a001a },
{ fill: 0x00cccc, stroke: 0x44ffff, text: '#88ffff', bg: 0x001a1a },
];
captures.forEach((cap, i) => {
const color = palette[i % palette.length];
const label = cap.map(cardName).join(' + ');
const y = SCOREBAR_H + 70 + i * 36;
const bg = this.add.graphics().setDepth(20);
bg.fillStyle(0x001a0a, 0.9);
bg.fillStyle(color.bg, 0.9);
bg.fillRoundedRect(W / 2 - 180, y - 14, 360, 28, 7);
bg.lineStyle(1, 0x00ff88, 0.7);
bg.lineStyle(2, color.stroke, 0.8);
bg.strokeRoundedRect(W / 2 - 180, y - 14, 360, 28, 7);
const btn = this.add.zone(W / 2, y, 360, 28).setInteractive({ useHandCursor: true }).setDepth(21);
const txt = this.add.text(W / 2, y, `Cattura: ${label}`, {
fontFamily: 'serif', fontSize: '14px', color: '#00ffaa',
fontFamily: 'serif', fontSize: '14px', color: color.text,
}).setOrigin(0.5).setDepth(21);
btn.on('pointerdown', () => this.confirmMove(this.selectedCard!, cap));
(bg as any)._captureBtn = true;
this.tableHighlights.push(bg, btn, txt);
});
for (const cap of captures) {
// Highlight table cards belonging to this option with the matching color
for (const c of cap) {
const img = this.cardImages.get(c.id);
if (img) {
const hl = this.add.rectangle(img.x, img.y, CW_H + 8, CH_H + 8, 0xffff00, 0.15)
.setStrokeStyle(2, 0xffff00, 0.8).setDepth(4);
const hl = this.add.rectangle(img.x, img.y, CW_H + 8, CH_H + 8, color.fill, 0.2)
.setStrokeStyle(2, color.stroke, 0.9).setDepth(4);
this.tableHighlights.push(hl);
img.setInteractive({ useHandCursor: true });
img.once('pointerdown', () => this.confirmMove(this.selectedCard!, cap));
}
}
}
});
}
private highlightTableForDump(card: Card): void {