mirror of
https://github.com/Nighthawk42/roll20-character-sheets.git
synced 2026-09-04 14:12:28 +00:00
* Make calculateTpKKMod a bit easier to read
This commit is contained in:
@@ -17191,9 +17191,14 @@ on("change:kk change:NKW1_SchwellenwertKK change:NKW1_Schwellenwert change:NKW2_
|
||||
});
|
||||
|
||||
function calculateTpKKMod(values, weapon) {
|
||||
let kkDifference = parseInt(values["kk"]) - parseInt(values["NKW" + weapon + "_SchwellenwertKK"]);
|
||||
let KK = parseInt(values["kk"]);
|
||||
let weaponKK = parseInt(values["NKW" + weapon + "_SchwellenwertKK"]);
|
||||
let threshold = parseInt(values["NKW" + weapon + "_Schwellenwert"]);
|
||||
|
||||
let kkDifference = KK - weaponKK;
|
||||
|
||||
var tpkkMod = Math.floor(Math.abs(kkDifference) / threshold);
|
||||
|
||||
var tpkkMod = Math.floor(Math.abs(kkDifference) / parseInt(values["NKW" + weapon + "_Schwellenwert"]));
|
||||
if (kkDifference < 0) {
|
||||
tpkkMod = tpkkMod * -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user