mirror of
https://github.com/morbalint/kemkas.git
synced 2026-07-18 03:13:46 +00:00
use Redux for tulajdonsagok
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user