Actually roll a die when converting to chance die pool.

This commit is contained in:
projectmoon 2020-10-22 23:34:01 +00:00
parent 1a980aa608
commit d482046b9b
1 changed files with 5 additions and 6 deletions

View File

@ -385,8 +385,8 @@ pub async fn roll_pool(pool: &DicePoolWithContext<'_>) -> Result<RolledDicePool,
} else { } else {
let chance_die = DicePool::chance_die(); let chance_die = DicePool::chance_die();
let pool = DicePoolWithContext(&chance_die, &pool.1); let pool = DicePoolWithContext(&chance_die, &pool.1);
let rolls = roll_dice(&pool.0, num_dice, &mut roller); let rolls = roll_dice(&pool.0, 1, &mut roller);
Ok(RolledDicePool::from(&pool.0, num_dice, rolls)) Ok(RolledDicePool::from(&pool.0, 1, rolls))
} }
} }
@ -573,10 +573,9 @@ mod tests {
let result = roll_pool(&pool_with_ctx).await; let result = roll_pool(&pool_with_ctx).await;
assert!(result.is_ok()); assert!(result.is_ok());
assert_eq!( let roll = result.unwrap();
DicePoolQuality::ChanceDie, assert_eq!(DicePoolQuality::ChanceDie, roll.modifiers.quality);
result.unwrap().modifiers.quality assert_eq!(1, roll.num_dice);
);
} }
#[tokio::test] #[tokio::test]