diff --git a/Stars_Without_Number_Revised/ReadMe.md b/Stars_Without_Number_Revised/ReadMe.md index 9b09f53606..f17a8c37c4 100644 --- a/Stars_Without_Number_Revised/ReadMe.md +++ b/Stars_Without_Number_Revised/ReadMe.md @@ -42,6 +42,11 @@ on Github. ## Changelog +### 2.4.7 + +* Fix attribute boosts not being counted correctly for encumbrance and system strain. +* Collapse attribute base and boosts fields into a single field in display mode. + ### 2.4.6 * Add a box to keep track of attribute boosts. diff --git a/Stars_Without_Number_Revised/Source/pug/character.pug b/Stars_Without_Number_Revised/Source/pug/character.pug index aead6e0d28..d49b603659 100644 --- a/Stars_Without_Number_Revised/Source/pug/character.pug +++ b/Stars_Without_Number_Revised/Source/pug/character.pug @@ -151,8 +151,10 @@ input(type="hidden", name="attr_magic_type", value="arcanist").magic-type thead tr th - th(data-i18n="BASE") - th(data-i18n="BOOSTS") + th(data-i18n="BASE").edit + th(data-i18n="BOOSTS").edit + th(data-i18n="TOTAL").edit + th(data-i18n="ATTRIBUTE").display th(data-i18n="BONUS") th(data-i18n="MODIFIER") tbody @@ -160,12 +162,15 @@ input(type="hidden", name="attr_magic_type", value="arcanist").magic-type each attr in attributes tr td(data-i18n=attr.toUpperCase(), data-i18n-title=`${attr.toUpperCase()}_DESC`) + td.edit + input(type="number", name=`attr_${attr}_base`, value="10") + //span(name=`attr_${attr}`).display + td.edit + input(type="number", name=`attr_${attr}_boosts`, value="0") + //span(name=`attr_${attr}_boosts`).display td - input(type="number", name=`attr_${attr}`, value="10").edit - span(name=`attr_${attr}`).display - td - input(type="number", name=`attr_${attr}_boosts`, value="0").edit - span(name=`attr_${attr}_boosts`).display + //input(type="number", name=`attr_${attr}_boosts`, value="0").edit + span(name=`attr_${attr}`) td input(type="number", name=`attr_${attr}_bonus`, value="0").edit span(name=`attr_${attr}_bonus`).display diff --git a/Stars_Without_Number_Revised/Source/workers.js b/Stars_Without_Number_Revised/Source/workers.js index b327b8b0e7..9d35795e0c 100644 --- a/Stars_Without_Number_Revised/Source/workers.js +++ b/Stars_Without_Number_Revised/Source/workers.js @@ -3,7 +3,7 @@ "use strict"; /* Data constants */ const sheetName = "Stars Without Number (revised)"; - const sheetVersion = "2.4.6"; + const sheetVersion = "2.4.7"; const translate = getTranslationByKey; const attributes = ["strength", "dexterity", "constitution", "intelligence", "wisdom", "charisma"]; const effortAttributes = ["wisdom_mod", "constitution_mod", "psionics_extra_effort", @@ -2012,7 +2012,7 @@ const calculateMaxStrain = () => { getAttrs(["constitution", "strain_max"], v => { mySetAttrs({ - strain_max: v.constitution + strain_max: parseInt(v.constitution) }, v); }); }; @@ -2045,15 +2045,26 @@ }); }; + const calculateAttr = (attr) => { + getAttrs([attr, `${attr}_base`, `${attr}_boosts`], v => { + const setting = { + [`${attr}`]: `${(parseInt(v[`${attr}_base`]) || 10) + (parseInt(v[`${attr}_boosts`]) || 0)}` + }; + mySetAttrs(setting, v, null, () => { + calculateMod(attr); + }); + }); + } + const calculateMod = (attr) => { - getAttrs([attr, `${attr}_bonus`, `${attr}_boosts`, `${attr}_mod`], v => { + getAttrs([attr, `${attr}_bonus`, `${attr}_mod`], v => { const mod = (value => { if (value >= 18) return 2; else if (value >= 14) return 1; else if (value >= 8) return 0; else if (value >= 4) return -1; else return -2; - })((parseInt(v[attr]) || 10) + parseInt(v[`${attr}_boosts`]) || 0); + })(parseInt(v[attr]) || 10); const setting = { [`${attr}_mod`]: `${mod + (parseInt(v[`${attr}_bonus`]) || 0)}` @@ -2137,7 +2148,7 @@ ...armorIDs.filter(id => v[`repeating_armor_${id}_armor_status`] === "READIED") .map(id => parseInt(v[`repeating_armor_${id}_armor_encumbrance_bonus`]) || 0) ); - const gear_stowed_max = (parseInt(v.strength) || 0) + armor_encumbrance_bonus; + const gear_stowed_max = parseInt(v.strength) + armor_encumbrance_bonus; const gear_readied_max = Math.floor(gear_stowed_max / 2); const setting = { gear_readied, @@ -3153,6 +3164,19 @@ calculateCyberwareStrain(); upgradeSheet("2.4.3"); } + /** v2.4.7 + * Move attr to attr_base, and recalculate attr + **/ + else if (major == 2 && minor == 4 && patch < 7) { + attributes.forEach(attr => { + getAttrs([attr, `${attr}_base`], v => { + mySetAttrs({[`${attr}_base`]: parseInt(v[`${attr}`] || 10)}, v, null, () => { + calculateAttr(attr); + }); + }); + }); + upgradeSheet("2.4.7"); + } /** Final upgrade clause, always leave this around */ else upgradeSheet(sheetVersion, false, true); }; @@ -3563,7 +3587,8 @@ /* Character sheet */ on("change:class", fillClassStats); - attributes.forEach(attr => on(`change:${attr} change:${attr}_boosts change:${attr}_bonus`, () => calculateMod(attr))); + attributes.forEach(attr => on(`change:${attr}_base change:${attr}_boosts`, () => calculateAttr(attr))); + attributes.forEach(attr => on(`change:${attr} change:${attr}_bonus`, () => calculateMod(attr))); on(weaponDisplayEvent, generateWeaponDisplay); diff --git a/Stars_Without_Number_Revised/Stars_Without_Number_Revised.html b/Stars_Without_Number_Revised/Stars_Without_Number_Revised.html index ea53e3d24a..4ee43dde11 100644 --- a/Stars_Without_Number_Revised/Stars_Without_Number_Revised.html +++ b/Stars_Without_Number_Revised/Stars_Without_Number_Revised.html @@ -1,3 +1,3 @@ -

API

/
/
/
/

/
/

(, ).  / 
/

:
:
-

+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +

+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +

:

+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +

:
:
-

/
/
#

:

/
/
/
/

:(;; ;  ,  ,  ).  / 
/

:( ,  ).

:( ,  ).

/

( )

/
( ).  / 
/
( ).  / 
/
( ).  / 
/
+

API

/
/
/
/

/
/

(, ).  / 
/

:
:
-

+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +

+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +

:

+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +

:
:
-

/
/
#

:

/
/
/
/

:(;; ;  ,  ,  ).  / 
/

:( ,  ).

:( ,  ).

/

( )

/
( ).  / 
/
( ).  / 
/
( ).  / 
/
{{charname}}
{{title}}
{{#reaction}}
{{#rollLess() reaction 3}} {{/rollLess() reaction 3}}{{#rollBetween() reaction 3 5}} {{/rollBetween() reaction 3 5}}{{#rollBetween() reaction 6 8}} {{/rollBetween() reaction 6 8}}{{#rollBetween() reaction 9 11}} {{/rollBetween() reaction 9 11}}{{#rollGreater() reaction 11}} {{/rollGreater() reaction 11}}
{{reaction}}
{{/reaction}} {{#info}}
{{info}}
{{/info}} {{#rollGreater() damage 0}}
{{damage}}
{{/rollGreater() damage 0}} {{#allprops() charname title damage reaction desc info buttons}}
{{key}}
{{value}}
{{/allprops() charname title damage reaction desc info buttons}}
{{desc}}
{{buttons}}
{{charname}}
{{title}} {{#rollGreater() burst 0}}(){{/rollGreater() burst 0}} {{#rollLess() mod 0}}{{mod}}{{/rollLess() mod 0}}{{#rollGreater() mod 0}}+ {{mod}}{{/rollGreater() mod 0}}
{{attack}}
{{damage}}
{{#attack2}}
{{attack2}}
{{damage2}}
{{/attack2}}{{#attack3}}
{{attack3}}
{{damage3}}
{{/attack3}}{{#attack4}}
{{attack4}}
{{damage4}}
{{/attack4}} {{#attack5}}
{{attack5}}
{{damage5}}
{{/attack5}} {{#attack6}}
{{attack6}}
{{damage6}}
{{/attack6}} {{#attack7}}
{{attack7}}
{{damage7}}
{{/attack7}} {{#attack8}}
{{attack8}}
{{damage8}}
{{/attack8}} {{#shock}}
{{shock}}
{{/shock}}
{{#range}} {{range}}{{/range}}{{#ammo}} {{ammo}}{{/ammo}}
{{desc}}
{{charname}}
{{title}} {{attribute}} {{#rollLess() mod 0}}{{mod}}{{/rollLess() mod 0}}{{#rollGreater() mod 0}}+ {{mod}}{{/rollGreater() mod 0}}
{{dice}}
{{#save}} {{#^rollLess() dice save}}
{{charname}}
{{title}}
{{dice}}
{{save}}{{morale}}
{{/^rollLess() dice save}} {{#rollLess() dice save}}
{{charname}}
{{title}}
{{dice}}
{{save}}{{morale}}
{{/rollLess() dice save}} {{/save}} {{#morale}} {{#^rollGreater() dice morale}}
{{charname}}
{{title}}
{{dice}}
{{save}}{{morale}}
{{/^rollGreater() dice morale}} {{#rollGreater() dice morale}}
{{charname}}
{{title}}
{{dice}}
{{save}}{{morale}}
{{/rollGreater() dice morale}} {{/morale}}
- +