1
0

Added bank information to bank placement.

Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
James Ketrenos 2022-02-26 14:11:21 -08:00
parent 8d9926a413
commit 09690ee4e0

View File

@ -2153,7 +2153,9 @@ router.put("/:id/:action/:value?", async (req, res) => {
console.log(`Bank ${bank}`) console.log(`Bank ${bank}`)
return; return;
} }
bankType = (type === 'bank') ? '3:1' : type; bankType = (type === 'bank')
? '3 of anything for 1 resource'
: `2 ${type} for 1 resource`;
if (player.banks.indexOf(type) === -1) { if (player.banks.indexOf(type) === -1) {
player.banks.push(type); player.banks.push(type);
} }
@ -2162,7 +2164,8 @@ router.put("/:id/:action/:value?", async (req, res) => {
game.turn.actions = []; game.turn.actions = [];
game.turn.limits = {}; game.turn.limits = {};
if (bankType) { if (bankType) {
addChatMessage(game, session, `${name} placed a settlement by a maritime bank for ${bankType}.`); addChatMessage(game, session,
`${name} placed a settlement by a maritime bank that trades ${bankType}.`);
} else { } else {
addChatMessage(game, session, `${name} placed a settlement.`); addChatMessage(game, session, `${name} placed a settlement.`);
} }
@ -2173,6 +2176,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
} }
corner.color = session.color; corner.color = session.color;
corner.type = 'settlement'; corner.type = 'settlement';
let bankType = undefined;
if (layout.corners[index].banks.length) { if (layout.corners[index].banks.length) {
layout.corners[index].banks.forEach(bank => { layout.corners[index].banks.forEach(bank => {
console.log(game.borderOrder); console.log(game.borderOrder);
@ -2183,15 +2187,24 @@ router.put("/:id/:action/:value?", async (req, res) => {
if (!type) { if (!type) {
return; return;
} }
bankType = (type === 'bank')
? '3 of anything for 1 resource'
: `2 ${type} for 1 resource`;
if (player.banks.indexOf(type) === -1) { if (player.banks.indexOf(type) === -1) {
player.banks.push(type); player.banks.push(type);
} }
}); });
} }
player.settlements--; player.settlements--;
player.maritime = player.banks.map(bank => game.borders[Math.floor(bank / 3) + bank % 3]); if (bankType) {
addChatMessage(game, session,
`${name} placed a settlement by a maritime bank that trades ${bankType}. ` +
`Next, they need to place a road.`);
} else {
addChatMessage(game, session, `${name} placed a settlement.` +
`Next, they need to place a road.`);
}
placeRoad(game, layout.corners[index].roads); placeRoad(game, layout.corners[index].roads);
addChatMessage(game, session, `Placed a settlement. Next, they need to place a road.`);
} }
break; break;
@ -2750,7 +2763,6 @@ const resetGame = (game) => {
points: 0, points: 0,
development: [], development: [],
banks: [], banks: [],
maritime: [],
army: 0, army: 0,
playedCard: 0, playedCard: 0,
haveResources: false, haveResources: false,