Fix Winning dialog and trackTheft on backend
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
746340576f
commit
2e48ab04e2
@ -94,6 +94,9 @@ const Winner = ({ winnerDismissed, setWinnerDismissed }) => {
|
|||||||
let playerStolen = [];
|
let playerStolen = [];
|
||||||
const stats = winner.stolen;
|
const stats = winner.stolen;
|
||||||
for (let player in stats) {
|
for (let player in stats) {
|
||||||
|
if (player === 'total') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (player === 'robber') {
|
if (player === 'robber') {
|
||||||
robber = <></>;
|
robber = <></>;
|
||||||
for (let type in stats.robber.stole) {
|
for (let type in stats.robber.stole) {
|
||||||
|
@ -292,7 +292,7 @@ const distributeResources = (game, roll) => {
|
|||||||
if (!tile.robber) {
|
if (!tile.robber) {
|
||||||
receives[active.color][resource.type] += count;
|
receives[active.color][resource.type] += count;
|
||||||
} else {
|
} else {
|
||||||
trackTheft(game, active.color, robber, resource.type, count);
|
trackTheft(game, active.color, 'robber', resource.type, count);
|
||||||
receives.robber[resource.type] += count;
|
receives.robber[resource.type] += count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4072,11 +4072,11 @@ const trackTheft = (game, from, to, type, count) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/* Initialize 'type' field in structures */
|
/* Initialize 'type' field in structures */
|
||||||
if (!(type in stats[from].stole)) {
|
if (!(type in stats[from].stolen)) {
|
||||||
stats[from].stole[type] = 0;
|
stats[from].stolen[type] = 0;
|
||||||
}
|
}
|
||||||
if (!(type in stats[to].stolen)) {
|
if (!(type in stats[to].stole)) {
|
||||||
stats[to].stolen[type] = 0;
|
stats[to].stole[type] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update counts */
|
/* Update counts */
|
||||||
@ -4112,7 +4112,9 @@ const resetGame = (game) => {
|
|||||||
players: game.players,
|
players: game.players,
|
||||||
stolen: {
|
stolen: {
|
||||||
robber: {
|
robber: {
|
||||||
stole: 0
|
stole: {
|
||||||
|
total: 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
total: 0
|
total: 0
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user