DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

6abc7f2247dc518eca45a0b85bdf2cb87f0e5bae — Jonni Liljamo 1 year, 7 months ago cbfbc57
feat(client): update RollForCurrency
M client/src/api/game/mod.rs => client/src/api/game/mod.rs +2 -2
@@ 64,8 64,8 @@ pub enum Command {
        state: PlayerState,
    },
    RollForCurrency {
        min: usize,
        max: usize,
        amount: usize,
        sides: usize,
    },
}


M client/src/game_status/parser.rs => client/src/game_status/parser.rs +4 -2
@@ 229,8 229,10 @@ 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);
        Command::RollForCurrency { amount, sides } => {
            for _ in 0..*amount {
                target.currency += Rng::with_seed(action.seed.parse::<u64>().unwrap()).usize(1..=*sides);
            }
        }
        #[allow(unreachable_patterns)]
        _ => todo!(),

M client/src/plugins/game/ui/mod.rs => client/src/plugins/game/ui/mod.rs +1 -1
@@ 422,7 422,7 @@ fn hardcoded_init(game: &Game, create_action_ev_w: &mut EventWriter<GameActionCr
                    long_details: vec![],
                    cost: 0,
                    actions: vec![CardAction {
                        command: Command::RollForCurrency { min: 1, max: 6 },
                        command: Command::RollForCurrency { amount: 1, sides: 6 },
                    }],
                },
                amount: 10,

M client/src/util/action_to_log.rs => client/src/util/action_to_log.rs +4 -2
@@ 76,10 76,12 @@ pub fn action_to_log(
                LogSection::bold(&format!("{:?}", state)),
            ])
        }
        Command::RollForCurrency { min: _, max: _ } => {
        Command::RollForCurrency { amount, sides } => {
            LogEntry::from_sections(vec![
                LogSection::bold(invoker_name),
                LogSection::normal(" rolled for currency (log borked)"),
                LogSection::normal(" rolled "),
                LogSection::bold(&format!("{}d{}", amount, sides)),
                LogSection::normal(" for currency"),
            ])
        }
        #[allow(unreachable_patterns)]