Fix bug that sorted players by final score

This commit is contained in:
Lucas Mello 2021-07-28 19:43:48 -03:00
commit 664b470b12
2 changed files with 3 additions and 3 deletions

View file

@ -50,7 +50,6 @@ export function setup(numPlayers: number, { beginner = true }: GameOptions, seed
additionalBid: 0,
showBid: false,
showAdditionalBid: false,
finalScore: 0,
isAI: false,
didDomesticSale: false,
}));
@ -824,7 +823,7 @@ function calculateEndScore(G: GameState) {
return grouped[a].length > grouped[b].length ? a : b;
});
const points = cloneDeep(player.pointCard!.containerValues).map((cv) => {
const points = player.pointCard!.containerValues.map((cv) => {
if (grouped[cv.containerColor]) {
player.finalScoreBreakdown!.push(
`$${grouped[cv.containerColor].length * (hasOneOfEach ? cv.specialValue : cv.baseValue)} (${

View file

@ -1,3 +1,4 @@
import { cloneDeep } from 'lodash';
import type { GameState } from './index';
import * as engine from './src/engine';
import type { LogMove } from './src/log';
@ -23,7 +24,7 @@ export async function move(G: GameState, move: Move, player: number) {
export { ended, scores, stripSecret } from './src/engine';
export function rankings(G: GameState) {
const sortedPlayers = G.players
const sortedPlayers = cloneDeep(G.players)
.sort((p1, p2) => {
if (p1.money == p2.money) {
return p1.containersOnIsland.length - p2.containersOnIsland.length;