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 = [];
|
||||
const stats = winner.stolen;
|
||||
for (let player in stats) {
|
||||
if (player === 'total') {
|
||||
continue;
|
||||
}
|
||||
if (player === 'robber') {
|
||||
robber = <></>;
|
||||
for (let type in stats.robber.stole) {
|
||||
|
@ -292,7 +292,7 @@ const distributeResources = (game, roll) => {
|
||||
if (!tile.robber) {
|
||||
receives[active.color][resource.type] += count;
|
||||
} else {
|
||||
trackTheft(game, active.color, robber, resource.type, count);
|
||||
trackTheft(game, active.color, '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 */
|
||||
if (!(type in stats[from].stole)) {
|
||||
stats[from].stole[type] = 0;
|
||||
if (!(type in stats[from].stolen)) {
|
||||
stats[from].stolen[type] = 0;
|
||||
}
|
||||
if (!(type in stats[to].stolen)) {
|
||||
stats[to].stolen[type] = 0;
|
||||
if (!(type in stats[to].stole)) {
|
||||
stats[to].stole[type] = 0;
|
||||
}
|
||||
|
||||
/* Update counts */
|
||||
@ -4112,7 +4112,9 @@ const resetGame = (game) => {
|
||||
players: game.players,
|
||||
stolen: {
|
||||
robber: {
|
||||
stole: 0
|
||||
stole: {
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
total: 0
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user