add initial value to reduce
This commit is contained in:
parent
9d7aed2773
commit
7808093bc7
|
@ -117,14 +117,24 @@ export const runCmd = (fullCmd: string, modifiers: RollModifiers): SolvedRoll =>
|
||||||
returnMsg.line3 = line3;
|
returnMsg.line3 = line3;
|
||||||
|
|
||||||
// Reduce counts to a single object
|
// Reduce counts to a single object
|
||||||
returnMsg.counts = tempCountDetails.reduce((acc, cnt) => ({
|
returnMsg.counts = tempCountDetails.reduce(
|
||||||
|
(acc, cnt) => ({
|
||||||
total: acc.total + cnt.total,
|
total: acc.total + cnt.total,
|
||||||
successful: acc.successful + cnt.successful,
|
successful: acc.successful + cnt.successful,
|
||||||
failed: acc.failed + cnt.failed,
|
failed: acc.failed + cnt.failed,
|
||||||
rerolled: acc.rerolled + cnt.rerolled,
|
rerolled: acc.rerolled + cnt.rerolled,
|
||||||
dropped: acc.dropped + cnt.dropped,
|
dropped: acc.dropped + cnt.dropped,
|
||||||
exploded: acc.exploded + cnt.exploded,
|
exploded: acc.exploded + cnt.exploded,
|
||||||
}));
|
}),
|
||||||
|
{
|
||||||
|
total: 0,
|
||||||
|
successful: 0,
|
||||||
|
failed: 0,
|
||||||
|
rerolled: 0,
|
||||||
|
dropped: 0,
|
||||||
|
exploded: 0,
|
||||||
|
},
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Fill in the return block
|
// Fill in the return block
|
||||||
returnMsg.error = true;
|
returnMsg.error = true;
|
||||||
|
|
Loading…
Reference in New Issue