Playing an Army activates robberInAction for active player to place Robber
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
ee3f96dc6f
commit
27cdcda2d4
@ -392,8 +392,7 @@ const Action = ({ table }) => {
|
||||
player = game ? game.player : undefined,
|
||||
hasRolled = (game && game.turn && game.turn.roll) ? true : false,
|
||||
isTurn = (game && game.turn && game.turn.color === game.color) ? true : false,
|
||||
robberActions = (game && game.turn && game.turn.roll === 7 &&
|
||||
!game.turn.robberDone),
|
||||
robberActions = (game && game.turn && game.turn.robberInAction),
|
||||
haveResources = player ? player.haveResources : false;
|
||||
|
||||
return (
|
||||
@ -1057,6 +1056,13 @@ class Table extends React.Component {
|
||||
table={this}
|
||||
/>
|
||||
}
|
||||
{ game.largestArmy && game.largestArmy === game.color &&
|
||||
<Placard
|
||||
active={false}
|
||||
type='largest-army'
|
||||
table={this}
|
||||
/>
|
||||
}
|
||||
<Placard
|
||||
active={this.state.buildActive}
|
||||
disabled={!game || !game.turn || !game.turn.roll}
|
||||
|
@ -102,7 +102,7 @@ for (let i = 1; i <= 14; i++) {
|
||||
});
|
||||
}
|
||||
|
||||
[ 'monopoly', 'road-1', 'road-2', 'yeard-of-plenty'].forEach(card => assetData.developmentCards.push({
|
||||
[ 'monopoly', 'road-1', 'road-2', 'year-of-plenty'].forEach(card => assetData.developmentCards.push({
|
||||
type: 'progress',
|
||||
card: card
|
||||
}));
|
||||
@ -367,7 +367,7 @@ const processRoll = (game, dice) => {
|
||||
game.turn.roll = game.dice[0] + game.dice[1];
|
||||
if (game.turn.roll === 7) {
|
||||
addChatMessage(game, null, `ROBBER! ${game.gender === 'female' ? 'Roberta' : 'Robert'} Robber Roberson!`);
|
||||
game.turn.robberDone = false;
|
||||
game.turn.robberInAction = true;
|
||||
delete game.turn.placedRobber;
|
||||
for (let id in game.sessions) {
|
||||
const player = game.sessions[id].player;
|
||||
@ -1459,7 +1459,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
|
||||
/* If the current turn is a robber placement, and everyone has
|
||||
* discarded, set the limits for where the robber can be placed */
|
||||
if (game.turn && game.turn.roll === 7 && !game.turn.robberDone) {
|
||||
if (game.turn && game.turn.robberInAction) {
|
||||
error = `Robber is in action. Turn can not stop until all Robber tasks are resolved.`;
|
||||
break;
|
||||
}
|
||||
@ -1515,7 +1515,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
addChatMessage(game, session, `${session.name} must select player to steal resource from.`);
|
||||
} else {
|
||||
game.turn.actions = [];
|
||||
game.turn.robberDone = true;
|
||||
game.turn.robberInAction = false;
|
||||
delete game.turn.limits;
|
||||
addChatMessage(game, session, `The Robber was moved to a terrain with no other players.`);
|
||||
}
|
||||
@ -1552,7 +1552,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
addChatMessage(game, session,
|
||||
`${session.name} randomly stole ${type} from ${playerNameFromColor(game, value)}.`);
|
||||
}
|
||||
game.turn.robberDone = true;
|
||||
game.turn.robberInAction = false;
|
||||
break;
|
||||
|
||||
case 'buy-development':
|
||||
@ -1569,7 +1569,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
break;
|
||||
}
|
||||
|
||||
if (game.turn && game.turn.roll === 7 && !game.turn.robberDone) {
|
||||
if (game.turn && game.turn.robberInAction) {
|
||||
error = `Robber is in action. You can not purchase until all Robber tasks are resolved.`;
|
||||
break;
|
||||
}
|
||||
@ -1596,7 +1596,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
|
||||
case 'play-card':
|
||||
if (game.state !== 'normal') {
|
||||
error = `You cannot purchase a settlement unless the game is active.`;
|
||||
error = `You cannot play a development card unless the game is active.`;
|
||||
break;
|
||||
}
|
||||
if (session.color !== game.turn.color) {
|
||||
@ -1608,7 +1608,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
break;
|
||||
}
|
||||
|
||||
if (game.turn && game.turn.roll === 7 && !game.turn.robberDone) {
|
||||
if (game.turn && game.turn.robberInAction) {
|
||||
error = `Robber is in action. You can not play a card until all Robber tasks are resolved.`;
|
||||
break;
|
||||
}
|
||||
@ -1650,7 +1650,6 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
|
||||
if (card.type === 'army') {
|
||||
player.army++;
|
||||
}
|
||||
|
||||
if (player.army > 2 &&
|
||||
(!game.largestArmy || game.players[game.largestArmy].army < player.army)) {
|
||||
@ -1659,6 +1658,12 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
addChatMessage(game, session, `${session.name} now has the largest army (${player.army})!`)
|
||||
}
|
||||
}
|
||||
|
||||
game.turn.robberInAction = true;
|
||||
delete game.turn.placedRobber;
|
||||
addChatMessage(game, session, `${session.name} must now move the robber.`);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'buy-settlement':
|
||||
@ -1675,7 +1680,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
break;
|
||||
}
|
||||
|
||||
if (game.turn && game.turn.roll === 7 && !game.turn.robberDone) {
|
||||
if (game.turn && game.turn.robberInAction) {
|
||||
error = `Robber is in action. You can not purchase until all Robber tasks are resolved.`;
|
||||
break;
|
||||
}
|
||||
@ -1808,7 +1813,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
break;
|
||||
}
|
||||
|
||||
if (game.turn && game.turn.roll === 7 && !game.turn.robberDone) {
|
||||
if (game.turn && game.turn.robberInAction) {
|
||||
error = `Robber is in action. You can not purchase until all Robber tasks are resolved.`;
|
||||
break;
|
||||
}
|
||||
@ -1888,7 +1893,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
||||
break;
|
||||
}
|
||||
|
||||
if (game.turn && game.turn.roll === 7 && !game.turn.robberDone) {
|
||||
if (game.turn && game.turn.robberInAction) {
|
||||
error = `Robber is in action. You can not purchase until all Robber tasks are resolved.`;
|
||||
break;
|
||||
}
|
||||
@ -2118,7 +2123,7 @@ const sendGame = async (req, res, game, error) => {
|
||||
|
||||
/* If the current turn is a robber placement, and everyone has
|
||||
* discarded, set the limits for where the robber can be placed */
|
||||
if (game.turn && game.turn.roll === 7) {
|
||||
if (game.turn && game.turn.robberInAction) {
|
||||
let move = true;
|
||||
for (let color in game.players) {
|
||||
const discard = game.players[color].mustDiscard;
|
||||
|
Loading…
x
Reference in New Issue
Block a user