forked from asundr/gwent-classic
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working