select cards
This commit is contained in:
@@ -143,6 +143,20 @@ export default class GameStore {
|
||||
return this.gameUpdate(game);
|
||||
}
|
||||
|
||||
select(gameID: string, cardIndex: number, cardID: string): GameUpdate {
|
||||
const game = this.getGame(gameID);
|
||||
const card = game.cards[cardIndex];
|
||||
const replacement = deck.select(cardID);
|
||||
|
||||
if (!card) throw new Error(`Card ${cardIndex} not found`);
|
||||
if (!replacement) throw new Error(`Card ${cardID} not found`);
|
||||
|
||||
game.cards[cardIndex] = replacement;
|
||||
game.lastUpdated = Date.now();
|
||||
|
||||
return this.gameUpdate(game);
|
||||
}
|
||||
|
||||
updateSettings(gameID: string, settings: Settings) {
|
||||
const game = this.getGame(gameID);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user