DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

49a7a70c12a34314d776ea936c0d9d89fcf4679c — Jonni Liljamo 1 year, 4 months ago 2dd6c9f
feat(client): show what the user rolled in log
2 files changed, 7 insertions(+), 4 deletions(-)

M client/src/game_status/parser.rs
M client/src/util/action_to_log.rs
M client/src/game_status/parser.rs => client/src/game_status/parser.rs +6 -3
@@ 16,7 16,7 @@ use crate::{
    util::action_to_log,
};

use super::{GameStatus, PlayerState, PlayerStatus};
use super::{GameStatus, PlayerState, PlayerStatus, LogSection, LogEntry};

/// funny unsafe wrapper
fn get_invoker_target_next<'a>(


@@ 254,8 254,11 @@ fn parse_action(action: &Action, game: &Game, game_status: &mut GameStatus) {
        }
        Command::RollForCurrency { amount, sides } => {
            for _ in 0..*amount {
                target.currency +=
                    Rng::with_seed(action.seed.parse::<u64>().unwrap()).usize(1..=*sides);
                let result = Rng::with_seed(action.seed.parse::<u64>().unwrap()).usize(1..=*sides);
                target.currency += result;
                game_status.log.push(LogEntry::from_sections([
                    LogSection::bold(&format!("  {}", result.to_string())),
                ]));
            }
        }
        Command::GivePlays { amount } => {

M client/src/util/action_to_log.rs => client/src/util/action_to_log.rs +1 -1
@@ 92,7 92,7 @@ pub fn action_to_log(action: &Action, game_status: &GameStatus) -> LogEntry {
            LogSection::bold(invoker_name),
            LogSection::normal(" rolled "),
            LogSection::bold(&format!("{}d{}", amount, sides)),
            LogSection::normal(" for currency"),
            LogSection::normal(" for currency:"),
        ]),
        #[allow(unreachable_patterns)]
        _ => LogEntry {