|
|
@@ -8,8 +8,6 @@
|
|
|
|
|
|
#include "dice-roll/roll.h"
|
|
|
|
|
|
-#include <iostream>
|
|
|
-#include <memory>
|
|
|
#include <numeric>
|
|
|
|
|
|
#include "dice-roll/random.h"
|
|
|
@@ -24,36 +22,6 @@ dice_roll::operator int() const {
|
|
|
std::accumulate(modifiers.begin(), modifiers.end(), 0);
|
|
|
}
|
|
|
|
|
|
-std::ostream & operator<<(std::ostream & out, die_roll const & r) {
|
|
|
- out << r.sign;
|
|
|
- switch (r.rolled.size()) {
|
|
|
- case 0:
|
|
|
- // Prevent crashes if we somehow get a 0dM expression
|
|
|
- return out << "0";
|
|
|
- case 1:
|
|
|
- // Don't bother with braces if there's only a single roll,
|
|
|
- // the braces are for grouping purposes.
|
|
|
- return out << r.rolled[0];
|
|
|
- default:
|
|
|
- out << "[ ";
|
|
|
- out << r.rolled[0];
|
|
|
- for (int i = 1; i < r.rolled.size(); ++i) {
|
|
|
- out << ", " << r.rolled[i];
|
|
|
- }
|
|
|
- return out << " ]";
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-std::ostream & operator<<(std::ostream & out, dice_roll const & r) {
|
|
|
- for (die_roll const & dr : r.sub_rolls) {
|
|
|
- out << dr;
|
|
|
- }
|
|
|
- for (mod const & m : r.modifiers) {
|
|
|
- out << m.sign << m.value;
|
|
|
- }
|
|
|
- return out;
|
|
|
-}
|
|
|
-
|
|
|
die_roll roll_impl(die const & d, engine::random & gen) {
|
|
|
std::vector<int> hits;
|
|
|
for (int i = 0; i < d.num; ++i) {
|