DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

045dc64ec8cbfb0889865ab4a91a5fd5a8272746 — Jonni Liljamo 1 year, 7 months ago eb160ae
feat(client): roll for currency command
2 files changed, 7 insertions(+), 0 deletions(-)

M client/src/api/game/mod.rs
M client/src/game_status/parser.rs
M client/src/api/game/mod.rs => client/src/api/game/mod.rs +4 -0
@@ 58,6 58,10 @@ pub enum Command {
    ChangePlayerState {
        state: PlayerState,
    },
    RollForCurrency {
        min: usize,
        max: usize,
    },
}

#[derive(Deserialize, Serialize, Clone, PartialEq)]

M client/src/game_status/parser.rs => client/src/game_status/parser.rs +3 -0
@@ 194,6 194,9 @@ fn parse_action(action: &Action, game: &Game, game_status: &mut GameStatus) {
        Command::ChangePlayerState { state } => {
            target.state = *state;
        }
        Command::RollForCurrency { min, max } => {
            target.currency += Rng::with_seed(action.seed.parse::<u64>().unwrap()).usize(min..=max);
        }
        #[allow(unreachable_patterns)]
        _ => todo!(),
    }