1
0

Fixed city placement hover

Changed working on discard

Added Requirement action to the Activities list

Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
James Ketrenos 2022-03-02 11:09:30 -08:00
parent 4ff9ad015e
commit 8170189400
4 changed files with 40 additions and 12 deletions

View File

@ -30,11 +30,25 @@
align-items: center; align-items: center;
} }
.Activity b, .Activities > div.Go {
.Activity .Dice { background-color: rgba(36, 148, 46, 0.5);
filter: drop-shadow(0px 0px 10px rgb(54, 219, 68));
}
.Activities > div.Requirement {
background-color: rgba(219, 208, 54, 0.5);
filter: drop-shadow(0px 0px 10px rgb(219, 208, 54));
}
.Activities b,
.Activities .Dice {
margin-left: 0.25em; margin-left: 0.25em;
} }
.Activities b {
margin-right: 0.25em;
}
.Activities > div:last-child { .Activities > div:last-child {
border-top: 1px solid black; border-top: 1px solid black;
} }

View File

@ -63,7 +63,8 @@ const Activities = ({ table }) => {
game = table.game, game = table.game,
isTurn = (game.turn && game.turn.color === game.color) ? true : false, isTurn = (game.turn && game.turn.color === game.color) ? true : false,
normalPlay = (game.state === 'initial-placement' || game.state === 'normal'), normalPlay = (game.state === 'initial-placement' || game.state === 'normal'),
mustDiscard = game.player ? (parseInt(game.player.mustDiscard ? game.player.mustDiscard : 0) !== 0) : false; mustDiscard = game.player ? parseInt(game.player.mustDiscard ? game.player.mustDiscard : 0) : 0,
mustPlaceRobber = (game.turn && !game.turn.placedRobber && game.turn.robberInAction);
const list = game.activities const list = game.activities
.filter(activity => game.timestamp - activity.date < 11000) .filter(activity => game.timestamp - activity.date < 11000)
@ -74,17 +75,24 @@ const Activities = ({ table }) => {
return ( return (
<div className="Activities"> <div className="Activities">
{ list } { list }
{ !isTurn && normalPlay && game.player && mustDiscard === 0 && mustPlaceRobber &&
{ !isTurn && normalPlay && !mustDiscard && <div className="Requirement"><PlayerColor color={table.game.turn.color}/> {table.game.turn.name} must move the Robber.</div>
<div>Waiting for <PlayerColor color={table.game.turn.color}/> {table.game.turn.name} to complete their turn.</div>
} }
{ isTurn && normalPlay && game.player && mustDiscard && { isTurn && normalPlay && game.player && mustDiscard === 0 && mustPlaceRobber &&
<div>You must discard.</div> <div className="Requirement">You must move the Robber.</div>
}
{ normalPlay && game.player && mustDiscard !== 0 &&
<div className="Requirement">You must discard <b>{mustDiscard}</b> cards.</div>
}
{ !isTurn && normalPlay &&
<div>It is <PlayerColor color={table.game.turn.color}/> {table.game.turn.name}'s turn.</div>
} }
{ isTurn && normalPlay && { isTurn && normalPlay &&
<div><PlayerColor color={game.turn.color}/> It is your turn.</div> <div className="Go"><PlayerColor color={game.turn.color}/> It is your turn.</div>
} }
</div> </div>
); );

View File

@ -164,7 +164,13 @@ div[disabled] .Option {
.Option .Tile-Shape, .Option .Tile-Shape,
.Option .Corner-Shape, .Option .Corner-Shape,
.Option .Road-Shape { .Option .Road-Shape {
background-color: rgba(255, 255, 255, 0.5); background-color: rgba(255, 255, 255, 0.5) !important;
}
.Option .Tile-Shape:hover,
.Option .Corner-Shape:hover,
.Option .Road-Shape :hover{
background-color: rgba(255, 255, 255, 0.75) !important;
} }
.Robber .Pip-Shape { .Robber .Pip-Shape {

View File

@ -399,7 +399,7 @@ const processRoll = (game, dice) => {
} }
} else { } else {
mustDiscard.forEach(player => mustDiscard.forEach(player =>
addChatMessage(game, null, `${getPlayerName(game, player)} must discard ${player.mustDiscard} resource cards the robber steals while fleeing!`) addChatMessage(game, null, `The robber was rolled and ${getPlayerName(game, player)} must discard ${player.mustDiscard} resource cards!`)
); );
} }
} else { } else {
@ -2454,7 +2454,7 @@ router.put("/:id/:action/:value?", async (req, res) => {
} }
addChatMessage(game, null, `${session.name} discarded ${sum} resource cards.`); addChatMessage(game, null, `${session.name} discarded ${sum} resource cards.`);
if (player.mustDiscard) { if (player.mustDiscard) {
addChatMessage(game, null, `${session.name} must discard ${player.mustDiscard} more cards.`); addChatMessage(game, null, `${session.name} did not discard enough and must discard ${player.mustDiscard} more cards.`);
break; break;
} }