use Redux for tulajdonsagok

This commit is contained in:
2024-03-31 11:55:56 +02:00
parent edbe8934e4
commit a922b006bc
12 changed files with 212 additions and 71 deletions
@@ -0,0 +1,21 @@
import {d6} from "./kockak";
export function RollAbility(dependencies: {
d6: () => number
} = {d6}) {
const { d6: roll6 } = dependencies;
let min = 6;
let sum = 0;
let rolls: number[] = []
for (let i = 0; i < 4; i++) {
const roll = roll6();
if (roll < min) {
min = roll;
}
sum += roll;
rolls.push(roll)
}
const result = sum - min;
console.log("Rolled: " + rolls + " got: " + result)
return result;
}