-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/disallow immediate dev card #290
Changes from all commits
d98b96d
63cbaa2
cb4b99c
3b2f398
b8e9b9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,10 @@ | |
# de-normalized features (for performance since we think they are good features) | ||
"ACTUAL_VICTORY_POINTS": 0, | ||
"LONGEST_ROAD_LENGTH": 0, | ||
"KNIGHT_PURCHASED_THIS_TURN": 0, | ||
"MONOPOLY_PURCHASED_THIS_TURN": 0, | ||
"YEAR_OF_PLENTY_PURCHASED_THIS_TURN": 0, | ||
"ROAD_BUILDING_PURCHASED_THIS_TURN": 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you share more about the motivation of these? I believe this is what the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a player has a knight card at the start of their turn, then purchases 2 knight cards, they should still be able to play the one knight card. Alternatively, we could have something like KNIGHT_OWNED_AT_START_OF_TURN, and check in player_can_play_dev() for: Looking back, maybe that approach is more straightforward |
||
} | ||
for resource in RESOURCES: | ||
PLAYER_INITIAL_STATE[f"{resource}_IN_HAND"] = 0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,7 @@ function PlayButtons() { | |
[enqueueSnackbar, closeSnackbar] | ||
); | ||
|
||
const { gameState, isPlayingMonopoly, isPlayingYearOfPlenty } = state; | ||
const { gameState, isPlayingMonopoly, isPlayingYearOfPlenty, isRoadBuilding } = state; | ||
const key = playerKey(gameState, gameState.current_color); | ||
const isRoll = | ||
gameState.current_prompt === "PLAY_TURN" && | ||
|
@@ -198,51 +198,51 @@ function PlayButtons() { | |
return ( | ||
<> | ||
<OptionsButton | ||
disabled={playableDevCardTypes.size === 0 || isPlayingYearOfPlenty} | ||
disabled={playableDevCardTypes.size === 0 || isPlayingMonopoly || isPlayingYearOfPlenty || isRoadBuilding} | ||
menuListId="use-menu-list" | ||
icon={<SimCardIcon />} | ||
items={useItems} | ||
> | ||
Use | ||
</OptionsButton> | ||
<OptionsButton | ||
disabled={buildActionTypes.size === 0 || isPlayingYearOfPlenty} | ||
disabled={buildActionTypes.size === 0 || isPlayingMonopoly || isPlayingYearOfPlenty || isRoadBuilding} | ||
menuListId="build-menu-list" | ||
icon={<BuildIcon />} | ||
items={buildItems} | ||
> | ||
Buy | ||
</OptionsButton> | ||
<OptionsButton | ||
disabled={tradeItems.length === 0 || isPlayingYearOfPlenty} | ||
disabled={tradeItems.length === 0 || isPlayingMonopoly || isPlayingYearOfPlenty || isRoadBuilding} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NIT: I'd be awesome if we can give the |
||
menuListId="trade-menu-list" | ||
icon={<AccountBalanceIcon />} | ||
items={tradeItems} | ||
> | ||
Trade | ||
</OptionsButton> | ||
<Button | ||
disabled={gameState.is_initial_build_phase} | ||
disabled={gameState.is_initial_build_phase || isRoadBuilding} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still need to see ResourceSelector "Select" button for Monopoly/YOP, hide other buttons while playing dev cards |
||
variant="contained" | ||
color="primary" | ||
startIcon={<NavigateNextIcon />} | ||
onClick={ | ||
isRoll | ||
? rollAction | ||
: isDiscard | ||
isDiscard | ||
? proceedAction | ||
: isMoveRobber | ||
? setIsMovingRobber | ||
: isPlayingYearOfPlenty || isPlayingMonopoly | ||
? handleOpenResourceSelector | ||
: isRoll | ||
? rollAction | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved isRoll to later in the ternary statements because if a dev card is played before rolling, we want to see the ResourceSelector button for monopoly/yearOfPlenty |
||
: endTurnAction | ||
} | ||
> | ||
{ | ||
isRoll ? "ROLL" : | ||
isDiscard ? "DISCARD" : | ||
isMoveRobber ? "ROB" : | ||
isPlayingYearOfPlenty || isPlayingMonopoly ? "SELECT" : | ||
isRoll ? "ROLL" : | ||
"END" | ||
} | ||
</Button> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the scenario they are road building, I think I'd like the game state to stay focused on that what do you think? Feels a bit off to: Play Road Building, Place a Road, Play Knight, ... It might lead to subtle bugs of states we are not thinking about.
Could you keep this branch of
state.is_road_building
to only return those options? Thanks!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe then the final structure is something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! Didn't realize this testing thru the UI because is_road_building prevents the UI player from doing anything else