Distribute initial resources
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
d8878ed81f
commit
d932312f5f
@ -314,7 +314,7 @@ const GameOrder = ({table}) => {
|
|||||||
players = players.map(item =>
|
players = players.map(item =>
|
||||||
<div className="GameOrderPlayer" key={`player-${item.color}`}>
|
<div className="GameOrderPlayer" key={`player-${item.color}`}>
|
||||||
<PlayerColor color={item.color}/>
|
<PlayerColor color={item.color}/>
|
||||||
<div>{item.order+1}. {item.name}</div>
|
<div>{item.name}</div>
|
||||||
{ item.orderRoll !== 0 && <>rolled <Dice pips={item.orderRoll}/>.</> }
|
{ item.orderRoll !== 0 && <>rolled <Dice pips={item.orderRoll}/>.</> }
|
||||||
{ item.orderRoll === 0 && <>has not rolled yet. {item.orderStatus}</>}
|
{ item.orderRoll === 0 && <>has not rolled yet. {item.orderStatus}</>}
|
||||||
</div>
|
</div>
|
||||||
|
@ -765,6 +765,9 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
|||||||
corner.color = session.color;
|
corner.color = session.color;
|
||||||
corner.type = 'settlement';
|
corner.type = 'settlement';
|
||||||
if (game.state === 'initial-placement') {
|
if (game.state === 'initial-placement') {
|
||||||
|
if (game.direction && game.direction === 'backward') {
|
||||||
|
session.initialSettlement = index;
|
||||||
|
}
|
||||||
game.turn.actions = ['place-road'];
|
game.turn.actions = ['place-road'];
|
||||||
game.turn.limits = { roads: layout.corners[index].roads }; /* road placement is limited to be near this corner */
|
game.turn.limits = { roads: layout.corners[index].roads }; /* road placement is limited to be near this corner */
|
||||||
addChatMessage(game, session, `Placed a settlement. Next, they need to place a road.`);
|
addChatMessage(game, session, `Placed a settlement. Next, they need to place a road.`);
|
||||||
@ -831,7 +834,28 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
addChatMessage(game, null, `Everyone has placed their two settlements!`);
|
addChatMessage(game, null, `Everyone has placed their two settlements!`);
|
||||||
addChatMessage(game, null, `TODO: Give players resources from their second placement.`);
|
|
||||||
|
/* Figure out which players received which resources */
|
||||||
|
for (let id in game.sessions) {
|
||||||
|
const session = game.sessions[id],
|
||||||
|
receives = {};
|
||||||
|
if (session.initialSettlement) {
|
||||||
|
layout.tiles.forEach((tile, index) => {
|
||||||
|
if (tile.corners.indexOf(session.initialSettlement) !== -1) {
|
||||||
|
const resource = assetData.tiles[game.tileOrder[index]].type;
|
||||||
|
if (!(resource in receives)) {
|
||||||
|
receives[resource] = 0;
|
||||||
|
}
|
||||||
|
receives[resource]++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let message = [];
|
||||||
|
for (let type in receives) {
|
||||||
|
message.push(`${receives[type]} ${type}`);
|
||||||
|
}
|
||||||
|
addChatMessage(game, null, `${session.name} receives ${message.join(', ')}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
addChatMessage(game, null, `It is ${name}'s turn.`);
|
addChatMessage(game, null, `It is ${name}'s turn.`);
|
||||||
game.state = 'normal';
|
game.state = 'normal';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user