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
@@ -1,7 +1,7 @@
import {TulajdonsagokFajjal} from "./faj";
import {KarakterInputs} from "./karakter";
import {d6} from "../../shared/domain-models/kockak";
import {RollAbility} from "../../shared/domain-models/rollAbility";
export enum Tulajdonsag {
Ero = 't_ero',
@@ -43,27 +43,10 @@ export function TulajdonsagLabel(tul: Tulajdonsag) : string {
}
}
function rollAbility() {
let min = 6;
let sum = 0;
let rolls: number[] = []
for (let i = 0; i < 4; i++) {
const roll = d6();
if (roll < min) {
min = roll;
}
sum += roll;
rolls.push(roll)
}
const result = sum - min;
console.log("Rolled: " + rolls + " got: " + result)
return result;
}
export function RollAllAbilities() : KarakterTulajdonsagok {
const response = {...TulajdonsagDefaults}
for (const key of TulajdonsagIDs) {
response[key] = rollAbility()
response[key] = RollAbility()
}
return response
}