From a644aaa14c8be704b5e00bbcf4225a554fd9ef0c Mon Sep 17 00:00:00 2001 From: Peter Bjerg Mogensen Date: Tue, 13 Oct 2020 09:10:41 +0200 Subject: [PATCH] - Changed custom rogue skill no armor total and heavy armor total to have 0 as default value. - Added logging to RepeatingCalculateTotal --- AD&D 2E Revised/2ESheet.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/AD&D 2E Revised/2ESheet.html b/AD&D 2E Revised/2ESheet.html index 19be4a10f7..ec79ec1bb6 100644 --- a/AD&D 2E Revised/2ESheet.html +++ b/AD&D 2E Revised/2ESheet.html @@ -2603,10 +2603,10 @@ % % - % + % % - % + % @@ -18031,18 +18031,23 @@ function setupCalculateTotal(totalField, fieldsToSum) { } function setupRepeatingCalculateTotal(repeatingTotalField, repeatingFieldsToSum, repeatingName) { + console.log(repeatingFieldsToSum); let onChange = repeatingFieldsToSum.map(field => `change:repeating_${repeatingName}:${field}`).join(' '); let allFields = [...repeatingFieldsToSum]; allFields.push(repeatingTotalField); + console.log(onChange); + console.log(allFields); on(`${onChange} remove:repeating_${repeatingName}`, function(){ TAS.repeating(repeatingName) .fields(allFields) .reduce(function(m,r) { repeatingFieldsToSum.forEach(column => { m.total += r.I[column]; + console.log(m); }); return m; }, {total: 0}, function (m,r) { + console.log(m); r[repeatingTotalField] = m.total; }) .execute();