Skip to content

Skellige faction ability desync #2

@Rickvs64

Description

@Rickvs64

The Skellige faction ability (revive 2 random cards from the graveyard at the start of round 3) is causing desyncs, seemingly differing per client which 2 random cards are revived.

Suggested fix: change the faction ability to instead revive the two strongest (highest base power) unit cards. In the case of a tie, prioritize filename to ensure no randomization.

In factions.js replace:
await Promise.all(player.grave.findCardsRandom(c => c.isUnit(), 2).map(c => board.toRow(c, player.grave)));
with:

const units = player.grave.cards.filter(c => c.isUnit());
units.sort((a, b) => {
	const powerDiff = b.basePower - a.basePower;
	if (powerDiff !== 0) return powerDiff;
	return a.filename.localeCompare(b.filename);	// Fallback, if points are tied then use filename as a tiebreaker.
});

I'm not a JS developer and I haven't tested this fix thoroughly, but based on a few local reproductions it appears to fix the desync issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions