feat(swdbg): nudge galaxy row cards by faction ownership
Visually indicate card ownership in the galaxy row by shifting cards vertically: player's faction cards move down 12px (easier to buy), opponent faction cards move up 12px, neutral cards stay centered.
This commit is contained in:
parent
450f2d05bc
commit
4dcc8211b8
|
|
@ -787,15 +787,20 @@ export default class SWDBGGame extends Phaser.Scene {
|
|||
// the row
|
||||
const rowX0 = 510;
|
||||
const legal = this.humanTurnLegal();
|
||||
const humanFaction = gs.players[this.humanSeat].faction;
|
||||
gs.galaxy.row.forEach((card, i) => {
|
||||
const def = cardDef(card);
|
||||
const x = rowX0 + i * (cw + 14);
|
||||
this._rowPos.set(card.uid, { x, y });
|
||||
// nudge cards vertically to hint at ownership: down for the player's own
|
||||
// faction (easier to buy), up for the opponent's faction, untouched if neutral
|
||||
const rowNudge = def.faction === 'neutral' ? 0 : def.faction === humanFaction ? 12 : -12;
|
||||
const cy = y + rowNudge;
|
||||
this._rowPos.set(card.uid, { x, y: cy });
|
||||
const buyable = !this.squad.size && legal && legal.buys.some((b) => b.uid === card.uid);
|
||||
const targetable = this.squad.size > 0 && this.rowTargetReachable(card);
|
||||
const freeTarget = this.mode.type === 'target' && ['discardRow', 'freePurchase', 'destroyCapital'].includes(this.mode.decision?.op)
|
||||
&& (this.mode.candidates || []).some((c) => c.uid === card.uid);
|
||||
this.makeCard(x, y, card, cw, ch, {
|
||||
this.makeCard(x, cy, card, cw, ch, {
|
||||
parent: this.rowLayer, showText: true,
|
||||
highlightBuy: buyable, highlightTarget: targetable, highlightGold: freeTarget,
|
||||
onClick: () => this.onRowClicked(card),
|
||||
|
|
|
|||
Loading…
Reference in New Issue