Compare commits
2 Commits
71d279c835
...
41466e14f3
| Author | SHA1 | Date |
|---|---|---|
|
|
41466e14f3 | |
|
|
285d992915 |
|
|
@ -83,6 +83,32 @@ export const FIRST_GAME = [
|
|||
'moat', 'remodel', 'smithy', 'village', 'workshop',
|
||||
];
|
||||
|
||||
// Additional recommended kingdoms from the 2nd-edition rulebook.
|
||||
export const SIZE_DISTORTION = [
|
||||
'artisan', 'bandit', 'bureaucrat', 'gardens', 'harbinger',
|
||||
'laboratory', 'moneylender', 'throneroom', 'village', 'witch',
|
||||
];
|
||||
export const DECK_TOP = [
|
||||
'artisan', 'bureaucrat', 'councilroom', 'festival', 'harbinger',
|
||||
'laboratory', 'poacher', 'sentry', 'vassal', 'village',
|
||||
];
|
||||
export const SILVER_AND_GOLD = [
|
||||
'artisan', 'bandit', 'councilroom', 'mine', 'moneylender',
|
||||
'poacher', 'remodel', 'smithy', 'throneroom', 'vassal',
|
||||
];
|
||||
export const HELPFUL_ACTIONS = [
|
||||
'cellar', 'councilroom', 'festival', 'harbinger', 'laboratory',
|
||||
'library', 'merchant', 'militia', 'moat', 'sentry',
|
||||
];
|
||||
|
||||
export const KINGDOM_PRESETS = {
|
||||
'standard': FIRST_GAME,
|
||||
'size-distortion': SIZE_DISTORTION,
|
||||
'deck-top': DECK_TOP,
|
||||
'silver-gold': SILVER_AND_GOLD,
|
||||
'helpful-actions': HELPFUL_ACTIONS,
|
||||
};
|
||||
|
||||
export function hasType(card, type) {
|
||||
return card.types.includes(type);
|
||||
}
|
||||
|
|
@ -103,5 +129,6 @@ export function chooseRandomKingdom(rand) {
|
|||
|
||||
export function kingdomFor(deckMode, rand) {
|
||||
if (deckMode === 'random') return chooseRandomKingdom(rand);
|
||||
return FIRST_GAME.slice().sort((a, b) => getCard(a).cost - getCard(b).cost);
|
||||
const preset = KINGDOM_PRESETS[deckMode] ?? FIRST_GAME;
|
||||
return preset.slice().sort((a, b) => getCard(a).cost - getCard(b).cost);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,20 @@ const CX = GAME_WIDTH / 2;
|
|||
|
||||
const D = { bg: -1, supply: 5, inplay: 6, hand: 10, hud: 15, portrait: 20, prompt: 40, modal: 80, popup: 95 };
|
||||
|
||||
// Returns the screen (x, y) at distance d along the clockwise perimeter of a
|
||||
// rectangle with top-left corner (left, top) and dimensions W×H.
|
||||
function perimPoint(d, W, H, left, top) {
|
||||
const perim = 2 * (W + H);
|
||||
d = ((d % perim) + perim) % perim;
|
||||
if (d < W) return [left + d, top ];
|
||||
d -= W;
|
||||
if (d < H) return [left + W, top + d];
|
||||
d -= H;
|
||||
if (d < W) return [left + W - d, top + H];
|
||||
d -= W;
|
||||
return [left, top + H - d];
|
||||
}
|
||||
|
||||
const SUPPLY_W = 100, SUPPLY_H = 144;
|
||||
const HAND_W = 132, HAND_H = 190;
|
||||
const PLAY_W = 78, PLAY_H = 112;
|
||||
|
|
@ -84,6 +98,8 @@ export default class DominionGame extends Phaser.Scene {
|
|||
this._arrowSeat = null;
|
||||
this._boughtThisTurn = false;
|
||||
this._suppressTurnUi = false;
|
||||
this._handFxGraphics = [];
|
||||
this._handFxTweens = [];
|
||||
}
|
||||
|
||||
create() {
|
||||
|
|
@ -404,6 +420,7 @@ export default class DominionGame extends Phaser.Scene {
|
|||
// ── Render (dynamic layer) ───────────────────────────────────────────────────
|
||||
|
||||
render() {
|
||||
this._clearHandFx();
|
||||
if (this.hoverTimer) { this.hoverTimer.remove(); this.hoverTimer = null; }
|
||||
this.hideHover();
|
||||
this.dynamicLayer?.destroy(true);
|
||||
|
|
@ -554,8 +571,8 @@ export default class DominionGame extends Phaser.Scene {
|
|||
const hs = { iid: c.iid, id: c.id, def, x, baseY, face, hit, isPlayableAction, isPlayableTreasure };
|
||||
this.handSprites.push(hs);
|
||||
|
||||
if (isPlayableAction) this.highlightFace(face, COLORS.accent);
|
||||
else if (isPlayableTreasure) this.highlightFace(face, COLORS.gold);
|
||||
if (isPlayableAction) this._buildHandFxItem(hs, COLORS.accent);
|
||||
else if (isPlayableTreasure) this._buildHandFxItem(hs, COLORS.gold);
|
||||
|
||||
hit.on('pointerdown', (ptr) => {
|
||||
if (this._animating) return;
|
||||
|
|
@ -577,6 +594,62 @@ export default class DominionGame extends Phaser.Scene {
|
|||
face.addAt(glow, 0);
|
||||
}
|
||||
|
||||
_clearHandFx() {
|
||||
this._handFxTweens.forEach(t => t.destroy());
|
||||
this._handFxGraphics.forEach(g => g.destroy());
|
||||
this._handFxTweens = [];
|
||||
this._handFxGraphics = [];
|
||||
}
|
||||
|
||||
_buildHandFxItem(hs, color) {
|
||||
const gfx = this.add.graphics();
|
||||
gfx.setDepth(D.hand + 25);
|
||||
this._handFxGraphics.push(gfx);
|
||||
|
||||
const W = HAND_W, H = HAND_H;
|
||||
const perim = 2 * (W + H);
|
||||
const TAIL_PX = 90;
|
||||
const SEGMENTS = 20;
|
||||
const COMETS = 2;
|
||||
|
||||
const tracker = { t: 0 };
|
||||
const tween = this.tweens.add({
|
||||
targets: tracker,
|
||||
t: { from: 0, to: 1 },
|
||||
duration: 1200,
|
||||
repeat: -1,
|
||||
ease: 'Linear',
|
||||
onUpdate: () => {
|
||||
const left = hs.x - W / 2;
|
||||
const top = hs.face.y - H / 2;
|
||||
gfx.clear();
|
||||
|
||||
gfx.lineStyle(2, color, 0.2);
|
||||
gfx.strokeRect(left, top, W, H);
|
||||
|
||||
for (let c = 0; c < COMETS; c++) {
|
||||
const headDist = ((tracker.t + c / COMETS) % 1) * perim;
|
||||
for (let seg = 0; seg < SEGMENTS; seg++) {
|
||||
const frac = seg / SEGMENTS;
|
||||
const d1 = ((headDist - (1 - frac) * TAIL_PX + perim * 100) % perim);
|
||||
const d2 = ((headDist - (1 - (seg + 1) / SEGMENTS) * TAIL_PX + perim * 100) % perim);
|
||||
const [x1, y1] = perimPoint(d1, W, H, left, top);
|
||||
const [x2, y2] = perimPoint(d2, W, H, left, top);
|
||||
const alpha = 0.1 + frac * 0.85;
|
||||
const lineColor = frac > 0.85 ? 0xffffff : color;
|
||||
const lineWidth = frac > 0.85 ? 4 : 2;
|
||||
gfx.lineStyle(lineWidth, lineColor, alpha);
|
||||
gfx.beginPath();
|
||||
gfx.moveTo(x1, y1);
|
||||
gfx.lineTo(x2, y2);
|
||||
gfx.strokePath();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
this._handFxTweens.push(tween);
|
||||
}
|
||||
|
||||
renderCounts() {
|
||||
const gs = this.gs;
|
||||
// Human deck — face-down card pile with count badge
|
||||
|
|
|
|||
|
|
@ -531,13 +531,20 @@ export default class OpponentSelectScene extends Phaser.Scene {
|
|||
// ── Dominion: Kingdom deck mode toggle ─────────────────────────────────────
|
||||
buildDeckModeSection(centerX, centerY) {
|
||||
const options = [
|
||||
{ id: 'standard', label: 'Standard' },
|
||||
{ id: 'random', label: 'Random' },
|
||||
{ id: 'standard', label: 'Standard' },
|
||||
{ id: 'size-distortion', label: 'Size Distortion' },
|
||||
{ id: 'deck-top', label: 'Deck Top' },
|
||||
{ id: 'silver-gold', label: 'Silver & Gold' },
|
||||
{ id: 'helpful-actions', label: 'Helpful Actions' },
|
||||
{ id: 'random', label: 'Random' },
|
||||
];
|
||||
const pillW = 150, pillH = 40, pillGap = 12;
|
||||
const totalW = options.length * pillW + (options.length - 1) * pillGap;
|
||||
const labelY = centerY - 28;
|
||||
const pillY = centerY + 10;
|
||||
const cols = 3;
|
||||
const rowW = cols * pillW + (cols - 1) * pillGap;
|
||||
// Two rows — shift the whole section up so both rows sit above y=1080.
|
||||
const labelY = centerY - 53;
|
||||
const row0Y = centerY - 12;
|
||||
const row1Y = centerY + 38;
|
||||
|
||||
const labelText = this.add.text(centerX, labelY, 'Kingdom', {
|
||||
fontFamily: '"Julius Sans One"',
|
||||
|
|
@ -549,14 +556,17 @@ export default class OpponentSelectScene extends Phaser.Scene {
|
|||
|
||||
this._deckModeBtns = [];
|
||||
options.forEach((opt, i) => {
|
||||
const x = centerX - totalW / 2 + i * (pillW + pillGap) + pillW / 2;
|
||||
const col = i % cols;
|
||||
const row = Math.floor(i / cols);
|
||||
const x = centerX - rowW / 2 + col * (pillW + pillGap) + pillW / 2;
|
||||
const y = row === 0 ? row0Y : row1Y;
|
||||
const isSelected = this.selectedDeckMode === opt.id;
|
||||
const bg = this.add.rectangle(x, pillY, pillW, pillH, COLORS.panel)
|
||||
const bg = this.add.rectangle(x, y, pillW, pillH, COLORS.panel)
|
||||
.setStrokeStyle(3, isSelected ? COLORS.accent : COLORS.muted)
|
||||
.setInteractive({ useHandCursor: true });
|
||||
const pillBg = this.add.rectangle(x, pillY, pillW, pillH, 0x000000, 0.72);
|
||||
const pillBg = this.add.rectangle(x, y, pillW, pillH, 0x000000, 0.72);
|
||||
this.children.moveBelow(pillBg, bg);
|
||||
this.add.text(x, pillY, opt.label, {
|
||||
this.add.text(x, y, opt.label, {
|
||||
fontFamily: '"Julius Sans One"',
|
||||
fontSize: '16px',
|
||||
color: COLORS.textHex,
|
||||
|
|
|
|||
Loading…
Reference in New Issue