From ec4502b7b26af04e45eb66f0fc330cbc40a44958 Mon Sep 17 00:00:00 2001 From: Kreuvf Date: Wed, 25 Nov 2020 21:27:35 +0100 Subject: [PATCH] * Make calculateTpKKMod a bit easier to read --- Das_Schwarze_Auge_4-1/dsa4_1_character_sheet_roll20.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Das_Schwarze_Auge_4-1/dsa4_1_character_sheet_roll20.html b/Das_Schwarze_Auge_4-1/dsa4_1_character_sheet_roll20.html index 52e825146e..f5cae28e61 100644 --- a/Das_Schwarze_Auge_4-1/dsa4_1_character_sheet_roll20.html +++ b/Das_Schwarze_Auge_4-1/dsa4_1_character_sheet_roll20.html @@ -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; }