From 97721fc36a8317bae49b566bc315997078093229 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Thu, 14 Apr 2022 17:34:12 -0700 Subject: [PATCH 1/9] New Size Template UI Deprecated size template UI based on repeating sections, implemented new UI to use select list resulting in more performance gains. --- BESM4eExtras/BESM4eExtras.css | 15 + BESM4eExtras/BESM4eExtras.html | 6580 +------------------------------- 2 files changed, 79 insertions(+), 6516 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.css b/BESM4eExtras/BESM4eExtras.css index 03e84087c6..3f41a6ddb3 100644 --- a/BESM4eExtras/BESM4eExtras.css +++ b/BESM4eExtras/BESM4eExtras.css @@ -2678,6 +2678,21 @@ div.sheet-flex-skillcontainer { align-self: center; } +.sheet-flex-11-12 { + flex: 0 1 91.66667%; + align-self: center; +} + +.sheet-flex-12-13 { + flex: 0 1 92.30769%; + align-self: center; +} + +.sheet-flex-14-15 { + flex: 0 1 93.33333%; + align-self: center; +} + .sheet-flex-19-20 { flex: 0 1 95%; align-self: center; diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 3acbea5349..2192e97227 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -30,7 +30,7 @@

Sheet Options

Sheet Version - +

Sheet Type @@ -110,10 +110,61 @@

-

Size Template

+

Size Template

-
+
+
+

Size + +

+
+
+

+   +

+

Rank + +

+

Cost + +

+
+
+

+   +

+
+
+
+
+

Description + +

+
+
@@ -156,7 +208,7 @@

Spent - +

Remaining @@ -189,13 +241,13 @@

Size - +

Height - +

Mass - +

@@ -1904,7 +1956,9 @@

-   + Lift + +

@@ -7643,1380 +7697,6 @@ \ No newline at end of file From 910429ac8ec286ab26c256900f96b73395d34fd3 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Thu, 14 Apr 2022 17:45:35 -0700 Subject: [PATCH 2/9] Fixed Enhancement Bonus Levels Corrected Tough and Energized to increase Health and Energy Points by 10 points per level, respectively, and Social Mastery and Unassailable to increase Social and Sanity points by 2 points per level, respectively. --- BESM4eExtras/BESM4eExtras.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 3acbea5349..62fedeec6b 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -30,7 +30,7 @@

Sheet Options

Sheet Version - +

Sheet Type @@ -9031,10 +9031,11 @@ (derivedvalue == 'sanity') ? 'unassailable' : (derivedvalue == 'social') ? 'socialmastery' : ''; + const multiplier = attribute === 'tough' || attribute === 'energized' ? 10 : 2; const bonusattribute = attrdb[`${attribute}`]; const bonus = _.chain(bonusattribute) .map(o => { - const result = parseInt(o.level) || 0; + const result = parseInt(o.level) * multiplier || 0; return result; }) .reduce((memo, num)=>{ return memo + num; }, 0) From 558deed030710faf60cfbfbbb21ea4bf0429fbf4 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Fri, 15 Apr 2022 20:44:07 -0700 Subject: [PATCH 3/9] Bug Fixes Fixed activated button theme colors. Fixed "targeted" attribute activation buttons not activating correctly. --- BESM4eExtras/BESM4eExtras.html | 6632 +++++++++++++++++++++++++++++++- 1 file changed, 6631 insertions(+), 1 deletion(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 2192e97227..0c97f7feb0 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -30,7 +30,7 @@

Sheet Options

Sheet Version - +

Sheet Type @@ -7697,6 +7697,1454 @@

\ No newline at end of file From d138bfdb258a58b26a35a41bdc2104a4379301a2 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Fri, 15 Apr 2022 22:09:43 -0700 Subject: [PATCH 4/9] Fixed Small Size Lift Added support for sizes smaller than medium to have lower lift values. --- BESM4eExtras/BESM4eExtras.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 0c97f7feb0..ea2a20b734 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -7888,10 +7888,10 @@ if (isLesserThan172) { upgradeTo_1_7_2(attrIDs, setObj); } - const isLesserThan177 = major_global_version <= 1 && minor_global_version < 7.7 ? + const isLesserThan180 = major_global_version <= 1 && minor_global_version < 8.0 ? true : false; - if (isLesserThan177) { - upgradeTo_1_7_7(sizetemplateIDs, value, sheetdb, setObj); + if (isLesserThan180) { + upgradeTo_1_8_0(sizetemplateIDs, value, sheetdb, setObj); } setObj.global_version = sheet_version; } @@ -7968,15 +7968,16 @@ clog(2, {}, 'upgraded to 1.7.2'); } - function upgradeTo_1_7_7(sizetemplateIDs, value, sheetdb, setObj) { + function upgradeTo_1_8_0(sizetemplateIDs, value, sheetdb, setObj) { const currSize = value.static_template_size_name || 'medium'; setDefaultSize(sheetdb, setObj, currSize); + setTotalLift(0, {}, {}, value, setObj); if (sizetemplateIDs.length !== undefined) { _.each(sizetemplateIDs, id => { removeRepeatingRow(`repeating_sizetemplate_${id}`); }); } - clog(2, {}, 'upgraded to 1.7.7'); + clog(2, {}, 'upgraded to 1.8.0'); } /** Build UI Functions **/ @@ -7991,8 +7992,10 @@ function setTotalLift(debug, timer, attrdb, value, setObj) { const size = value.static_template_size_name; + const rank = parseInt(value.static_template_size_rank); clog(debug, timer, 'size =', size, 'setTotalLift()'); const liftMultiplier = size === 'Medium' ? 1 : + rank < 0 ? parseFloat(value.static_template_size_lift) : parseInt(value.static_template_size_lift); clog(debug, timer, 'liftMultiplier =', liftMultiplier); const ssdb = attrdb.superstrength; From 3f563379ec46b81517ca2b0f16dde500322466cf Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Sat, 16 Apr 2022 15:42:23 -0700 Subject: [PATCH 5/9] Fixed Targeted Attributes Fixed attributes with targeted configurations so their apply buttons become active when attribute is active, and correctly apply their value to rolls or damage, respectively. --- BESM4eExtras/BESM4eExtras.html | 63 +++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index ea2a20b734..60a2462876 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -10634,6 +10634,7 @@ function setDynamicRollValue(debug, timer, eventInfo, value, attrdb, rowID, sourceAttr, setObj) { const rolltype = value.static_roll_type_selection; + clog(debug, timer, 'rolltype =', rolltype, 'setDynamicRollValue()'); let cv = 0; let rollmod = 0; let type = ''; @@ -10648,7 +10649,7 @@ title = '{{title=Roll 2d6}}'; break; case 'acv': - cv = getCV(debug, timer, value, attrdb, setObj, sourceAttr, 'acv', '', true); + cv = getCV(debug, timer, value, attrdb, setObj, 'acv', ''); type = '{{acvroll=1}}'; title = '{{title=Roll ACV}}'; stat = `{{acv=${cv}}}`; @@ -10665,10 +10666,8 @@ parseInt(value.static_button_personal_defense) ? 'personal' : ''; - const bonus = defensetype != '' ? - getSumOfActiveAttrLevels(attrdb, 'rangeddefense', defensetype) * 2 : - 0; - cv = getCV(debug, timer, value, attrdb, setObj, sourceAttr, 'dcv', '', true) + bonus; + clog(debug, timer, 'defensetype =', defensetype); + cv = getCV(debug, timer, value, attrdb, setObj, 'dcv', defensetype); type = '{{dcvroll=1}}'; title = '{{title=Roll DCV}}'; stat = `{{dcv=${cv}}}`; @@ -10676,7 +10675,7 @@ result = `${result} ${buildProtectionsString(debug, timer, value)}`; break; case 'initiative': - cv = getCV(debug, timer, value, attrdb, setObj, sourceAttr, 'acv', ''); + cv = getCV(debug, timer, value, attrdb, setObj, 'acv', ''); rollmod = getSumOfActiveSubAttrRanks(attrdb, 'combattechnique', 'lightningreflexes') || 0; type = '{{initiative=1}}'; title = '{{title=Roll Initiative}}'; @@ -10707,6 +10706,7 @@ `|Minor Edge, ${setDice(rollmod, 1)}|Minor Obstacle, ${setDice(rollmod, -1)}` + `|Major Edge, ${setDice(rollmod, 2)}|Major Obstacle, ${setDice(rollmod, -2)}}]]` + `+[[${base}]] ${turntracker}]]}} {{roll=$[[0]]}}`; + clog(debug, timer, 'result =', result); setObj.dynamic_roll_value = result; setObj.dynamic_roll_base = base; } @@ -12258,19 +12258,23 @@ clog(debug, timer, 'setDamageType', setDamageType,'setDamageType()'); } - function getCV(debug, timer, value, attrdb, setObj, sourceAttr, type, focus = 'unarmed', invertState = false) { + function getCV(debug, timer, value, attrdb, setObj, type, focus = 'unarmed') { + clog(debug, timer, 'focus =', focus, 'getCV()'); const mastery = (type == 'acv') ? getSumOfActiveAttrLevels(attrdb, 'attackmastery') : (type == 'dcv') ? getSumOfActiveAttrLevels(attrdb, 'defensemastery') : 0; + clog(debug, timer, 'mastery =', mastery); const isMelee = getIsMelee(debug, timer, focus); + clog(debug, timer, 'isMelee =', isMelee); const specialty = (isMelee && type == 'acv') ? getSumOfActiveAttrLevels(attrdb, 'meleeattack', focus) * 2 : (isMelee && type == 'dcv') ? getSumOfActiveAttrLevels(attrdb, 'meleedefense', focus) * 2 : (!isMelee && type == 'acv') ? getSumOfActiveAttrLevels(attrdb, 'rangedattack', focus) * 2 : (!isMelee && type == 'dcv') ? getSumOfActiveAttrLevels(attrdb, 'rangeddefense', focus) * 2 : 0; + clog(debug, timer, 'specialty =', specialty); const state = (type == 'acv') ? isNaN(parseInt(setObj.static_button_targeted_attack)) ? @@ -12281,25 +12285,36 @@ parseInt(value.static_button_targeted_defense) : parseInt(setObj.static_button_targeted_defense) : 0; + clog(debug, timer, 'state =', state); const enemy = - (type == 'acv') ? getTargetedLevel(attrdb, 'enemyattack') * 2 : - (type == 'dcv') ? getTargetedLevel(attrdb, 'enemydefense') * 2 : + (type == 'acv' && state) ? + getTargetedLevel(attrdb, 'enemyattack') * 2 : + (type == 'dcv' && state) ? + getTargetedLevel(attrdb, 'enemydefense') * 2 : 0; + clog(debug, timer, 'enemy =', enemy); + /* const targeted = - (type == 'acv') ? (invertState && sourceAttr == 'attack') ? (state > 0) ? - 0 : enemy : (state > 0) ? enemy : 0 : + (type == 'acv') ? + (invertState && sourceAttr == 'attack') ? + (state > 0) ? + 0 : enemy : + (state > 0) ? + enemy : 0 : (type == 'dcv') ? (invertState && sourceAttr == 'defense') ? (state > 0) ? 0 : enemy : (state > 0) ? enemy : 0 : 0; + */ const cv = Math.round((parseInt(setObj.stat_total_body) + parseInt(setObj.stat_total_mind) + parseInt(setObj.stat_total_soul)) / 3) || Math.round((parseInt(value.stat_total_body) + parseInt(value.stat_total_mind) + parseInt(value.stat_total_soul)) / 3) || 0; + clog(debug, timer, 'cv =', cv); const result = - cv + targeted + specialty + mastery; - clog(debug, timer, 'result =', result, 'getCV()'); + cv + enemy + specialty + mastery; + clog(debug, timer, 'result =', result); return result; } @@ -13033,9 +13048,9 @@ const targetedmdLevel = getTargetedLevel(attrdb, 'massivedamage') || 0; const targetedmd = - invertState && sourceAttr == 'damage' ? - targetedmdState > 0 ? 0 : targetedmdLevel : - targetedmdState > 0 ? targetedmdLevel : 0; + //invertState && sourceAttr == 'damage' ? + //targetedmdState > 0 ? 0 : targetedmdLevel : + targetedmdState ? targetedmdLevel : 0; const rushattackState = isNaN(parseInt(setObj.static_button_targeted_rushdamage)) ? parseInt(value.static_button_targeted_rushdamage) : @@ -13071,11 +13086,11 @@ const acv = attack_maneuvers_regex.test(maneuver) ? isSwarm ? parseInt(weapon.level) + 4 : - getCV(debug, timer, value, attrdb, setObj, sourceAttr, 'acv', weaponclass) : 0; + getCV(debug, timer, value, attrdb, setObj, 'acv', weaponclass) : 0; const dcv = defense_maneuvers_regex.test(maneuver) ? isSwarm ? 0 : - getCV(debug, timer, value, attrdb, setObj, sourceAttr, 'dcv', weaponclass) : 0; + getCV(debug, timer, value, attrdb, setObj, 'dcv', weaponclass) : 0; let damage = isSwarm ? Math.round(weapon.critters/10) : isTelekinesis ? @@ -14311,12 +14326,14 @@ break; case `button`: if (rowID == 'targeted') { - const rolltype = selection => - selection == 'acv' || selection == 'dcv' ? - setDynamicRollValue(debug, timer, eventInfo, value, attrdb, rowID, sourceAttr, setObj) : - false; - rolltype(value.static_roll_type_selection); setButtonState(debug, timer, value, source, rowID, sourceAttr, setObj); + if (sourceAttr === "attack" || sourceAttr === 'defense') { + const rolltype = selection => + selection == 'acv' || selection == 'dcv' ? + setDynamicRollValue(debug, timer, eventInfo, value, attrdb, rowID, sourceAttr, setObj) : + false; + rolltype(value.static_roll_type_selection); + } setCombatRoll(debug, timer, value, attrdb, undefined, sourceAttr, setObj, true); } if (rowID == 'personal' || rowID == 'movement') { From 81f13cc52036671f5abdd1e1b785b5fb3675b805 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Sat, 16 Apr 2022 15:48:49 -0700 Subject: [PATCH 6/9] Updated writeValues() Added more undefined detection logic to writeValues(). --- BESM4eExtras/BESM4eExtras.html | 1 + 1 file changed, 1 insertion(+) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 60a2462876..78188773b7 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -8975,6 +8975,7 @@ key === undefined ? true : key === "" ? true : key.indexOf('undefined') !== -1 ? true : + key.indexOf('__') !== -1 ? true : false; const isResultUndefined = result === undefined ? true : From b1259a08a25d6a48b4ce3e0ac14e2d1c36ea0668 Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Sat, 16 Apr 2022 16:20:34 -0700 Subject: [PATCH 7/9] Updated more button depressed shading Updated targeted and Unaffected button depressed shading --- BESM4eExtras/BESM4eExtras.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BESM4eExtras/BESM4eExtras.css b/BESM4eExtras/BESM4eExtras.css index 3f41a6ddb3..bd49497676 100644 --- a/BESM4eExtras/BESM4eExtras.css +++ b/BESM4eExtras/BESM4eExtras.css @@ -2326,7 +2326,9 @@ button.sheet-major-stat[type="action"] { } button.sheet-activated, +input.sheet-targeted[value="1"] ~ button.sheet-targeted, input.sheet-push-button:checked + button.sheet-condition, +input.sheet-push-button:checked + button.sheet-multi-select, input.sheet-protectionstate:checked + h4.sheet-protection, input.sheet-targeted:checked + button.sheet-targeted, input.sheet-weapon:checked + button.sheet-weapon, From 58a23dc304de30346573821998a27e869a7a61cc Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Sat, 16 Apr 2022 18:50:09 -0700 Subject: [PATCH 8/9] v1.8.0 version update --- BESM4eExtras/BESM4eExtras.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BESM4eExtras/BESM4eExtras.css b/BESM4eExtras/BESM4eExtras.css index bd49497676..db17d51dcd 100644 --- a/BESM4eExtras/BESM4eExtras.css +++ b/BESM4eExtras/BESM4eExtras.css @@ -1,5 +1,5 @@ /* === VERSION === */ -/* 1.7.6 */ +/* 1.8.0 */ /* === GENERAL === */ .charsheet { From 50887247b5ffccec312dd606364a94131ec48f5f Mon Sep 17 00:00:00 2001 From: Darth-John <77751557+Darth-John@users.noreply.github.com> Date: Sun, 17 Apr 2022 09:03:39 -0700 Subject: [PATCH 9/9] STR-Lift Shortcoming Bug Fix Fixed issue where activating STR-based shortcoming did not activate correctly. Fix issue where after activating STR-based shortcoming, lift was not recalculated. --- BESM4eExtras/BESM4eExtras.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/BESM4eExtras/BESM4eExtras.html b/BESM4eExtras/BESM4eExtras.html index 78188773b7..811993d9a9 100644 --- a/BESM4eExtras/BESM4eExtras.html +++ b/BESM4eExtras/BESM4eExtras.html @@ -30,7 +30,7 @@

Sheet Options

Sheet Version - +

Sheet Type @@ -8002,8 +8002,10 @@ const hasSuperStrength = ssdb === undefined ? false : _.chain(ssdb).pluck('level').reduce((p,c) => { return p + c; }, 0).value(); clog(debug, timer, 'hasSuperStrength =', hasSuperStrength); + const strValue = isNaN(parseInt(setObj.stat_total_str)) ? + parseInt(value.stat_total_str) : parseInt(setObj.stat_total_str); const lift = hasSuperStrength ? parseInt(getSuperStrengthLift(debug, timer, hasSuperStrength)) : - parseInt(value.stat_total_str) * 25; + strValue * 25; clog(debug, timer, 'lift =', lift); const totalLift = lift * liftMultiplier; clog(debug, timer, 'totalLift =', totalLift); @@ -8324,7 +8326,7 @@ } function getDefectPointsByCategory(value, rowID, defect){ - const aspect = value[`repeating_attr_${rowID}_defectaspect`]; + const aspect = value[`repeating_attr_${rowID}_defectaspect`] || []; const result = defect == 'shortcoming' ? aspect.length > 3 ? -4 : -1 : lesser_defects_regex.test(defect) ? -1 : serious_defects_regex.test(defect) ? -2 : @@ -9110,8 +9112,8 @@ const showMajorAspectStats = majorAspectInUse ? 1 : 0; setObj.showallaspectsstats = showAllAspectsStats; setObj.showmajoraspectstats = showMajorAspectStats; - clog(debug, timer, 'showallaspectsstats =', showallaspectsstats, 'setStatAspectView()'); - clog(debug, timer, 'showmajoraspectstats =', showmajoraspectstats); + clog(debug, timer, 'showallaspectsstats =', showAllAspectsStats, 'setStatAspectView()'); + clog(debug, timer, 'showmajoraspectstats =', showMajorAspectStats); } function setDamageLevelByDamageTaken(debug, timer, value, setObj, sourceAttr) { @@ -10789,7 +10791,8 @@ _.each(all_defects_array, defectmatch => { defectmatch = removeWhiteSpace(defectmatch); const exposesetting = defectmatch == defect ? 1 : 0; - setObj[`repeating_attr_${rowID}_show${defectmatch}`] = exposesetting; + //setObj[`repeating_attr_${rowID}_show${defectmatch}`] = exposesetting; + writeValues(debug, timer, value, `repeating_attr_${rowID}_show${defectmatch}`, exposesetting, setObj); exposesetting ? exposed_settings.push(`show${defectmatch}`) : false; }); clog(debug, timer, 'exposed_settings:', exposed_settings, 'exposeDefectSettingsOnDefectChange()'); @@ -14162,6 +14165,7 @@ } setGroupDefectPointsOnActivation(debug, timer, attrIDs, attrdb, value, sectionName, rowID, setObj); setDepleteResurvation(debug, timer, attrdb, value, rowID, setObj); + setTotalLift(debug, timer, attrdb, value, setObj); break; case `lock`: if (resetOnActive(debug, timer, eventInfo, value, match, rowID, setObj)) return;