|
|
@@ -18,8 +18,13 @@ die_roll::operator int() const {
|
|
|
}
|
|
|
|
|
|
dice_roll::operator int() const {
|
|
|
- return std::accumulate(sub_rolls.begin(), sub_rolls.end(), 0) +
|
|
|
+ auto subtotal = std::accumulate(sub_rolls.begin(), sub_rolls.end(), 0) +
|
|
|
std::accumulate(modifiers.begin(), modifiers.end(), 0);
|
|
|
+ if (dc.comp != difficulty_class::test::None) {
|
|
|
+ return static_cast<int>(dc(subtotal));
|
|
|
+ } else {
|
|
|
+ return subtotal;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
die_roll roll_impl(die const & d, engine::random & gen) {
|
|
|
@@ -35,7 +40,7 @@ dice_roll roll_impl(dice const & d, engine::random & gen) {
|
|
|
for (die const & di : d.of) {
|
|
|
hits.push_back(roll_impl(di, gen));
|
|
|
}
|
|
|
- return {hits, d.modifier};
|
|
|
+ return {hits, d.modifier, d.dc};
|
|
|
}
|
|
|
|
|
|
roller::roller() : gen() {}
|