File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -459,6 +459,15 @@ export class Splendor extends BaseGame<State> {
459459
460460 if ( input . length > 3 ) return { success : false , error : "You can't take that many tokens!" as ToTranslate } ;
461461 if ( input . length === 0 ) return { success : false , error : 'You must take at least 2 tokens!' as ToTranslate } ;
462+ if ( input . length < 3 && input . every ( ( { count } ) => count === 1 ) ) {
463+ // Support people taking one-of-a-kind for _less_ than 3
464+ // Mainly matters when either the bank doesn't have enough types or the player can't take 3 more
465+ const typesInBank = TokenTypes . filter ( tokenType => this . state . board . tokens [ tokenType ] > 0 ) ;
466+ const playerTokens = Object . values ( this . state . playerData [ this . turn ! ] . tokens ) . sum ( ) ;
467+ if ( ! ( typesInBank . length < 3 || playerTokens + 3 > MAX_TOKEN_COUNT ) )
468+ return { success : false , error : 'You should probably be taking one token of three different types...' as ToTranslate } ;
469+ return { success : true , data : null } ;
470+ }
462471 if ( input . length === 2 ) {
463472 return { success : false , error : 'You can only take 2 from 1 type or 1 each from 3 types!' as ToTranslate } ;
464473 }
You can’t perform that action at this time.
0 commit comments